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-5.1.1 app/views/promethee/utils/_summernote-config.html.erb
promethee-5.1.0 app/views/promethee/utils/_summernote-config.html.erb
promethee-5.0.2 app/views/promethee/utils/_summernote-config.html.erb
promethee-5.0.1 app/views/promethee/utils/_summernote-config.html.erb
promethee-5.0.0 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.28 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.27 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.26 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.25 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.24 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.23 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.22 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.21 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.20 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.19 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.18 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.17 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.16 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.15 app/views/promethee/utils/_summernote-config.html.erb
promethee-4.1.14 app/views/promethee/utils/_summernote-config.html.erb