horizontal-insert

How to get horizontal-insert

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

Insert a new structure somewhere under a node, using the schema for the exact location.

Inserts elements for which the parent is known, but the position relative to its siblings is restricted by the schema. This operation is most often used for contextual operations which insert an optional part of a composition, such as a description for a figure. It can also be used for toolbar operations, if a transform is first used to determine a suitable context node based on the selection, Horizontal-insert prefers the position directly after the current selection (like append-structure), but will consider all other positions as well.

After reaching the end of the node, it will overflow to the first position under the targeted node.

Example:

Given a position at the start of parentNode O,
   with a certain childList,
   and a childNode X,
   and a schema: (A (X){0.1} B) (meaning: A, then optionally X, then B).
 The Node O: 
      O  
     / \ 
    A   B

 The following attempt will be made.
      O   
    / | \ 
   X  A  B

 This will fail, the next attempt will be:
      O   
    / | \ 
   A  X  B

 This is valid, the operation will succeed.

Imported operation data

Name Type Description
contextNodeId NodeId

The id of the parent under which the new structure may appear

childNodeStructure StencilJsonML

A stencil describing the structure to be inserted. This may mention the selection

[model] Object

(Optional) model to be bound to the stencil after insertion.

[overrideRange] OverrideRange

The range to set the selection in as defined by the stencil instead of the selectionRange

Was this page helpful?