Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,17 @@

updateInput(initialData, false);

this.editor.model.document.on('change:data', () => {
this.editor.model.document.on('change:data', (eventInfo) => {

Check failure on line 308 in src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest functions more than 4 levels deep.

See more on https://sonarcloud.io/project/issues?id=ibexa_fieldtype-richtext&issues=AZql2l-zMGpR_j7zVefB&open=AZql2l-zMGpR_j7zVefB&pullRequest=274
const data = this.getData();
const changes = Array.from(eventInfo.source.differ.getChanges());
const shouldFireInputEventAttribute = changes.find(
(change) => change.type === 'attribute' && change.attributeKey === 'shouldFireInputEvent',
);
if (shouldFireInputEventAttribute && typeof shouldFireInputEventAttribute.attributeNewValue === 'boolean') {
updateInput(data, shouldFireInputEventAttribute.attributeNewValue);

return;
}

updateInput(data);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class IbexaEmbedContentInlineEditing extends Plugin {
writer.setAttribute('contentId', contentId, modelElement);
writer.setAttribute('locationId', locationId, modelElement);
writer.setAttribute('languageCodes', languageCodes, modelElement);
writer.setAttribute('shouldFireInputEvent', false, modelElement);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class IbexaEmbedContentEditing extends Plugin {
writer.setAttribute('contentId', contentId, modelElement);
writer.setAttribute('locationId', locationId, modelElement);
writer.setAttribute('languageCodes', languageCodes, modelElement);
writer.setAttribute('shouldFireInputEvent', false, modelElement);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class IbexaEmbedImageEditing extends Plugin {
.then((imageData) => {
this.editor.model.change((writer) => {
writer.setAttribute('previewUrl', imageData.ContentImageVariation.uri, modelElement);
writer.setAttribute('shouldFireInputEvent', false, modelElement);
});
})
.catch(window.ibexa.helpers.notification.showErrorNotification);
Expand Down
Loading