MutationHandler (typing/utils)
@ckeditor/ckeditor5-typing/src/utils/injecttypingmutationshandling
Helper class for translating DOM mutations into model changes.
Filtering
Properties
-
editing : EditingControllermodule:typing/utils/injecttypingmutationshandling~MutationHandler#editingreadonly
The editing controller.
-
Editor instance for which mutations are handled.
Methods
-
constructor( editor )module:typing/utils/injecttypingmutationshandling~MutationHandler#constructor -
handle( mutations, viewSelection )module:typing/utils/injecttypingmutationshandling~MutationHandler#handleHandles given mutations.
Parameters
mutations : Array.<(MutatedText | MutatedChildren)>viewSelection : Selection | null
-
_handleContainerChildrenMutations( mutations, viewSelection )module:typing/utils/injecttypingmutationshandling~MutationHandler#_handleContainerChildrenMutationsprivate
Handles situations when container's children mutated during input. This can happen when the browser is trying to "fix" DOM in certain situations. For example, when the user starts to type in
<p><a href=""><i>Link{}</i></a></p>, the browser might change the order of elements to<p><i><a href="">Link</a>x{}</i></p>. A similar situation happens when the spell checker replaces a word wrapped with<strong>with a word wrapped with a<b>element.To handle such situations, the common DOM ancestor of all mutations is converted to the model representation and then compared with the current model to calculate the proper text change.
Note: Single text node insertion is handled in
_handleTextNodeInsertionand text node mutation is handled in_handleTextMutation).Parameters
mutations : Array.<(MutatedText | MutatedChildren)>viewSelection : Selection | null
-
_handleTextMutation()module:typing/utils/injecttypingmutationshandling~MutationHandler#_handleTextMutationprivate
-
_handleTextNodeInsertion()module:typing/utils/injecttypingmutationshandling~MutationHandler#_handleTextNodeInsertionprivate
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.