Score:2

How to disable a CKEditor5 package loaded by core?

au flag

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: []
Score:0
au flag

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!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.