Skip to content

Commit b58bebc

Browse files
mateuszdebinskiMateusz Dębiński
andauthored
IBX-9657: Added option to set shouldFireInputEvent in updateInput via attribute to prevent error message removal (#274)
Co-authored-by: Mateusz Dębiński <[email protected]>
1 parent 0123542 commit b58bebc

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,17 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0;
305305

306306
updateInput(initialData, false);
307307

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

311320
updateInput(data);
312321
});

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)