Sha256: 40c52ffbe9174aa42e6c9398fa1f8b47a9ae8503df47992f465bb58d3cbc82ee
Contents?: true
Size: 1.05 KB
Versions: 13
Compression:
Stored size: 1.05 KB
Contents
# https://quilljs.com/docs/download/ # https://github.com/quilljs/quill (this.EffectiveBootstrap || {}).effective_editor = ($element, options) -> editor = '#' + $element.attr('id') + '_editor' delta = options['delta'] delete options['delta'] quill = new Quill(editor, options) content = $element.val() || '' if content.length > 0 if content.startsWith('{') then quill.setContents(JSON.parse(content)) else quill.pasteHTML(content) if delta quill.on 'text-change', (delta, old, source) -> $element.val(JSON.stringify(quill.getContents())) else quill.on 'text-change', (delta, old, source) -> html = $(editor).children('.ql-editor').html() html = '' if html == '<p><br></p>' || html == '<p></p>' $element.val(html) $element.on 'quill:focus', (event) -> quill.focus() # This is the read only region. Always delta. (this.EffectiveBootstrap || {}).effective_editor_tag = ($element, options) -> quill = new Quill('#' + $element.attr('id'), options) if $element.data('delta') quill.setContents($element.data('delta'))
Version data entries
13 entries across 13 versions & 1 rubygems