roosterjs-content-model-api 9.44.0 → 9.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +63 -63
- package/lib/index.js +131 -131
- package/lib/index.js.map +1 -1
- package/lib/modelApi/block/setModelAlignment.d.ts +5 -5
- package/lib/modelApi/block/setModelAlignment.js +65 -65
- package/lib/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib/modelApi/block/setModelDirection.d.ts +5 -5
- package/lib/modelApi/block/setModelDirection.js +113 -109
- package/lib/modelApi/block/setModelDirection.js.map +1 -1
- package/lib/modelApi/block/setModelIndentation.d.ts +8 -8
- package/lib/modelApi/block/setModelIndentation.js +158 -158
- package/lib/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
- package/lib/modelApi/block/splitSelectedParagraphByBr.js +71 -71
- package/lib/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
- package/lib/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
- package/lib/modelApi/block/toggleModelBlockQuote.js +53 -53
- package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib/modelApi/common/adjustIndentation.d.ts +13 -13
- package/lib/modelApi/common/adjustIndentation.js +114 -114
- package/lib/modelApi/common/adjustIndentation.js.map +1 -1
- package/lib/modelApi/common/clearModelFormat.d.ts +5 -5
- package/lib/modelApi/common/clearModelFormat.js +143 -143
- package/lib/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib/modelApi/common/queryContentModelBlocks.d.ts +10 -10
- package/lib/modelApi/common/queryContentModelBlocks.js +87 -87
- package/lib/modelApi/common/queryContentModelBlocks.js.map +1 -1
- package/lib/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
- package/lib/modelApi/common/reducedModelChildProcessor.js +63 -63
- package/lib/modelApi/common/reducedModelChildProcessor.js.map +1 -1
- package/lib/modelApi/common/wrapBlock.d.ts +16 -16
- package/lib/modelApi/common/wrapBlock.js +52 -52
- package/lib/modelApi/common/wrapBlock.js.map +1 -1
- package/lib/modelApi/entity/insertEntityModel.d.ts +5 -5
- package/lib/modelApi/entity/insertEntityModel.js +105 -105
- package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.d.ts +5 -5
- package/lib/modelApi/image/applyImageBorderFormat.js +57 -57
- package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib/modelApi/link/getLinkUrl.d.ts +5 -5
- package/lib/modelApi/link/getLinkUrl.js +28 -28
- package/lib/modelApi/link/getLinkUrl.js.map +1 -1
- package/lib/modelApi/link/matchLink.d.ts +12 -12
- package/lib/modelApi/link/matchLink.js +93 -93
- package/lib/modelApi/link/matchLink.js.map +1 -1
- package/lib/modelApi/link/promoteLink.d.ts +20 -20
- package/lib/modelApi/link/promoteLink.js +54 -54
- package/lib/modelApi/link/promoteLink.js.map +1 -1
- package/lib/modelApi/list/findListItemsInSameThread.d.ts +13 -13
- package/lib/modelApi/list/findListItemsInSameThread.js +113 -113
- package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib/modelApi/list/getListAnnounceData.d.ts +7 -7
- package/lib/modelApi/list/getListAnnounceData.js +68 -68
- package/lib/modelApi/list/getListAnnounceData.js.map +1 -1
- package/lib/modelApi/list/setListType.d.ts +8 -8
- package/lib/modelApi/list/setListType.js +117 -117
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/list/setModelListStartNumber.d.ts +7 -7
- package/lib/modelApi/list/setModelListStartNumber.js +21 -21
- package/lib/modelApi/list/setModelListStartNumber.js.map +1 -1
- package/lib/modelApi/list/setModelListStyle.d.ts +7 -7
- package/lib/modelApi/list/setModelListStyle.js +25 -25
- package/lib/modelApi/list/setModelListStyle.js.map +1 -1
- package/lib/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
- package/lib/modelApi/selection/adjustSegmentSelection.js +47 -47
- package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js +56 -56
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustWordSelection.d.ts +8 -8
- package/lib/modelApi/selection/adjustWordSelection.js +123 -123
- package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib/modelApi/selection/collapseTableSelection.d.ts +5 -5
- package/lib/modelApi/selection/collapseTableSelection.js +16 -16
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib/modelApi/table/alignTable.d.ts +5 -5
- package/lib/modelApi/table/alignTable.js +11 -11
- package/lib/modelApi/table/alignTable.js.map +1 -1
- package/lib/modelApi/table/alignTableCell.d.ts +9 -9
- package/lib/modelApi/table/alignTableCell.js +57 -57
- package/lib/modelApi/table/alignTableCell.js.map +1 -1
- package/lib/modelApi/table/canMergeCells.d.ts +5 -5
- package/lib/modelApi/table/canMergeCells.js +56 -56
- package/lib/modelApi/table/canMergeCells.js.map +1 -1
- package/lib/modelApi/table/clearSelectedCells.d.ts +7 -7
- package/lib/modelApi/table/clearSelectedCells.js +29 -29
- package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib/modelApi/table/createTableStructure.d.ts +5 -5
- package/lib/modelApi/table/createTableStructure.js +19 -19
- package/lib/modelApi/table/createTableStructure.js.map +1 -1
- package/lib/modelApi/table/deleteTable.d.ts +5 -5
- package/lib/modelApi/table/deleteTable.js +10 -10
- package/lib/modelApi/table/deleteTable.js.map +1 -1
- package/lib/modelApi/table/deleteTableColumn.d.ts +5 -5
- package/lib/modelApi/table/deleteTableColumn.js +24 -24
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib/modelApi/table/deleteTableRow.d.ts +5 -5
- package/lib/modelApi/table/deleteTableRow.js +23 -23
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js +56 -56
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.d.ts +7 -7
- package/lib/modelApi/table/insertTableColumn.js +27 -27
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.d.ts +7 -7
- package/lib/modelApi/table/insertTableRow.js +31 -31
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.d.ts +5 -5
- package/lib/modelApi/table/mergeTableCells.js +25 -25
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.d.ts +5 -5
- package/lib/modelApi/table/mergeTableColumn.js +35 -35
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.d.ts +5 -5
- package/lib/modelApi/table/mergeTableRow.js +35 -35
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
- package/lib/modelApi/table/splitTableCellHorizontally.js +54 -54
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.d.ts +5 -5
- package/lib/modelApi/table/splitTableCellVertically.js +53 -53
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/block/setAlignment.d.ts +7 -7
- package/lib/publicApi/block/setAlignment.js +16 -16
- package/lib/publicApi/block/setAlignment.js.map +1 -1
- package/lib/publicApi/block/setDirection.d.ts +7 -7
- package/lib/publicApi/block/setDirection.js +16 -16
- package/lib/publicApi/block/setDirection.js.map +1 -1
- package/lib/publicApi/block/setHeadingLevel.d.ts +7 -7
- package/lib/publicApi/block/setHeadingLevel.js +50 -50
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib/publicApi/block/setIndentation.d.ts +8 -8
- package/lib/publicApi/block/setIndentation.js +21 -21
- package/lib/publicApi/block/setIndentation.js.map +1 -1
- package/lib/publicApi/block/setParagraphMargin.d.ts +9 -9
- package/lib/publicApi/block/setParagraphMargin.js +33 -33
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib/publicApi/block/setSpacing.d.ts +7 -7
- package/lib/publicApi/block/setSpacing.js +21 -21
- package/lib/publicApi/block/setSpacing.js.map +1 -1
- package/lib/publicApi/block/toggleBlockQuote.d.ts +9 -9
- package/lib/publicApi/block/toggleBlockQuote.js +39 -39
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib/publicApi/entity/insertEntity.d.ts +25 -25
- package/lib/publicApi/entity/insertEntity.js +67 -67
- package/lib/publicApi/entity/insertEntity.js.map +1 -1
- package/lib/publicApi/format/clearFormat.d.ts +6 -6
- package/lib/publicApi/format/clearFormat.js +34 -34
- package/lib/publicApi/format/clearFormat.js.map +1 -1
- package/lib/publicApi/format/getFormatState.d.ts +7 -7
- package/lib/publicApi/format/getFormatState.js +31 -31
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/adjustImageSelection.d.ts +6 -6
- package/lib/publicApi/image/adjustImageSelection.js +29 -29
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib/publicApi/image/changeImage.d.ts +7 -7
- package/lib/publicApi/image/changeImage.js +35 -35
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.d.ts +7 -7
- package/lib/publicApi/image/insertImage.js +38 -38
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/image/setImageAltText.d.ts +8 -8
- package/lib/publicApi/image/setImageAltText.js +17 -17
- package/lib/publicApi/image/setImageAltText.js.map +1 -1
- package/lib/publicApi/image/setImageBorder.d.ts +9 -9
- package/lib/publicApi/image/setImageBorder.js +19 -19
- package/lib/publicApi/image/setImageBorder.js.map +1 -1
- package/lib/publicApi/image/setImageBoxShadow.d.ts +8 -8
- package/lib/publicApi/image/setImageBoxShadow.js +29 -29
- package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib/publicApi/link/adjustLinkSelection.d.ts +6 -6
- package/lib/publicApi/link/adjustLinkSelection.js +34 -34
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +15 -15
- package/lib/publicApi/link/insertLink.js +120 -120
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +8 -8
- package/lib/publicApi/link/removeLink.js +32 -32
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +7 -7
- package/lib/publicApi/list/setListStartNumber.js +18 -18
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +7 -7
- package/lib/publicApi/list/setListStyle.js +18 -18
- package/lib/publicApi/list/setListStyle.js.map +1 -1
- package/lib/publicApi/list/toggleBullet.d.ts +9 -9
- package/lib/publicApi/list/toggleBullet.js +22 -22
- package/lib/publicApi/list/toggleBullet.js.map +1 -1
- package/lib/publicApi/list/toggleNumbering.d.ts +9 -9
- package/lib/publicApi/list/toggleNumbering.js +22 -22
- package/lib/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib/publicApi/segment/applySegmentFormat.d.ts +7 -7
- package/lib/publicApi/segment/applySegmentFormat.js +23 -23
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib/publicApi/segment/changeCapitalization.d.ts +10 -10
- package/lib/publicApi/segment/changeCapitalization.js +49 -49
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib/publicApi/segment/changeFontSize.d.ts +8 -8
- package/lib/publicApi/segment/changeFontSize.js +63 -63
- package/lib/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib/publicApi/segment/setBackgroundColor.d.ts +7 -7
- package/lib/publicApi/segment/setBackgroundColor.js +35 -35
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib/publicApi/segment/setFontName.d.ts +7 -7
- package/lib/publicApi/segment/setFontName.js +19 -19
- package/lib/publicApi/segment/setFontName.js.map +1 -1
- package/lib/publicApi/segment/setFontSize.d.ts +12 -12
- package/lib/publicApi/segment/setFontSize.js +33 -33
- package/lib/publicApi/segment/setFontSize.js.map +1 -1
- package/lib/publicApi/segment/setTextColor.d.ts +7 -7
- package/lib/publicApi/segment/setTextColor.js +26 -26
- package/lib/publicApi/segment/setTextColor.js.map +1 -1
- package/lib/publicApi/segment/splitTextSegment.d.ts +10 -10
- package/lib/publicApi/segment/splitTextSegment.js +30 -30
- package/lib/publicApi/segment/splitTextSegment.js.map +1 -1
- package/lib/publicApi/segment/toggleBold.d.ts +6 -6
- package/lib/publicApi/segment/toggleBold.js +27 -27
- package/lib/publicApi/segment/toggleBold.js.map +1 -1
- package/lib/publicApi/segment/toggleCode.d.ts +6 -6
- package/lib/publicApi/segment/toggleCode.js +28 -28
- package/lib/publicApi/segment/toggleCode.js.map +1 -1
- package/lib/publicApi/segment/toggleItalic.d.ts +6 -6
- package/lib/publicApi/segment/toggleItalic.js +21 -21
- package/lib/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +6 -6
- package/lib/publicApi/segment/toggleStrikethrough.js +15 -15
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib/publicApi/segment/toggleSubscript.d.ts +6 -6
- package/lib/publicApi/segment/toggleSubscript.js +15 -15
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib/publicApi/segment/toggleSuperscript.d.ts +6 -6
- package/lib/publicApi/segment/toggleSuperscript.js +15 -15
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib/publicApi/segment/toggleUnderline.d.ts +6 -6
- package/lib/publicApi/segment/toggleUnderline.js +24 -24
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +8 -8
- package/lib/publicApi/table/applyTableBorderFormat.js +297 -297
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.d.ts +7 -7
- package/lib/publicApi/table/editTable.js +95 -95
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/formatTable.d.ts +8 -8
- package/lib/publicApi/table/formatTable.js +38 -38
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +12 -11
- package/lib/publicApi/table/insertTable.js +76 -52
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +7 -7
- package/lib/publicApi/table/setTableCellShade.js +32 -32
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
- package/lib/publicApi/utils/createEditorContextForEntity.js +29 -29
- package/lib/publicApi/utils/createEditorContextForEntity.js.map +1 -1
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
- package/lib/publicApi/utils/formatImageWithContentModel.js +18 -18
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
- package/lib/publicApi/utils/formatInsertPointWithContentModel.js +130 -130
- package/lib/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +23 -23
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +117 -117
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
- package/lib/publicApi/utils/formatTableWithContentModel.js +46 -46
- package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
- package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +34 -34
- package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
- package/lib-amd/index.d.ts +63 -63
- package/lib-amd/index.js +69 -69
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/block/setModelAlignment.d.ts +5 -5
- package/lib-amd/modelApi/block/setModelAlignment.js +64 -64
- package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-amd/modelApi/block/setModelDirection.d.ts +5 -5
- package/lib-amd/modelApi/block/setModelDirection.js +112 -108
- package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-amd/modelApi/block/setModelIndentation.d.ts +8 -8
- package/lib-amd/modelApi/block/setModelIndentation.js +154 -154
- package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-amd/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
- package/lib-amd/modelApi/block/splitSelectedParagraphByBr.js +71 -71
- package/lib-amd/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
- package/lib-amd/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js +52 -52
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-amd/modelApi/common/adjustIndentation.d.ts +13 -13
- package/lib-amd/modelApi/common/adjustIndentation.js +114 -114
- package/lib-amd/modelApi/common/adjustIndentation.js.map +1 -1
- package/lib-amd/modelApi/common/clearModelFormat.d.ts +5 -5
- package/lib-amd/modelApi/common/clearModelFormat.js +142 -142
- package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-amd/modelApi/common/queryContentModelBlocks.d.ts +10 -10
- package/lib-amd/modelApi/common/queryContentModelBlocks.js +87 -87
- package/lib-amd/modelApi/common/queryContentModelBlocks.js.map +1 -1
- package/lib-amd/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
- package/lib-amd/modelApi/common/reducedModelChildProcessor.js +63 -63
- package/lib-amd/modelApi/common/reducedModelChildProcessor.js.map +1 -1
- package/lib-amd/modelApi/common/wrapBlock.d.ts +16 -16
- package/lib-amd/modelApi/common/wrapBlock.js +52 -52
- package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-amd/modelApi/entity/insertEntityModel.d.ts +5 -5
- package/lib-amd/modelApi/entity/insertEntityModel.js +105 -105
- package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +5 -5
- package/lib-amd/modelApi/image/applyImageBorderFormat.js +58 -58
- package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-amd/modelApi/link/getLinkUrl.d.ts +5 -5
- package/lib-amd/modelApi/link/getLinkUrl.js +29 -29
- package/lib-amd/modelApi/link/getLinkUrl.js.map +1 -1
- package/lib-amd/modelApi/link/matchLink.d.ts +12 -12
- package/lib-amd/modelApi/link/matchLink.js +93 -93
- package/lib-amd/modelApi/link/matchLink.js.map +1 -1
- package/lib-amd/modelApi/link/promoteLink.d.ts +20 -20
- package/lib-amd/modelApi/link/promoteLink.js +54 -54
- package/lib-amd/modelApi/link/promoteLink.js.map +1 -1
- package/lib-amd/modelApi/list/findListItemsInSameThread.d.ts +13 -13
- package/lib-amd/modelApi/list/findListItemsInSameThread.js +115 -115
- package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-amd/modelApi/list/getListAnnounceData.d.ts +7 -7
- package/lib-amd/modelApi/list/getListAnnounceData.js +68 -68
- package/lib-amd/modelApi/list/getListAnnounceData.js.map +1 -1
- package/lib-amd/modelApi/list/setListType.d.ts +8 -8
- package/lib-amd/modelApi/list/setListType.js +116 -116
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/list/setModelListStartNumber.d.ts +7 -7
- package/lib-amd/modelApi/list/setModelListStartNumber.js +22 -22
- package/lib-amd/modelApi/list/setModelListStartNumber.js.map +1 -1
- package/lib-amd/modelApi/list/setModelListStyle.d.ts +7 -7
- package/lib-amd/modelApi/list/setModelListStyle.js +25 -25
- package/lib-amd/modelApi/list/setModelListStyle.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js +48 -48
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js +56 -56
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustWordSelection.d.ts +8 -8
- package/lib-amd/modelApi/selection/adjustWordSelection.js +123 -123
- package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/collapseTableSelection.d.ts +5 -5
- package/lib-amd/modelApi/selection/collapseTableSelection.js +17 -17
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-amd/modelApi/table/alignTable.d.ts +5 -5
- package/lib-amd/modelApi/table/alignTable.js +13 -13
- package/lib-amd/modelApi/table/alignTable.js.map +1 -1
- package/lib-amd/modelApi/table/alignTableCell.d.ts +9 -9
- package/lib-amd/modelApi/table/alignTableCell.js +58 -58
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-amd/modelApi/table/canMergeCells.d.ts +5 -5
- package/lib-amd/modelApi/table/canMergeCells.js +58 -58
- package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-amd/modelApi/table/clearSelectedCells.d.ts +7 -7
- package/lib-amd/modelApi/table/clearSelectedCells.js +30 -30
- package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-amd/modelApi/table/createTableStructure.d.ts +5 -5
- package/lib-amd/modelApi/table/createTableStructure.js +20 -20
- package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTable.d.ts +5 -5
- package/lib-amd/modelApi/table/deleteTable.js +12 -12
- package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableColumn.d.ts +5 -5
- package/lib-amd/modelApi/table/deleteTableColumn.js +24 -24
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableRow.d.ts +5 -5
- package/lib-amd/modelApi/table/deleteTableRow.js +23 -23
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js +57 -57
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableColumn.d.ts +7 -7
- package/lib-amd/modelApi/table/insertTableColumn.js +27 -27
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.d.ts +7 -7
- package/lib-amd/modelApi/table/insertTableRow.js +30 -30
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.d.ts +5 -5
- package/lib-amd/modelApi/table/mergeTableCells.js +25 -25
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.d.ts +5 -5
- package/lib-amd/modelApi/table/mergeTableColumn.js +35 -35
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.d.ts +5 -5
- package/lib-amd/modelApi/table/mergeTableRow.js +35 -35
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js +54 -54
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.d.ts +5 -5
- package/lib-amd/modelApi/table/splitTableCellVertically.js +53 -53
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/block/setAlignment.d.ts +7 -7
- package/lib-amd/publicApi/block/setAlignment.js +17 -17
- package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
- package/lib-amd/publicApi/block/setDirection.d.ts +7 -7
- package/lib-amd/publicApi/block/setDirection.js +17 -17
- package/lib-amd/publicApi/block/setDirection.js.map +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.d.ts +7 -7
- package/lib-amd/publicApi/block/setHeadingLevel.js +51 -51
- package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-amd/publicApi/block/setIndentation.d.ts +8 -8
- package/lib-amd/publicApi/block/setIndentation.js +22 -22
- package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.d.ts +9 -9
- package/lib-amd/publicApi/block/setParagraphMargin.js +33 -33
- package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-amd/publicApi/block/setSpacing.d.ts +7 -7
- package/lib-amd/publicApi/block/setSpacing.js +22 -22
- package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +9 -9
- package/lib-amd/publicApi/block/toggleBlockQuote.js +39 -39
- package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-amd/publicApi/entity/insertEntity.d.ts +25 -25
- package/lib-amd/publicApi/entity/insertEntity.js +66 -66
- package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-amd/publicApi/format/clearFormat.d.ts +6 -6
- package/lib-amd/publicApi/format/clearFormat.js +34 -34
- package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.d.ts +7 -7
- package/lib-amd/publicApi/format/getFormatState.js +31 -31
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.d.ts +6 -6
- package/lib-amd/publicApi/image/adjustImageSelection.js +29 -29
- package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-amd/publicApi/image/changeImage.d.ts +7 -7
- package/lib-amd/publicApi/image/changeImage.js +35 -35
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.d.ts +7 -7
- package/lib-amd/publicApi/image/insertImage.js +39 -39
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/image/setImageAltText.d.ts +8 -8
- package/lib-amd/publicApi/image/setImageAltText.js +18 -18
- package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBorder.d.ts +9 -9
- package/lib-amd/publicApi/image/setImageBorder.js +19 -19
- package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +8 -8
- package/lib-amd/publicApi/image/setImageBoxShadow.js +30 -30
- package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +6 -6
- package/lib-amd/publicApi/link/adjustLinkSelection.js +33 -33
- package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-amd/publicApi/link/insertLink.d.ts +15 -15
- package/lib-amd/publicApi/link/insertLink.js +118 -118
- package/lib-amd/publicApi/link/insertLink.js.map +1 -1
- package/lib-amd/publicApi/link/removeLink.d.ts +8 -8
- package/lib-amd/publicApi/link/removeLink.js +32 -32
- package/lib-amd/publicApi/link/removeLink.js.map +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +7 -7
- package/lib-amd/publicApi/list/setListStartNumber.js +19 -19
- package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-amd/publicApi/list/setListStyle.d.ts +7 -7
- package/lib-amd/publicApi/list/setListStyle.js +19 -19
- package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
- package/lib-amd/publicApi/list/toggleBullet.d.ts +9 -9
- package/lib-amd/publicApi/list/toggleBullet.js +23 -23
- package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.d.ts +9 -9
- package/lib-amd/publicApi/list/toggleNumbering.js +23 -23
- package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +7 -7
- package/lib-amd/publicApi/segment/applySegmentFormat.js +24 -24
- package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.d.ts +10 -10
- package/lib-amd/publicApi/segment/changeCapitalization.js +50 -50
- package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-amd/publicApi/segment/changeFontSize.d.ts +8 -8
- package/lib-amd/publicApi/segment/changeFontSize.js +62 -62
- package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +7 -7
- package/lib-amd/publicApi/segment/setBackgroundColor.js +35 -35
- package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontName.d.ts +7 -7
- package/lib-amd/publicApi/segment/setFontName.js +20 -20
- package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontSize.d.ts +12 -12
- package/lib-amd/publicApi/segment/setFontSize.js +34 -34
- package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setTextColor.d.ts +7 -7
- package/lib-amd/publicApi/segment/setTextColor.js +27 -27
- package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-amd/publicApi/segment/splitTextSegment.d.ts +10 -10
- package/lib-amd/publicApi/segment/splitTextSegment.js +30 -30
- package/lib-amd/publicApi/segment/splitTextSegment.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleBold.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleBold.js +27 -27
- package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleCode.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleCode.js +28 -28
- package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleItalic.js +22 -22
- package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleStrikethrough.js +16 -16
- package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleSubscript.js +16 -16
- package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleSuperscript.js +16 -16
- package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.d.ts +6 -6
- package/lib-amd/publicApi/segment/toggleUnderline.js +25 -25
- package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +8 -8
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +297 -297
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.d.ts +7 -7
- package/lib-amd/publicApi/table/editTable.js +84 -84
- package/lib-amd/publicApi/table/editTable.js.map +1 -1
- package/lib-amd/publicApi/table/formatTable.d.ts +8 -8
- package/lib-amd/publicApi/table/formatTable.js +38 -38
- package/lib-amd/publicApi/table/formatTable.js.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +12 -11
- package/lib-amd/publicApi/table/insertTable.js +74 -50
- package/lib-amd/publicApi/table/insertTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.d.ts +7 -7
- package/lib-amd/publicApi/table/setTableCellShade.js +32 -32
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
- package/lib-amd/publicApi/utils/createEditorContextForEntity.js +30 -30
- package/lib-amd/publicApi/utils/createEditorContextForEntity.js.map +1 -1
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js +19 -19
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js +130 -130
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +23 -23
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +115 -115
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js +45 -45
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
- package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +35 -35
- package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
- package/lib-mjs/index.d.ts +63 -63
- package/lib-mjs/index.js +63 -63
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.d.ts +5 -5
- package/lib-mjs/modelApi/block/setModelAlignment.js +61 -61
- package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.d.ts +5 -5
- package/lib-mjs/modelApi/block/setModelDirection.js +109 -105
- package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelIndentation.d.ts +8 -8
- package/lib-mjs/modelApi/block/setModelIndentation.js +154 -154
- package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
- package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.js +67 -67
- package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js +49 -49
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-mjs/modelApi/common/adjustIndentation.d.ts +13 -13
- package/lib-mjs/modelApi/common/adjustIndentation.js +109 -109
- package/lib-mjs/modelApi/common/adjustIndentation.js.map +1 -1
- package/lib-mjs/modelApi/common/clearModelFormat.d.ts +5 -5
- package/lib-mjs/modelApi/common/clearModelFormat.js +139 -139
- package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-mjs/modelApi/common/queryContentModelBlocks.d.ts +10 -10
- package/lib-mjs/modelApi/common/queryContentModelBlocks.js +83 -83
- package/lib-mjs/modelApi/common/queryContentModelBlocks.js.map +1 -1
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.js +59 -59
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.js.map +1 -1
- package/lib-mjs/modelApi/common/wrapBlock.d.ts +16 -16
- package/lib-mjs/modelApi/common/wrapBlock.js +47 -47
- package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-mjs/modelApi/entity/insertEntityModel.d.ts +5 -5
- package/lib-mjs/modelApi/entity/insertEntityModel.js +101 -101
- package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +5 -5
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js +53 -53
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-mjs/modelApi/link/getLinkUrl.d.ts +5 -5
- package/lib-mjs/modelApi/link/getLinkUrl.js +24 -24
- package/lib-mjs/modelApi/link/getLinkUrl.js.map +1 -1
- package/lib-mjs/modelApi/link/matchLink.d.ts +12 -12
- package/lib-mjs/modelApi/link/matchLink.js +89 -89
- package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
- package/lib-mjs/modelApi/link/promoteLink.d.ts +20 -20
- package/lib-mjs/modelApi/link/promoteLink.js +49 -49
- package/lib-mjs/modelApi/link/promoteLink.js.map +1 -1
- package/lib-mjs/modelApi/list/findListItemsInSameThread.d.ts +13 -13
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js +109 -109
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-mjs/modelApi/list/getListAnnounceData.d.ts +7 -7
- package/lib-mjs/modelApi/list/getListAnnounceData.js +64 -64
- package/lib-mjs/modelApi/list/getListAnnounceData.js.map +1 -1
- package/lib-mjs/modelApi/list/setListType.d.ts +8 -8
- package/lib-mjs/modelApi/list/setListType.js +113 -113
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/list/setModelListStartNumber.d.ts +7 -7
- package/lib-mjs/modelApi/list/setModelListStartNumber.js +17 -17
- package/lib-mjs/modelApi/list/setModelListStartNumber.js.map +1 -1
- package/lib-mjs/modelApi/list/setModelListStyle.d.ts +7 -7
- package/lib-mjs/modelApi/list/setModelListStyle.js +21 -21
- package/lib-mjs/modelApi/list/setModelListStyle.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js +43 -43
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js +52 -52
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustWordSelection.d.ts +8 -8
- package/lib-mjs/modelApi/selection/adjustWordSelection.js +119 -119
- package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/collapseTableSelection.d.ts +5 -5
- package/lib-mjs/modelApi/selection/collapseTableSelection.js +12 -12
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTable.d.ts +5 -5
- package/lib-mjs/modelApi/table/alignTable.js +7 -7
- package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.d.ts +9 -9
- package/lib-mjs/modelApi/table/alignTableCell.js +52 -52
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-mjs/modelApi/table/canMergeCells.d.ts +5 -5
- package/lib-mjs/modelApi/table/canMergeCells.js +52 -52
- package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.d.ts +7 -7
- package/lib-mjs/modelApi/table/clearSelectedCells.js +25 -25
- package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-mjs/modelApi/table/createTableStructure.d.ts +5 -5
- package/lib-mjs/modelApi/table/createTableStructure.js +15 -15
- package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTable.d.ts +5 -5
- package/lib-mjs/modelApi/table/deleteTable.js +6 -6
- package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.d.ts +5 -5
- package/lib-mjs/modelApi/table/deleteTableColumn.js +20 -20
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.d.ts +5 -5
- package/lib-mjs/modelApi/table/deleteTableRow.js +19 -19
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js +52 -52
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableColumn.d.ts +7 -7
- package/lib-mjs/modelApi/table/insertTableColumn.js +23 -23
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.d.ts +7 -7
- package/lib-mjs/modelApi/table/insertTableRow.js +27 -27
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.d.ts +5 -5
- package/lib-mjs/modelApi/table/mergeTableCells.js +21 -21
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.d.ts +5 -5
- package/lib-mjs/modelApi/table/mergeTableColumn.js +31 -31
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.d.ts +5 -5
- package/lib-mjs/modelApi/table/mergeTableRow.js +31 -31
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +50 -50
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.d.ts +5 -5
- package/lib-mjs/modelApi/table/splitTableCellVertically.js +49 -49
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/block/setAlignment.d.ts +7 -7
- package/lib-mjs/publicApi/block/setAlignment.js +12 -12
- package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
- package/lib-mjs/publicApi/block/setDirection.d.ts +7 -7
- package/lib-mjs/publicApi/block/setDirection.js +12 -12
- package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +7 -7
- package/lib-mjs/publicApi/block/setHeadingLevel.js +46 -46
- package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-mjs/publicApi/block/setIndentation.d.ts +8 -8
- package/lib-mjs/publicApi/block/setIndentation.js +17 -17
- package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +9 -9
- package/lib-mjs/publicApi/block/setParagraphMargin.js +29 -29
- package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-mjs/publicApi/block/setSpacing.d.ts +7 -7
- package/lib-mjs/publicApi/block/setSpacing.js +17 -17
- package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +9 -9
- package/lib-mjs/publicApi/block/toggleBlockQuote.js +35 -35
- package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-mjs/publicApi/entity/insertEntity.d.ts +25 -25
- package/lib-mjs/publicApi/entity/insertEntity.js +63 -63
- package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-mjs/publicApi/format/clearFormat.d.ts +6 -6
- package/lib-mjs/publicApi/format/clearFormat.js +30 -30
- package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.d.ts +7 -7
- package/lib-mjs/publicApi/format/getFormatState.js +27 -27
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +6 -6
- package/lib-mjs/publicApi/image/adjustImageSelection.js +25 -25
- package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.d.ts +7 -7
- package/lib-mjs/publicApi/image/changeImage.js +31 -31
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.d.ts +7 -7
- package/lib-mjs/publicApi/image/insertImage.js +34 -34
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +8 -8
- package/lib-mjs/publicApi/image/setImageAltText.js +13 -13
- package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBorder.d.ts +9 -9
- package/lib-mjs/publicApi/image/setImageBorder.js +15 -15
- package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +8 -8
- package/lib-mjs/publicApi/image/setImageBoxShadow.js +25 -25
- package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +6 -6
- package/lib-mjs/publicApi/link/adjustLinkSelection.js +30 -30
- package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.d.ts +15 -15
- package/lib-mjs/publicApi/link/insertLink.js +116 -116
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
- package/lib-mjs/publicApi/link/removeLink.d.ts +8 -8
- package/lib-mjs/publicApi/link/removeLink.js +28 -28
- package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +7 -7
- package/lib-mjs/publicApi/list/setListStartNumber.js +14 -14
- package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStyle.d.ts +7 -7
- package/lib-mjs/publicApi/list/setListStyle.js +14 -14
- package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.d.ts +9 -9
- package/lib-mjs/publicApi/list/toggleBullet.js +18 -18
- package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.d.ts +9 -9
- package/lib-mjs/publicApi/list/toggleNumbering.js +18 -18
- package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +7 -7
- package/lib-mjs/publicApi/segment/applySegmentFormat.js +19 -19
- package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +10 -10
- package/lib-mjs/publicApi/segment/changeCapitalization.js +45 -45
- package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.d.ts +8 -8
- package/lib-mjs/publicApi/segment/changeFontSize.js +59 -59
- package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +7 -7
- package/lib-mjs/publicApi/segment/setBackgroundColor.js +31 -31
- package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontName.d.ts +7 -7
- package/lib-mjs/publicApi/segment/setFontName.js +15 -15
- package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.d.ts +12 -12
- package/lib-mjs/publicApi/segment/setFontSize.js +28 -28
- package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.d.ts +7 -7
- package/lib-mjs/publicApi/segment/setTextColor.js +22 -22
- package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/splitTextSegment.d.ts +10 -10
- package/lib-mjs/publicApi/segment/splitTextSegment.js +26 -26
- package/lib-mjs/publicApi/segment/splitTextSegment.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleBold.js +23 -23
- package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleCode.js +24 -24
- package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleItalic.js +17 -17
- package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js +11 -11
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleSubscript.js +11 -11
- package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleSuperscript.js +11 -11
- package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +6 -6
- package/lib-mjs/publicApi/segment/toggleUnderline.js +20 -20
- package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +8 -8
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +293 -293
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.d.ts +7 -7
- package/lib-mjs/publicApi/table/editTable.js +91 -91
- package/lib-mjs/publicApi/table/editTable.js.map +1 -1
- package/lib-mjs/publicApi/table/formatTable.d.ts +8 -8
- package/lib-mjs/publicApi/table/formatTable.js +34 -34
- package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +12 -11
- package/lib-mjs/publicApi/table/insertTable.js +72 -48
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.d.ts +7 -7
- package/lib-mjs/publicApi/table/setTableCellShade.js +28 -28
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
- package/lib-mjs/publicApi/utils/createEditorContextForEntity.js +25 -25
- package/lib-mjs/publicApi/utils/createEditorContextForEntity.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +14 -14
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js +126 -126
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +19 -19
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +113 -113
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js +42 -42
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
- package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +30 -30
- package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ContentModelEntity, EditorContext, ReadonlyContentModelBlock, ReadonlyContentModelBlockBase, ReadonlyContentModelBlockGroup } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* Query content model blocks
|
|
4
|
-
* @param group The block group to query
|
|
5
|
-
* @param type The type of block to query
|
|
6
|
-
* @param filter Optional selector to filter the blocks
|
|
7
|
-
* @param findFirstOnly True to return the first block only, false to return all blocks
|
|
8
|
-
* @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not
|
|
9
|
-
*/
|
|
10
|
-
export declare function queryContentModelBlocks<T extends ReadonlyContentModelBlock>(group: ReadonlyContentModelBlockGroup, type: T extends ReadonlyContentModelBlockBase<infer U> ? U : never, filter?: (element: T) => element is T, findFirstOnly?: boolean, shouldExpandEntity?: (entity: ContentModelEntity) => EditorContext | null): T[];
|
|
1
|
+
import type { ContentModelEntity, EditorContext, ReadonlyContentModelBlock, ReadonlyContentModelBlockBase, ReadonlyContentModelBlockGroup } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Query content model blocks
|
|
4
|
+
* @param group The block group to query
|
|
5
|
+
* @param type The type of block to query
|
|
6
|
+
* @param filter Optional selector to filter the blocks
|
|
7
|
+
* @param findFirstOnly True to return the first block only, false to return all blocks
|
|
8
|
+
* @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not
|
|
9
|
+
*/
|
|
10
|
+
export declare function queryContentModelBlocks<T extends ReadonlyContentModelBlock>(group: ReadonlyContentModelBlockGroup, type: T extends ReadonlyContentModelBlockBase<infer U> ? U : never, filter?: (element: T) => element is T, findFirstOnly?: boolean, shouldExpandEntity?: (entity: ContentModelEntity) => EditorContext | null): T[];
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.queryContentModelBlocks = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Query content model blocks
|
|
7
|
-
* @param group The block group to query
|
|
8
|
-
* @param type The type of block to query
|
|
9
|
-
* @param filter Optional selector to filter the blocks
|
|
10
|
-
* @param findFirstOnly True to return the first block only, false to return all blocks
|
|
11
|
-
* @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not
|
|
12
|
-
*/
|
|
13
|
-
function queryContentModelBlocks(group, type, filter, findFirstOnly, shouldExpandEntity) {
|
|
14
|
-
var e_1, _a, e_2, _b;
|
|
15
|
-
var elements = [];
|
|
16
|
-
for (var i = 0; i < group.blocks.length; i++) {
|
|
17
|
-
if (findFirstOnly && elements.length > 0) {
|
|
18
|
-
return elements;
|
|
19
|
-
}
|
|
20
|
-
var block = group.blocks[i];
|
|
21
|
-
switch (block.blockType) {
|
|
22
|
-
case 'Paragraph':
|
|
23
|
-
case 'Divider':
|
|
24
|
-
case 'Entity':
|
|
25
|
-
if (isExpectedBlockType(block, type, filter)) {
|
|
26
|
-
elements.push(block);
|
|
27
|
-
}
|
|
28
|
-
if (block.blockType == 'Entity' && shouldExpandEntity) {
|
|
29
|
-
var editorContext = shouldExpandEntity(block);
|
|
30
|
-
if (editorContext) {
|
|
31
|
-
var context = (0, roosterjs_content_model_dom_1.createDomToModelContext)(editorContext);
|
|
32
|
-
var model = (0, roosterjs_content_model_dom_1.domToContentModel)(block.wrapper, context);
|
|
33
|
-
var results_1 = queryContentModelBlocks(model, type, filter, findFirstOnly, shouldExpandEntity);
|
|
34
|
-
elements.push.apply(elements, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(results_1), false));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
case 'BlockGroup':
|
|
39
|
-
if (isExpectedBlockType(block, type, filter)) {
|
|
40
|
-
elements.push(block);
|
|
41
|
-
}
|
|
42
|
-
var results = queryContentModelBlocks(block, type, filter, findFirstOnly, shouldExpandEntity);
|
|
43
|
-
elements.push.apply(elements, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(results), false));
|
|
44
|
-
break;
|
|
45
|
-
case 'Table':
|
|
46
|
-
if (isExpectedBlockType(block, type, filter)) {
|
|
47
|
-
elements.push(block);
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
for (var _c = (e_1 = void 0, (0, tslib_1.__values)(block.rows)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
51
|
-
var row = _d.value;
|
|
52
|
-
try {
|
|
53
|
-
for (var _e = (e_2 = void 0, (0, tslib_1.__values)(row.cells)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
54
|
-
var cell = _f.value;
|
|
55
|
-
var results_2 = queryContentModelBlocks(cell, type, filter, findFirstOnly, shouldExpandEntity);
|
|
56
|
-
elements.push.apply(elements, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(results_2), false));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
60
|
-
finally {
|
|
61
|
-
try {
|
|
62
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
63
|
-
}
|
|
64
|
-
finally { if (e_2) throw e_2.error; }
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
69
|
-
finally {
|
|
70
|
-
try {
|
|
71
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
72
|
-
}
|
|
73
|
-
finally { if (e_1) throw e_1.error; }
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return elements;
|
|
79
|
-
}
|
|
80
|
-
exports.queryContentModelBlocks = queryContentModelBlocks;
|
|
81
|
-
function isExpectedBlockType(block, type, filter) {
|
|
82
|
-
return isBlockType(block, type) && (!filter || filter(block));
|
|
83
|
-
}
|
|
84
|
-
function isBlockType(block, type) {
|
|
85
|
-
return block.blockType == type;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.queryContentModelBlocks = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Query content model blocks
|
|
7
|
+
* @param group The block group to query
|
|
8
|
+
* @param type The type of block to query
|
|
9
|
+
* @param filter Optional selector to filter the blocks
|
|
10
|
+
* @param findFirstOnly True to return the first block only, false to return all blocks
|
|
11
|
+
* @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not
|
|
12
|
+
*/
|
|
13
|
+
function queryContentModelBlocks(group, type, filter, findFirstOnly, shouldExpandEntity) {
|
|
14
|
+
var e_1, _a, e_2, _b;
|
|
15
|
+
var elements = [];
|
|
16
|
+
for (var i = 0; i < group.blocks.length; i++) {
|
|
17
|
+
if (findFirstOnly && elements.length > 0) {
|
|
18
|
+
return elements;
|
|
19
|
+
}
|
|
20
|
+
var block = group.blocks[i];
|
|
21
|
+
switch (block.blockType) {
|
|
22
|
+
case 'Paragraph':
|
|
23
|
+
case 'Divider':
|
|
24
|
+
case 'Entity':
|
|
25
|
+
if (isExpectedBlockType(block, type, filter)) {
|
|
26
|
+
elements.push(block);
|
|
27
|
+
}
|
|
28
|
+
if (block.blockType == 'Entity' && shouldExpandEntity) {
|
|
29
|
+
var editorContext = shouldExpandEntity(block);
|
|
30
|
+
if (editorContext) {
|
|
31
|
+
var context = (0, roosterjs_content_model_dom_1.createDomToModelContext)(editorContext);
|
|
32
|
+
var model = (0, roosterjs_content_model_dom_1.domToContentModel)(block.wrapper, context);
|
|
33
|
+
var results_1 = queryContentModelBlocks(model, type, filter, findFirstOnly, shouldExpandEntity);
|
|
34
|
+
elements.push.apply(elements, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(results_1), false));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
case 'BlockGroup':
|
|
39
|
+
if (isExpectedBlockType(block, type, filter)) {
|
|
40
|
+
elements.push(block);
|
|
41
|
+
}
|
|
42
|
+
var results = queryContentModelBlocks(block, type, filter, findFirstOnly, shouldExpandEntity);
|
|
43
|
+
elements.push.apply(elements, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(results), false));
|
|
44
|
+
break;
|
|
45
|
+
case 'Table':
|
|
46
|
+
if (isExpectedBlockType(block, type, filter)) {
|
|
47
|
+
elements.push(block);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
for (var _c = (e_1 = void 0, (0, tslib_1.__values)(block.rows)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
51
|
+
var row = _d.value;
|
|
52
|
+
try {
|
|
53
|
+
for (var _e = (e_2 = void 0, (0, tslib_1.__values)(row.cells)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
54
|
+
var cell = _f.value;
|
|
55
|
+
var results_2 = queryContentModelBlocks(cell, type, filter, findFirstOnly, shouldExpandEntity);
|
|
56
|
+
elements.push.apply(elements, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(results_2), false));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
60
|
+
finally {
|
|
61
|
+
try {
|
|
62
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
63
|
+
}
|
|
64
|
+
finally { if (e_2) throw e_2.error; }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
69
|
+
finally {
|
|
70
|
+
try {
|
|
71
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
72
|
+
}
|
|
73
|
+
finally { if (e_1) throw e_1.error; }
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return elements;
|
|
79
|
+
}
|
|
80
|
+
exports.queryContentModelBlocks = queryContentModelBlocks;
|
|
81
|
+
function isExpectedBlockType(block, type, filter) {
|
|
82
|
+
return isBlockType(block, type) && (!filter || filter(block));
|
|
83
|
+
}
|
|
84
|
+
function isBlockType(block, type) {
|
|
85
|
+
return block.blockType == type;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
88
|
//# sourceMappingURL=queryContentModelBlocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryContentModelBlocks.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/queryContentModelBlocks.ts"],"names":[],"mappings":"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","sourcesContent":["import { createDomToModelContext, domToContentModel } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockType,\n ContentModelEntity,\n EditorContext,\n ReadonlyContentModelBlock,\n ReadonlyContentModelBlockBase,\n ReadonlyContentModelBlockGroup,\n} from 'roosterjs-content-model-types';\n\n/**\n * Query content model blocks\n * @param group The block group to query\n * @param type The type of block to query\n * @param filter Optional selector to filter the blocks\n * @param findFirstOnly True to return the first block only, false to return all blocks\n * @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not\n */\nexport function queryContentModelBlocks<T extends ReadonlyContentModelBlock>(\n group: ReadonlyContentModelBlockGroup,\n type: T extends ReadonlyContentModelBlockBase<infer U> ? U : never,\n filter?: (element: T) => element is T,\n findFirstOnly?: boolean,\n shouldExpandEntity?: (entity: ContentModelEntity) => EditorContext | null\n): T[] {\n const elements: T[] = [];\n for (let i = 0; i < group.blocks.length; i++) {\n if (findFirstOnly && elements.length > 0) {\n return elements;\n }\n const block = group.blocks[i];\n\n switch (block.blockType) {\n case 'Paragraph':\n case 'Divider':\n case 'Entity':\n if (isExpectedBlockType(block, type, filter)) {\n elements.push(block);\n }\n if (block.blockType == 'Entity' && shouldExpandEntity) {\n const editorContext = shouldExpandEntity(block);\n if (editorContext) {\n const context = createDomToModelContext(editorContext);\n const model = domToContentModel(block.wrapper, context);\n const results = queryContentModelBlocks<T>(\n model,\n type,\n filter,\n findFirstOnly,\n shouldExpandEntity\n );\n elements.push(...results);\n }\n }\n break;\n case 'BlockGroup':\n if (isExpectedBlockType(block, type, filter)) {\n elements.push(block);\n }\n const results = queryContentModelBlocks<T>(\n block,\n type,\n filter,\n findFirstOnly,\n shouldExpandEntity\n );\n elements.push(...results);\n break;\n case 'Table':\n if (isExpectedBlockType(block, type, filter)) {\n elements.push(block);\n }\n for (const row of block.rows) {\n for (const cell of row.cells) {\n const results = queryContentModelBlocks<T>(\n cell,\n type,\n filter,\n findFirstOnly,\n shouldExpandEntity\n );\n elements.push(...results);\n }\n }\n break;\n }\n }\n return elements;\n}\n\nfunction isExpectedBlockType<T extends ReadonlyContentModelBlock>(\n block: ReadonlyContentModelBlock,\n type: ContentModelBlockType,\n filter?: (element: T) => element is T\n): block is T {\n return isBlockType<T>(block, type) && (!filter || filter(block));\n}\n\nfunction isBlockType<T extends ReadonlyContentModelBlock>(\n block: ReadonlyContentModelBlock,\n type: ContentModelBlockType\n): block is T {\n return block.blockType == type;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"queryContentModelBlocks.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/queryContentModelBlocks.ts"],"names":[],"mappings":"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","sourcesContent":["import { createDomToModelContext, domToContentModel } from 'roosterjs-content-model-dom';\r\nimport type {\r\n ContentModelBlockType,\r\n ContentModelEntity,\r\n EditorContext,\r\n ReadonlyContentModelBlock,\r\n ReadonlyContentModelBlockBase,\r\n ReadonlyContentModelBlockGroup,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Query content model blocks\r\n * @param group The block group to query\r\n * @param type The type of block to query\r\n * @param filter Optional selector to filter the blocks\r\n * @param findFirstOnly True to return the first block only, false to return all blocks\r\n * @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not\r\n */\r\nexport function queryContentModelBlocks<T extends ReadonlyContentModelBlock>(\r\n group: ReadonlyContentModelBlockGroup,\r\n type: T extends ReadonlyContentModelBlockBase<infer U> ? U : never,\r\n filter?: (element: T) => element is T,\r\n findFirstOnly?: boolean,\r\n shouldExpandEntity?: (entity: ContentModelEntity) => EditorContext | null\r\n): T[] {\r\n const elements: T[] = [];\r\n for (let i = 0; i < group.blocks.length; i++) {\r\n if (findFirstOnly && elements.length > 0) {\r\n return elements;\r\n }\r\n const block = group.blocks[i];\r\n\r\n switch (block.blockType) {\r\n case 'Paragraph':\r\n case 'Divider':\r\n case 'Entity':\r\n if (isExpectedBlockType(block, type, filter)) {\r\n elements.push(block);\r\n }\r\n if (block.blockType == 'Entity' && shouldExpandEntity) {\r\n const editorContext = shouldExpandEntity(block);\r\n if (editorContext) {\r\n const context = createDomToModelContext(editorContext);\r\n const model = domToContentModel(block.wrapper, context);\r\n const results = queryContentModelBlocks<T>(\r\n model,\r\n type,\r\n filter,\r\n findFirstOnly,\r\n shouldExpandEntity\r\n );\r\n elements.push(...results);\r\n }\r\n }\r\n break;\r\n case 'BlockGroup':\r\n if (isExpectedBlockType(block, type, filter)) {\r\n elements.push(block);\r\n }\r\n const results = queryContentModelBlocks<T>(\r\n block,\r\n type,\r\n filter,\r\n findFirstOnly,\r\n shouldExpandEntity\r\n );\r\n elements.push(...results);\r\n break;\r\n case 'Table':\r\n if (isExpectedBlockType(block, type, filter)) {\r\n elements.push(block);\r\n }\r\n for (const row of block.rows) {\r\n for (const cell of row.cells) {\r\n const results = queryContentModelBlocks<T>(\r\n cell,\r\n type,\r\n filter,\r\n findFirstOnly,\r\n shouldExpandEntity\r\n );\r\n elements.push(...results);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return elements;\r\n}\r\n\r\nfunction isExpectedBlockType<T extends ReadonlyContentModelBlock>(\r\n block: ReadonlyContentModelBlock,\r\n type: ContentModelBlockType,\r\n filter?: (element: T) => element is T\r\n): block is T {\r\n return isBlockType<T>(block, type) && (!filter || filter(block));\r\n}\r\n\r\nfunction isBlockType<T extends ReadonlyContentModelBlock>(\r\n block: ReadonlyContentModelBlock,\r\n type: ContentModelBlockType\r\n): block is T {\r\n return block.blockType == type;\r\n}\r\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { ContentModelBlockGroup, DomToModelContext } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
interface FormatStateContext extends DomToModelContext {
|
|
6
|
-
/**
|
|
7
|
-
* An optional stack of parent elements to process. When provided, the child nodes of current parent element will be ignored,
|
|
8
|
-
* but use the top element in this stack instead in childProcessor.
|
|
9
|
-
*/
|
|
10
|
-
nodeStack?: Node[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
* In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create
|
|
15
|
-
* content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.
|
|
16
|
-
* This "reduced" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,
|
|
17
|
-
* then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state
|
|
18
|
-
*/
|
|
19
|
-
export declare function reducedModelChildProcessor(group: ContentModelBlockGroup, parent: ParentNode, context: FormatStateContext): void;
|
|
20
|
-
export {};
|
|
1
|
+
import type { ContentModelBlockGroup, DomToModelContext } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
interface FormatStateContext extends DomToModelContext {
|
|
6
|
+
/**
|
|
7
|
+
* An optional stack of parent elements to process. When provided, the child nodes of current parent element will be ignored,
|
|
8
|
+
* but use the top element in this stack instead in childProcessor.
|
|
9
|
+
*/
|
|
10
|
+
nodeStack?: Node[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create
|
|
15
|
+
* content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.
|
|
16
|
+
* This "reduced" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,
|
|
17
|
+
* then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state
|
|
18
|
+
*/
|
|
19
|
+
export declare function reducedModelChildProcessor(group: ContentModelBlockGroup, parent: ParentNode, context: FormatStateContext): void;
|
|
20
|
+
export {};
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.reducedModelChildProcessor = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create
|
|
8
|
-
* content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.
|
|
9
|
-
* This "reduced" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,
|
|
10
|
-
* then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state
|
|
11
|
-
*/
|
|
12
|
-
function reducedModelChildProcessor(group, parent, context) {
|
|
13
|
-
if (!context.nodeStack) {
|
|
14
|
-
var selectionRootNode = (0, roosterjs_content_model_dom_1.getSelectionRootNode)(context.selection);
|
|
15
|
-
context.nodeStack = selectionRootNode ? createNodeStack(parent, selectionRootNode) : [];
|
|
16
|
-
}
|
|
17
|
-
var stackChild = context.nodeStack.pop();
|
|
18
|
-
if (stackChild) {
|
|
19
|
-
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getRegularSelectionOffsets)(context, parent), 2), nodeStartOffset = _a[0], nodeEndOffset = _a[1];
|
|
20
|
-
// If selection is not on this node, skip getting node index to save some time since we don't need it here
|
|
21
|
-
var index = nodeStartOffset >= 0 || nodeEndOffset >= 0 ? getChildIndex(parent, stackChild) : -1;
|
|
22
|
-
if (index >= 0) {
|
|
23
|
-
(0, roosterjs_content_model_dom_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
|
|
24
|
-
}
|
|
25
|
-
(0, roosterjs_content_model_dom_1.processChildNode)(group, stackChild, context);
|
|
26
|
-
if (index >= 0) {
|
|
27
|
-
(0, roosterjs_content_model_dom_1.handleRegularSelection)(index + 1, context, group, nodeStartOffset, nodeEndOffset);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// No child node from node stack, that means we have reached the deepest node of selection.
|
|
32
|
-
// Now we can use default child processor to perform full sub tree scanning for content model,
|
|
33
|
-
// So that all selected node will be included.
|
|
34
|
-
context.defaultElementProcessors.child(group, parent, context);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.reducedModelChildProcessor = reducedModelChildProcessor;
|
|
38
|
-
function createNodeStack(root, startNode) {
|
|
39
|
-
var result = [];
|
|
40
|
-
var node = startNode;
|
|
41
|
-
while (node && root != node && root.contains(node)) {
|
|
42
|
-
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(node, 'ELEMENT_NODE') && node.tagName == 'TABLE') {
|
|
43
|
-
// For table, we can't do a reduced model creation since we need to handle their cells and indexes,
|
|
44
|
-
// so clean up whatever we already have, and just put table into the stack
|
|
45
|
-
result.splice(0, result.length, node);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
result.push(node);
|
|
49
|
-
}
|
|
50
|
-
node = node.parentNode;
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
function getChildIndex(parent, stackChild) {
|
|
55
|
-
var index = 0;
|
|
56
|
-
var child = parent.firstChild;
|
|
57
|
-
while (child && child != stackChild) {
|
|
58
|
-
index++;
|
|
59
|
-
child = child.nextSibling;
|
|
60
|
-
}
|
|
61
|
-
return index;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.reducedModelChildProcessor = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create
|
|
8
|
+
* content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.
|
|
9
|
+
* This "reduced" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,
|
|
10
|
+
* then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state
|
|
11
|
+
*/
|
|
12
|
+
function reducedModelChildProcessor(group, parent, context) {
|
|
13
|
+
if (!context.nodeStack) {
|
|
14
|
+
var selectionRootNode = (0, roosterjs_content_model_dom_1.getSelectionRootNode)(context.selection);
|
|
15
|
+
context.nodeStack = selectionRootNode ? createNodeStack(parent, selectionRootNode) : [];
|
|
16
|
+
}
|
|
17
|
+
var stackChild = context.nodeStack.pop();
|
|
18
|
+
if (stackChild) {
|
|
19
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getRegularSelectionOffsets)(context, parent), 2), nodeStartOffset = _a[0], nodeEndOffset = _a[1];
|
|
20
|
+
// If selection is not on this node, skip getting node index to save some time since we don't need it here
|
|
21
|
+
var index = nodeStartOffset >= 0 || nodeEndOffset >= 0 ? getChildIndex(parent, stackChild) : -1;
|
|
22
|
+
if (index >= 0) {
|
|
23
|
+
(0, roosterjs_content_model_dom_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
|
|
24
|
+
}
|
|
25
|
+
(0, roosterjs_content_model_dom_1.processChildNode)(group, stackChild, context);
|
|
26
|
+
if (index >= 0) {
|
|
27
|
+
(0, roosterjs_content_model_dom_1.handleRegularSelection)(index + 1, context, group, nodeStartOffset, nodeEndOffset);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// No child node from node stack, that means we have reached the deepest node of selection.
|
|
32
|
+
// Now we can use default child processor to perform full sub tree scanning for content model,
|
|
33
|
+
// So that all selected node will be included.
|
|
34
|
+
context.defaultElementProcessors.child(group, parent, context);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.reducedModelChildProcessor = reducedModelChildProcessor;
|
|
38
|
+
function createNodeStack(root, startNode) {
|
|
39
|
+
var result = [];
|
|
40
|
+
var node = startNode;
|
|
41
|
+
while (node && root != node && root.contains(node)) {
|
|
42
|
+
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(node, 'ELEMENT_NODE') && node.tagName == 'TABLE') {
|
|
43
|
+
// For table, we can't do a reduced model creation since we need to handle their cells and indexes,
|
|
44
|
+
// so clean up whatever we already have, and just put table into the stack
|
|
45
|
+
result.splice(0, result.length, node);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
result.push(node);
|
|
49
|
+
}
|
|
50
|
+
node = node.parentNode;
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function getChildIndex(parent, stackChild) {
|
|
55
|
+
var index = 0;
|
|
56
|
+
var child = parent.firstChild;
|
|
57
|
+
while (child && child != stackChild) {
|
|
58
|
+
index++;
|
|
59
|
+
child = child.nextSibling;
|
|
60
|
+
}
|
|
61
|
+
return index;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
64
|
//# sourceMappingURL=reducedModelChildProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducedModelChildProcessor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/reducedModelChildProcessor.ts"],"names":[],"mappings":";;;;IAoBA;;;;;;OAMG;IACH,SAAgB,0BAA0B,CACtC,KAA6B,EAC7B,MAAkB,EAClB,OAA2B;QAE3B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACpB,IAAM,iBAAiB,GAAG,IAAA,kDAAoB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAClE,OAAO,CAAC,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3F;QAED,IAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAE3C,IAAI,UAAU,EAAE;YACN,IAAA,KAAA,oBAAmC,IAAA,wDAA0B,EAAC,OAAO,EAAE,MAAM,CAAC,IAAA,EAA7E,eAAe,QAAA,EAAE,aAAa,QAA+C,CAAC;YAErF,0GAA0G;YAC1G,IAAM,KAAK,GACP,eAAe,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAExF,IAAI,KAAK,IAAI,CAAC,EAAE;gBACZ,IAAA,oDAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;aACjF;YAED,IAAA,8CAAgB,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAE7C,IAAI,KAAK,IAAI,CAAC,EAAE;gBACZ,IAAA,oDAAsB,EAAC,KAAK,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;aACrF;SACJ;aAAM;YACH,2FAA2F;YAC3F,8FAA8F;YAC9F,8CAA8C;YAC9C,OAAO,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SAClE;IACL,CAAC;IAlCD,gEAkCC;IAED,SAAS,eAAe,CAAC,IAAU,EAAE,SAAe;QAChD,IAAM,MAAM,GAAW,EAAE,CAAC;QAC1B,IAAI,IAAI,GAAgB,SAAS,CAAC;QAElC,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAChD,IAAI,IAAA,0CAAY,EAAC,IAAI,EAAE,cAAc,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE;gBAC/D,mGAAmG;gBACnG,0EAA0E;gBAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACzC;iBAAM;gBACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACrB;YAED,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;SAC1B;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,SAAS,aAAa,CAAC,MAAkB,EAAE,UAAgB;QACvD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;QAE9B,OAAO,KAAK,IAAI,KAAK,IAAI,UAAU,EAAE;YACjC,KAAK,EAAE,CAAC;YACR,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;SAC7B;QACD,OAAO,KAAK,CAAC;IACjB,CAAC","sourcesContent":["import {\n getRegularSelectionOffsets,\n getSelectionRootNode,\n handleRegularSelection,\n isNodeOfType,\n processChildNode,\n} from 'roosterjs-content-model-dom';\nimport type { ContentModelBlockGroup, DomToModelContext } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\ninterface FormatStateContext extends DomToModelContext {\n /**\n * An optional stack of parent elements to process. When provided, the child nodes of current parent element will be ignored,\n * but use the top element in this stack instead in childProcessor.\n */\n nodeStack?: Node[];\n}\n\n/**\n * @internal\n * In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create\n * content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.\n * This \"reduced\" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,\n * then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state\n */\nexport function reducedModelChildProcessor(\n group: ContentModelBlockGroup,\n parent: ParentNode,\n context: FormatStateContext\n) {\n if (!context.nodeStack) {\n const selectionRootNode = getSelectionRootNode(context.selection);\n context.nodeStack = selectionRootNode ? createNodeStack(parent, selectionRootNode) : [];\n }\n\n const stackChild = context.nodeStack.pop();\n\n if (stackChild) {\n const [nodeStartOffset, nodeEndOffset] = getRegularSelectionOffsets(context, parent);\n\n // If selection is not on this node, skip getting node index to save some time since we don't need it here\n const index =\n nodeStartOffset >= 0 || nodeEndOffset >= 0 ? getChildIndex(parent, stackChild) : -1;\n\n if (index >= 0) {\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n }\n\n processChildNode(group, stackChild, context);\n\n if (index >= 0) {\n handleRegularSelection(index + 1, context, group, nodeStartOffset, nodeEndOffset);\n }\n } else {\n // No child node from node stack, that means we have reached the deepest node of selection.\n // Now we can use default child processor to perform full sub tree scanning for content model,\n // So that all selected node will be included.\n context.defaultElementProcessors.child(group, parent, context);\n }\n}\n\nfunction createNodeStack(root: Node, startNode: Node): Node[] {\n const result: Node[] = [];\n let node: Node | null = startNode;\n\n while (node && root != node && root.contains(node)) {\n if (isNodeOfType(node, 'ELEMENT_NODE') && node.tagName == 'TABLE') {\n // For table, we can't do a reduced model creation since we need to handle their cells and indexes,\n // so clean up whatever we already have, and just put table into the stack\n result.splice(0, result.length, node);\n } else {\n result.push(node);\n }\n\n node = node.parentNode;\n }\n\n return result;\n}\n\nfunction getChildIndex(parent: ParentNode, stackChild: Node) {\n let index = 0;\n let child = parent.firstChild;\n\n while (child && child != stackChild) {\n index++;\n child = child.nextSibling;\n }\n return index;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reducedModelChildProcessor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/reducedModelChildProcessor.ts"],"names":[],"mappings":";;;;IAoBA;;;;;;OAMG;IACH,SAAgB,0BAA0B,CACtC,KAA6B,EAC7B,MAAkB,EAClB,OAA2B;QAE3B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACpB,IAAM,iBAAiB,GAAG,IAAA,kDAAoB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAClE,OAAO,CAAC,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3F;QAED,IAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAE3C,IAAI,UAAU,EAAE;YACN,IAAA,KAAA,oBAAmC,IAAA,wDAA0B,EAAC,OAAO,EAAE,MAAM,CAAC,IAAA,EAA7E,eAAe,QAAA,EAAE,aAAa,QAA+C,CAAC;YAErF,0GAA0G;YAC1G,IAAM,KAAK,GACP,eAAe,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAExF,IAAI,KAAK,IAAI,CAAC,EAAE;gBACZ,IAAA,oDAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;aACjF;YAED,IAAA,8CAAgB,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAE7C,IAAI,KAAK,IAAI,CAAC,EAAE;gBACZ,IAAA,oDAAsB,EAAC,KAAK,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;aACrF;SACJ;aAAM;YACH,2FAA2F;YAC3F,8FAA8F;YAC9F,8CAA8C;YAC9C,OAAO,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SAClE;IACL,CAAC;IAlCD,gEAkCC;IAED,SAAS,eAAe,CAAC,IAAU,EAAE,SAAe;QAChD,IAAM,MAAM,GAAW,EAAE,CAAC;QAC1B,IAAI,IAAI,GAAgB,SAAS,CAAC;QAElC,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAChD,IAAI,IAAA,0CAAY,EAAC,IAAI,EAAE,cAAc,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE;gBAC/D,mGAAmG;gBACnG,0EAA0E;gBAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACzC;iBAAM;gBACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACrB;YAED,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;SAC1B;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,SAAS,aAAa,CAAC,MAAkB,EAAE,UAAgB;QACvD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;QAE9B,OAAO,KAAK,IAAI,KAAK,IAAI,UAAU,EAAE;YACjC,KAAK,EAAE,CAAC;YACR,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;SAC7B;QACD,OAAO,KAAK,CAAC;IACjB,CAAC","sourcesContent":["import {\r\n getRegularSelectionOffsets,\r\n getSelectionRootNode,\r\n handleRegularSelection,\r\n isNodeOfType,\r\n processChildNode,\r\n} from 'roosterjs-content-model-dom';\r\nimport type { ContentModelBlockGroup, DomToModelContext } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface FormatStateContext extends DomToModelContext {\r\n /**\r\n * An optional stack of parent elements to process. When provided, the child nodes of current parent element will be ignored,\r\n * but use the top element in this stack instead in childProcessor.\r\n */\r\n nodeStack?: Node[];\r\n}\r\n\r\n/**\r\n * @internal\r\n * In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create\r\n * content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.\r\n * This \"reduced\" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,\r\n * then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state\r\n */\r\nexport function reducedModelChildProcessor(\r\n group: ContentModelBlockGroup,\r\n parent: ParentNode,\r\n context: FormatStateContext\r\n) {\r\n if (!context.nodeStack) {\r\n const selectionRootNode = getSelectionRootNode(context.selection);\r\n context.nodeStack = selectionRootNode ? createNodeStack(parent, selectionRootNode) : [];\r\n }\r\n\r\n const stackChild = context.nodeStack.pop();\r\n\r\n if (stackChild) {\r\n const [nodeStartOffset, nodeEndOffset] = getRegularSelectionOffsets(context, parent);\r\n\r\n // If selection is not on this node, skip getting node index to save some time since we don't need it here\r\n const index =\r\n nodeStartOffset >= 0 || nodeEndOffset >= 0 ? getChildIndex(parent, stackChild) : -1;\r\n\r\n if (index >= 0) {\r\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\r\n }\r\n\r\n processChildNode(group, stackChild, context);\r\n\r\n if (index >= 0) {\r\n handleRegularSelection(index + 1, context, group, nodeStartOffset, nodeEndOffset);\r\n }\r\n } else {\r\n // No child node from node stack, that means we have reached the deepest node of selection.\r\n // Now we can use default child processor to perform full sub tree scanning for content model,\r\n // So that all selected node will be included.\r\n context.defaultElementProcessors.child(group, parent, context);\r\n }\r\n}\r\n\r\nfunction createNodeStack(root: Node, startNode: Node): Node[] {\r\n const result: Node[] = [];\r\n let node: Node | null = startNode;\r\n\r\n while (node && root != node && root.contains(node)) {\r\n if (isNodeOfType(node, 'ELEMENT_NODE') && node.tagName == 'TABLE') {\r\n // For table, we can't do a reduced model creation since we need to handle their cells and indexes,\r\n // so clean up whatever we already have, and just put table into the stack\r\n result.splice(0, result.length, node);\r\n } else {\r\n result.push(node);\r\n }\r\n\r\n node = node.parentNode;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction getChildIndex(parent: ParentNode, stackChild: Node) {\r\n let index = 0;\r\n let child = parent.firstChild;\r\n\r\n while (child && child != stackChild) {\r\n index++;\r\n child = child.nextSibling;\r\n }\r\n return index;\r\n}\r\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { ContentModelBlock, ContentModelBlockGroup, ReadonlyContentModelBlock, ReadonlyContentModelBlockGroup, ShallowMutableContentModelBlock } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export interface WrapBlockStep1Result<T extends ContentModelBlockGroup & ContentModelBlock> {
|
|
6
|
-
parent: ReadonlyContentModelBlockGroup;
|
|
7
|
-
wrapper: T;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare function wrapBlockStep1<T extends ContentModelBlockGroup & ContentModelBlock>(step1Result: WrapBlockStep1Result<T>[], readonlyParent: ReadonlyContentModelBlockGroup | null, readonlyBlockToWrap: ReadonlyContentModelBlock, creator: (isRtl: boolean) => T, canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock) => target is T): void;
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare function wrapBlockStep2<T extends ContentModelBlockGroup & ContentModelBlock>(step1Result: WrapBlockStep1Result<T>[], canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock, current: T) => target is T): void;
|
|
1
|
+
import type { ContentModelBlock, ContentModelBlockGroup, ReadonlyContentModelBlock, ReadonlyContentModelBlockGroup, ShallowMutableContentModelBlock } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface WrapBlockStep1Result<T extends ContentModelBlockGroup & ContentModelBlock> {
|
|
6
|
+
parent: ReadonlyContentModelBlockGroup;
|
|
7
|
+
wrapper: T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function wrapBlockStep1<T extends ContentModelBlockGroup & ContentModelBlock>(step1Result: WrapBlockStep1Result<T>[], readonlyParent: ReadonlyContentModelBlockGroup | null, readonlyBlockToWrap: ReadonlyContentModelBlock, creator: (isRtl: boolean) => T, canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock) => target is T): void;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function wrapBlockStep2<T extends ContentModelBlockGroup & ContentModelBlock>(step1Result: WrapBlockStep1Result<T>[], canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock, current: T) => target is T): void;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.wrapBlockStep2 = exports.wrapBlockStep1 = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
function wrapBlockStep1(step1Result, readonlyParent, readonlyBlockToWrap, creator, canMerge) {
|
|
9
|
-
var _a;
|
|
10
|
-
var parent = readonlyParent ? (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyParent) : null;
|
|
11
|
-
var blockToWrap = (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyBlockToWrap);
|
|
12
|
-
var index = (_a = parent === null || parent === void 0 ? void 0 : parent.blocks.indexOf(blockToWrap)) !== null && _a !== void 0 ? _a : -1;
|
|
13
|
-
if (parent && index >= 0) {
|
|
14
|
-
parent.blocks.splice(index, 1);
|
|
15
|
-
var readonlyPrevBlock = parent.blocks[index - 1];
|
|
16
|
-
var prevBlock = readonlyPrevBlock ? (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyPrevBlock) : null;
|
|
17
|
-
var isRtl = blockToWrap.format.direction == 'rtl';
|
|
18
|
-
var wrapper = prevBlock && canMerge(isRtl, prevBlock)
|
|
19
|
-
? prevBlock
|
|
20
|
-
: createAndAdd(parent, index, creator, isRtl);
|
|
21
|
-
(0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(blockToWrap);
|
|
22
|
-
(0, roosterjs_content_model_dom_1.addBlock)(wrapper, blockToWrap);
|
|
23
|
-
// Use reverse order, so that we can merge from last to first to avoid modifying unmerged quotes
|
|
24
|
-
step1Result.unshift({ parent: parent, wrapper: wrapper });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.wrapBlockStep1 = wrapBlockStep1;
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
function wrapBlockStep2(step1Result, canMerge) {
|
|
32
|
-
step1Result.forEach(function (_a) {
|
|
33
|
-
var _b;
|
|
34
|
-
var parent = _a.parent, wrapper = _a.wrapper;
|
|
35
|
-
var index = parent.blocks.indexOf(wrapper);
|
|
36
|
-
var readonlyNextBlock = parent.blocks[index + 1];
|
|
37
|
-
var nextBlock = readonlyNextBlock ? (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyNextBlock) : null;
|
|
38
|
-
var isRtl = wrapper.format.direction == 'rtl';
|
|
39
|
-
if (index >= 0 && nextBlock && canMerge(isRtl, nextBlock, wrapper)) {
|
|
40
|
-
wrapper.blocks.forEach(roosterjs_content_model_dom_1.setParagraphNotImplicit);
|
|
41
|
-
(_b = wrapper.blocks).push.apply(_b, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(nextBlock.blocks), false));
|
|
42
|
-
(0, roosterjs_content_model_dom_1.mutateBlock)(parent).blocks.splice(index + 1, 1);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
exports.wrapBlockStep2 = wrapBlockStep2;
|
|
47
|
-
function createAndAdd(parent, index, creator, isRtl) {
|
|
48
|
-
var block = creator(isRtl);
|
|
49
|
-
(0, roosterjs_content_model_dom_1.mutateBlock)(parent).blocks.splice(index, 0, block);
|
|
50
|
-
return block;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.wrapBlockStep2 = exports.wrapBlockStep1 = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function wrapBlockStep1(step1Result, readonlyParent, readonlyBlockToWrap, creator, canMerge) {
|
|
9
|
+
var _a;
|
|
10
|
+
var parent = readonlyParent ? (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyParent) : null;
|
|
11
|
+
var blockToWrap = (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyBlockToWrap);
|
|
12
|
+
var index = (_a = parent === null || parent === void 0 ? void 0 : parent.blocks.indexOf(blockToWrap)) !== null && _a !== void 0 ? _a : -1;
|
|
13
|
+
if (parent && index >= 0) {
|
|
14
|
+
parent.blocks.splice(index, 1);
|
|
15
|
+
var readonlyPrevBlock = parent.blocks[index - 1];
|
|
16
|
+
var prevBlock = readonlyPrevBlock ? (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyPrevBlock) : null;
|
|
17
|
+
var isRtl = blockToWrap.format.direction == 'rtl';
|
|
18
|
+
var wrapper = prevBlock && canMerge(isRtl, prevBlock)
|
|
19
|
+
? prevBlock
|
|
20
|
+
: createAndAdd(parent, index, creator, isRtl);
|
|
21
|
+
(0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(blockToWrap);
|
|
22
|
+
(0, roosterjs_content_model_dom_1.addBlock)(wrapper, blockToWrap);
|
|
23
|
+
// Use reverse order, so that we can merge from last to first to avoid modifying unmerged quotes
|
|
24
|
+
step1Result.unshift({ parent: parent, wrapper: wrapper });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.wrapBlockStep1 = wrapBlockStep1;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
function wrapBlockStep2(step1Result, canMerge) {
|
|
32
|
+
step1Result.forEach(function (_a) {
|
|
33
|
+
var _b;
|
|
34
|
+
var parent = _a.parent, wrapper = _a.wrapper;
|
|
35
|
+
var index = parent.blocks.indexOf(wrapper);
|
|
36
|
+
var readonlyNextBlock = parent.blocks[index + 1];
|
|
37
|
+
var nextBlock = readonlyNextBlock ? (0, roosterjs_content_model_dom_1.mutateBlock)(readonlyNextBlock) : null;
|
|
38
|
+
var isRtl = wrapper.format.direction == 'rtl';
|
|
39
|
+
if (index >= 0 && nextBlock && canMerge(isRtl, nextBlock, wrapper)) {
|
|
40
|
+
wrapper.blocks.forEach(roosterjs_content_model_dom_1.setParagraphNotImplicit);
|
|
41
|
+
(_b = wrapper.blocks).push.apply(_b, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(nextBlock.blocks), false));
|
|
42
|
+
(0, roosterjs_content_model_dom_1.mutateBlock)(parent).blocks.splice(index + 1, 1);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.wrapBlockStep2 = wrapBlockStep2;
|
|
47
|
+
function createAndAdd(parent, index, creator, isRtl) {
|
|
48
|
+
var block = creator(isRtl);
|
|
49
|
+
(0, roosterjs_content_model_dom_1.mutateBlock)(parent).blocks.splice(index, 0, block);
|
|
50
|
+
return block;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
53
|
//# sourceMappingURL=wrapBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapBlock.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/wrapBlock.ts"],"names":[],"mappings":"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","sourcesContent":["import { addBlock, mutateBlock, setParagraphNotImplicit } from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ReadonlyContentModelBlock,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelBlock,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport interface WrapBlockStep1Result<T extends ContentModelBlockGroup & ContentModelBlock> {\n parent: ReadonlyContentModelBlockGroup;\n wrapper: T;\n}\n\n/**\n * @internal\n */\nexport function wrapBlockStep1<T extends ContentModelBlockGroup & ContentModelBlock>(\n step1Result: WrapBlockStep1Result<T>[],\n readonlyParent: ReadonlyContentModelBlockGroup | null,\n readonlyBlockToWrap: ReadonlyContentModelBlock,\n creator: (isRtl: boolean) => T,\n canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock) => target is T\n) {\n const parent = readonlyParent ? mutateBlock(readonlyParent) : null;\n const blockToWrap = mutateBlock(readonlyBlockToWrap);\n const index = parent?.blocks.indexOf(blockToWrap) ?? -1;\n\n if (parent && index >= 0) {\n parent.blocks.splice(index, 1);\n\n const readonlyPrevBlock: ReadonlyContentModelBlock = parent.blocks[index - 1];\n const prevBlock = readonlyPrevBlock ? mutateBlock(readonlyPrevBlock) : null;\n const isRtl = blockToWrap.format.direction == 'rtl';\n const wrapper =\n prevBlock && canMerge(isRtl, prevBlock)\n ? prevBlock\n : createAndAdd(parent, index, creator, isRtl);\n\n setParagraphNotImplicit(blockToWrap);\n addBlock(wrapper, blockToWrap);\n\n // Use reverse order, so that we can merge from last to first to avoid modifying unmerged quotes\n step1Result.unshift({ parent, wrapper });\n }\n}\n\n/**\n * @internal\n */\nexport function wrapBlockStep2<T extends ContentModelBlockGroup & ContentModelBlock>(\n step1Result: WrapBlockStep1Result<T>[],\n canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock, current: T) => target is T\n) {\n step1Result.forEach(({ parent, wrapper }) => {\n const index = parent.blocks.indexOf(wrapper);\n const readonlyNextBlock = parent.blocks[index + 1];\n const nextBlock = readonlyNextBlock ? mutateBlock(readonlyNextBlock) : null;\n const isRtl = wrapper.format.direction == 'rtl';\n\n if (index >= 0 && nextBlock && canMerge(isRtl, nextBlock, wrapper)) {\n wrapper.blocks.forEach(setParagraphNotImplicit);\n wrapper.blocks.push(...nextBlock.blocks);\n mutateBlock(parent).blocks.splice(index + 1, 1);\n }\n });\n}\n\nfunction createAndAdd<T extends ContentModelBlockGroup & ContentModelBlock>(\n parent: ReadonlyContentModelBlockGroup,\n index: number,\n creator: (isRtl: boolean) => T,\n isRtl: boolean\n): T {\n const block = creator(isRtl);\n\n mutateBlock(parent).blocks.splice(index, 0, block);\n\n return block;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"wrapBlock.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/wrapBlock.ts"],"names":[],"mappings":"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","sourcesContent":["import { addBlock, mutateBlock, setParagraphNotImplicit } from 'roosterjs-content-model-dom';\r\nimport type {\r\n ContentModelBlock,\r\n ContentModelBlockGroup,\r\n ReadonlyContentModelBlock,\r\n ReadonlyContentModelBlockGroup,\r\n ShallowMutableContentModelBlock,\r\n} from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface WrapBlockStep1Result<T extends ContentModelBlockGroup & ContentModelBlock> {\r\n parent: ReadonlyContentModelBlockGroup;\r\n wrapper: T;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function wrapBlockStep1<T extends ContentModelBlockGroup & ContentModelBlock>(\r\n step1Result: WrapBlockStep1Result<T>[],\r\n readonlyParent: ReadonlyContentModelBlockGroup | null,\r\n readonlyBlockToWrap: ReadonlyContentModelBlock,\r\n creator: (isRtl: boolean) => T,\r\n canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock) => target is T\r\n) {\r\n const parent = readonlyParent ? mutateBlock(readonlyParent) : null;\r\n const blockToWrap = mutateBlock(readonlyBlockToWrap);\r\n const index = parent?.blocks.indexOf(blockToWrap) ?? -1;\r\n\r\n if (parent && index >= 0) {\r\n parent.blocks.splice(index, 1);\r\n\r\n const readonlyPrevBlock: ReadonlyContentModelBlock = parent.blocks[index - 1];\r\n const prevBlock = readonlyPrevBlock ? mutateBlock(readonlyPrevBlock) : null;\r\n const isRtl = blockToWrap.format.direction == 'rtl';\r\n const wrapper =\r\n prevBlock && canMerge(isRtl, prevBlock)\r\n ? prevBlock\r\n : createAndAdd(parent, index, creator, isRtl);\r\n\r\n setParagraphNotImplicit(blockToWrap);\r\n addBlock(wrapper, blockToWrap);\r\n\r\n // Use reverse order, so that we can merge from last to first to avoid modifying unmerged quotes\r\n step1Result.unshift({ parent, wrapper });\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function wrapBlockStep2<T extends ContentModelBlockGroup & ContentModelBlock>(\r\n step1Result: WrapBlockStep1Result<T>[],\r\n canMerge: (isRtl: boolean, target: ShallowMutableContentModelBlock, current: T) => target is T\r\n) {\r\n step1Result.forEach(({ parent, wrapper }) => {\r\n const index = parent.blocks.indexOf(wrapper);\r\n const readonlyNextBlock = parent.blocks[index + 1];\r\n const nextBlock = readonlyNextBlock ? mutateBlock(readonlyNextBlock) : null;\r\n const isRtl = wrapper.format.direction == 'rtl';\r\n\r\n if (index >= 0 && nextBlock && canMerge(isRtl, nextBlock, wrapper)) {\r\n wrapper.blocks.forEach(setParagraphNotImplicit);\r\n wrapper.blocks.push(...nextBlock.blocks);\r\n mutateBlock(parent).blocks.splice(index + 1, 1);\r\n }\r\n });\r\n}\r\n\r\nfunction createAndAdd<T extends ContentModelBlockGroup & ContentModelBlock>(\r\n parent: ReadonlyContentModelBlockGroup,\r\n index: number,\r\n creator: (isRtl: boolean) => T,\r\n isRtl: boolean\r\n): T {\r\n const block = creator(isRtl);\r\n\r\n mutateBlock(parent).blocks.splice(index, 0, block);\r\n\r\n return block;\r\n}\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContentModelEntity, FormatContentModelContext, InsertEntityPosition, InsertPoint, ReadonlyContentModelDocument } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare function insertEntityModel(model: ReadonlyContentModelDocument, entityModel: ContentModelEntity, position: InsertEntityPosition, isBlock: boolean, focusAfterEntity?: boolean, context?: FormatContentModelContext, insertPointOverride?: InsertPoint): void;
|
|
1
|
+
import type { ContentModelEntity, FormatContentModelContext, InsertEntityPosition, InsertPoint, ReadonlyContentModelDocument } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function insertEntityModel(model: ReadonlyContentModelDocument, entityModel: ContentModelEntity, position: InsertEntityPosition, isBlock: boolean, focusAfterEntity?: boolean, context?: FormatContentModelContext, insertPointOverride?: InsertPoint): void;
|