Sha256: 4de76cf8f47c048030b5aa875840cf9f2710e0d480ecddac5f4756120e3fde5d

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

<script>
  promethee.constant('summernoteConfig', {
    disableDragAndDrop: true,
    callbacks: {
      // Remove text styles on paste
      onPaste: function(event) {
        event.preventDefault();

        // Get and trim clipboard content as paragraph
        var paragraph = document.createElement('p');
        paragraph.textContent = ((event.originalEvent || event).clipboardData || window.clipboardData).getData('Text').trim();

        // Delete selection if anything is selected (expected behaviour on paste)
        if((window.getSelection !== undefined ? window.getSelection() : document.selection.createRange()).toString().length > 0) {
          document.execCommand('delete', false);
        }

        // Insert trimmed clipboard content as paragraph
        document.execCommand('insertHTML', false, paragraph.outerHTML);
      }
    },
    toolbar: [
      ['headline', ['style']],
      ['style', ['bold', 'italic']],
      ['alignment', ['ul', 'ol', 'paragraph']],
      ['code', ['codeview']],
      ['link', ['linkDialogShow', 'unlink']],
      ['insert', ['hr']]
    ],
    styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
  });
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
promethee-1.11.9 app/views/promethee/utils/_summernote-config.html.erb