split And Insert
Type: Function
Splits from the selectionRange until the splitUntilNode and inserts the second half of the split, wrapped in the stencil, in the contextNode.
Splitting and inserting takes the following approach:
Input: context node I, split until II, cursor in textnode (child of III)
Other
I
|
II
|
III
The following split is made:
Other
I
|
II
/ \
III III'
After the split, the stencil is inserted after the highest ancestor of the selection within the contextNode.
Other
I
/ \
II S
/ \
III III'
The remainder (second half) of the split node is inserted in the gap in the inserted stencil
Other
I
/ \
II S
/ \
III III'
Refer to primitives for more information on how to include this primitive.
Arguments
context
Node (Required)
Type: Node
The node to insert the structure at
split
Until Selector (Required)
Type: String
The node to stop at when splitting
stencil
Json Ml (Required)
Type: JsonML
The stencil to insert in the contextNode
model
(Optional)
Type: Model
The model to apply to the stencil
blueprint
(Required)
Type: Blueprint
The blueprint
format
(Required)
Type: Format
The format
selection
Range (Required)
Type: BlueprintRange
The selectionRange of the cursor
Returns
Type: Boolean
Whether the split can be validly made. If true, the blueprint represents the state after the split