Sha256: e69b17f46e4531565a17db05e2cdd56207c580f7a7b97467e07f2c0be55c3195

Contents?: true

Size: 1.53 KB

Versions: 53

Compression:

Stored size: 1.53 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);
      },

      onInit: function() {
        $(this).summernote('removeModule', 'autoLink');
      },

      onApplyCustomStyle: function($target, context, onFormatBlock) {
        if ($target.hasClass('dropdown-item')) {
          $target = $target.children().first();
        }
        onFormatBlock($target.prop('tagName'), $target);
      }
    },
    toolbar: [
      ['headline', ['style']],
      ['style', ['bold', 'italic']],
      ['font', ['superscript', 'subscript']],
      ['alignment', ['ul', 'ol', 'paragraph']],
      ['insert', ['hr']],
      ['link', ['linkDialogShow', 'unlink']],
      ['code', ['codeview']]
    ],
    styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
  });
</script>

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
promethee-4.1.13 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.12 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.11 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.10 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.9 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.8 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.7 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.6 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.5 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.4 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.3 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.2 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.1 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.0 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.0.8 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.0.7 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.0.6 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.0.5 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.0.4 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.0.3 app/views/promethee/utils/_summernote-config.html.erb