Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 14e5803

Browse files
authored
Merge pull request #245 from ckeditor/t/241
Fix: Add missing return value for link post-fixer. Closes #241.
2 parents d6c45df + f1eb91e commit 14e5803

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/linkediting.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export default class LinkEditing extends Plugin {
198198
// Adding the class.
199199
view.document.registerPostFixer( writer => {
200200
const selection = editor.model.document.selection;
201+
let changed = false;
201202

202203
if ( selection.hasAttribute( 'linkHref' ) ) {
203204
const modelRange = findLinkRange( selection.getFirstPosition(), selection.getAttribute( 'linkHref' ), editor.model );
@@ -206,12 +207,15 @@ export default class LinkEditing extends Plugin {
206207
// There might be multiple `a` elements in the `viewRange`, for example, when the `a` element is
207208
// broken by a UIElement.
208209
for ( const item of viewRange.getItems() ) {
209-
if ( item.is( 'a' ) ) {
210+
if ( item.is( 'a' ) && !item.hasClass( HIGHLIGHT_CLASS ) ) {
210211
writer.addClass( HIGHLIGHT_CLASS, item );
211212
highlightedLinks.add( item );
213+
changed = true;
212214
}
213215
}
214216
}
217+
218+
return changed;
215219
} );
216220

217221
// Removing the class.

0 commit comments

Comments
 (0)