How to get split-and-insert

Depend on fontoxml-base-flow to make this operation available.

Split a node in two, wrap the latter part, and insert it after the selection.

This can be used to split a paragraph into a paragraph and some thing else, wrapping the part of the paragraph after the start of the selection into the other node.

There is no mirrored equivalent of this operation.


"something-insert": {
  "description": "inserts a something.",
  "steps": [
      "type": "transform/setContextNodeIdToSelectionAncestor",
      "data": {"selectionAncestorNodeSpec": "self::someAncestor"}
       "type": "operation/split-and-insert",
       "data": {
         "childNodeStructure": [
           [{"multiple": true, "bindTo": "remainder"}]
         "contextNodeId": "{{contextNodeId}}",
         "splitUntilNodeSpecOrSelector": "self::someParent"

This will perform the following mutation:

<!-- input -->
     A piece of text with the cursor HERE, and more text
<!-- output -->
     A piece of text with the cursor HE
     RE, and more text

Imported operation data

Name Type Description
contextNodeId NodeId

The node to place the cursor in.

childNodeStructure StencilJsonML

A stencil describing the structure to be inserted. The stencil should contain a single optional gap called remainder, indicating the position in the structure where the selected content will be placed. A gap called selection in this stencil can be used to influence the position of the selection after the operation is executed.

model Object

model to be bound to the stencil after insertion.

[overrideRange] OverrideRange

The range to operate on instead of the selectionRange

[splitUntilNodeSpecOrSelector] XPathTest

(Optional, either pass this or splitUntilAncestorThatMatchesOneOf) Selector used to find the node until where a split must happen. Must match an ancestor of the context node, or the contextNode itself.

[splitUntilAncestorThatMatchesOneOf] XPathTest[]

(Optional, either pass this or splitUntilNodeSpecOrSelector) Selectors used to find the ancestor which must be split. Should be an array of selectors.