roosterjs-content-model-api 0.27.0 → 9.0.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/README.md +47 -37
- package/lib/index.d.ts +48 -42
- package/lib/index.js +56 -43
- package/lib/index.js.map +1 -1
- package/lib/modelApi/block/setModelAlignment.js +2 -2
- package/lib/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib/modelApi/block/setModelDirection.js +5 -5
- package/lib/modelApi/block/setModelDirection.js.map +1 -1
- package/lib/modelApi/block/setModelIndentation.js +6 -7
- package/lib/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib/modelApi/block/toggleModelBlockQuote.js +3 -4
- package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib/modelApi/common/clearModelFormat.js +6 -7
- package/lib/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib/modelApi/common/reducedModelChildProcessor.d.ts +20 -0
- package/lib/modelApi/common/reducedModelChildProcessor.js +64 -0
- package/lib/modelApi/common/reducedModelChildProcessor.js.map +1 -0
- package/lib/modelApi/common/wrapBlock.js.map +1 -1
- package/lib/modelApi/entity/insertEntityModel.d.ts +2 -2
- package/lib/modelApi/entity/insertEntityModel.js +19 -10
- package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.js +3 -3
- package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib/modelApi/link/matchLink.d.ts +1 -18
- package/lib/modelApi/link/matchLink.js +0 -1
- package/lib/modelApi/link/matchLink.js.map +1 -1
- package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib/modelApi/list/setListType.js +3 -4
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/list/setModelListStartNumber.d.ts +7 -0
- package/lib/modelApi/list/setModelListStartNumber.js +22 -0
- package/lib/modelApi/list/setModelListStartNumber.js.map +1 -0
- package/lib/modelApi/list/setModelListStyle.d.ts +7 -0
- package/lib/modelApi/list/setModelListStyle.js +26 -0
- package/lib/modelApi/list/setModelListStyle.js.map +1 -0
- package/lib/modelApi/selection/adjustSegmentSelection.js +3 -3
- package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js +1 -2
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustWordSelection.js +3 -4
- package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib/modelApi/table/alignTable.js.map +1 -1
- package/lib/modelApi/table/alignTableCell.js +3 -3
- package/lib/modelApi/table/alignTableCell.js.map +1 -1
- package/lib/modelApi/table/canMergeCells.js.map +1 -1
- package/lib/modelApi/table/clearSelectedCells.js +2 -2
- package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib/modelApi/table/createTableStructure.js.map +1 -1
- package/lib/modelApi/table/deleteTable.js.map +1 -1
- package/lib/modelApi/table/deleteTableColumn.js +2 -2
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib/modelApi/table/deleteTableRow.js +2 -2
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.js +1 -2
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.js +1 -2
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.js +2 -2
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js +2 -2
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js +2 -2
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.js +1 -2
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.js +1 -2
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/block/setAlignment.d.ts +1 -1
- package/lib/publicApi/block/setAlignment.js +2 -1
- package/lib/publicApi/block/setAlignment.js.map +1 -1
- package/lib/publicApi/block/setDirection.d.ts +1 -1
- package/lib/publicApi/block/setDirection.js +2 -1
- package/lib/publicApi/block/setDirection.js.map +1 -1
- package/lib/publicApi/block/setHeadingLevel.d.ts +1 -1
- package/lib/publicApi/block/setHeadingLevel.js +2 -1
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib/publicApi/block/setIndentation.d.ts +1 -1
- package/lib/publicApi/block/setIndentation.js +2 -1
- package/lib/publicApi/block/setIndentation.js.map +1 -1
- package/lib/publicApi/block/setParagraphMargin.d.ts +1 -1
- package/lib/publicApi/block/setParagraphMargin.js +2 -1
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib/publicApi/block/setSpacing.d.ts +1 -1
- package/lib/publicApi/block/setSpacing.js +2 -1
- package/lib/publicApi/block/setSpacing.js.map +1 -1
- package/lib/publicApi/block/toggleBlockQuote.d.ts +1 -1
- package/lib/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib/publicApi/entity/insertEntity.d.ts +3 -3
- package/lib/publicApi/entity/insertEntity.js +19 -12
- package/lib/publicApi/entity/insertEntity.js.map +1 -1
- package/lib/publicApi/format/clearFormat.d.ts +1 -1
- package/lib/publicApi/format/clearFormat.js +2 -1
- package/lib/publicApi/format/clearFormat.js.map +1 -1
- package/lib/publicApi/format/getFormatState.d.ts +1 -1
- package/lib/publicApi/format/getFormatState.js +13 -4
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/adjustImageSelection.d.ts +1 -1
- package/lib/publicApi/image/adjustImageSelection.js +2 -1
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib/publicApi/image/changeImage.d.ts +1 -1
- package/lib/publicApi/image/changeImage.js +6 -5
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.d.ts +1 -1
- package/lib/publicApi/image/insertImage.js +4 -4
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/image/setImageAltText.d.ts +1 -1
- package/lib/publicApi/image/setImageAltText.js +3 -2
- package/lib/publicApi/image/setImageAltText.js.map +1 -1
- package/lib/publicApi/image/setImageBorder.d.ts +1 -1
- package/lib/publicApi/image/setImageBorder.js +4 -3
- package/lib/publicApi/image/setImageBorder.js.map +1 -1
- package/lib/publicApi/image/setImageBoxShadow.d.ts +1 -1
- package/lib/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib/publicApi/link/adjustLinkSelection.d.ts +1 -1
- package/lib/publicApi/link/adjustLinkSelection.js +5 -4
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +1 -1
- package/lib/publicApi/link/insertLink.js +5 -5
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +1 -1
- package/lib/publicApi/link/removeLink.js +4 -3
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib/publicApi/list/setListStartNumber.js +4 -11
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +1 -1
- package/lib/publicApi/list/setListStyle.js +4 -18
- package/lib/publicApi/list/setListStyle.js.map +1 -1
- package/lib/publicApi/list/toggleBullet.d.ts +1 -1
- package/lib/publicApi/list/toggleBullet.js +2 -1
- package/lib/publicApi/list/toggleBullet.js.map +1 -1
- package/lib/publicApi/list/toggleNumbering.d.ts +1 -1
- package/lib/publicApi/list/toggleNumbering.js +2 -1
- package/lib/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib/publicApi/segment/applySegmentFormat.d.ts +1 -1
- package/lib/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib/publicApi/segment/changeCapitalization.d.ts +1 -1
- package/lib/publicApi/segment/changeCapitalization.js +2 -1
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib/publicApi/segment/changeFontSize.d.ts +1 -1
- package/lib/publicApi/segment/changeFontSize.js +2 -1
- package/lib/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib/publicApi/segment/setBackgroundColor.d.ts +1 -1
- package/lib/publicApi/segment/setBackgroundColor.js +3 -3
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib/publicApi/segment/setFontName.d.ts +1 -1
- package/lib/publicApi/segment/setFontName.js +2 -1
- package/lib/publicApi/segment/setFontName.js.map +1 -1
- package/lib/publicApi/segment/setFontSize.d.ts +1 -1
- package/lib/publicApi/segment/setFontSize.js +2 -2
- package/lib/publicApi/segment/setFontSize.js.map +1 -1
- package/lib/publicApi/segment/setTextColor.d.ts +1 -1
- package/lib/publicApi/segment/setTextColor.js +2 -1
- package/lib/publicApi/segment/setTextColor.js.map +1 -1
- package/lib/publicApi/segment/toggleBold.d.ts +1 -1
- package/lib/publicApi/segment/toggleBold.js +4 -3
- package/lib/publicApi/segment/toggleBold.js.map +1 -1
- package/lib/publicApi/segment/toggleCode.d.ts +1 -1
- package/lib/publicApi/segment/toggleCode.js +2 -1
- package/lib/publicApi/segment/toggleCode.js.map +1 -1
- package/lib/publicApi/segment/toggleItalic.d.ts +1 -1
- package/lib/publicApi/segment/toggleItalic.js +2 -1
- package/lib/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib/publicApi/segment/toggleSubscript.d.ts +1 -1
- package/lib/publicApi/segment/toggleSubscript.js +2 -1
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib/publicApi/segment/toggleSuperscript.d.ts +1 -1
- package/lib/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib/publicApi/segment/toggleUnderline.d.ts +1 -1
- package/lib/publicApi/segment/toggleUnderline.js +2 -1
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.js +6 -6
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.d.ts +1 -1
- package/lib/publicApi/table/editTable.js +2 -1
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/formatTable.d.ts +1 -1
- package/lib/publicApi/table/formatTable.js +6 -5
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +1 -1
- package/lib/publicApi/table/insertTable.js +8 -8
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib/publicApi/table/setTableCellShade.js +7 -6
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatInsertPointWithContentModel.d.ts +5 -0
- package/lib/publicApi/utils/formatInsertPointWithContentModel.js +127 -0
- package/lib/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -0
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +6 -3
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +9 -3
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatTableWithContentModel.js +5 -6
- package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-amd/index.d.ts +48 -42
- package/lib-amd/index.js +50 -44
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/block/setModelAlignment.js +2 -2
- package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-amd/modelApi/block/setModelDirection.js +5 -5
- package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-amd/modelApi/block/setModelIndentation.js +6 -6
- package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js +3 -3
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-amd/modelApi/common/clearModelFormat.js +7 -7
- package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-amd/modelApi/common/reducedModelChildProcessor.d.ts +20 -0
- package/lib-amd/modelApi/common/reducedModelChildProcessor.js +64 -0
- package/lib-amd/modelApi/common/reducedModelChildProcessor.js.map +1 -0
- package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-amd/modelApi/entity/insertEntityModel.d.ts +2 -2
- package/lib-amd/modelApi/entity/insertEntityModel.js +20 -10
- package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.js +4 -3
- package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-amd/modelApi/link/matchLink.d.ts +1 -18
- package/lib-amd/modelApi/link/matchLink.js +0 -1
- package/lib-amd/modelApi/link/matchLink.js.map +1 -1
- package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-amd/modelApi/list/setListType.js +4 -4
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/list/setModelListStartNumber.d.ts +7 -0
- package/lib-amd/modelApi/list/setModelListStartNumber.js +23 -0
- package/lib-amd/modelApi/list/setModelListStartNumber.js.map +1 -0
- package/lib-amd/modelApi/list/setModelListStyle.d.ts +7 -0
- package/lib-amd/modelApi/list/setModelListStyle.js +26 -0
- package/lib-amd/modelApi/list/setModelListStyle.js.map +1 -0
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js +3 -3
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js +2 -2
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustWordSelection.js +4 -4
- package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-amd/modelApi/table/alignTable.js.map +1 -1
- package/lib-amd/modelApi/table/alignTableCell.js +3 -3
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-amd/modelApi/table/clearSelectedCells.js +2 -2
- package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableColumn.js +2 -2
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableRow.js +2 -2
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableColumn.js +2 -2
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.js +2 -2
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js +2 -2
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js +2 -2
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js +2 -2
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js +2 -2
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.js +2 -2
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/block/setAlignment.d.ts +1 -1
- package/lib-amd/publicApi/block/setAlignment.js +2 -1
- package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
- package/lib-amd/publicApi/block/setDirection.d.ts +1 -1
- package/lib-amd/publicApi/block/setDirection.js +2 -1
- package/lib-amd/publicApi/block/setDirection.js.map +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.d.ts +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.js +2 -1
- package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-amd/publicApi/block/setIndentation.d.ts +1 -1
- package/lib-amd/publicApi/block/setIndentation.js +2 -1
- package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.d.ts +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.js +2 -1
- package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-amd/publicApi/block/setSpacing.d.ts +1 -1
- package/lib-amd/publicApi/block/setSpacing.js +2 -1
- package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-amd/publicApi/entity/insertEntity.d.ts +3 -3
- package/lib-amd/publicApi/entity/insertEntity.js +19 -12
- package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-amd/publicApi/format/clearFormat.d.ts +1 -1
- package/lib-amd/publicApi/format/clearFormat.js +2 -1
- package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.d.ts +1 -1
- package/lib-amd/publicApi/format/getFormatState.js +12 -4
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.d.ts +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.js +2 -1
- package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-amd/publicApi/image/changeImage.d.ts +1 -1
- package/lib-amd/publicApi/image/changeImage.js +6 -5
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.d.ts +1 -1
- package/lib-amd/publicApi/image/insertImage.js +5 -4
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/image/setImageAltText.d.ts +1 -1
- package/lib-amd/publicApi/image/setImageAltText.js +3 -2
- package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBorder.d.ts +1 -1
- package/lib-amd/publicApi/image/setImageBorder.js +4 -3
- package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +1 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.js +5 -4
- package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-amd/publicApi/link/insertLink.d.ts +1 -1
- package/lib-amd/publicApi/link/insertLink.js +6 -5
- package/lib-amd/publicApi/link/insertLink.js.map +1 -1
- package/lib-amd/publicApi/link/removeLink.d.ts +1 -1
- package/lib-amd/publicApi/link/removeLink.js +4 -3
- package/lib-amd/publicApi/link/removeLink.js.map +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.js +4 -11
- package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-amd/publicApi/list/setListStyle.d.ts +1 -1
- package/lib-amd/publicApi/list/setListStyle.js +4 -17
- package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
- package/lib-amd/publicApi/list/toggleBullet.d.ts +1 -1
- package/lib-amd/publicApi/list/toggleBullet.js +2 -1
- package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.d.ts +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.js +2 -1
- package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.d.ts +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.js +2 -1
- package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-amd/publicApi/segment/changeFontSize.d.ts +1 -1
- package/lib-amd/publicApi/segment/changeFontSize.js +2 -1
- package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.js +4 -3
- package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontName.d.ts +1 -1
- package/lib-amd/publicApi/segment/setFontName.js +2 -1
- package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontSize.d.ts +1 -1
- package/lib-amd/publicApi/segment/setFontSize.js +2 -2
- package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setTextColor.d.ts +1 -1
- package/lib-amd/publicApi/segment/setTextColor.js +2 -1
- package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleBold.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleBold.js +4 -3
- package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleCode.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleCode.js +2 -1
- package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.js +2 -1
- package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.js +2 -1
- package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.js +2 -1
- package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +7 -6
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.d.ts +1 -1
- package/lib-amd/publicApi/table/editTable.js +2 -1
- package/lib-amd/publicApi/table/editTable.js.map +1 -1
- package/lib-amd/publicApi/table/formatTable.d.ts +1 -1
- package/lib-amd/publicApi/table/formatTable.js +6 -5
- package/lib-amd/publicApi/table/formatTable.js.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +1 -1
- package/lib-amd/publicApi/table/insertTable.js +8 -7
- package/lib-amd/publicApi/table/insertTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.js +7 -6
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.d.ts +5 -0
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js +127 -0
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -0
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +6 -3
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +9 -3
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js +6 -6
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-mjs/index.d.ts +48 -42
- package/lib-mjs/index.js +48 -42
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.js +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.js +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelIndentation.js +1 -2
- package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js +1 -2
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-mjs/modelApi/common/clearModelFormat.js +1 -2
- package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.d.ts +20 -0
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.js +60 -0
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.js.map +1 -0
- package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-mjs/modelApi/entity/insertEntityModel.d.ts +2 -2
- package/lib-mjs/modelApi/entity/insertEntityModel.js +18 -9
- package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js +2 -3
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-mjs/modelApi/link/matchLink.d.ts +1 -18
- package/lib-mjs/modelApi/link/matchLink.js +0 -1
- package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-mjs/modelApi/list/setListType.js +1 -2
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/list/setModelListStartNumber.d.ts +7 -0
- package/lib-mjs/modelApi/list/setModelListStartNumber.js +18 -0
- package/lib-mjs/modelApi/list/setModelListStartNumber.js.map +1 -0
- package/lib-mjs/modelApi/list/setModelListStyle.d.ts +7 -0
- package/lib-mjs/modelApi/list/setModelListStyle.js +22 -0
- package/lib-mjs/modelApi/list/setModelListStyle.js.map +1 -0
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js +1 -1
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js +1 -2
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustWordSelection.js +1 -2
- package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableColumn.js +1 -2
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.js +1 -2
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +1 -2
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.js +1 -2
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/block/setAlignment.d.ts +1 -1
- package/lib-mjs/publicApi/block/setAlignment.js +1 -1
- package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
- package/lib-mjs/publicApi/block/setDirection.d.ts +1 -1
- package/lib-mjs/publicApi/block/setDirection.js +1 -1
- package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.js +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-mjs/publicApi/block/setIndentation.d.ts +1 -1
- package/lib-mjs/publicApi/block/setIndentation.js +1 -1
- package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.js +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-mjs/publicApi/block/setSpacing.d.ts +1 -1
- package/lib-mjs/publicApi/block/setSpacing.js +1 -1
- package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.js +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-mjs/publicApi/entity/insertEntity.d.ts +3 -3
- package/lib-mjs/publicApi/entity/insertEntity.js +18 -12
- package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-mjs/publicApi/format/clearFormat.d.ts +1 -1
- package/lib-mjs/publicApi/format/clearFormat.js +1 -1
- package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.d.ts +1 -1
- package/lib-mjs/publicApi/format/getFormatState.js +12 -4
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.js +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.d.ts +1 -1
- package/lib-mjs/publicApi/image/changeImage.js +3 -3
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.d.ts +1 -1
- package/lib-mjs/publicApi/image/insertImage.js +2 -3
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.js +2 -2
- package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBorder.d.ts +1 -1
- package/lib-mjs/publicApi/image/setImageBorder.js +3 -3
- package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.js +2 -2
- package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.js +2 -2
- package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.d.ts +1 -1
- package/lib-mjs/publicApi/link/insertLink.js +2 -3
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
- package/lib-mjs/publicApi/link/removeLink.d.ts +1 -1
- package/lib-mjs/publicApi/link/removeLink.js +2 -2
- package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.js +3 -11
- package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStyle.d.ts +1 -1
- package/lib-mjs/publicApi/list/setListStyle.js +3 -18
- package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.d.ts +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.js +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.d.ts +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.js +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.js +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.js +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.d.ts +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.js +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.js +2 -3
- package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontName.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setFontName.js +1 -1
- package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.js +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.js +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.js +2 -2
- package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.js +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.js +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.js +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.js +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.js +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +2 -3
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.d.ts +1 -1
- package/lib-mjs/publicApi/table/editTable.js +1 -1
- package/lib-mjs/publicApi/table/editTable.js.map +1 -1
- package/lib-mjs/publicApi/table/formatTable.d.ts +1 -1
- package/lib-mjs/publicApi/table/formatTable.js +2 -2
- package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +1 -1
- package/lib-mjs/publicApi/table/insertTable.js +2 -3
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.js +2 -2
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +5 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.d.ts +5 -0
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js +123 -0
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -0
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +5 -2
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +8 -2
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js +1 -2
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/package.json +4 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyTableBorderFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/applyTableBorderFormat.ts"],"names":[],"mappings":";;;IAkCA;;;;;OAKG;IACH,SAAwB,sBAAsB,CAC1C,MAAe,EACf,MAAc,EACd,SAA2B;QAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACK,IAAA,KAAA,oBAAe,IAAA,oDAAqB,EAAC,KAAK,CAAC,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AW,GAAG,CAAC,IAAI,CAAC,EAAE;YAC5C,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;gBACnE,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;gBAClE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;aACjF;SACJ;QACD,qBAAqB;QACrB,IAAI,SAAS,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;YACzE,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;gBACnE,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;gBACjE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;aACjF;SACJ;IACL,CAAC","sourcesContent":["import { parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport {\n extractBorderValues,\n getFirstSelectedTable,\n getSelectedCells,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\nimport type {\n IEditor,\n Border,\n ContentModelTable,\n ContentModelTableCell,\n BorderOperations,\n TableSelectionCoordinates,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Border positions\n */\ntype BorderPositions = 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight';\n\n/**\n * @internal\n * Perimeter of the table selection\n * Used to determine where to apply border to the cells adjacent to the selection.\n */\ntype Perimeter = {\n Top: boolean;\n Bottom: boolean;\n Left: boolean;\n Right: boolean;\n};\n\n/**\n * Operations to apply border\n * @param editor The editor instance\n * @param border The border to apply\n * @param operation The operation to apply\n */\nexport default function applyTableBorderFormat(\n editor: IEditor,\n border: Border,\n operation: BorderOperations\n) {\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n const sel = getSelectedCells(tableModel);\n const perimeter: Perimeter = {\n Top: false,\n Bottom: false,\n Left: false,\n Right: false,\n };\n\n // Create border format with table format as backup\n let borderFormat = '';\n const format = tableModel.format;\n const { width, style, color } = border;\n const extractedBorder = extractBorderValues(format.borderTop);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n\n if (width) {\n borderFormat = parseValueWithUnit(width) + 'px';\n } else if (borderWidth) {\n borderFormat = borderWidth;\n } else {\n borderFormat = '1px';\n }\n\n if (style) {\n borderFormat = `${borderFormat} ${style}`;\n } else if (borderStyle) {\n borderFormat = `${borderFormat} ${borderStyle}`;\n } else {\n borderFormat = `${borderFormat} solid`;\n }\n\n if (color) {\n borderFormat = `${borderFormat} ${color}`;\n } else if (borderColor) {\n borderFormat = `${borderFormat} ${borderColor}`;\n }\n\n // undefined is treated as Left to Right\n const isRtl = tableModel.format.direction == 'rtl';\n\n if (sel) {\n const operations: BorderOperations[] = [operation];\n while (operations.length) {\n switch (operations.pop()) {\n case 'noBorders':\n // Do All borders but with empty border format\n borderFormat = '';\n operations.push('allBorders');\n break;\n case 'allBorders':\n const allBorders: BorderPositions[] = [\n 'borderTop',\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[colIndex];\n // Format cells - All borders\n applyBorderFormat(cell, borderFormat, allBorders);\n }\n }\n\n // Format perimeter\n perimeter.Top = true;\n perimeter.Bottom = true;\n perimeter.Left = true;\n perimeter.Right = true;\n break;\n case 'leftBorders':\n const leftBorder: BorderPositions[] = ['borderLeft'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ];\n // Format cells - Left border\n applyBorderFormat(cell, borderFormat, leftBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Right = true) : (perimeter.Left = true);\n break;\n case 'rightBorders':\n const rightBorder: BorderPositions[] = ['borderRight'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ];\n // Format cells - Right border\n applyBorderFormat(cell, borderFormat, rightBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Left = true) : (perimeter.Right = true);\n break;\n case 'topBorders':\n const topBorder: BorderPositions[] = ['borderTop'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n // Format cells - Top border\n applyBorderFormat(cell, borderFormat, topBorder);\n }\n\n // Format perimeter\n perimeter.Top = true;\n break;\n case 'bottomBorders':\n const bottomBorder: BorderPositions[] = ['borderBottom'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n // Format cells - Bottom border\n applyBorderFormat(cell, borderFormat, bottomBorder);\n }\n\n // Format perimeter\n perimeter.Bottom = true;\n break;\n case 'insideBorders':\n // Format cells - Inside borders\n const singleCol = sel.lastColumn == sel.firstColumn;\n const singleRow = sel.lastRow == sel.firstRow;\n // Single cell selection\n if (singleCol && singleRow) {\n break;\n }\n // Single column selection\n if (singleCol) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[sel.firstColumn],\n borderFormat,\n ['borderBottom']\n );\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex <= sel.lastRow - 1;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[sel.firstColumn],\n borderFormat,\n ['borderTop']\n );\n break;\n }\n // Single row selection\n if (singleRow) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderRight']\n );\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex <= sel.lastColumn - 1;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderLeft',\n 'borderRight',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderLeft']\n );\n break;\n }\n\n // For multiple rows and columns selections\n // Top left cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderBottom', 'borderRight']\n );\n // Top right cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderBottom', 'borderLeft']\n );\n // Bottom left cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderTop', 'borderRight']\n );\n // Bottom right cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderTop', 'borderLeft']\n );\n // First row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // Last row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // First column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderLeft' : 'borderRight',\n ]);\n }\n // Last column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderRight' : 'borderLeft',\n ]);\n }\n // Inner cells\n sel.firstColumn++;\n sel.firstRow++;\n sel.lastColumn--;\n sel.lastRow--;\n operations.push('allBorders');\n break;\n case 'outsideBorders':\n // Format cells - Outside borders\n operations.push('topBorders');\n operations.push('bottomBorders');\n operations.push('leftBorders');\n operations.push('rightBorders');\n break;\n default:\n break;\n }\n }\n\n //Format perimeter if necessary or possible\n modifyPerimeter(tableModel, sel, borderFormat, perimeter, isRtl);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'tableBorder',\n }\n );\n}\n\n/**\n * @internal\n * Apply border format to a cell\n * @param cell The cell to apply border format\n * @param borderFormat The border format to apply\n * @param positions The positions to apply\n */\nfunction applyBorderFormat(\n cell: ContentModelTableCell,\n borderFormat: string,\n positions: BorderPositions[]\n) {\n positions.forEach(pos => {\n cell.format[pos] = borderFormat;\n });\n\n updateTableCellMetadata(cell, metadata => {\n metadata = metadata || {};\n metadata.borderOverride = true;\n return metadata;\n });\n\n // Cell was modified, so delete cached element\n delete cell.cachedElement;\n}\n\n/**\n * @internal\n * Modify the perimeter of the table selection\n * @param tableModel The table model\n * @param sel The table selection\n * @param borderFormat The border format to apply\n * If borderFormat is empty, the border will be removed\n * @param perimeter Where in the perimeter to apply\n */\nfunction modifyPerimeter(\n tableModel: ContentModelTable,\n sel: TableSelectionCoordinates,\n borderFormat: string,\n perimeter: Perimeter,\n isRtl: boolean\n) {\n // Top of selection\n if (perimeter.Top && sel.firstRow - 1 >= 0) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.firstRow - 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderBottom']);\n }\n }\n // Bottom of selection\n if (perimeter.Bottom && sel.lastRow + 1 < tableModel.rows.length) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.lastRow + 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderTop']);\n }\n }\n // Left of selection\n if (perimeter.Left && sel.firstColumn - 1 >= 0) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn - 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderLeft' : 'borderRight']);\n }\n }\n // Right of selection\n if (perimeter.Right && sel.lastColumn + 1 < tableModel.rows[0].cells.length) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn + 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderRight' : 'borderLeft']);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"applyTableBorderFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/applyTableBorderFormat.ts"],"names":[],"mappings":";;;;IAkCA;;;;;OAKG;IACH,SAAgB,sBAAsB,CAClC,MAAe,EACf,MAAc,EACd,SAA2B;QAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACK,IAAA,KAAA,oBAAe,IAAA,mDAAqB,EAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;YAElD,IAAI,UAAU,EAAE;gBACZ,IAAM,GAAG,GAAG,IAAA,8CAAgB,EAAC,UAAU,CAAC,CAAC;gBACzC,IAAM,SAAS,GAAc;oBACzB,GAAG,EAAE,KAAK;oBACV,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE,KAAK;iBACf,CAAC;gBAEF,mDAAmD;gBACnD,IAAI,YAAY,GAAG,EAAE,CAAC;gBACtB,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;gBACzB,IAAA,KAAK,GAAmB,MAAM,MAAzB,EAAE,KAAK,GAAY,MAAM,MAAlB,EAAE,KAAK,GAAK,MAAM,MAAX,CAAY;gBACvC,IAAM,eAAe,GAAG,IAAA,iDAAmB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC9D,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;gBAC1C,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;gBAC1C,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;gBAE1C,IAAI,KAAK,EAAE;oBACP,YAAY,GAAG,IAAA,gDAAkB,EAAC,KAAK,CAAC,GAAG,IAAI,CAAC;iBACnD;qBAAM,IAAI,WAAW,EAAE;oBACpB,YAAY,GAAG,WAAW,CAAC;iBAC9B;qBAAM;oBACH,YAAY,GAAG,KAAK,CAAC;iBACxB;gBAED,IAAI,KAAK,EAAE;oBACP,YAAY,GAAM,YAAY,SA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n extractBorderValues,\n getFirstSelectedTable,\n getSelectedCells,\n parseValueWithUnit,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-dom';\nimport type {\n IEditor,\n Border,\n ContentModelTable,\n ContentModelTableCell,\n BorderOperations,\n TableSelectionCoordinates,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Border positions\n */\ntype BorderPositions = 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight';\n\n/**\n * @internal\n * Perimeter of the table selection\n * Used to determine where to apply border to the cells adjacent to the selection.\n */\ntype Perimeter = {\n Top: boolean;\n Bottom: boolean;\n Left: boolean;\n Right: boolean;\n};\n\n/**\n * Operations to apply border\n * @param editor The editor instance\n * @param border The border to apply\n * @param operation The operation to apply\n */\nexport function applyTableBorderFormat(\n editor: IEditor,\n border: Border,\n operation: BorderOperations\n) {\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n const sel = getSelectedCells(tableModel);\n const perimeter: Perimeter = {\n Top: false,\n Bottom: false,\n Left: false,\n Right: false,\n };\n\n // Create border format with table format as backup\n let borderFormat = '';\n const format = tableModel.format;\n const { width, style, color } = border;\n const extractedBorder = extractBorderValues(format.borderTop);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n\n if (width) {\n borderFormat = parseValueWithUnit(width) + 'px';\n } else if (borderWidth) {\n borderFormat = borderWidth;\n } else {\n borderFormat = '1px';\n }\n\n if (style) {\n borderFormat = `${borderFormat} ${style}`;\n } else if (borderStyle) {\n borderFormat = `${borderFormat} ${borderStyle}`;\n } else {\n borderFormat = `${borderFormat} solid`;\n }\n\n if (color) {\n borderFormat = `${borderFormat} ${color}`;\n } else if (borderColor) {\n borderFormat = `${borderFormat} ${borderColor}`;\n }\n\n // undefined is treated as Left to Right\n const isRtl = tableModel.format.direction == 'rtl';\n\n if (sel) {\n const operations: BorderOperations[] = [operation];\n while (operations.length) {\n switch (operations.pop()) {\n case 'noBorders':\n // Do All borders but with empty border format\n borderFormat = '';\n operations.push('allBorders');\n break;\n case 'allBorders':\n const allBorders: BorderPositions[] = [\n 'borderTop',\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[colIndex];\n // Format cells - All borders\n applyBorderFormat(cell, borderFormat, allBorders);\n }\n }\n\n // Format perimeter\n perimeter.Top = true;\n perimeter.Bottom = true;\n perimeter.Left = true;\n perimeter.Right = true;\n break;\n case 'leftBorders':\n const leftBorder: BorderPositions[] = ['borderLeft'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ];\n // Format cells - Left border\n applyBorderFormat(cell, borderFormat, leftBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Right = true) : (perimeter.Left = true);\n break;\n case 'rightBorders':\n const rightBorder: BorderPositions[] = ['borderRight'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ];\n // Format cells - Right border\n applyBorderFormat(cell, borderFormat, rightBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Left = true) : (perimeter.Right = true);\n break;\n case 'topBorders':\n const topBorder: BorderPositions[] = ['borderTop'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n // Format cells - Top border\n applyBorderFormat(cell, borderFormat, topBorder);\n }\n\n // Format perimeter\n perimeter.Top = true;\n break;\n case 'bottomBorders':\n const bottomBorder: BorderPositions[] = ['borderBottom'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n // Format cells - Bottom border\n applyBorderFormat(cell, borderFormat, bottomBorder);\n }\n\n // Format perimeter\n perimeter.Bottom = true;\n break;\n case 'insideBorders':\n // Format cells - Inside borders\n const singleCol = sel.lastColumn == sel.firstColumn;\n const singleRow = sel.lastRow == sel.firstRow;\n // Single cell selection\n if (singleCol && singleRow) {\n break;\n }\n // Single column selection\n if (singleCol) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[sel.firstColumn],\n borderFormat,\n ['borderBottom']\n );\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex <= sel.lastRow - 1;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[sel.firstColumn],\n borderFormat,\n ['borderTop']\n );\n break;\n }\n // Single row selection\n if (singleRow) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderRight']\n );\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex <= sel.lastColumn - 1;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderLeft',\n 'borderRight',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderLeft']\n );\n break;\n }\n\n // For multiple rows and columns selections\n // Top left cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderBottom', 'borderRight']\n );\n // Top right cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderBottom', 'borderLeft']\n );\n // Bottom left cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderTop', 'borderRight']\n );\n // Bottom right cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderTop', 'borderLeft']\n );\n // First row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // Last row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // First column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderLeft' : 'borderRight',\n ]);\n }\n // Last column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderRight' : 'borderLeft',\n ]);\n }\n // Inner cells\n sel.firstColumn++;\n sel.firstRow++;\n sel.lastColumn--;\n sel.lastRow--;\n operations.push('allBorders');\n break;\n case 'outsideBorders':\n // Format cells - Outside borders\n operations.push('topBorders');\n operations.push('bottomBorders');\n operations.push('leftBorders');\n operations.push('rightBorders');\n break;\n default:\n break;\n }\n }\n\n //Format perimeter if necessary or possible\n modifyPerimeter(tableModel, sel, borderFormat, perimeter, isRtl);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'tableBorder',\n }\n );\n}\n\n/**\n * @internal\n * Apply border format to a cell\n * @param cell The cell to apply border format\n * @param borderFormat The border format to apply\n * @param positions The positions to apply\n */\nfunction applyBorderFormat(\n cell: ContentModelTableCell,\n borderFormat: string,\n positions: BorderPositions[]\n) {\n positions.forEach(pos => {\n cell.format[pos] = borderFormat;\n });\n\n updateTableCellMetadata(cell, metadata => {\n metadata = metadata || {};\n metadata.borderOverride = true;\n return metadata;\n });\n\n // Cell was modified, so delete cached element\n delete cell.cachedElement;\n}\n\n/**\n * @internal\n * Modify the perimeter of the table selection\n * @param tableModel The table model\n * @param sel The table selection\n * @param borderFormat The border format to apply\n * If borderFormat is empty, the border will be removed\n * @param perimeter Where in the perimeter to apply\n */\nfunction modifyPerimeter(\n tableModel: ContentModelTable,\n sel: TableSelectionCoordinates,\n borderFormat: string,\n perimeter: Perimeter,\n isRtl: boolean\n) {\n // Top of selection\n if (perimeter.Top && sel.firstRow - 1 >= 0) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.firstRow - 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderBottom']);\n }\n }\n // Bottom of selection\n if (perimeter.Bottom && sel.lastRow + 1 < tableModel.rows.length) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.lastRow + 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderTop']);\n }\n }\n // Left of selection\n if (perimeter.Left && sel.firstColumn - 1 >= 0) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn - 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderLeft' : 'borderRight']);\n }\n }\n // Right of selection\n if (perimeter.Right && sel.lastColumn + 1 < tableModel.rows[0].cells.length) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn + 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderRight' : 'borderLeft']);\n }\n }\n}\n"]}
|
|
@@ -4,4 +4,4 @@ import type { TableOperation, IEditor } from 'roosterjs-content-model-types';
|
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param operation The table operation to apply
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function editTable(editor: IEditor, operation: TableOperation): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/table/alignTable", "../../modelApi/table/deleteTable", "../../modelApi/table/deleteTableColumn", "../../modelApi/table/deleteTableRow", "../utils/formatTableWithContentModel", "../../modelApi/table/insertTableColumn", "../../modelApi/table/insertTableRow", "../../modelApi/table/mergeTableCells", "../../modelApi/table/mergeTableColumn", "../../modelApi/table/mergeTableRow", "../../modelApi/table/splitTableCellHorizontally", "../../modelApi/table/splitTableCellVertically", "../../modelApi/table/alignTableCell"], function (require, exports, alignTable_1, deleteTable_1, deleteTableColumn_1, deleteTableRow_1, formatTableWithContentModel_1, insertTableColumn_1, insertTableRow_1, mergeTableCells_1, mergeTableColumn_1, mergeTableRow_1, splitTableCellHorizontally_1, splitTableCellVertically_1, alignTableCell_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.editTable = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Format current focused table with the given format
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -62,6 +63,6 @@ define(["require", "exports", "../../modelApi/table/alignTable", "../../modelApi
|
|
|
62
63
|
}
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
|
-
exports.
|
|
66
|
+
exports.editTable = editTable;
|
|
66
67
|
});
|
|
67
68
|
//# sourceMappingURL=editTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editTable.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"editTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/editTable.ts"],"names":[],"mappings":";;;;IAkBA;;;;OAIG;IACH,SAAgB,SAAS,CAAC,MAAe,EAAE,SAAyB;QAChE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,WAAW,EAAE,UAAA,UAAU;YACvD,QAAQ,SAAS,EAAE;gBACf,KAAK,eAAe,CAAC;gBACrB,KAAK,iBAAiB,CAAC;gBACvB,KAAK,gBAAgB;oBACjB,IAAA,2CAA0B,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBAClD,MAAM;gBACV,KAAK,cAAc,CAAC;gBACpB,KAAK,iBAAiB,CAAC;gBACvB,KAAK,iBAAiB;oBAClB,IAAA,yCAAwB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBAChD,MAAM;gBACV,KAAK,aAAa,CAAC;gBACnB,KAAK,WAAW,CAAC;gBACjB,KAAK,YAAY;oBACb,IAAA,uBAAU,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBAClC,MAAM;gBAEV,KAAK,cAAc;oBACf,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;oBAC9B,MAAM;gBAEV,KAAK,WAAW;oBACZ,IAAA,+BAAc,EAAC,UAAU,CAAC,CAAC;oBAC3B,MAAM;gBAEV,KAAK,aAAa;oBACd,IAAA,yBAAW,EAAC,UAAU,CAAC,CAAC;oBACxB,MAAM;gBAEV,KAAK,aAAa,CAAC;gBACnB,KAAK,aAAa;oBACd,IAAA,+BAAc,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBACtC,MAAM;gBAEV,KAAK,YAAY,CAAC;gBAClB,KAAK,aAAa;oBACd,IAAA,qCAAiB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBACzC,MAAM;gBAEV,KAAK,YAAY,CAAC;gBAClB,KAAK,YAAY;oBACb,IAAA,6BAAa,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBACrC,MAAM;gBAEV,KAAK,YAAY;oBACb,IAAA,iCAAe,EAAC,UAAU,CAAC,CAAC;oBAC5B,MAAM;gBAEV,KAAK,WAAW,CAAC;gBACjB,KAAK,YAAY;oBACb,IAAA,mCAAgB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBACxC,MAAM;gBAEV,KAAK,mBAAmB;oBACpB,IAAA,uDAA0B,EAAC,UAAU,CAAC,CAAC;oBACvC,MAAM;gBAEV,KAAK,iBAAiB;oBAClB,IAAA,mDAAwB,EAAC,UAAU,CAAC,CAAC;oBACrC,MAAM;aACb;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAlED,8BAkEC","sourcesContent":["import { alignTable } from '../../modelApi/table/alignTable';\nimport { deleteTable } from '../../modelApi/table/deleteTable';\nimport { deleteTableColumn } from '../../modelApi/table/deleteTableColumn';\nimport { deleteTableRow } from '../../modelApi/table/deleteTableRow';\nimport { formatTableWithContentModel } from '../utils/formatTableWithContentModel';\nimport { insertTableColumn } from '../../modelApi/table/insertTableColumn';\nimport { insertTableRow } from '../../modelApi/table/insertTableRow';\nimport { mergeTableCells } from '../../modelApi/table/mergeTableCells';\nimport { mergeTableColumn } from '../../modelApi/table/mergeTableColumn';\nimport { mergeTableRow } from '../../modelApi/table/mergeTableRow';\nimport { splitTableCellHorizontally } from '../../modelApi/table/splitTableCellHorizontally';\nimport { splitTableCellVertically } from '../../modelApi/table/splitTableCellVertically';\nimport type { TableOperation, IEditor } from 'roosterjs-content-model-types';\nimport {\n alignTableCellHorizontally,\n alignTableCellVertically,\n} from '../../modelApi/table/alignTableCell';\n\n/**\n * Format current focused table with the given format\n * @param editor The editor instance\n * @param operation The table operation to apply\n */\nexport function editTable(editor: IEditor, operation: TableOperation) {\n editor.focus();\n\n formatTableWithContentModel(editor, 'editTable', tableModel => {\n switch (operation) {\n case 'alignCellLeft':\n case 'alignCellCenter':\n case 'alignCellRight':\n alignTableCellHorizontally(tableModel, operation);\n break;\n case 'alignCellTop':\n case 'alignCellMiddle':\n case 'alignCellBottom':\n alignTableCellVertically(tableModel, operation);\n break;\n case 'alignCenter':\n case 'alignLeft':\n case 'alignRight':\n alignTable(tableModel, operation);\n break;\n\n case 'deleteColumn':\n deleteTableColumn(tableModel);\n break;\n\n case 'deleteRow':\n deleteTableRow(tableModel);\n break;\n\n case 'deleteTable':\n deleteTable(tableModel);\n break;\n\n case 'insertAbove':\n case 'insertBelow':\n insertTableRow(tableModel, operation);\n break;\n\n case 'insertLeft':\n case 'insertRight':\n insertTableColumn(tableModel, operation);\n break;\n\n case 'mergeAbove':\n case 'mergeBelow':\n mergeTableRow(tableModel, operation);\n break;\n\n case 'mergeCells':\n mergeTableCells(tableModel);\n break;\n\n case 'mergeLeft':\n case 'mergeRight':\n mergeTableColumn(tableModel, operation);\n break;\n\n case 'splitHorizontally':\n splitTableCellHorizontally(tableModel);\n break;\n\n case 'splitVertically':\n splitTableCellVertically(tableModel);\n break;\n }\n });\n}\n"]}
|
|
@@ -5,4 +5,4 @@ import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types
|
|
|
5
5
|
* @param format The table format to apply
|
|
6
6
|
* @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function formatTable(editor: IEditor, format: TableMetadataFormat, keepCellShade?: boolean): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.formatTable = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Format current focused table with the given format
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -10,12 +11,12 @@ define(["require", "exports", "tslib", "roosterjs-content-model-core"], function
|
|
|
10
11
|
function formatTable(editor, format, keepCellShade) {
|
|
11
12
|
editor.focus();
|
|
12
13
|
editor.formatContentModel(function (model) {
|
|
13
|
-
var _a = (0, tslib_1.__read)((0,
|
|
14
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getFirstSelectedTable)(model), 1), tableModel = _a[0];
|
|
14
15
|
if (tableModel) {
|
|
15
16
|
// Wipe border metadata
|
|
16
17
|
tableModel.rows.forEach(function (row) {
|
|
17
18
|
row.cells.forEach(function (cell) {
|
|
18
|
-
(0,
|
|
19
|
+
(0, roosterjs_content_model_dom_1.updateTableCellMetadata)(cell, function (metadata) {
|
|
19
20
|
if (metadata) {
|
|
20
21
|
delete metadata.borderOverride;
|
|
21
22
|
}
|
|
@@ -23,7 +24,7 @@ define(["require", "exports", "tslib", "roosterjs-content-model-core"], function
|
|
|
23
24
|
});
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
|
-
(0,
|
|
27
|
+
(0, roosterjs_content_model_dom_1.applyTableFormat)(tableModel, format, keepCellShade);
|
|
27
28
|
return true;
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
@@ -33,6 +34,6 @@ define(["require", "exports", "tslib", "roosterjs-content-model-core"], function
|
|
|
33
34
|
apiName: 'formatTable',
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
exports.
|
|
37
|
+
exports.formatTable = formatTable;
|
|
37
38
|
});
|
|
38
39
|
//# sourceMappingURL=formatTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatTable.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"formatTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/formatTable.ts"],"names":[],"mappings":";;;;IAOA;;;;;OAKG;IACH,SAAgB,WAAW,CAAC,MAAe,EAAE,MAA2B,EAAE,aAAuB;QAC7F,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACK,IAAA,KAAA,oBAAe,IAAA,mDAAqB,EAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;YAElD,IAAI,UAAU,EAAE;gBACZ,uBAAuB;gBACvB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBACvB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;wBAClB,IAAA,qDAAuB,EAAC,IAAI,EAAE,UAAA,QAAQ;4BAClC,IAAI,QAAQ,EAAE;gCACV,OAAO,QAAQ,CAAC,cAAc,CAAC;6BAClC;4BACD,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;gBACH,IAAA,8CAAgB,EAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,OAAO,EAAE,aAAa;SACzB,CACJ,CAAC;IACN,CAAC;IA7BD,kCA6BC","sourcesContent":["import {\n applyTableFormat,\n getFirstSelectedTable,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-dom';\nimport type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';\n\n/**\n * Format current focused table with the given format\n * @param editor The editor instance\n * @param format The table format to apply\n * @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color\n */\nexport function formatTable(editor: IEditor, format: TableMetadataFormat, keepCellShade?: boolean) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n // Wipe border metadata\n tableModel.rows.forEach(row => {\n row.cells.forEach(cell => {\n updateTableCellMetadata(cell, metadata => {\n if (metadata) {\n delete metadata.borderOverride;\n }\n return metadata;\n });\n });\n });\n applyTableFormat(tableModel, format, keepCellShade);\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'formatTable',\n }\n );\n}\n"]}
|
|
@@ -8,4 +8,4 @@ import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types
|
|
|
8
8
|
* @param format (Optional) The table format. If not passed, the default format will be applied:
|
|
9
9
|
* background color: #FFF; border color: #ABABAB
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export declare function insertTable(editor: IEditor, columns: number, rows: number, format?: Partial<TableMetadataFormat>): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
define(["require", "exports", "
|
|
1
|
+
define(["require", "exports", "../../modelApi/table/createTableStructure", "roosterjs-content-model-dom"], function (require, exports, createTableStructure_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.insertTable = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Insert table into editor at current selection
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -14,15 +15,15 @@ define(["require", "exports", "roosterjs-content-model-dom", "../../modelApi/tab
|
|
|
14
15
|
editor.focus();
|
|
15
16
|
editor.formatContentModel(function (model, context) {
|
|
16
17
|
var _a, _b, _c;
|
|
17
|
-
var insertPosition = (0,
|
|
18
|
+
var insertPosition = (0, roosterjs_content_model_dom_1.deleteSelection)(model, [], context).insertPoint;
|
|
18
19
|
if (insertPosition) {
|
|
19
20
|
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
20
21
|
var table = (0, createTableStructure_1.createTableStructure)(doc, columns, rows);
|
|
21
|
-
(0,
|
|
22
|
+
(0, roosterjs_content_model_dom_1.normalizeTable)(table, editor.getPendingFormat() || insertPosition.marker.format);
|
|
22
23
|
// Assign default vertical align
|
|
23
24
|
format = format || { verticalAlign: 'top' };
|
|
24
|
-
(0,
|
|
25
|
-
(0,
|
|
25
|
+
(0, roosterjs_content_model_dom_1.applyTableFormat)(table, format);
|
|
26
|
+
(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
|
|
26
27
|
insertPosition: insertPosition,
|
|
27
28
|
mergeFormat: 'mergeAll',
|
|
28
29
|
});
|
|
@@ -30,7 +31,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "../../modelApi/tab
|
|
|
30
31
|
if ((firstBlock === null || firstBlock === void 0 ? void 0 : firstBlock.blockType) == 'Paragraph') {
|
|
31
32
|
var marker = (0, roosterjs_content_model_dom_1.createSelectionMarker)((_c = firstBlock.segments[0]) === null || _c === void 0 ? void 0 : _c.format);
|
|
32
33
|
firstBlock.segments.unshift(marker);
|
|
33
|
-
(0,
|
|
34
|
+
(0, roosterjs_content_model_dom_1.setSelection)(model, marker);
|
|
34
35
|
}
|
|
35
36
|
return true;
|
|
36
37
|
}
|
|
@@ -41,6 +42,6 @@ define(["require", "exports", "roosterjs-content-model-dom", "../../modelApi/tab
|
|
|
41
42
|
apiName: 'insertTable',
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
|
-
exports.
|
|
45
|
+
exports.insertTable = insertTable;
|
|
45
46
|
});
|
|
46
47
|
//# sourceMappingURL=insertTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"insertTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts"],"names":[],"mappings":";;;;IAYA;;;;;;;;OAQG;IACH,SAAgB,WAAW,CACvB,MAAe,EACf,OAAe,EACf,IAAY,EACZ,MAAqC;QAErC,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;YACX,IAAM,cAAc,GAA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kCA0CC","sourcesContent":["import { createTableStructure } from '../../modelApi/table/createTableStructure';\nimport {\n createContentModelDocument,\n createSelectionMarker,\n applyTableFormat,\n deleteSelection,\n mergeModel,\n normalizeTable,\n setSelection,\n} from 'roosterjs-content-model-dom';\nimport type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';\n\n/**\n * Insert table into editor at current selection\n * @param editor The editor instance\n * @param columns Number of columns in table, it also controls the default table cell width:\n * if columns <= 4, width = 120px; if columns <= 6, width = 100px; else width = 70px\n * @param rows Number of rows in table\n * @param format (Optional) The table format. If not passed, the default format will be applied:\n * background color: #FFF; border color: #ABABAB\n */\nexport function insertTable(\n editor: IEditor,\n columns: number,\n rows: number,\n format?: Partial<TableMetadataFormat>\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const insertPosition = deleteSelection(model, [], context).insertPoint;\n\n if (insertPosition) {\n const doc = createContentModelDocument();\n const table = createTableStructure(doc, columns, rows);\n\n normalizeTable(table, editor.getPendingFormat() || insertPosition.marker.format);\n // Assign default vertical align\n format = format || { verticalAlign: 'top' };\n applyTableFormat(table, format);\n mergeModel(model, doc, context, {\n insertPosition,\n mergeFormat: 'mergeAll',\n });\n\n const firstBlock = table.rows[0]?.cells[0]?.blocks[0];\n\n if (firstBlock?.blockType == 'Paragraph') {\n const marker = createSelectionMarker(firstBlock.segments[0]?.format);\n firstBlock.segments.unshift(marker);\n setSelection(model, marker);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'insertTable',\n }\n );\n}\n"]}
|
|
@@ -4,4 +4,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param color The color to set. Pass null to remove existing shade color
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setTableCellShade(editor: IEditor, color: string | null): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setTableCellShade = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set table cell shade color
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -9,13 +10,13 @@ define(["require", "exports", "tslib", "roosterjs-content-model-core"], function
|
|
|
9
10
|
function setTableCellShade(editor, color) {
|
|
10
11
|
editor.focus();
|
|
11
12
|
editor.formatContentModel(function (model) {
|
|
12
|
-
var _a = (0, tslib_1.__read)((0,
|
|
13
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getFirstSelectedTable)(model), 1), table = _a[0];
|
|
13
14
|
if (table) {
|
|
14
|
-
(0,
|
|
15
|
+
(0, roosterjs_content_model_dom_1.normalizeTable)(table);
|
|
15
16
|
table.rows.forEach(function (row) {
|
|
16
17
|
return row.cells.forEach(function (cell) {
|
|
17
|
-
if ((0,
|
|
18
|
-
(0,
|
|
18
|
+
if ((0, roosterjs_content_model_dom_1.hasSelectionInBlockGroup)(cell)) {
|
|
19
|
+
(0, roosterjs_content_model_dom_1.setTableCellBackgroundColor)(cell, color, true /*isColorOverride*/);
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
});
|
|
@@ -28,6 +29,6 @@ define(["require", "exports", "tslib", "roosterjs-content-model-core"], function
|
|
|
28
29
|
apiName: 'setTableCellShade',
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
exports.
|
|
32
|
+
exports.setTableCellShade = setTableCellShade;
|
|
32
33
|
});
|
|
33
34
|
//# sourceMappingURL=setTableCellShade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setTableCellShade.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setTableCellShade.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/setTableCellShade.ts"],"names":[],"mappings":";;;;IAQA;;;;OAIG;IACH,SAAgB,iBAAiB,CAAC,MAAe,EAAE,KAAoB;QACnE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACK,IAAA,KAAA,oBAAU,IAAA,mDAAqB,EAAC,KAAK,CAAC,IAAA,EAArC,KAAK,QAAgC,CAAC;YAE7C,IAAI,KAAK,EAAE;gBACP,IAAA,4CAAc,EAAC,KAAK,CAAC,CAAC;gBAEtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBAClB,OAAA,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;wBAClB,IAAI,IAAA,sDAAwB,EAAC,IAAI,CAAC,EAAE;4BAChC,IAAA,yDAA2B,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;yBACtE;oBACL,CAAC,CAAC;gBAJF,CAIE,CACL,CAAC;gBAEF,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,OAAO,EAAE,mBAAmB;SAC/B,CACJ,CAAC;IACN,CAAC;IA3BD,8CA2BC","sourcesContent":["import {\n hasSelectionInBlockGroup,\n getFirstSelectedTable,\n normalizeTable,\n setTableCellBackgroundColor,\n} from 'roosterjs-content-model-dom';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set table cell shade color\n * @param editor The editor instance\n * @param color The color to set. Pass null to remove existing shade color\n */\nexport function setTableCellShade(editor: IEditor, color: string | null) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const [table] = getFirstSelectedTable(model);\n\n if (table) {\n normalizeTable(table);\n\n table.rows.forEach(row =>\n row.cells.forEach(cell => {\n if (hasSelectionInBlockGroup(cell)) {\n setTableCellBackgroundColor(cell, color, true /*isColorOverride*/);\n }\n })\n );\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'setTableCellShade',\n }\n );\n}\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Invoke a callback to format the selected image using Content Model
|
|
4
|
+
* @param editor The editor object
|
|
5
|
+
* @param apiName Name of API this calling this function. This is mostly for logging.
|
|
6
|
+
* @param callback The callback to format the image. It will be called with current selected table. If no table is selected, it will not be called.
|
|
4
7
|
*/
|
|
5
|
-
export
|
|
8
|
+
export declare function formatImageWithContentModel(editor: IEditor, apiName: string, callback: (segment: ContentModelImage) => void): void;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
define(["require", "exports", "./formatSegmentWithContentModel"], function (require, exports, formatSegmentWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.formatImageWithContentModel = void 0;
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Invoke a callback to format the selected image using Content Model
|
|
7
|
+
* @param editor The editor object
|
|
8
|
+
* @param apiName Name of API this calling this function. This is mostly for logging.
|
|
9
|
+
* @param callback The callback to format the image. It will be called with current selected table. If no table is selected, it will not be called.
|
|
6
10
|
*/
|
|
7
11
|
function formatImageWithContentModel(editor, apiName, callback) {
|
|
8
12
|
(0, formatSegmentWithContentModel_1.formatSegmentWithContentModel)(editor, apiName, function (_, __, segment) {
|
|
@@ -11,6 +15,6 @@ define(["require", "exports", "./formatSegmentWithContentModel"], function (requ
|
|
|
11
15
|
}
|
|
12
16
|
}, undefined /** segmentHasStyleCallback **/, undefined /** includingFormatHolder */);
|
|
13
17
|
}
|
|
14
|
-
exports.
|
|
18
|
+
exports.formatImageWithContentModel = formatImageWithContentModel;
|
|
15
19
|
});
|
|
16
20
|
//# sourceMappingURL=formatImageWithContentModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatImageWithContentModel.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"formatImageWithContentModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/formatImageWithContentModel.ts"],"names":[],"mappings":";;;;IAGA;;;;;OAKG;IACH,SAAgB,2BAA2B,CACvC,MAAe,EACf,OAAe,EACf,QAA8C;QAE9C,IAAA,6DAA6B,EACzB,MAAM,EACN,OAAO,EACP,UAAC,CAAC,EAAE,EAAE,EAAE,OAAO;YACX,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,KAAI,OAAO,EAAE;gBACjC,QAAQ,CAAC,OAAO,CAAC,CAAC;aACrB;QACL,CAAC,EACD,SAAS,CAAC,+BAA+B,EACzC,SAAS,CAAC,4BAA4B,CACzC,CAAC;IACN,CAAC;IAhBD,kEAgBC","sourcesContent":["import { formatSegmentWithContentModel } from './formatSegmentWithContentModel';\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Invoke a callback to format the selected image using Content Model\n * @param editor The editor object\n * @param apiName Name of API this calling this function. This is mostly for logging.\n * @param callback The callback to format the image. It will be called with current selected table. If no table is selected, it will not be called.\n */\nexport function formatImageWithContentModel(\n editor: IEditor,\n apiName: string,\n callback: (segment: ContentModelImage) => void\n) {\n formatSegmentWithContentModel(\n editor,\n apiName,\n (_, __, segment) => {\n if (segment?.segmentType == 'Image') {\n callback(segment);\n }\n },\n undefined /** segmentHasStyleCallback **/,\n undefined /** includingFormatHolder */\n );\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DOMInsertPoint, FormatContentModelOptions, IEditor, InsertPoint, ContentModelDocument, FormatContentModelContext } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatInsertPointWithContentModel(editor: IEditor, insertPoint: DOMInsertPoint, callback: (model: ContentModelDocument, context: FormatContentModelContext, insertPoint?: InsertPoint) => void, options?: FormatContentModelOptions): void;
|
|
@@ -0,0 +1,127 @@
|
|
|
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.formatInsertPointWithContentModel = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function formatInsertPointWithContentModel(editor, insertPoint, callback, options) {
|
|
9
|
+
var bundle = {
|
|
10
|
+
input: insertPoint,
|
|
11
|
+
};
|
|
12
|
+
editor.formatContentModel(function (model, context) {
|
|
13
|
+
callback(model, context, bundle.result);
|
|
14
|
+
if (bundle === null || bundle === void 0 ? void 0 : bundle.result) {
|
|
15
|
+
var _a = bundle.result, paragraph = _a.paragraph, marker = _a.marker;
|
|
16
|
+
var index = paragraph.segments.indexOf(marker);
|
|
17
|
+
if (index >= 0) {
|
|
18
|
+
paragraph.segments.splice(index, 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}, options, {
|
|
23
|
+
processorOverride: {
|
|
24
|
+
child: getShadowChildProcessor(bundle),
|
|
25
|
+
textWithSelection: getShadowTextProcessor(bundle),
|
|
26
|
+
},
|
|
27
|
+
tryGetFromCache: false,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.formatInsertPointWithContentModel = formatInsertPointWithContentModel;
|
|
31
|
+
function getShadowChildProcessor(bundle) {
|
|
32
|
+
return function (group, parent, context) {
|
|
33
|
+
var contextWithPath = context;
|
|
34
|
+
contextWithPath.path = contextWithPath.path || [];
|
|
35
|
+
var shouldShiftPath = false;
|
|
36
|
+
if (contextWithPath.path[0] != group) {
|
|
37
|
+
contextWithPath.path.unshift(group);
|
|
38
|
+
shouldShiftPath = true;
|
|
39
|
+
}
|
|
40
|
+
var offsets = getShadowSelectionOffsets(context, bundle, parent);
|
|
41
|
+
var index = 0;
|
|
42
|
+
for (var child = parent.firstChild; child; child = child.nextSibling) {
|
|
43
|
+
handleElementShadowSelection(bundle, index, context, group, offsets, parent);
|
|
44
|
+
(0, roosterjs_content_model_dom_1.processChildNode)(group, child, context);
|
|
45
|
+
index++;
|
|
46
|
+
}
|
|
47
|
+
handleElementShadowSelection(bundle, index, context, group, offsets, parent);
|
|
48
|
+
if (shouldShiftPath) {
|
|
49
|
+
contextWithPath.path.shift();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function handleElementShadowSelection(bundle, index, context, group, offsets, container) {
|
|
54
|
+
if (index == offsets[2] &&
|
|
55
|
+
(index <= offsets[0] || offsets[0] < 0) &&
|
|
56
|
+
(index < offsets[1] || offsets[1] < 0)) {
|
|
57
|
+
addSelectionMarker(group, context, container, index, bundle);
|
|
58
|
+
offsets[2] = -1;
|
|
59
|
+
}
|
|
60
|
+
if (index == offsets[0]) {
|
|
61
|
+
context.isInSelection = true;
|
|
62
|
+
addSelectionMarker(group, context, container, index);
|
|
63
|
+
}
|
|
64
|
+
if (index == offsets[2] && (index < offsets[1] || offsets[1] < 0)) {
|
|
65
|
+
addSelectionMarker(group, context, container, index, bundle);
|
|
66
|
+
offsets[2] = -1;
|
|
67
|
+
}
|
|
68
|
+
if (index == offsets[1]) {
|
|
69
|
+
addSelectionMarker(group, context, container, index);
|
|
70
|
+
context.isInSelection = false;
|
|
71
|
+
}
|
|
72
|
+
if (index == offsets[2]) {
|
|
73
|
+
addSelectionMarker(group, context, container, index, bundle);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var getShadowTextProcessor = function (bundle) { return function (group, textNode, context) {
|
|
77
|
+
var txt = textNode.nodeValue || '';
|
|
78
|
+
var offsets = getShadowSelectionOffsets(context, bundle, textNode);
|
|
79
|
+
var _a = (0, tslib_1.__read)(offsets, 3), start = _a[0], end = _a[1], shadow = _a[2];
|
|
80
|
+
var handleTextSelection = function (subtract, originalOffset, bundle) {
|
|
81
|
+
(0, roosterjs_content_model_dom_1.addTextSegment)(group, txt.substring(0, subtract), context);
|
|
82
|
+
addSelectionMarker(group, context, textNode, originalOffset, bundle);
|
|
83
|
+
offsets[0] -= subtract;
|
|
84
|
+
offsets[1] -= subtract;
|
|
85
|
+
offsets[2] = bundle ? -1 : offsets[2] - subtract;
|
|
86
|
+
txt = txt.substring(subtract);
|
|
87
|
+
};
|
|
88
|
+
if (offsets[2] >= 0 &&
|
|
89
|
+
(offsets[2] <= offsets[0] || offsets[0] < 0) &&
|
|
90
|
+
(offsets[2] < offsets[1] || offsets[1] < 0)) {
|
|
91
|
+
handleTextSelection(offsets[2], shadow, bundle);
|
|
92
|
+
}
|
|
93
|
+
if (offsets[0] >= 0) {
|
|
94
|
+
handleTextSelection(offsets[0], start);
|
|
95
|
+
context.isInSelection = true;
|
|
96
|
+
}
|
|
97
|
+
if (offsets[2] >= 0 && offsets[2] > offsets[0] && (offsets[2] < offsets[1] || offsets[1] < 0)) {
|
|
98
|
+
handleTextSelection(offsets[2], shadow, bundle);
|
|
99
|
+
}
|
|
100
|
+
if (offsets[1] >= 0) {
|
|
101
|
+
handleTextSelection(offsets[1], end);
|
|
102
|
+
context.isInSelection = false;
|
|
103
|
+
}
|
|
104
|
+
if (offsets[2] >= 0 && offsets[2] >= offsets[1]) {
|
|
105
|
+
handleTextSelection(offsets[2], shadow, bundle);
|
|
106
|
+
}
|
|
107
|
+
(0, roosterjs_content_model_dom_1.addTextSegment)(group, txt, context);
|
|
108
|
+
}; };
|
|
109
|
+
function addSelectionMarker(group, context, container, offset, bundle) {
|
|
110
|
+
var marker = (0, roosterjs_content_model_dom_1.buildSelectionMarker)(group, context, container, offset);
|
|
111
|
+
marker.isSelected = !bundle;
|
|
112
|
+
var para = (0, roosterjs_content_model_dom_1.addSegment)(group, marker, context.blockFormat, marker.format);
|
|
113
|
+
if (bundle && context.path) {
|
|
114
|
+
bundle.result = {
|
|
115
|
+
path: (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(context.path), false),
|
|
116
|
+
paragraph: para,
|
|
117
|
+
marker: marker,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function getShadowSelectionOffsets(context, bundle, currentContainer) {
|
|
122
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getRegularSelectionOffsets)(context, currentContainer), 2), start = _a[0], end = _a[1];
|
|
123
|
+
var shadow = bundle.input.node == currentContainer ? bundle.input.offset : -1;
|
|
124
|
+
return [start, end, shadow];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=formatInsertPointWithContentModel.js.map
|