Skip to content

Commit ab1e68a

Browse files
IBX-6151, IBX-6148: Added check if balloon hasView to prevent trying it add again it, corrected logic for countElementsWithSameId (#101)
1 parent 48542ee commit ab1e68a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bundle/Resources/public/js/CKEditor/anchor/anchor-ui.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ class IbexaAnchorUI extends Plugin {
7171
const parentElement = this.getModelElement();
7272
const values = {};
7373

74+
if (this.balloon.hasView(this.formView)) {
75+
return;
76+
}
77+
7478
if (parentElement) {
7579
values.anchor = parentElement.getAttribute('anchor') || '';
7680
}
@@ -116,7 +120,7 @@ class IbexaAnchorUI extends Plugin {
116120
Array.from(richtexts).every((richtext) => {
117121
countElementsWithSameId += richtext.querySelectorAll(`[id="${value}"]`).length;
118122

119-
return countElementsWithSameId > 1;
123+
return countElementsWithSameId < 1;
120124
});
121125

122126
return (isSameAsBefore && countElementsWithSameId === 1) || (!isSameAsBefore && countElementsWithSameId === 0);

0 commit comments

Comments
 (0)