roosterjs-content-model-api 0.26.4 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +46 -42
- package/lib/index.js +52 -43
- package/lib/index.js.map +1 -1
- package/lib/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib/modelApi/block/setModelDirection.js.map +1 -1
- package/lib/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib/modelApi/common/wrapBlock.js.map +1 -1
- package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.js +2 -1
- 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.d.ts +2 -1
- package/lib/modelApi/list/setListType.js +5 -3
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- 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.map +1 -1
- package/lib/modelApi/table/canMergeCells.js.map +1 -1
- 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.map +1 -1
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/block/setAlignment.d.ts +2 -2
- package/lib/publicApi/block/setAlignment.js +2 -1
- package/lib/publicApi/block/setAlignment.js.map +1 -1
- package/lib/publicApi/block/setDirection.d.ts +2 -2
- package/lib/publicApi/block/setDirection.js +2 -1
- package/lib/publicApi/block/setDirection.js.map +1 -1
- package/lib/publicApi/block/setHeadingLevel.d.ts +2 -2
- package/lib/publicApi/block/setHeadingLevel.js +2 -1
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib/publicApi/block/setIndentation.d.ts +2 -2
- package/lib/publicApi/block/setIndentation.js +2 -1
- package/lib/publicApi/block/setIndentation.js.map +1 -1
- package/lib/publicApi/block/setParagraphMargin.d.ts +2 -2
- package/lib/publicApi/block/setParagraphMargin.js +2 -1
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib/publicApi/block/setSpacing.d.ts +2 -2
- package/lib/publicApi/block/setSpacing.js +2 -1
- package/lib/publicApi/block/setSpacing.js.map +1 -1
- package/lib/publicApi/block/toggleBlockQuote.d.ts +2 -2
- package/lib/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib/publicApi/entity/insertEntity.d.ts +5 -5
- package/lib/publicApi/entity/insertEntity.js +24 -4
- package/lib/publicApi/entity/insertEntity.js.map +1 -1
- package/lib/publicApi/format/clearFormat.d.ts +2 -2
- package/lib/publicApi/format/clearFormat.js +2 -1
- package/lib/publicApi/format/clearFormat.js.map +1 -1
- package/lib/publicApi/format/getFormatState.d.ts +2 -2
- package/lib/publicApi/format/getFormatState.js +2 -1
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/adjustImageSelection.d.ts +2 -2
- package/lib/publicApi/image/adjustImageSelection.js +2 -1
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib/publicApi/image/changeImage.d.ts +2 -2
- package/lib/publicApi/image/changeImage.js +3 -2
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.d.ts +2 -2
- package/lib/publicApi/image/insertImage.js +2 -1
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/image/setImageAltText.d.ts +2 -2
- package/lib/publicApi/image/setImageAltText.js +3 -2
- package/lib/publicApi/image/setImageAltText.js.map +1 -1
- package/lib/publicApi/image/setImageBorder.d.ts +2 -2
- package/lib/publicApi/image/setImageBorder.js +4 -3
- package/lib/publicApi/image/setImageBorder.js.map +1 -1
- package/lib/publicApi/image/setImageBoxShadow.d.ts +2 -2
- package/lib/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib/publicApi/link/adjustLinkSelection.d.ts +2 -2
- package/lib/publicApi/link/adjustLinkSelection.js +2 -1
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +2 -2
- package/lib/publicApi/link/insertLink.js +2 -1
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +2 -2
- package/lib/publicApi/link/removeLink.js +2 -1
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib/publicApi/list/setListStartNumber.js +2 -1
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +2 -2
- package/lib/publicApi/list/setListStyle.js +2 -1
- package/lib/publicApi/list/setListStyle.js.map +1 -1
- package/lib/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib/publicApi/list/toggleBullet.js +6 -3
- package/lib/publicApi/list/toggleBullet.js.map +1 -1
- package/lib/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib/publicApi/list/toggleNumbering.js +6 -3
- package/lib/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib/publicApi/segment/applySegmentFormat.d.ts +2 -2
- package/lib/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib/publicApi/segment/changeCapitalization.d.ts +2 -2
- package/lib/publicApi/segment/changeCapitalization.js +2 -1
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib/publicApi/segment/changeFontSize.d.ts +2 -2
- package/lib/publicApi/segment/changeFontSize.js +2 -1
- package/lib/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib/publicApi/segment/setBackgroundColor.d.ts +2 -2
- package/lib/publicApi/segment/setBackgroundColor.js +2 -1
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib/publicApi/segment/setFontName.d.ts +2 -2
- package/lib/publicApi/segment/setFontName.js +2 -1
- package/lib/publicApi/segment/setFontName.js.map +1 -1
- package/lib/publicApi/segment/setFontSize.d.ts +2 -2
- package/lib/publicApi/segment/setFontSize.js +2 -2
- package/lib/publicApi/segment/setFontSize.js.map +1 -1
- package/lib/publicApi/segment/setTextColor.d.ts +2 -2
- package/lib/publicApi/segment/setTextColor.js +2 -1
- package/lib/publicApi/segment/setTextColor.js.map +1 -1
- package/lib/publicApi/segment/toggleBold.d.ts +2 -2
- package/lib/publicApi/segment/toggleBold.js +2 -1
- package/lib/publicApi/segment/toggleBold.js.map +1 -1
- package/lib/publicApi/segment/toggleCode.d.ts +2 -2
- package/lib/publicApi/segment/toggleCode.js +2 -1
- package/lib/publicApi/segment/toggleCode.js.map +1 -1
- package/lib/publicApi/segment/toggleItalic.d.ts +2 -2
- package/lib/publicApi/segment/toggleItalic.js +2 -1
- package/lib/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +2 -2
- package/lib/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib/publicApi/segment/toggleSubscript.d.ts +2 -2
- package/lib/publicApi/segment/toggleSubscript.js +2 -1
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib/publicApi/segment/toggleSuperscript.d.ts +2 -2
- package/lib/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib/publicApi/segment/toggleUnderline.d.ts +2 -2
- package/lib/publicApi/segment/toggleUnderline.js +2 -1
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +2 -2
- package/lib/publicApi/table/applyTableBorderFormat.js +2 -1
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.d.ts +2 -2
- package/lib/publicApi/table/editTable.js +2 -1
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/formatTable.d.ts +2 -2
- package/lib/publicApi/table/formatTable.js +2 -1
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +2 -2
- package/lib/publicApi/table/insertTable.js +2 -1
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib/publicApi/table/setTableCellShade.js +2 -1
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
- package/lib/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
- package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-amd/index.d.ts +46 -42
- package/lib-amd/index.js +48 -44
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
- 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 +2 -1
- 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.d.ts +2 -1
- package/lib-amd/modelApi/list/setListType.js +5 -3
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- 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.map +1 -1
- package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/block/setAlignment.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +5 -5
- package/lib-amd/publicApi/entity/insertEntity.js +24 -4
- package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-amd/publicApi/format/clearFormat.d.ts +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/format/getFormatState.js +2 -1
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.d.ts +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/image/changeImage.js +3 -2
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.d.ts +2 -2
- package/lib-amd/publicApi/image/insertImage.js +2 -1
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/image/setImageAltText.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/link/adjustLinkSelection.js +2 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-amd/publicApi/link/insertLink.d.ts +2 -2
- package/lib-amd/publicApi/link/insertLink.js +2 -1
- package/lib-amd/publicApi/link/insertLink.js.map +1 -1
- package/lib-amd/publicApi/link/removeLink.d.ts +2 -2
- package/lib-amd/publicApi/link/removeLink.js +2 -1
- package/lib-amd/publicApi/link/removeLink.js.map +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib-amd/publicApi/list/setListStartNumber.js +2 -1
- package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-amd/publicApi/list/setListStyle.d.ts +2 -2
- package/lib-amd/publicApi/list/setListStyle.js +2 -1
- package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
- package/lib-amd/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib-amd/publicApi/list/toggleBullet.js +6 -3
- package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib-amd/publicApi/list/toggleNumbering.js +6 -3
- package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/segment/setBackgroundColor.js +2 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontName.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/segment/toggleBold.js +2 -1
- package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleCode.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +2 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.d.ts +2 -2
- 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 +2 -2
- package/lib-amd/publicApi/table/formatTable.js +2 -1
- package/lib-amd/publicApi/table/formatTable.js.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +2 -2
- package/lib-amd/publicApi/table/insertTable.js +2 -1
- package/lib-amd/publicApi/table/insertTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib-amd/publicApi/table/setTableCellShade.js +2 -1
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-mjs/index.d.ts +46 -42
- package/lib-mjs/index.js +46 -42
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
- 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 +1 -1
- 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.d.ts +2 -1
- package/lib-mjs/modelApi/list/setListType.js +5 -3
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- 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.map +1 -1
- package/lib-mjs/modelApi/table/canMergeCells.js.map +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.map +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.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/block/setAlignment.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +5 -5
- package/lib-mjs/publicApi/entity/insertEntity.js +23 -4
- package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-mjs/publicApi/format/clearFormat.d.ts +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/format/getFormatState.js +1 -1
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/image/changeImage.js +2 -2
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.d.ts +2 -2
- package/lib-mjs/publicApi/image/insertImage.js +1 -1
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/link/adjustLinkSelection.js +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.d.ts +2 -2
- package/lib-mjs/publicApi/link/insertLink.js +1 -1
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
- package/lib-mjs/publicApi/link/removeLink.d.ts +2 -2
- package/lib-mjs/publicApi/link/removeLink.js +1 -1
- package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib-mjs/publicApi/list/setListStartNumber.js +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStyle.d.ts +2 -2
- package/lib-mjs/publicApi/list/setListStyle.js +1 -1
- package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib-mjs/publicApi/list/toggleBullet.js +4 -2
- package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib-mjs/publicApi/list/toggleNumbering.js +4 -2
- package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/segment/setBackgroundColor.js +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontName.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/segment/toggleBold.js +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.d.ts +2 -2
- 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 +2 -2
- package/lib-mjs/publicApi/table/formatTable.js +1 -1
- package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +2 -2
- package/lib-mjs/publicApi/table/insertTable.js +1 -1
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib-mjs/publicApi/table/setTableCellShade.js +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +5 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ContentModelParagraph, ContentModelSegmentFormat,
|
|
1
|
+
import type { ContentModelParagraph, ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set font size
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param fontSize The font size to set
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setFontSize(editor: IEditor, fontSize: string): void;
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
* Internal set font function shared by setFontSize and changeFontSize
|
|
@@ -4,7 +4,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param fontSize The font size to set
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function setFontSize(editor, fontSize) {
|
|
8
8
|
editor.focus();
|
|
9
9
|
formatSegmentWithContentModel(editor, 'setFontSize', function (format, _, __, paragraph) { return setFontSizeInternal(fontSize, format, paragraph); }, undefined /* segmentHasStyleCallback*/, true /*includingFormatHandler*/);
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setFontSize.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setFontSize.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/setFontSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAOvF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,QAAgB;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,aAAa,EACb,UAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,IAAK,OAAA,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAhD,CAAgD,EAC9E,SAAS,CAAC,4BAA4B,EACtC,IAAI,CAAC,0BAA0B,CAClC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAC/B,QAAgB,EAChB,MAAiC,EACjC,SAAuC;;IAEvC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE3B,iIAAiI;IACjI,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,aAAa,0CAAE,QAAQ,EAAE;QACpC,IAAM,MAAI,GAAG,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;QAE9C,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;YAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAI,CAAC;aAClC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;KAC3C;AACL,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type {\n ContentModelParagraph,\n ContentModelSegmentFormat,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * Set font size\n * @param editor The editor to operate on\n * @param fontSize The font size to set\n */\nexport function setFontSize(editor: IEditor, fontSize: string) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'setFontSize',\n (format, _, __, paragraph) => setFontSizeInternal(fontSize, format, paragraph),\n undefined /* segmentHasStyleCallback*/,\n true /*includingFormatHandler*/\n );\n}\n\n/**\n * @internal\n * Internal set font function shared by setFontSize and changeFontSize\n */\nexport function setFontSizeInternal(\n fontSize: string,\n format: ContentModelSegmentFormat,\n paragraph: ContentModelParagraph | null\n) {\n format.fontSize = fontSize;\n\n // Since we have set font size to segment, it can be smaller than the one in paragraph format, so delete font size from paragraph\n if (paragraph?.segmentFormat?.fontSize) {\n const size = paragraph.segmentFormat.fontSize;\n\n paragraph.segments.forEach(segment => {\n if (!segment.format.fontSize) {\n segment.format.fontSize = size;\n }\n });\n\n delete paragraph.segmentFormat.fontSize;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set text color
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param textColor The text color to set. Pass null to remove existing color.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setTextColor(editor: IEditor, textColor: string | null): void;
|
|
@@ -4,7 +4,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param textColor The text color to set. Pass null to remove existing color.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function setTextColor(editor, textColor) {
|
|
8
8
|
editor.focus();
|
|
9
9
|
formatSegmentWithContentModel(editor, 'setTextColor', textColor === null
|
|
10
10
|
? function (format, _, segment) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setTextColor.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setTextColor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/setTextColor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe,EAAE,SAAwB;IAClE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,cAAc,EACd,SAAS,KAAK,IAAI;QACd,CAAC,CAAC,UAAC,MAAM,EAAE,CAAC,EAAE,OAAO;YACf,OAAO,MAAM,CAAC,SAAS,CAAC;YAExB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;aACxC;QACL,CAAC;QACH,CAAC,CAAC,UAAC,MAAM,EAAE,CAAC,EAAE,OAAO;YACf,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;YAE7B,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;aAC7C;QACL,CAAC,EACP,SAAS,CAAC,4BAA4B,EACtC,IAAI,CAAC,0BAA0B,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text color\n * @param editor The editor to operate on\n * @param textColor The text color to set. Pass null to remove existing color.\n */\nexport function setTextColor(editor: IEditor, textColor: string | null) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'setTextColor',\n textColor === null\n ? (format, _, segment) => {\n delete format.textColor;\n\n if (segment?.link) {\n delete segment.link.format.textColor;\n }\n }\n : (format, _, segment) => {\n format.textColor = textColor;\n\n if (segment?.link) {\n segment.link.format.textColor = textColor;\n }\n },\n undefined /* segmentHasStyleCallback*/,\n true /*includingFormatHandler*/\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle bold style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleBold(editor: IEditor): void;
|
|
@@ -4,7 +4,7 @@ import { isBold } from 'roosterjs-content-model-core';
|
|
|
4
4
|
* Toggle bold style
|
|
5
5
|
* @param editor The editor to operate on
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function toggleBold(editor) {
|
|
8
8
|
editor.focus();
|
|
9
9
|
formatSegmentWithContentModel(editor, 'toggleBold', function (format, isTurningOn) {
|
|
10
10
|
format.fontWeight = isTurningOn ? 'bold' : 'normal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleBold.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleBold.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleBold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe;IACtC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,YAAY,EACZ,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxD,CAAC,EACD,UAAC,MAAM,EAAE,CAAC,EAAE,SAAS;;QACjB,OAAA,MAAM,CACF,OAAO,MAAM,CAAC,UAAU,IAAI,WAAW;YACnC,CAAC,CAAC,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,0CAAE,MAAM,CAAC,UAAU;YACzC,CAAC,CAAC,MAAM,CAAC,UAAU,CAC1B,CAAA;KAAA,CACR,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport { isBold } from 'roosterjs-content-model-core';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle bold style\n * @param editor The editor to operate on\n */\nexport function toggleBold(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleBold',\n (format, isTurningOn) => {\n format.fontWeight = isTurningOn ? 'bold' : 'normal';\n },\n (format, _, paragraph) =>\n isBold(\n typeof format.fontWeight == 'undefined'\n ? paragraph?.decorator?.format.fontWeight\n : format.fontWeight\n )\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle italic style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleCode(editor: IEditor): void;
|
|
@@ -9,7 +9,7 @@ var DefaultCode = {
|
|
|
9
9
|
* Toggle italic style
|
|
10
10
|
* @param editor The editor to operate on
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export function toggleCode(editor) {
|
|
13
13
|
editor.focus();
|
|
14
14
|
formatSegmentWithContentModel(editor, 'toggleCode', function (_, isTurningOn, segment) {
|
|
15
15
|
if (segment) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleCode.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleCode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF,IAAM,WAAW,GAAqB;IAClC,MAAM,EAAE;QACJ,UAAU,EAAE,WAAW;KAC1B;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe;IACtC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,YAAY,EACZ,UAAC,CAAC,EAAE,WAAW,EAAE,OAAO;QACpB,IAAI,OAAO,EAAE;YACT,IAAI,WAAW,EAAE;gBACb,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;aACjC;iBAAM;gBACH,OAAO,OAAO,CAAC,IAAI,CAAC;aACvB;SACJ;IACL,CAAC,EACD,UAAC,CAAC,EAAE,OAAO,IAAK,OAAA,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAA,EAAf,CAAe,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { addCode } from 'roosterjs-content-model-dom';\nimport { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { ContentModelCode, IEditor } from 'roosterjs-content-model-types';\n\nconst DefaultCode: ContentModelCode = {\n format: {\n fontFamily: 'monospace',\n },\n};\n\n/**\n * Toggle italic style\n * @param editor The editor to operate on\n */\nexport function toggleCode(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleCode',\n (_, isTurningOn, segment) => {\n if (segment) {\n if (isTurningOn) {\n addCode(segment, DefaultCode);\n } else {\n delete segment.code;\n }\n }\n },\n (_, segment) => !!segment?.code\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle italic style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleItalic(editor: IEditor): void;
|
|
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
3
3
|
* Toggle italic style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export function toggleItalic(editor) {
|
|
7
7
|
editor.focus();
|
|
8
8
|
formatSegmentWithContentModel(editor, 'toggleItalic', function (format, isTurningOn) {
|
|
9
9
|
format.italic = !!isTurningOn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleItalic.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleItalic.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleItalic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe;IACxC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,cAAc,EACd,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;IAClC,CAAC,EACD,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,MAAM,EAAf,CAAe,CAC5B,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle italic style\n * @param editor The editor to operate on\n */\nexport function toggleItalic(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleItalic',\n (format, isTurningOn) => {\n format.italic = !!isTurningOn;\n },\n format => !!format.italic\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle strikethrough style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleStrikethrough(editor: IEditor): void;
|
|
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
3
3
|
* Toggle strikethrough style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export function toggleStrikethrough(editor) {
|
|
7
7
|
editor.focus();
|
|
8
8
|
formatSegmentWithContentModel(editor, 'toggleStrikethrough', function (format, isTurningOn) {
|
|
9
9
|
format.strikethrough = !!isTurningOn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleStrikethrough.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleStrikethrough.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleStrikethrough.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAe;IAC/C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,qBAAqB,EACrB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC;IACzC,CAAC,EACD,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,aAAa,EAAtB,CAAsB,CACnC,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle strikethrough style\n * @param editor The editor to operate on\n */\nexport function toggleStrikethrough(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleStrikethrough',\n (format, isTurningOn) => {\n format.strikethrough = !!isTurningOn;\n },\n format => !!format.strikethrough\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle subscript style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleSubscript(editor: IEditor): void;
|
|
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
3
3
|
* Toggle subscript style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export function toggleSubscript(editor) {
|
|
7
7
|
editor.focus();
|
|
8
8
|
formatSegmentWithContentModel(editor, 'toggleSubscript', function (format, isTurningOn) {
|
|
9
9
|
format.superOrSubScriptSequence = isTurningOn ? 'sub' : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleSubscript.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleSubscript.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleSubscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe;IAC3C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,iBAAiB,EACjB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,CAAC,EACD,UAAA,MAAM,YAAI,OAAA,CAAA,MAAA,MAAM,CAAC,wBAAwB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAI,KAAK,CAAA,EAAA,CACvE,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle subscript style\n * @param editor The editor to operate on\n */\nexport function toggleSubscript(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleSubscript',\n (format, isTurningOn) => {\n format.superOrSubScriptSequence = isTurningOn ? 'sub' : '';\n },\n format => format.superOrSubScriptSequence?.split(' ').pop() == 'sub'\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle superscript style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleSuperscript(editor: IEditor): void;
|
|
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
3
3
|
* Toggle superscript style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export function toggleSuperscript(editor) {
|
|
7
7
|
editor.focus();
|
|
8
8
|
formatSegmentWithContentModel(editor, 'toggleSuperscript', function (format, isTurningOn) {
|
|
9
9
|
format.superOrSubScriptSequence = isTurningOn ? 'super' : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleSuperscript.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleSuperscript.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleSuperscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC7C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,mBAAmB,EACnB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC,EACD,UAAA,MAAM,YAAI,OAAA,CAAA,MAAA,MAAM,CAAC,wBAAwB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAI,OAAO,CAAA,EAAA,CACzE,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle superscript style\n * @param editor The editor to operate on\n */\nexport function toggleSuperscript(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleSuperscript',\n (format, isTurningOn) => {\n format.superOrSubScriptSequence = isTurningOn ? 'super' : '';\n },\n format => format.superOrSubScriptSequence?.split(' ').pop() == 'super'\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle underline style
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function toggleUnderline(editor: IEditor): void;
|
|
@@ -4,7 +4,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
|
|
|
4
4
|
* Toggle underline style
|
|
5
5
|
* @param editor The editor to operate on
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function toggleUnderline(editor) {
|
|
8
8
|
editor.focus();
|
|
9
9
|
formatSegmentWithContentModel(editor, 'toggleUnderline', function (format, isTurningOn, segment) {
|
|
10
10
|
format.underline = !!isTurningOn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleUnderline.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleUnderline.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleUnderline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe;IAC3C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,iBAAiB,EACjB,UAAC,MAAM,EAAE,WAAW,EAAE,OAAO;QACzB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC;QAEjC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC;SACjD;IACL,CAAC,EACD,UAAC,MAAM,EAAE,OAAO,gBAAK,OAAA,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,CAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,MAAM,0CAAE,SAAS,CAAA,CAAA,EAAA,EAC7E,KAAK,CAAC,yBAAyB,EAC/B,4BAA4B,CAC/B,CAAC;AACN,CAAC","sourcesContent":["import { adjustTrailingSpaceSelection } from '../../modelApi/selection/adjustTrailingSpaceSelection';\nimport { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle underline style\n * @param editor The editor to operate on\n */\nexport function toggleUnderline(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleUnderline',\n (format, isTurningOn, segment) => {\n format.underline = !!isTurningOn;\n\n if (segment?.link) {\n segment.link.format.underline = !!isTurningOn;\n }\n },\n (format, segment) => !!format.underline || !!segment?.link?.format?.underline,\n false /*includingFormatHolder*/,\n adjustTrailingSpaceSelection\n );\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor, Border, BorderOperations } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Operations to apply border
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param border The border to apply
|
|
6
6
|
* @param operation The operation to apply
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function applyTableBorderFormat(editor: IEditor, border: Border, operation: BorderOperations): void;
|
|
@@ -7,7 +7,7 @@ import { extractBorderValues, getFirstSelectedTable, getSelectedCells, updateTab
|
|
|
7
7
|
* @param border The border to apply
|
|
8
8
|
* @param operation The operation to apply
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export function applyTableBorderFormat(editor, border, operation) {
|
|
11
11
|
editor.formatContentModel(function (model) {
|
|
12
12
|
var _a = __read(getFirstSelectedTable(model), 1), tableModel = _a[0];
|
|
13
13
|
if (tableModel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyTableBorderFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/applyTableBorderFormat.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GAC1B,MAAM,8BAA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E,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;SACxD;KACJ;IACD,oBAAoB;IACpB,IAAI,SAAS,CAAC,IAAI,IAAI,GAAG,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,EAAE;QAC5C,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;YACnE,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;YAClE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;SACjF;KACJ;IACD,qBAAqB;IACrB,IAAI,SAAS,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;QACzE,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;YACnE,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YACjE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;SACjF;KACJ;AACL,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 IStandaloneEditor,\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: IStandaloneEditor,\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":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GAC1B,MAAM,8BAA8B,CAAC;AA4BtC;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAClC,MAAe,EACf,MAAc,EACd,SAA2B;IAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,OAAe,qBAAqB,CAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,IAAM,GAAG,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACzC,IAAM,SAAS,GAAc;gBACzB,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;aACf,CAAC;YAEF,mDAAmD;YACnD,IAAI,YAAY,GAAG,EAAE,CAAC;YACtB,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YACzB,IAAA,KAAK,GAAmB,MAAM,MAAzB,EAAE,KAAK,GAAY,MAAM,MAAlB,EAAE,KAAK,GAAK,MAAM,MAAX,CAAY;YACvC,IAAM,eAAe,GAAG,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC9D,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;YAC1C,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;YAC1C,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;YAE1C,IAAI,KA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AAU,GAAG,CAAC,CAAC,CAAC;YACjE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;SACjF;KACJ;AACL,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 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,7 +1,7 @@
|
|
|
1
|
-
import type { TableOperation,
|
|
1
|
+
import type { TableOperation, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Format current focused table with the given format
|
|
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;
|
|
@@ -16,7 +16,7 @@ import { alignTableCellHorizontally, alignTableCellVertically, } from '../../mod
|
|
|
16
16
|
* @param editor The editor instance
|
|
17
17
|
* @param operation The table operation to apply
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export function editTable(editor, operation) {
|
|
20
20
|
editor.focus();
|
|
21
21
|
formatTableWithContentModel(editor, 'editTable', function (tableModel) {
|
|
22
22
|
switch (operation) {
|
|
@@ -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":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,WA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iB,CAAC,UAAU,CAAC,CAAC;gBAC9B,MAAM;YAEV,KAAK,WAAW;gBACZ,cAAc,CAAC,UAAU,CAAC,CAAC;gBAC3B,MAAM;YAEV,KAAK,aAAa;gBACd,WAAW,CAAC,UAAU,CAAC,CAAC;gBACxB,MAAM;YAEV,KAAK,aAAa,CAAC;YACnB,KAAK,aAAa;gBACd,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACtC,MAAM;YAEV,KAAK,YAAY,CAAC;YAClB,KAAK,aAAa;gBACd,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACzC,MAAM;YAEV,KAAK,YAAY,CAAC;YAClB,KAAK,YAAY;gBACb,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACrC,MAAM;YAEV,KAAK,YAAY;gBACb,eAAe,CAAC,UAAU,CAAC,CAAC;gBAC5B,MAAM;YAEV,KAAK,WAAW,CAAC;YACjB,KAAK,YAAY;gBACb,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACxC,MAAM;YAEV,KAAK,mBAAmB;gBACpB,0BAA0B,CAAC,UAAU,CAAC,CAAC;gBACvC,MAAM;YAEV,KAAK,iBAAiB;gBAClB,wBAAwB,CAAC,UAAU,CAAC,CAAC;gBACrC,MAAM;SACb;IACL,CAAC,CAAC,CAAC;AACP,CAAC","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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Format current focused table with the given format
|
|
4
4
|
* @param editor The editor instance
|
|
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;
|
|
@@ -6,7 +6,7 @@ import { applyTableFormat, getFirstSelectedTable, updateTableCellMetadata, } fro
|
|
|
6
6
|
* @param format The table format to apply
|
|
7
7
|
* @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function formatTable(editor, format, keepCellShade) {
|
|
10
10
|
editor.focus();
|
|
11
11
|
editor.formatContentModel(function (model) {
|
|
12
12
|
var _a = __read(getFirstSelectedTable(model), 1), tableModel = _a[0];
|
|
@@ -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":";AAAA,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,GAC1B,MAAM,8BAA8B,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,MAA2B,EAAE,aAAuB;IAC7F,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,OAAe,qBAAqB,CAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,uBAAuB;YACvB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;gBACvB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;oBAClB,uBAAuB,CAAC,IAAI,EAAE,UAAA,QAAQ;wBAClC,IAAI,QAAQ,EAAE;4BACV,OAAO,QAAQ,CAAC,cAAc,CAAC;yBAClC;wBACD,OAAO,QAAQ,CAAC;oBACpB,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import {\n applyTableFormat,\n getFirstSelectedTable,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert table into editor at current selection
|
|
4
4
|
* @param editor The editor instance
|
|
@@ -8,4 +8,4 @@ import type { IStandaloneEditor, TableMetadataFormat } from 'roosterjs-content-m
|
|
|
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;
|
|
@@ -10,7 +10,7 @@ import { applyTableFormat, deleteSelection, mergeModel, normalizeTable, setSelec
|
|
|
10
10
|
* @param format (Optional) The table format. If not passed, the default format will be applied:
|
|
11
11
|
* background color: #FFF; border color: #ABABAB
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export function insertTable(editor, columns, rows, format) {
|
|
14
14
|
editor.focus();
|
|
15
15
|
editor.formatContentModel(function (model, context) {
|
|
16
16
|
var _a, _b, _c;
|