replaceSelection(with:)
Replaces the receiver’s current selection with the specified DOM node.
Declaration
@MainActor func replaceSelection(with node: DOMNode!)Parameters
- node:
The node that replaces the current selection. If
nil, aNOT_FOUND_ERRDOM error is thrown as an exception. Use the Deleteselection() method to delete the selection.
Discussion
If the current selection is collapsed (a range is selected with the same nodes and offsets for the start and end) then no content is removed when inserting the node, and the selection is collapsed and moved to the end of the inserted content. If no content is selected, the node is not inserted.
See Also
Editing Documents
replaceSelection(withText:)replaceSelection(withMarkupString:)replaceSelection(with:)deleteSelection()moveToBeginningOfSentence(_:)moveToBeginningOfSentenceAndModifySelection(_:)moveToEndOfSentence(_:)moveToEndOfSentenceAndModifySelection(_:)selectSentence(_:)toggleContinuousSpellChecking(_:)toggleSmartInsertDelete(_:)canMakeTextStandardSizemakeTextStandardSize(_:)maintainsInactiveSelection