Sha256: 60c44e94dd5eb526632054e2b0d4c7f3727ffb018c88b57eedb248adb16fb656
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
$ -> $("textarea.rich").each -> ta = new jRichTextArea(this) ta.toolbar.addButton("Bold", -> @textArea.wrapSelection "<b>", "</b>" ).addButton("Italics", -> @textArea.wrapSelection "<i>", "</i>" ).addButton("Heading 2", -> @textArea.wrapSelection "h2. ", "" ).addButton("Heading 3", -> @textArea.wrapSelection "h3. ", "" ).addButton("Heading 4", -> @textArea.wrapSelection "h4. ", "" ).addButton("Link", -> selection = @textArea.selectedText() selection = prompt("Link text", "") if selection is "" response = prompt("Enter link URL", "http://") if response @textArea.replaceSelection "\"" + ((if selection is "" then "Link text" else selection)) + "\":" + ((if response is "" then "http://link_url/" else response)).replace(/^(?!(f|ht)tps?:\/\/)/, "http://") ).addButton("Email", -> selection = @textArea.selectedText() response = prompt("Enter mail address", "") if response @textArea.replaceSelection "\"" + ((if selection is "" then response else selection)) + "\":mailto:" + ((if response is "" then "" else response)) ).addButton "Image", -> selection = @textArea.selectedText() if selection is "" response = prompt("Enter image URL", "") return unless response? @textArea.replaceSelection "!" + response + "!" else @textArea.replaceSelection "!" + selection + "!"
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.4.3 | app/assets/javascripts/pages/admin/features/rich_text.js.coffee |
pages_core-3.4.2 | app/assets/javascripts/pages/admin/features/rich_text.js.coffee |