Sha256: eb3950c4ebd3311e6566a7b8a97c3fdd5cdd27a845c631056e04ec44e3a57463

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 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']],
      ['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

19 entries across 19 versions & 1 rubygems

Version Path
promethee-2.0.6 app/views/promethee/utils/_summernote-config.html.erb
promethee-2.0.5 app/views/promethee/utils/_summernote-config.html.erb
promethee-2.0.4 app/views/promethee/utils/_summernote-config.html.erb
promethee-2.0.3 app/views/promethee/utils/_summernote-config.html.erb
promethee-2.0.2 app/views/promethee/utils/_summernote-config.html.erb
promethee-2.0.1 app/views/promethee/utils/_summernote-config.html.erb
promethee-2.0.0 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.29 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.28 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.27 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.26 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.25 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.24 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.23 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.22 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.21 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.20 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.19 app/views/promethee/utils/_summernote-config.html.erb
promethee-1.11.18 app/views/promethee/utils/_summernote-config.html.erb