From f8985fca05bcf2643736135a37ca40ce33369a28 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 28 Sep 2023 17:14:36 +0200 Subject: [PATCH 1/2] [BUGFIX] Fix typos in CKEditor5 upcast converters --- .../CkEditorPlugins/luxEmail4Link/email4link/editing.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js b/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js index b2ba4f0e..f1538b9f 100644 --- a/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js +++ b/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js @@ -23,7 +23,7 @@ export default class Email4LinkEditing extends Core.Plugin { }); editor.conversion.for('upcast').elementToAttribute({ view: { name: 'a', attributes: { 'data-lux-email4link-sendemail': true } }, - model: { key: 'sendEmail', value: (viewElement) => viewElement.getAttribute('data-lux-send-email') } + model: { key: 'sendEmail', value: (viewElement) => viewElement.getAttribute('data-lux-email4link-sendemail') } }); conversion.for('downcast').attributeToElement({ @@ -48,8 +48,8 @@ export default class Email4LinkEditing extends Core.Plugin { } }); editor.conversion.for('upcast').elementToAttribute({ - view: { name: 'a', attributes: { 'data-lux-email4link-sendemail': true } }, - model: { key: 'email4linkText', value: (viewElement) => viewElement.getAttribute('data-lux-email4link-text') } + view: { name: 'a', attributes: { 'data-lux-email4link-text': true } }, + model: { key: 'emailText', value: (viewElement) => viewElement.getAttribute('data-lux-email4link-text') } }); } } From 3c06b30ade13e914118fd6ce2241321300f2b79e Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 28 Sep 2023 17:15:13 +0200 Subject: [PATCH 2/2] [BUGFIX] Register custom link attributes to the CKEditor5 schema Model attribute will only be preserved and allowed when they are registered to the CKEditor5 schema. --- .../Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js b/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js index f1538b9f..9bf072ff 100644 --- a/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js +++ b/Resources/Public/JavaScript/Static/CkEditorPlugins/luxEmail4Link/email4link/editing.js @@ -12,6 +12,9 @@ export default class Email4LinkEditing extends Core.Plugin { _defineConverters() { const conversion = this.editor.conversion; + const schema = this.editor.model.schema; + + schema.extend('$text', { allowAttributes: ['sendEmail', 'emailTitle', 'emailText'] }) conversion.for('downcast').attributeToElement({ model: 'sendEmail',