Sha256: 172f756abcd601a5ecd96e98b9b48354564531345124fd6d309d579e4009d13f

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

# Icons: https://www.iconfinder.com/iconsets/silk2

class Text extends Row
  type: "text"
  name: "Text"
  initial_content: "<p>Your text here..</p>"

  options: ["bold", "italic", "underline", "strikeThrough", "createLink", "unlink", "insertImage", "floatLeft", "floatRight", "insertOrderedList", "insertUnorderedList", "indent", "outdent", "justifyLeft", "justifyCenter", "justifyRight", "justifyFull", "subscript", "superscript"]
  icons:
    "bold": "/assets/text_bold.png"
    "italic": "/assets/text_italic.png"
    "underline": "/assets/text_underline.png"
    "strikeThrough": "/assets/text_strikethrough.png"
    "createLink": "/assets/link_add.png"
    "unlink": "/assets/link_delete.png"
    "insertOrderedList": "/assets/text_list_numbers.png"
    "insertUnorderedList": "/assets/text_list_bullets.png"
    "indent": "/assets/text_indent.png"
    "outdent": "/assets/text_indent_remove.png"
    "justifyLeft": "/assets/text_align_left.png"
    "justifyCenter": "/assets/text_align_center.png"
    "justifyRight": "/assets/text_align_right.png"
    "justifyFull": "/assets/text_align_justify.png"
    "subscript": "/assets/text_subscript.png"
    "superscript": "/assets/text_superscript.png"
    "insertImage": "/assets/image_add.png"
    "floatLeft": "/assets/shape_align_left.png"
    "floatRight": "/assets/shape_align_right.png"

  on_option: (row, option) ->
    args = null
    switch option
      when "createLink"
        args = prompt("Where should the link take you? (Link URL)")
      when "insertImage"
        args = prompt("What is the image URL?")
      when "floatRight"
        $(window.getSelection().focusNode).addClass("pull-right")
        return
      when "floatLeft"
        $(window.getSelection().focusNode).addClass("pull-left")
        return
      else
    document.execCommand(option, false, args)

window.Text = Text

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledge-0.2.0 app/assets/javascripts/ledge/rows/text.coffee