Skip to content

Commit 81002b3

Browse files
author
Mateusz Dębiński
committed
IBX-9657: Added option to set shouldFireInputEvent in updateInput via attribute to prevent error message removal
1 parent 5c5d806 commit 81002b3

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,20 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0;
307307

308308
updateInput(initialData, false);
309309

310-
this.editor.model.document.on('change:data', () => {
310+
this.editor.model.document.on('change:data', (eventInfo) => {
311311
const data = this.getData();
312+
const changes = Array.from(eventInfo.source.differ.getChanges());
313+
const shouldFireInputEventAttribute = changes.find(
314+
change => change.type === 'attribute' && change.attributeKey === 'shouldFireInputEvent'
315+
);
316+
if (
317+
shouldFireInputEventAttribute
318+
&& typeof shouldFireInputEventAttribute.attributeNewValue === 'boolean'
319+
) {
320+
updateInput(data, shouldFireInputEventAttribute.attributeNewValue);
321+
322+
return;
323+
}
312324

313325
updateInput(data);
314326
});

src/bundle/Resources/public/js/CKEditor/embed/content-inline/embed-inline-editing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class IbexaEmbedContentInlineEditing extends Plugin {
165165
writer.setAttribute('contentId', contentId, modelElement);
166166
writer.setAttribute('locationId', locationId, modelElement);
167167
writer.setAttribute('languageCodes', languageCodes, modelElement);
168+
writer.setAttribute('shouldFireInputEvent', false, modelElement);
168169
});
169170
});
170171

src/bundle/Resources/public/js/CKEditor/embed/content/embed-editing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class IbexaEmbedContentEditing extends Plugin {
167167
writer.setAttribute('contentId', contentId, modelElement);
168168
writer.setAttribute('locationId', locationId, modelElement);
169169
writer.setAttribute('languageCodes', languageCodes, modelElement);
170+
writer.setAttribute('shouldFireInputEvent', false, modelElement);
170171
});
171172
});
172173

src/bundle/Resources/public/js/CKEditor/embed/image/embed-image-editing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class IbexaEmbedImageEditing extends Plugin {
5858
.then((imageData) => {
5959
this.editor.model.change((writer) => {
6060
writer.setAttribute('previewUrl', imageData.ContentImageVariation.uri, modelElement);
61+
writer.setAttribute('shouldFireInputEvent', false, modelElement);
6162
});
6263
})
6364
.catch(window.ibexa.helpers.notification.showErrorNotification);

0 commit comments

Comments
 (0)