From f1eb91e3b41c633beae1775379a002f23508f8b1 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Wed, 31 Jul 2019 16:15:19 +0200 Subject: [PATCH] Fix: missing return value for link postfixer. --- src/linkediting.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/linkediting.js b/src/linkediting.js index b2275f7..9d68757 100644 --- a/src/linkediting.js +++ b/src/linkediting.js @@ -198,6 +198,7 @@ export default class LinkEditing extends Plugin { // Adding the class. view.document.registerPostFixer( writer => { const selection = editor.model.document.selection; + let changed = false; if ( selection.hasAttribute( 'linkHref' ) ) { const modelRange = findLinkRange( selection.getFirstPosition(), selection.getAttribute( 'linkHref' ), editor.model ); @@ -206,12 +207,15 @@ export default class LinkEditing extends Plugin { // There might be multiple `a` elements in the `viewRange`, for example, when the `a` element is // broken by a UIElement. for ( const item of viewRange.getItems() ) { - if ( item.is( 'a' ) ) { + if ( item.is( 'a' ) && !item.hasClass( HIGHLIGHT_CLASS ) ) { writer.addClass( HIGHLIGHT_CLASS, item ); highlightedLinks.add( item ); + changed = true; } } } + + return changed; } ); // Removing the class.