2

Is there a way to disable a CKEditor5 package loaded by core? I would like to disable paste-from-office, but I can see the question here applying to different packages.

In the file web/core/core.libraries.yml we see this code:

ckeditor5.pasteFromOffice:
  remote: https://github.com/ckeditor/ckeditor5
  version: "35.4.0"
  license:
  name: GNU-GPL-2.0-or-later
  url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v35.4.0/LICENSE.md
  gpl-compatible: true
js:
  assets/vendor/ckeditor5/paste-from-office/paste-from-office.js: { minified: true }
dependencies:
  - core/ckeditor5

I tried removing it but now when CKEditor loads on an edit page it complains about the missing library.

We also have in web/core/modules/ckeditor5/ckeditor5.ckeditor5.yml

ckeditor5_pasteFromOffice:
  ckeditor5:
    plugins: [pasteFromOffice.PasteFromOffice]
  drupal:
    label: Paste From Office
    library: core/ckeditor5.pasteFromOffice
    elements: false
    conditions: []

1 Answer 1

0

I was able to disable rich-text paste from office365.com by adding this code to one of my custom CKE5 modules:

editor.editing.view.document.on('clipboardInput', (evt, data) => {
  data.content = editor.data.htmlProcessor.toView(data.dataTransfer.getData('text/plain'));
});

I was able to disable rich-text paste from the Word app by removing the reference to it in ckeditor5.ckeditor5.yml quoted above.

No errors!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.