How to get wrap-selection-or-container-in-structure

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

Replace the selected content with the specified structure.

Replaces the selected content with the specified structure, inserted under the specified ancestor of the selection. The selected content will be inserted at the specified location within the structure to be inserted, effectively 'wrapping' it in the structure. If the selection is empty, the child of the specified ancestor containing the selection will be wrapped in its entirety.


 "note-insert": {
       "label": "Note",
   "description": "Contains text that is related to the main text.",
   "icon": "sticky-note-o",
       "steps": [
            "type": "operation/note-set-context-node-id-to-valid-parent"
            "type": "operation/wrap-selection-or-container-in-structure",
           "data": {
                   "childNodeStructure": [
                       { "type": "note" },
                       [{ "bindTo": "selection.start", "empty": true }],
                       [{ "bindTo": "transclude", "multiple": true, "required": false }],
                       [{ "bindTo": "selection.end", "empty": true }]
                   "contextNodeId": "{{contextNodeId}}"

Imported operation data

Name Type Description
contextNodeId NodeId

The node under which the structure is to be inserted

childNodeStructure StencilJsonML

A stencil describing the structure to be inserted. The stencil should contain a single optional multi-node gap called transclude, indicating the position in the structure where the selected content will be placed.

[model] Object

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

[overrideRange] OverrideRange

The range to operate on instead of the selectionRange

[allowNesting=false] Boolean

By default, this operation is disabled if it would create a nested structure (if an ancestor of the context node or the context node matches the childNodeStructure stencil). Set this parameter to true to allow nesting.

Was this page helpful?