typing/utils/inlinehighlight
module
Functions
-
inlineHighlight( editor, attributeName, tagName, className ) → voidmodule:typing/utils/inlinehighlight~inlineHighlightAdds a visual highlight style to an attribute element in which the selection is anchored. Together with two-step caret movement, they indicate that the user is typing inside the element.
Highlight is turned on by adding the given class to the attribute element in the view:
- The class is removed before the conversion has started, as callbacks added with the
'highest'priority toDowncastDispatcherevents. - The class is added in the view post fixer, after other changes in the model tree were converted to the view.
This way, adding and removing the highlight does not interfere with conversion.
Usage:
import { inlineHighlight } from '@ckeditor/ckeditor5-typing/src/utils/inlinehighlight'; // Make `ck-link_selected` class be applied on an `a` element // whenever the corresponding `linkHref` attribute element is selected. inlineHighlight( editor, 'linkHref', 'a', 'ck-link_selected' );Copy codeParameters
editor : EditorThe editor instance.
attributeName : stringThe attribute name to check.
tagName : stringThe tagName of a view item.
className : stringThe class name to apply in the view.
Returns
void
- The class is removed before the conversion has started, as callbacks added with the