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
package/lib-amd/index.d.ts
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
1
|
+
export { insertTable } from './publicApi/table/insertTable';
|
|
2
|
+
export { formatTable } from './publicApi/table/formatTable';
|
|
3
|
+
export { setTableCellShade } from './publicApi/table/setTableCellShade';
|
|
4
|
+
export { editTable } from './publicApi/table/editTable';
|
|
5
|
+
export { applyTableBorderFormat } from './publicApi/table/applyTableBorderFormat';
|
|
6
|
+
export { toggleBullet } from './publicApi/list/toggleBullet';
|
|
7
|
+
export { toggleNumbering } from './publicApi/list/toggleNumbering';
|
|
8
|
+
export { toggleBold } from './publicApi/segment/toggleBold';
|
|
9
|
+
export { toggleItalic } from './publicApi/segment/toggleItalic';
|
|
10
|
+
export { toggleUnderline } from './publicApi/segment/toggleUnderline';
|
|
11
|
+
export { toggleStrikethrough } from './publicApi/segment/toggleStrikethrough';
|
|
12
|
+
export { toggleSubscript } from './publicApi/segment/toggleSubscript';
|
|
13
|
+
export { toggleSuperscript } from './publicApi/segment/toggleSuperscript';
|
|
14
|
+
export { setBackgroundColor } from './publicApi/segment/setBackgroundColor';
|
|
15
|
+
export { setFontName } from './publicApi/segment/setFontName';
|
|
16
|
+
export { setFontSize } from './publicApi/segment/setFontSize';
|
|
17
|
+
export { setTextColor } from './publicApi/segment/setTextColor';
|
|
18
|
+
export { changeFontSize } from './publicApi/segment/changeFontSize';
|
|
19
|
+
export { applySegmentFormat } from './publicApi/segment/applySegmentFormat';
|
|
20
|
+
export { changeCapitalization } from './publicApi/segment/changeCapitalization';
|
|
21
|
+
export { insertImage } from './publicApi/image/insertImage';
|
|
22
|
+
export { setListStyle } from './publicApi/list/setListStyle';
|
|
23
|
+
export { setListStartNumber } from './publicApi/list/setListStartNumber';
|
|
24
|
+
export { setIndentation } from './publicApi/block/setIndentation';
|
|
25
|
+
export { setAlignment } from './publicApi/block/setAlignment';
|
|
26
|
+
export { setDirection } from './publicApi/block/setDirection';
|
|
27
|
+
export { setHeadingLevel } from './publicApi/block/setHeadingLevel';
|
|
28
|
+
export { toggleBlockQuote } from './publicApi/block/toggleBlockQuote';
|
|
29
|
+
export { setSpacing } from './publicApi/block/setSpacing';
|
|
30
|
+
export { setImageBorder } from './publicApi/image/setImageBorder';
|
|
31
|
+
export { setImageBoxShadow } from './publicApi/image/setImageBoxShadow';
|
|
32
|
+
export { changeImage } from './publicApi/image/changeImage';
|
|
33
|
+
export { getFormatState } from './publicApi/format/getFormatState';
|
|
34
|
+
export { clearFormat } from './publicApi/format/clearFormat';
|
|
35
|
+
export { insertLink } from './publicApi/link/insertLink';
|
|
36
|
+
export { removeLink } from './publicApi/link/removeLink';
|
|
37
|
+
export { adjustLinkSelection } from './publicApi/link/adjustLinkSelection';
|
|
38
|
+
export { setImageAltText } from './publicApi/image/setImageAltText';
|
|
39
|
+
export { adjustImageSelection } from './publicApi/image/adjustImageSelection';
|
|
40
|
+
export { setParagraphMargin } from './publicApi/block/setParagraphMargin';
|
|
41
|
+
export { toggleCode } from './publicApi/segment/toggleCode';
|
|
42
|
+
export { insertEntity } from './publicApi/entity/insertEntity';
|
|
43
43
|
export { insertTableRow } from './modelApi/table/insertTableRow';
|
|
44
44
|
export { insertTableColumn } from './modelApi/table/insertTableColumn';
|
|
45
45
|
export { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';
|
|
46
|
+
export { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';
|
|
47
|
+
export { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';
|
|
48
|
+
export { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';
|
|
46
49
|
export { setListType } from './modelApi/list/setListType';
|
|
47
50
|
export { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';
|
|
48
51
|
export { setModelIndentation } from './modelApi/block/setModelIndentation';
|
|
52
|
+
export { matchLink } from './modelApi/link/matchLink';
|
package/lib-amd/index.js
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
define(["require", "exports", "./publicApi/table/insertTable", "./publicApi/table/formatTable", "./publicApi/table/setTableCellShade", "./publicApi/table/editTable", "./publicApi/table/applyTableBorderFormat", "./publicApi/list/toggleBullet", "./publicApi/list/toggleNumbering", "./publicApi/segment/toggleBold", "./publicApi/segment/toggleItalic", "./publicApi/segment/toggleUnderline", "./publicApi/segment/toggleStrikethrough", "./publicApi/segment/toggleSubscript", "./publicApi/segment/toggleSuperscript", "./publicApi/segment/setBackgroundColor", "./publicApi/segment/setFontName", "./publicApi/segment/setFontSize", "./publicApi/segment/setTextColor", "./publicApi/segment/changeFontSize", "./publicApi/segment/applySegmentFormat", "./publicApi/segment/changeCapitalization", "./publicApi/image/insertImage", "./publicApi/list/setListStyle", "./publicApi/list/setListStartNumber", "./publicApi/block/setIndentation", "./publicApi/block/setAlignment", "./publicApi/block/setDirection", "./publicApi/block/setHeadingLevel", "./publicApi/block/toggleBlockQuote", "./publicApi/block/setSpacing", "./publicApi/image/setImageBorder", "./publicApi/image/setImageBoxShadow", "./publicApi/image/changeImage", "./publicApi/format/getFormatState", "./publicApi/format/clearFormat", "./publicApi/link/insertLink", "./publicApi/link/removeLink", "./publicApi/link/adjustLinkSelection", "./publicApi/image/setImageAltText", "./publicApi/image/adjustImageSelection", "./publicApi/block/setParagraphMargin", "./publicApi/segment/toggleCode", "./publicApi/entity/insertEntity", "./modelApi/table/insertTableRow", "./modelApi/table/insertTableColumn", "./publicApi/utils/formatTableWithContentModel", "./modelApi/list/setListType", "./modelApi/list/findListItemsInSameThread", "./modelApi/block/setModelIndentation"], function (require, exports, insertTable_1, formatTable_1, setTableCellShade_1, editTable_1, applyTableBorderFormat_1, toggleBullet_1, toggleNumbering_1, toggleBold_1, toggleItalic_1, toggleUnderline_1, toggleStrikethrough_1, toggleSubscript_1, toggleSuperscript_1, setBackgroundColor_1, setFontName_1, setFontSize_1, setTextColor_1, changeFontSize_1, applySegmentFormat_1, changeCapitalization_1, insertImage_1, setListStyle_1, setListStartNumber_1, setIndentation_1, setAlignment_1, setDirection_1, setHeadingLevel_1, toggleBlockQuote_1, setSpacing_1, setImageBorder_1, setImageBoxShadow_1, changeImage_1, getFormatState_1, clearFormat_1, insertLink_1, removeLink_1, adjustLinkSelection_1, setImageAltText_1, adjustImageSelection_1, setParagraphMargin_1, toggleCode_1, insertEntity_1, insertTableRow_1, insertTableColumn_1, formatTableWithContentModel_1, setListType_1, findListItemsInSameThread_1, setModelIndentation_1) {
|
|
1
|
+
define(["require", "exports", "./publicApi/table/insertTable", "./publicApi/table/formatTable", "./publicApi/table/setTableCellShade", "./publicApi/table/editTable", "./publicApi/table/applyTableBorderFormat", "./publicApi/list/toggleBullet", "./publicApi/list/toggleNumbering", "./publicApi/segment/toggleBold", "./publicApi/segment/toggleItalic", "./publicApi/segment/toggleUnderline", "./publicApi/segment/toggleStrikethrough", "./publicApi/segment/toggleSubscript", "./publicApi/segment/toggleSuperscript", "./publicApi/segment/setBackgroundColor", "./publicApi/segment/setFontName", "./publicApi/segment/setFontSize", "./publicApi/segment/setTextColor", "./publicApi/segment/changeFontSize", "./publicApi/segment/applySegmentFormat", "./publicApi/segment/changeCapitalization", "./publicApi/image/insertImage", "./publicApi/list/setListStyle", "./publicApi/list/setListStartNumber", "./publicApi/block/setIndentation", "./publicApi/block/setAlignment", "./publicApi/block/setDirection", "./publicApi/block/setHeadingLevel", "./publicApi/block/toggleBlockQuote", "./publicApi/block/setSpacing", "./publicApi/image/setImageBorder", "./publicApi/image/setImageBoxShadow", "./publicApi/image/changeImage", "./publicApi/format/getFormatState", "./publicApi/format/clearFormat", "./publicApi/link/insertLink", "./publicApi/link/removeLink", "./publicApi/link/adjustLinkSelection", "./publicApi/image/setImageAltText", "./publicApi/image/adjustImageSelection", "./publicApi/block/setParagraphMargin", "./publicApi/segment/toggleCode", "./publicApi/entity/insertEntity", "./modelApi/table/insertTableRow", "./modelApi/table/insertTableColumn", "./publicApi/utils/formatTableWithContentModel", "./publicApi/utils/formatImageWithContentModel", "./publicApi/utils/formatParagraphWithContentModel", "./publicApi/utils/formatSegmentWithContentModel", "./modelApi/list/setListType", "./modelApi/list/findListItemsInSameThread", "./modelApi/block/setModelIndentation", "./modelApi/link/matchLink"], function (require, exports, insertTable_1, formatTable_1, setTableCellShade_1, editTable_1, applyTableBorderFormat_1, toggleBullet_1, toggleNumbering_1, toggleBold_1, toggleItalic_1, toggleUnderline_1, toggleStrikethrough_1, toggleSubscript_1, toggleSuperscript_1, setBackgroundColor_1, setFontName_1, setFontSize_1, setTextColor_1, changeFontSize_1, applySegmentFormat_1, changeCapitalization_1, insertImage_1, setListStyle_1, setListStartNumber_1, setIndentation_1, setAlignment_1, setDirection_1, setHeadingLevel_1, toggleBlockQuote_1, setSpacing_1, setImageBorder_1, setImageBoxShadow_1, changeImage_1, getFormatState_1, clearFormat_1, insertLink_1, removeLink_1, adjustLinkSelection_1, setImageAltText_1, adjustImageSelection_1, setParagraphMargin_1, toggleCode_1, insertEntity_1, insertTableRow_1, insertTableColumn_1, formatTableWithContentModel_1, formatImageWithContentModel_1, formatParagraphWithContentModel_1, formatSegmentWithContentModel_1, setListType_1, findListItemsInSameThread_1, setModelIndentation_1, matchLink_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.setModelIndentation = exports.findListItemsInSameThread = exports.setListType = exports.formatTableWithContentModel = exports.insertTableColumn = exports.insertTableRow = exports.insertEntity = exports.toggleCode = exports.setParagraphMargin = exports.adjustImageSelection = exports.setImageAltText = exports.adjustLinkSelection = exports.removeLink = exports.insertLink = exports.clearFormat = exports.getFormatState = exports.changeImage = exports.setImageBoxShadow = exports.setImageBorder = exports.setSpacing = exports.toggleBlockQuote = exports.setHeadingLevel = exports.setDirection = exports.setAlignment = exports.setIndentation = exports.setListStartNumber = exports.setListStyle = exports.insertImage = exports.changeCapitalization = exports.applySegmentFormat = exports.changeFontSize = exports.setTextColor = exports.setFontSize = exports.setFontName = exports.setBackgroundColor = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleUnderline = exports.toggleItalic = exports.toggleBold = exports.toggleNumbering = exports.toggleBullet = exports.applyTableBorderFormat = exports.editTable = exports.setTableCellShade = exports.formatTable = exports.insertTable = void 0;
|
|
5
|
-
Object.defineProperty(exports, "insertTable", { enumerable: true, get: function () { return insertTable_1.
|
|
6
|
-
Object.defineProperty(exports, "formatTable", { enumerable: true, get: function () { return formatTable_1.
|
|
7
|
-
Object.defineProperty(exports, "setTableCellShade", { enumerable: true, get: function () { return setTableCellShade_1.
|
|
8
|
-
Object.defineProperty(exports, "editTable", { enumerable: true, get: function () { return editTable_1.
|
|
9
|
-
Object.defineProperty(exports, "applyTableBorderFormat", { enumerable: true, get: function () { return applyTableBorderFormat_1.
|
|
10
|
-
Object.defineProperty(exports, "toggleBullet", { enumerable: true, get: function () { return toggleBullet_1.
|
|
11
|
-
Object.defineProperty(exports, "toggleNumbering", { enumerable: true, get: function () { return toggleNumbering_1.
|
|
12
|
-
Object.defineProperty(exports, "toggleBold", { enumerable: true, get: function () { return toggleBold_1.
|
|
13
|
-
Object.defineProperty(exports, "toggleItalic", { enumerable: true, get: function () { return toggleItalic_1.
|
|
14
|
-
Object.defineProperty(exports, "toggleUnderline", { enumerable: true, get: function () { return toggleUnderline_1.
|
|
15
|
-
Object.defineProperty(exports, "toggleStrikethrough", { enumerable: true, get: function () { return toggleStrikethrough_1.
|
|
16
|
-
Object.defineProperty(exports, "toggleSubscript", { enumerable: true, get: function () { return toggleSubscript_1.
|
|
17
|
-
Object.defineProperty(exports, "toggleSuperscript", { enumerable: true, get: function () { return toggleSuperscript_1.
|
|
18
|
-
Object.defineProperty(exports, "setBackgroundColor", { enumerable: true, get: function () { return setBackgroundColor_1.
|
|
19
|
-
Object.defineProperty(exports, "setFontName", { enumerable: true, get: function () { return setFontName_1.
|
|
20
|
-
Object.defineProperty(exports, "setFontSize", { enumerable: true, get: function () { return setFontSize_1.
|
|
21
|
-
Object.defineProperty(exports, "setTextColor", { enumerable: true, get: function () { return setTextColor_1.
|
|
22
|
-
Object.defineProperty(exports, "changeFontSize", { enumerable: true, get: function () { return changeFontSize_1.
|
|
23
|
-
Object.defineProperty(exports, "applySegmentFormat", { enumerable: true, get: function () { return applySegmentFormat_1.
|
|
24
|
-
Object.defineProperty(exports, "changeCapitalization", { enumerable: true, get: function () { return changeCapitalization_1.
|
|
25
|
-
Object.defineProperty(exports, "insertImage", { enumerable: true, get: function () { return insertImage_1.
|
|
26
|
-
Object.defineProperty(exports, "setListStyle", { enumerable: true, get: function () { return setListStyle_1.
|
|
27
|
-
Object.defineProperty(exports, "setListStartNumber", { enumerable: true, get: function () { return setListStartNumber_1.
|
|
28
|
-
Object.defineProperty(exports, "setIndentation", { enumerable: true, get: function () { return setIndentation_1.
|
|
29
|
-
Object.defineProperty(exports, "setAlignment", { enumerable: true, get: function () { return setAlignment_1.
|
|
30
|
-
Object.defineProperty(exports, "setDirection", { enumerable: true, get: function () { return setDirection_1.
|
|
31
|
-
Object.defineProperty(exports, "setHeadingLevel", { enumerable: true, get: function () { return setHeadingLevel_1.
|
|
32
|
-
Object.defineProperty(exports, "toggleBlockQuote", { enumerable: true, get: function () { return toggleBlockQuote_1.
|
|
33
|
-
Object.defineProperty(exports, "setSpacing", { enumerable: true, get: function () { return setSpacing_1.
|
|
34
|
-
Object.defineProperty(exports, "setImageBorder", { enumerable: true, get: function () { return setImageBorder_1.
|
|
35
|
-
Object.defineProperty(exports, "setImageBoxShadow", { enumerable: true, get: function () { return setImageBoxShadow_1.
|
|
36
|
-
Object.defineProperty(exports, "changeImage", { enumerable: true, get: function () { return changeImage_1.
|
|
37
|
-
Object.defineProperty(exports, "getFormatState", { enumerable: true, get: function () { return getFormatState_1.
|
|
38
|
-
Object.defineProperty(exports, "clearFormat", { enumerable: true, get: function () { return clearFormat_1.
|
|
39
|
-
Object.defineProperty(exports, "insertLink", { enumerable: true, get: function () { return insertLink_1.
|
|
40
|
-
Object.defineProperty(exports, "removeLink", { enumerable: true, get: function () { return removeLink_1.
|
|
41
|
-
Object.defineProperty(exports, "adjustLinkSelection", { enumerable: true, get: function () { return adjustLinkSelection_1.
|
|
42
|
-
Object.defineProperty(exports, "setImageAltText", { enumerable: true, get: function () { return setImageAltText_1.
|
|
43
|
-
Object.defineProperty(exports, "adjustImageSelection", { enumerable: true, get: function () { return adjustImageSelection_1.
|
|
44
|
-
Object.defineProperty(exports, "setParagraphMargin", { enumerable: true, get: function () { return setParagraphMargin_1.
|
|
45
|
-
Object.defineProperty(exports, "toggleCode", { enumerable: true, get: function () { return toggleCode_1.
|
|
46
|
-
Object.defineProperty(exports, "insertEntity", { enumerable: true, get: function () { return insertEntity_1.
|
|
4
|
+
exports.matchLink = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setListType = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = exports.formatTableWithContentModel = exports.insertTableColumn = exports.insertTableRow = exports.insertEntity = exports.toggleCode = exports.setParagraphMargin = exports.adjustImageSelection = exports.setImageAltText = exports.adjustLinkSelection = exports.removeLink = exports.insertLink = exports.clearFormat = exports.getFormatState = exports.changeImage = exports.setImageBoxShadow = exports.setImageBorder = exports.setSpacing = exports.toggleBlockQuote = exports.setHeadingLevel = exports.setDirection = exports.setAlignment = exports.setIndentation = exports.setListStartNumber = exports.setListStyle = exports.insertImage = exports.changeCapitalization = exports.applySegmentFormat = exports.changeFontSize = exports.setTextColor = exports.setFontSize = exports.setFontName = exports.setBackgroundColor = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleUnderline = exports.toggleItalic = exports.toggleBold = exports.toggleNumbering = exports.toggleBullet = exports.applyTableBorderFormat = exports.editTable = exports.setTableCellShade = exports.formatTable = exports.insertTable = void 0;
|
|
5
|
+
Object.defineProperty(exports, "insertTable", { enumerable: true, get: function () { return insertTable_1.insertTable; } });
|
|
6
|
+
Object.defineProperty(exports, "formatTable", { enumerable: true, get: function () { return formatTable_1.formatTable; } });
|
|
7
|
+
Object.defineProperty(exports, "setTableCellShade", { enumerable: true, get: function () { return setTableCellShade_1.setTableCellShade; } });
|
|
8
|
+
Object.defineProperty(exports, "editTable", { enumerable: true, get: function () { return editTable_1.editTable; } });
|
|
9
|
+
Object.defineProperty(exports, "applyTableBorderFormat", { enumerable: true, get: function () { return applyTableBorderFormat_1.applyTableBorderFormat; } });
|
|
10
|
+
Object.defineProperty(exports, "toggleBullet", { enumerable: true, get: function () { return toggleBullet_1.toggleBullet; } });
|
|
11
|
+
Object.defineProperty(exports, "toggleNumbering", { enumerable: true, get: function () { return toggleNumbering_1.toggleNumbering; } });
|
|
12
|
+
Object.defineProperty(exports, "toggleBold", { enumerable: true, get: function () { return toggleBold_1.toggleBold; } });
|
|
13
|
+
Object.defineProperty(exports, "toggleItalic", { enumerable: true, get: function () { return toggleItalic_1.toggleItalic; } });
|
|
14
|
+
Object.defineProperty(exports, "toggleUnderline", { enumerable: true, get: function () { return toggleUnderline_1.toggleUnderline; } });
|
|
15
|
+
Object.defineProperty(exports, "toggleStrikethrough", { enumerable: true, get: function () { return toggleStrikethrough_1.toggleStrikethrough; } });
|
|
16
|
+
Object.defineProperty(exports, "toggleSubscript", { enumerable: true, get: function () { return toggleSubscript_1.toggleSubscript; } });
|
|
17
|
+
Object.defineProperty(exports, "toggleSuperscript", { enumerable: true, get: function () { return toggleSuperscript_1.toggleSuperscript; } });
|
|
18
|
+
Object.defineProperty(exports, "setBackgroundColor", { enumerable: true, get: function () { return setBackgroundColor_1.setBackgroundColor; } });
|
|
19
|
+
Object.defineProperty(exports, "setFontName", { enumerable: true, get: function () { return setFontName_1.setFontName; } });
|
|
20
|
+
Object.defineProperty(exports, "setFontSize", { enumerable: true, get: function () { return setFontSize_1.setFontSize; } });
|
|
21
|
+
Object.defineProperty(exports, "setTextColor", { enumerable: true, get: function () { return setTextColor_1.setTextColor; } });
|
|
22
|
+
Object.defineProperty(exports, "changeFontSize", { enumerable: true, get: function () { return changeFontSize_1.changeFontSize; } });
|
|
23
|
+
Object.defineProperty(exports, "applySegmentFormat", { enumerable: true, get: function () { return applySegmentFormat_1.applySegmentFormat; } });
|
|
24
|
+
Object.defineProperty(exports, "changeCapitalization", { enumerable: true, get: function () { return changeCapitalization_1.changeCapitalization; } });
|
|
25
|
+
Object.defineProperty(exports, "insertImage", { enumerable: true, get: function () { return insertImage_1.insertImage; } });
|
|
26
|
+
Object.defineProperty(exports, "setListStyle", { enumerable: true, get: function () { return setListStyle_1.setListStyle; } });
|
|
27
|
+
Object.defineProperty(exports, "setListStartNumber", { enumerable: true, get: function () { return setListStartNumber_1.setListStartNumber; } });
|
|
28
|
+
Object.defineProperty(exports, "setIndentation", { enumerable: true, get: function () { return setIndentation_1.setIndentation; } });
|
|
29
|
+
Object.defineProperty(exports, "setAlignment", { enumerable: true, get: function () { return setAlignment_1.setAlignment; } });
|
|
30
|
+
Object.defineProperty(exports, "setDirection", { enumerable: true, get: function () { return setDirection_1.setDirection; } });
|
|
31
|
+
Object.defineProperty(exports, "setHeadingLevel", { enumerable: true, get: function () { return setHeadingLevel_1.setHeadingLevel; } });
|
|
32
|
+
Object.defineProperty(exports, "toggleBlockQuote", { enumerable: true, get: function () { return toggleBlockQuote_1.toggleBlockQuote; } });
|
|
33
|
+
Object.defineProperty(exports, "setSpacing", { enumerable: true, get: function () { return setSpacing_1.setSpacing; } });
|
|
34
|
+
Object.defineProperty(exports, "setImageBorder", { enumerable: true, get: function () { return setImageBorder_1.setImageBorder; } });
|
|
35
|
+
Object.defineProperty(exports, "setImageBoxShadow", { enumerable: true, get: function () { return setImageBoxShadow_1.setImageBoxShadow; } });
|
|
36
|
+
Object.defineProperty(exports, "changeImage", { enumerable: true, get: function () { return changeImage_1.changeImage; } });
|
|
37
|
+
Object.defineProperty(exports, "getFormatState", { enumerable: true, get: function () { return getFormatState_1.getFormatState; } });
|
|
38
|
+
Object.defineProperty(exports, "clearFormat", { enumerable: true, get: function () { return clearFormat_1.clearFormat; } });
|
|
39
|
+
Object.defineProperty(exports, "insertLink", { enumerable: true, get: function () { return insertLink_1.insertLink; } });
|
|
40
|
+
Object.defineProperty(exports, "removeLink", { enumerable: true, get: function () { return removeLink_1.removeLink; } });
|
|
41
|
+
Object.defineProperty(exports, "adjustLinkSelection", { enumerable: true, get: function () { return adjustLinkSelection_1.adjustLinkSelection; } });
|
|
42
|
+
Object.defineProperty(exports, "setImageAltText", { enumerable: true, get: function () { return setImageAltText_1.setImageAltText; } });
|
|
43
|
+
Object.defineProperty(exports, "adjustImageSelection", { enumerable: true, get: function () { return adjustImageSelection_1.adjustImageSelection; } });
|
|
44
|
+
Object.defineProperty(exports, "setParagraphMargin", { enumerable: true, get: function () { return setParagraphMargin_1.setParagraphMargin; } });
|
|
45
|
+
Object.defineProperty(exports, "toggleCode", { enumerable: true, get: function () { return toggleCode_1.toggleCode; } });
|
|
46
|
+
Object.defineProperty(exports, "insertEntity", { enumerable: true, get: function () { return insertEntity_1.insertEntity; } });
|
|
47
47
|
Object.defineProperty(exports, "insertTableRow", { enumerable: true, get: function () { return insertTableRow_1.insertTableRow; } });
|
|
48
48
|
Object.defineProperty(exports, "insertTableColumn", { enumerable: true, get: function () { return insertTableColumn_1.insertTableColumn; } });
|
|
49
49
|
Object.defineProperty(exports, "formatTableWithContentModel", { enumerable: true, get: function () { return formatTableWithContentModel_1.formatTableWithContentModel; } });
|
|
50
|
+
Object.defineProperty(exports, "formatImageWithContentModel", { enumerable: true, get: function () { return formatImageWithContentModel_1.formatImageWithContentModel; } });
|
|
51
|
+
Object.defineProperty(exports, "formatParagraphWithContentModel", { enumerable: true, get: function () { return formatParagraphWithContentModel_1.formatParagraphWithContentModel; } });
|
|
52
|
+
Object.defineProperty(exports, "formatSegmentWithContentModel", { enumerable: true, get: function () { return formatSegmentWithContentModel_1.formatSegmentWithContentModel; } });
|
|
50
53
|
Object.defineProperty(exports, "setListType", { enumerable: true, get: function () { return setListType_1.setListType; } });
|
|
51
54
|
Object.defineProperty(exports, "findListItemsInSameThread", { enumerable: true, get: function () { return findListItemsInSameThread_1.findListItemsInSameThread; } });
|
|
52
55
|
Object.defineProperty(exports, "setModelIndentation", { enumerable: true, get: function () { return setModelIndentation_1.setModelIndentation; } });
|
|
56
|
+
Object.defineProperty(exports, "matchLink", { enumerable: true, get: function () { return matchLink_1.matchLink; } });
|
|
53
57
|
});
|
|
54
58
|
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-api/lib/index.ts"],"names":[],"mappings":";;;;IAAS,0GAAA,WAAW,OAAA;IACX,0GAAA,WAAW,OAAA;IACX,sHAAA,iBAAiB,OAAA;IACjB,sGAAA,SAAS,OAAA;IACT,gIAAA,sBAAsB,OAAA;IACtB,4GAAA,YAAY,OAAA;IACZ,kHAAA,eAAe,OAAA;IACf,wGAAA,UAAU,OAAA;IACV,4GAAA,YAAY,OAAA;IACZ,kHAAA,eAAe,OAAA;IACf,0HAAA,mBAAmB,OAAA;IACnB,kHAAA,eAAe,OAAA;IACf,sHAAA,iBAAiB,OAAA;IACjB,wHAAA,kBAAkB,OAAA;IAClB,0GAAA,WAAW,OAAA;IACX,0GAAA,WAAW,OAAA;IACX,4GAAA,YAAY,OAAA;IACZ,gHAAA,cAAc,OAAA;IACd,wHAAA,kBAAkB,OAAA;IAClB,4HAAA,oBAAoB,OAAA;IACpB,0GAAA,WAAW,OAAA;IACX,4GAAA,YAAY,OAAA;IACZ,wHAAA,kBAAkB,OAAA;IAClB,gHAAA,cAAc,OAAA;IACd,4GAAA,YAAY,OAAA;IACZ,4GAAA,YAAY,OAAA;IACZ,kHAAA,eAAe,OAAA;IACf,oHAAA,gBAAgB,OAAA;IAChB,wGAAA,UAAU,OAAA;IACV,gHAAA,cAAc,OAAA;IACd,sHAAA,iBAAiB,OAAA;IACjB,0GAAA,WAAW,OAAA;IACX,gHAAA,cAAc,OAAA;IACd,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,wGAAA,UAAU,OAAA;IACV,0HAAA,mBAAmB,OAAA;IACnB,kHAAA,eAAe,OAAA;IACf,4HAAA,oBAAoB,OAAA;IACpB,wHAAA,kBAAkB,OAAA;IAClB,wGAAA,UAAU,OAAA;IACV,4GAAA,YAAY,OAAA;IACZ,gHAAA,cAAc,OAAA;IACd,sHAAA,iBAAiB,OAAA;IAEjB,0IAAA,2BAA2B,OAAA;IAC3B,0IAAA,2BAA2B,OAAA;IAC3B,kJAAA,+BAA+B,OAAA;IAC/B,8IAAA,6BAA6B,OAAA;IAE7B,0GAAA,WAAW,OAAA;IACX,sIAAA,yBAAyB,OAAA;IACzB,0HAAA,mBAAmB,OAAA;IACnB,sGAAA,SAAS,OAAA","sourcesContent":["export { insertTable } from './publicApi/table/insertTable';\nexport { formatTable } from './publicApi/table/formatTable';\nexport { setTableCellShade } from './publicApi/table/setTableCellShade';\nexport { editTable } from './publicApi/table/editTable';\nexport { applyTableBorderFormat } from './publicApi/table/applyTableBorderFormat';\nexport { toggleBullet } from './publicApi/list/toggleBullet';\nexport { toggleNumbering } from './publicApi/list/toggleNumbering';\nexport { toggleBold } from './publicApi/segment/toggleBold';\nexport { toggleItalic } from './publicApi/segment/toggleItalic';\nexport { toggleUnderline } from './publicApi/segment/toggleUnderline';\nexport { toggleStrikethrough } from './publicApi/segment/toggleStrikethrough';\nexport { toggleSubscript } from './publicApi/segment/toggleSubscript';\nexport { toggleSuperscript } from './publicApi/segment/toggleSuperscript';\nexport { setBackgroundColor } from './publicApi/segment/setBackgroundColor';\nexport { setFontName } from './publicApi/segment/setFontName';\nexport { setFontSize } from './publicApi/segment/setFontSize';\nexport { setTextColor } from './publicApi/segment/setTextColor';\nexport { changeFontSize } from './publicApi/segment/changeFontSize';\nexport { applySegmentFormat } from './publicApi/segment/applySegmentFormat';\nexport { changeCapitalization } from './publicApi/segment/changeCapitalization';\nexport { insertImage } from './publicApi/image/insertImage';\nexport { setListStyle } from './publicApi/list/setListStyle';\nexport { setListStartNumber } from './publicApi/list/setListStartNumber';\nexport { setIndentation } from './publicApi/block/setIndentation';\nexport { setAlignment } from './publicApi/block/setAlignment';\nexport { setDirection } from './publicApi/block/setDirection';\nexport { setHeadingLevel } from './publicApi/block/setHeadingLevel';\nexport { toggleBlockQuote } from './publicApi/block/toggleBlockQuote';\nexport { setSpacing } from './publicApi/block/setSpacing';\nexport { setImageBorder } from './publicApi/image/setImageBorder';\nexport { setImageBoxShadow } from './publicApi/image/setImageBoxShadow';\nexport { changeImage } from './publicApi/image/changeImage';\nexport { getFormatState } from './publicApi/format/getFormatState';\nexport { clearFormat } from './publicApi/format/clearFormat';\nexport { insertLink } from './publicApi/link/insertLink';\nexport { removeLink } from './publicApi/link/removeLink';\nexport { adjustLinkSelection } from './publicApi/link/adjustLinkSelection';\nexport { setImageAltText } from './publicApi/image/setImageAltText';\nexport { adjustImageSelection } from './publicApi/image/adjustImageSelection';\nexport { setParagraphMargin } from './publicApi/block/setParagraphMargin';\nexport { toggleCode } from './publicApi/segment/toggleCode';\nexport { insertEntity } from './publicApi/entity/insertEntity';\nexport { insertTableRow } from './modelApi/table/insertTableRow';\nexport { insertTableColumn } from './modelApi/table/insertTableColumn';\n\nexport { formatTableWithContentModel } from './publicApi/utils/formatTableWithContentModel';\nexport { formatImageWithContentModel } from './publicApi/utils/formatImageWithContentModel';\nexport { formatParagraphWithContentModel } from './publicApi/utils/formatParagraphWithContentModel';\nexport { formatSegmentWithContentModel } from './publicApi/utils/formatSegmentWithContentModel';\n\nexport { setListType } from './modelApi/list/setListType';\nexport { findListItemsInSameThread } from './modelApi/list/findListItemsInSameThread';\nexport { setModelIndentation } from './modelApi/block/setModelIndentation';\nexport { matchLink } from './modelApi/link/matchLink';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setModelAlignment.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setModelAlignment.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/block/setModelAlignment.ts"],"names":[],"mappings":";;;;IAQA,IAAM,SAAS,GAGX;QACA,IAAI,EAAE;YACF,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,KAAK;SACb;QACD,MAAM,EAAE;YACJ,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,QAAQ;SAChB;QACD,KAAK,EAAE;YACH,GAAG,EAAE,KAAK;YACV,GAAG,EAAE,OAAO;SACf;QACD,OAAO,EAAE;YACL,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;SACjB;KACJ,CAAC;IAEF,IAAM,aAAa,GAGf;QACA,IAAI,EAAE;YACF,GAAG,EAAE,WAAW;YAChB,GAAG,EAAE,YAAY;SACpB;QACD,MAAM,EAAE;YACJ,GAAG,EAAE,aAAa;YAClB,GAAG,EAAE,aAAa;SACrB;QACD,KAAK,EAAE;YACH,GAAG,EAAE,YAAY;YACjB,GAAG,EAAE,WAAW;SACnB;KACJ,CAAC;IAEF;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,KAA2B,EAC3B,SAAkD;QAElD,IAAM,0BAA0B,GAAG,IAAA,mDAAoB,EACnD,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,CAAC,WAAW,CAAC,CAChB,CAAC;QAEF,0BAA0B,CAAC,OAAO,CAAC,UAAC,EAAS;gBAAP,KAAK,WAAA;YACvC,IAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC3F,IAAI,KAAK,CAAC,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,SAAS,EAAE;gBACxD,IAAA,uBAAU,EACN,KAAK,EACL,aAAa,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAC5E,CAAC;aACL;iBAAM,IAAI,KAAK,EAAE;gBACd,IAAI,KAAK,CAAC,SAAS,KAAK,YAAY,IAAI,KAAK,CAAC,cAAc,KAAK,UAAU,EAAE;oBACzE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,CAAC;wBACV,IAAA,MAAM,GAAK,CAAC,OAAN,CAAO;wBACrB,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC;oBACpC,CAAC,CAAC,CAAC;iBACN;gBACO,IAAA,MAAM,GAAK,KAAK,OAAV,CAAW;gBACzB,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC;aACnC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,0BAA0B,CAAC,MAAM,GAAG,CAAC,CAAC;IACjD,CAAC;IA9BD,8CA8BC","sourcesContent":["import { alignTable } from '../table/alignTable';\nimport { getOperationalBlocks } from 'roosterjs-content-model-core';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n TableAlignOperation,\n} from 'roosterjs-content-model-types';\n\nconst ResultMap: Record<\n 'left' | 'center' | 'right' | 'justify',\n Record<'ltr' | 'rtl', 'start' | 'center' | 'end' | 'justify'>\n> = {\n left: {\n ltr: 'start',\n rtl: 'end',\n },\n center: {\n ltr: 'center',\n rtl: 'center',\n },\n right: {\n ltr: 'end',\n rtl: 'start',\n },\n justify: {\n ltr: 'justify',\n rtl: 'justify',\n },\n};\n\nconst TableAlignMap: Record<\n 'left' | 'center' | 'right',\n Record<'ltr' | 'rtl', TableAlignOperation>\n> = {\n left: {\n ltr: 'alignLeft',\n rtl: 'alignRight',\n },\n center: {\n ltr: 'alignCenter',\n rtl: 'alignCenter',\n },\n right: {\n ltr: 'alignRight',\n rtl: 'alignLeft',\n },\n};\n\n/**\n * @internal\n */\nexport function setModelAlignment(\n model: ContentModelDocument,\n alignment: 'left' | 'center' | 'right' | 'justify'\n) {\n const paragraphOrListItemOrTable = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n ['TableCell']\n );\n\n paragraphOrListItemOrTable.forEach(({ block }) => {\n const newAlignment = ResultMap[alignment][block.format.direction == 'rtl' ? 'rtl' : 'ltr'];\n if (block.blockType === 'Table' && alignment !== 'justify') {\n alignTable(\n block,\n TableAlignMap[alignment][block.format.direction == 'rtl' ? 'rtl' : 'ltr']\n );\n } else if (block) {\n if (block.blockType === 'BlockGroup' && block.blockGroupType === 'ListItem') {\n block.blocks.forEach(b => {\n const { format } = b;\n format.textAlign = newAlignment;\n });\n }\n const { format } = block;\n format.textAlign = newAlignment;\n }\n });\n\n return paragraphOrListItemOrTable.length > 0;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setModelDirection.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setModelDirection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/block/setModelDirection.ts"],"names":[],"mappings":";;;;IAiBA;;OAEG;IACH,SAAgB,iBAAiB,CAAC,KAA2B,EAAE,SAAwB;QACnF,IAAM,0BAA0B,GAAG,IAAA,mDAAoB,EACnD,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,CAAC,WAAW,CAAC,CAChB,CAAC;QAEF,0BAA0B,CAAC,OAAO,CAAC,UAAC,EAAS;gBAAP,KAAK,WAAA;YACvC,IAAI,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;gBAC7D,IAAM,KAAK,GAAG,IAAA,qDAAyB,EAAC,KAAK,EAAE,K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I,KAAK,IAAI,KAAK,CAAC,SAAS,IAAI,OAAO,EAAE;gBACrC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBAClB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;wBAClB,oDAAoD;wBACpD,IAAA,sDAAuB,EAAC,IAAI,EAAE,UAAA,QAAQ;4BAClC,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,EAAE;gCAC1B,IAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;gCAC/C,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gCAChE,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;6BAC5D;4BACD,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;gBAEH,wBAAwB;gBACxB,IAAA,+CAAgB,EAAC,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;aAC/E;SACJ;IACL,CAAC;IAED,SAAS,WAAW,CAChB,MAAmD,EACnD,GAAwD,EACxD,KAAyB;QAEzB,IAAI,KAAK,EAAE;YACP,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACvB;aAAM;YACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;SACtB;IACL,CAAC","sourcesContent":["import { findListItemsInSameThread } from '../list/findListItemsInSameThread';\nimport {\n applyTableFormat,\n getOperationalBlocks,\n isBlockGroupOfType,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\nimport type {\n BorderFormat,\n ContentModelBlock,\n ContentModelBlockFormat,\n ContentModelDocument,\n ContentModelListItem,\n MarginFormat,\n PaddingFormat,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function setModelDirection(model: ContentModelDocument, direction: 'ltr' | 'rtl') {\n const paragraphOrListItemOrTable = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n ['TableCell']\n );\n\n paragraphOrListItemOrTable.forEach(({ block }) => {\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const items = findListItemsInSameThread(model, block);\n\n items.forEach(item => {\n item.levels.forEach(level => {\n level.format.direction = direction;\n });\n\n item.blocks.forEach(block => internalSetDirection(block.format, direction));\n });\n } else if (block) {\n internalSetDirection(block.format, direction, block);\n }\n });\n\n return paragraphOrListItemOrTable.length > 0;\n}\n\nfunction internalSetDirection(\n format: ContentModelBlockFormat,\n direction: 'ltr' | 'rtl',\n block?: ContentModelBlock\n) {\n const wasRtl = format.direction == 'rtl';\n const isRtl = direction == 'rtl';\n\n if (wasRtl != isRtl) {\n format.direction = direction;\n\n // Adjust margin when change direction\n const marginLeft = format.marginLeft;\n const paddingLeft = format.paddingLeft;\n\n setProperty(format, 'marginLeft', format.marginRight);\n setProperty(format, 'marginRight', marginLeft);\n setProperty(format, 'paddingLeft', format.paddingRight);\n setProperty(format, 'paddingRight', paddingLeft);\n\n // If whole Table direction changed, flip cell side borders\n if (block && block.blockType == 'Table') {\n block.rows.forEach(row => {\n row.cells.forEach(cell => {\n // Optimise by skipping cells with unchanged borders\n updateTableCellMetadata(cell, metadata => {\n if (metadata?.borderOverride) {\n const storeBorderLeft = cell.format.borderLeft;\n setProperty(cell.format, 'borderLeft', cell.format.borderRight);\n setProperty(cell.format, 'borderRight', storeBorderLeft);\n }\n return metadata;\n });\n });\n });\n\n // Apply changed borders\n applyTableFormat(block, undefined /* newFormat */, true /* keepCellShade*/);\n }\n }\n}\n\nfunction setProperty(\n format: MarginFormat & PaddingFormat & BorderFormat,\n key: keyof (MarginFormat & PaddingFormat & BorderFormat),\n value: string | undefined\n) {\n if (value) {\n format[key] = value;\n } else {\n delete format[key];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setModelIndentation.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/block/setModelIndentation.ts"],"names":[],"mappings":";;;;IAiBA,IAAM,iBAAiB,GAAG,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,SAAgB,mBAAmB,CAC/B,KAA2B,EAC3B,WAAiC,EACjC,MAAkC;QAAlC,uBAAA,EAAA,0BAAkC;QAElC,IAAM,mBAAmB,GAAG,IAAA,mDAAoB,EAC5C,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,CAAC,WAAW,CAAC,CAChB,CAAC;QACF,IAAM,QAAQ,GAAG,WAAW,IAAI,QAAQ,CAAC;QACzC,IAAM,cAAc,GAAwB,EAAE,CAAC;QAE/C,mBAAmB,CAAC,OAAO,CAAC,UAAC,EAAuB;gBAArB,KAAK,WAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAA;YAC9C,IAAI,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;gBAC7D,IAAM,MAAM,GAAG,IAAA,qDAAyB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACvD,IAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC5B,8FAA8F;gBAC9F,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;oBACvD,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;oBACtB,IAAA,MAAM,GAAK,KAAK,OAAV,CAAW;oBACjB,IAAA,UAAU,GAAkB,MAAM,WAAxB,EAAE,WAAW,GAAK,MAAM,YAAX,CAAY;oBAC3C,IAAM,QAAQ,GAAG,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;oBAChE,IAAM,KAAK,GAAG,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC;oBACxC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AG,IAAA,gDAAkB,EAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAC3E,IAAI,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;QAEpF,IAAI,QAAQ,IAAI,aAAa,EAAE;YAC3B,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACnE;QAED,IAAI,QAAQ,IAAI,aAAa,EAAE;YAC3B,oDAAoD;YACpD,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,QAAQ,CAAC;SACnB;IACL,CAAC","sourcesContent":["import { createListLevel, parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport { findListItemsInSameThread } from '../list/findListItemsInSameThread';\nimport {\n getOperationalBlocks,\n isBlockGroupOfType,\n updateListMetadata,\n} from 'roosterjs-content-model-core';\n\nimport type {\n ContentModelBlock,\n ContentModelBlockFormat,\n ContentModelBlockGroup,\n ContentModelDocument,\n ContentModelListItem,\n ContentModelListLevel,\n} from 'roosterjs-content-model-types';\n\nconst IndentStepInPixel = 40;\n\n/**\n * @param model The content model to set indentation\n * @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent\n * @param length The length of indentation in pixel, default value is 40\n * Set indentation for selected list items or paragraphs\n */\nexport function setModelIndentation(\n model: ContentModelDocument,\n indentation: 'indent' | 'outdent',\n length: number = IndentStepInPixel\n) {\n const paragraphOrListItem = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n ['TableCell']\n );\n const isIndent = indentation == 'indent';\n const modifiedBlocks: ContentModelBlock[] = [];\n\n paragraphOrListItem.forEach(({ block, parent, path }) => {\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const thread = findListItemsInSameThread(model, block);\n const firstItem = thread[0];\n //if the first item is selected and has only one level, we should add margin to the whole list\n if (isSelected(firstItem) && firstItem.levels.length == 1) {\n const level = block.levels[0];\n const { format } = level;\n const { marginLeft, marginRight } = format;\n const newValue = calculateMarginValue(format, isIndent, length);\n const isRtl = format.direction == 'rtl';\n const originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);\n\n if (!isIndent && originalValue == 0) {\n block.levels.pop();\n } else if (newValue !== null) {\n if (isRtl) {\n level.format.marginRight = newValue + 'px';\n } else {\n level.format.marginLeft = newValue + 'px';\n }\n }\n //if block has only one level, there is not need to check if it is multilevel selection\n } else if (block.levels.length == 1 || !isMultilevelSelection(model, block, parent)) {\n if (isIndent) {\n const lastLevel = block.levels[block.levels.length - 1];\n const newLevel: ContentModelListLevel = createListLevel(\n lastLevel?.listType || 'UL',\n lastLevel?.format\n );\n\n updateListMetadata(newLevel, metadata => {\n metadata = metadata || {};\n metadata.applyListStyleFromLevel = true;\n return metadata;\n });\n\n // New level is totally new, no need to have these attributes for now\n delete newLevel.format.startNumberOverride;\n\n block.levels.push(newLevel);\n } else {\n block.levels.pop();\n }\n }\n } else if (block) {\n let currentBlock: ContentModelBlock = block;\n let currentParent: ContentModelBlockGroup = parent;\n\n while (currentParent && modifiedBlocks.indexOf(currentBlock) < 0) {\n const index = path.indexOf(currentParent);\n const { format } = currentBlock;\n const newValue = calculateMarginValue(format, isIndent, length);\n\n if (newValue !== null) {\n const isRtl = format.direction == 'rtl';\n\n if (isRtl) {\n format.marginRight = newValue + 'px';\n } else {\n format.marginLeft = newValue + 'px';\n }\n\n modifiedBlocks.push(currentBlock);\n\n break;\n } else if (currentParent.blockGroupType == 'FormatContainer' && index >= 0) {\n delete currentParent.cachedElement;\n\n currentBlock = currentParent;\n currentParent = path[index + 1];\n } else {\n break;\n }\n }\n }\n });\n\n return paragraphOrListItem.length > 0;\n}\n\nfunction isSelected(listItem: ContentModelListItem) {\n return listItem.blocks.some(block => {\n if (block.blockType == 'Paragraph') {\n return block.segments.some(segment => segment.isSelected);\n }\n });\n}\n\n/*\n * Check if the selection has list items with different levels and the first item of the list is selected, do not create a sub list.\n * Otherwise, the margin of the first item will be changed, and the sub list will be created, creating a unintentional margin difference between the list items.\n */\nfunction isMultilevelSelection(\n model: ContentModelDocument,\n listItem: ContentModelListItem,\n parent: ContentModelBlockGroup\n) {\n const listIndex = parent.blocks.indexOf(listItem);\n for (let i = listIndex - 1; i >= 0; i--) {\n const block = parent.blocks[i];\n if (\n isBlockGroupOfType<ContentModelListItem>(block, 'ListItem') &&\n block.levels.length == 1 &&\n isSelected(block)\n ) {\n const firstItem = findListItemsInSameThread(model, block)[0];\n return isSelected(firstItem);\n }\n\n if (!isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n return false;\n }\n }\n return false;\n}\n\nfunction calculateMarginValue(\n format: ContentModelBlockFormat,\n isIndent: boolean,\n length: number = IndentStepInPixel\n): number | null {\n const { marginLeft, marginRight, direction } = format;\n const isRtl = direction == 'rtl';\n const originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);\n let newValue = (isIndent ? Math.ceil : Math.floor)(originalValue / length) * length;\n\n if (newValue == originalValue) {\n newValue = Math.max(newValue + length * (isIndent ? 1 : -1), 0);\n }\n\n if (newValue == originalValue) {\n // Return null to let caller know nothing is changed\n return null;\n } else {\n return newValue;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"setModelIndentation.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/block/setModelIndentation.ts"],"names":[],"mappings":";;;;IAiBA,IAAM,iBAAiB,GAAG,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,SAAgB,mBAAmB,CAC/B,KAA2B,EAC3B,WAAiC,EACjC,MAAkC;QAAlC,uBAAA,EAAA,0BAAkC;QAElC,IAAM,mBAAmB,GAAG,IAAA,m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AI,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACnE;QAED,IAAI,QAAQ,IAAI,aAAa,EAAE;YAC3B,oDAAoD;YACpD,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,QAAQ,CAAC;SACnB;IACL,CAAC","sourcesContent":["import { createListLevel, parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport { findListItemsInSameThread } from '../list/findListItemsInSameThread';\nimport {\n getOperationalBlocks,\n isBlockGroupOfType,\n updateListMetadata,\n} from 'roosterjs-content-model-core';\n\nimport type {\n ContentModelBlock,\n ContentModelBlockFormat,\n ContentModelBlockGroup,\n ContentModelDocument,\n ContentModelListItem,\n ContentModelListLevel,\n} from 'roosterjs-content-model-types';\n\nconst IndentStepInPixel = 40;\n\n/**\n * @param model The content model to set indentation\n * @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent\n * @param length The length of indentation in pixel, default value is 40\n * Set indentation for selected list items or paragraphs\n */\nexport function setModelIndentation(\n model: ContentModelDocument,\n indentation: 'indent' | 'outdent',\n length: number = IndentStepInPixel\n) {\n const paragraphOrListItem = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n ['TableCell']\n );\n const isIndent = indentation == 'indent';\n const modifiedBlocks: ContentModelBlock[] = [];\n\n paragraphOrListItem.forEach(({ block, parent, path }) => {\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const thread = findListItemsInSameThread(model, block);\n const firstItem = thread[0];\n //if the first item is selected and has only one level, we should add margin to the whole list\n if (isSelected(firstItem) && firstItem.levels.length == 1) {\n const level = block.levels[0];\n const { format } = level;\n const { marginLeft, marginRight } = format;\n const newValue = calculateMarginValue(format, isIndent, length);\n const isRtl = format.direction == 'rtl';\n const originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);\n\n if (!isIndent && originalValue == 0) {\n block.levels.pop();\n } else if (newValue !== null) {\n if (isRtl) {\n level.format.marginRight = newValue + 'px';\n } else {\n level.format.marginLeft = newValue + 'px';\n }\n }\n //if block has only one level, there is not need to check if it is multilevel selection\n } else if (block.levels.length == 1 || !isMultilevelSelection(model, block, parent)) {\n if (isIndent) {\n const lastLevel = block.levels[block.levels.length - 1];\n const newLevel: ContentModelListLevel = createListLevel(\n lastLevel?.listType || 'UL',\n lastLevel?.format\n );\n\n updateListMetadata(newLevel, metadata => {\n metadata = metadata || {};\n metadata.applyListStyleFromLevel = true;\n return metadata;\n });\n\n // New level is totally new, no need to have these attributes for now\n delete newLevel.format.startNumberOverride;\n\n block.levels.push(newLevel);\n } else {\n block.levels.pop();\n }\n }\n } else if (block) {\n let currentBlock: ContentModelBlock = block;\n let currentParent: ContentModelBlockGroup = parent;\n\n while (currentParent && modifiedBlocks.indexOf(currentBlock) < 0) {\n const index = path.indexOf(currentParent);\n const { format } = currentBlock;\n const newValue = calculateMarginValue(format, isIndent, length);\n\n if (newValue !== null) {\n const isRtl = format.direction == 'rtl';\n\n if (isRtl) {\n format.marginRight = newValue + 'px';\n } else {\n format.marginLeft = newValue + 'px';\n }\n\n modifiedBlocks.push(currentBlock);\n\n break;\n } else if (currentParent.blockGroupType == 'FormatContainer' && index >= 0) {\n delete currentParent.cachedElement;\n\n currentBlock = currentParent;\n currentParent = path[index + 1];\n } else {\n break;\n }\n }\n }\n });\n\n return paragraphOrListItem.length > 0;\n}\n\nfunction isSelected(listItem: ContentModelListItem) {\n return listItem.blocks.some(block => {\n if (block.blockType == 'Paragraph') {\n return block.segments.some(segment => segment.isSelected);\n }\n });\n}\n\n/*\n * Check if the selection has list items with different levels and the first item of the list is selected, do not create a sub list.\n * Otherwise, the margin of the first item will be changed, and the sub list will be created, creating a unintentional margin difference between the list items.\n */\nfunction isMultilevelSelection(\n model: ContentModelDocument,\n listItem: ContentModelListItem,\n parent: ContentModelBlockGroup\n) {\n const listIndex = parent.blocks.indexOf(listItem);\n for (let i = listIndex - 1; i >= 0; i--) {\n const block = parent.blocks[i];\n if (\n isBlockGroupOfType<ContentModelListItem>(block, 'ListItem') &&\n block.levels.length == 1 &&\n isSelected(block)\n ) {\n const firstItem = findListItemsInSameThread(model, block)[0];\n return isSelected(firstItem);\n }\n\n if (!isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n return false;\n }\n }\n return false;\n}\n\nfunction calculateMarginValue(\n format: ContentModelBlockFormat,\n isIndent: boolean,\n length: number = IndentStepInPixel\n): number | null {\n const { marginLeft, marginRight, direction } = format;\n const isRtl = direction == 'rtl';\n const originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);\n let newValue = (isIndent ? Math.ceil : Math.floor)(originalValue / length) * length;\n\n if (newValue == originalValue) {\n newValue = Math.max(newValue + length * (isIndent ? 1 : -1), 0);\n }\n\n if (newValue == originalValue) {\n // Return null to let caller know nothing is changed\n return null;\n } else {\n return newValue;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleModelBlockQuote.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleModelBlockQuote.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/block/toggleModelBlockQuote.ts"],"names":[],"mappings":";;;;IAcA;;OAEG;IACH,SAAgB,qBAAqB,CACjC,KAA2B,EAC3B,SAA4C,EAC5C,SAA4C;QAE5C,IAAM,gBAAgB,GAAG,IAAA,mDAAoB,EAE3C,KAAK,EAAE,CAAC,iBAAiB,EAAE,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7E,IAAI,iBAAiB,CAAC,gBAAgB,CAAC,EAAE;YACrC,+DAA+D;YAC/D,gBAAgB,CAAC,OAAO,CAAC,UAAC,EAAiB;oBAAf,KAAK,WAAA,EAAE,MAAM,YAAA;gBACrC,IAAA,yCAAW,EAAC,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CAAC;IACN,CAAC;IAED,SAAS,iBAAiB,CACtB,eAAwF;QAMxF,OAAO,eAAe,CAAC,KAAK,CAAC,UAAA,cAAc,IAAI,OAAA,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,EAA7B,CAA6B,CAAC,CAAC;IAClF,CAAC","sourcesContent":["import { areSameFormats, createFormatContainer, unwrapBlock } from 'roosterjs-content-model-dom';\nimport { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';\nimport { wrapBlockStep1, wrapBlockStep2 } from '../common/wrapBlock';\nimport type { OperationalBlocks } from 'roosterjs-content-model-core';\nimport type { WrapBlockStep1Result } from '../common/wrapBlock';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelDocument,\n ContentModelFormatContainer,\n ContentModelFormatContainerFormat,\n ContentModelListItem,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function toggleModelBlockQuote(\n model: ContentModelDocument,\n formatLtr: ContentModelFormatContainerFormat,\n formatRtl: ContentModelFormatContainerFormat\n): boolean {\n const paragraphOfQuote = getOperationalBlocks<\n ContentModelFormatContainer | ContentModelListItem\n >(model, ['FormatContainer', 'ListItem'], ['TableCell'], true /*deepFirst*/);\n\n if (areAllBlockQuotes(paragraphOfQuote)) {\n // All selections are already in quote, we need to unquote them\n paragraphOfQuote.forEach(({ block, parent }) => {\n unwrapBlock(parent, block);\n });\n } else {\n const step1Results: WrapBlockStep1Result<ContentModelFormatContainer>[] = [];\n const creator = (isRtl: boolean) =>\n createFormatContainer('blockquote', isRtl ? formatRtl : formatLtr);\n const canMerge = (\n isRtl: boolean,\n target: ContentModelBlock,\n current?: ContentModelFormatContainer\n ): target is ContentModelFormatContainer =>\n canMergeQuote(target, current?.format || (isRtl ? formatRtl : formatLtr));\n\n paragraphOfQuote.forEach(({ block, parent }) => {\n if (isQuote(block)) {\n // Already in quote, no op\n } else {\n wrapBlockStep1(step1Results, parent, block, creator, canMerge);\n }\n });\n\n wrapBlockStep2(step1Results, canMerge);\n }\n\n return paragraphOfQuote.length > 0;\n}\n\nfunction canMergeQuote(\n target: ContentModelBlock,\n format: ContentModelFormatContainerFormat\n): target is ContentModelFormatContainer {\n return isQuote(target) && areSameFormats(format, target.format);\n}\n\nfunction isQuote(block: ContentModelBlock): block is ContentModelFormatContainer {\n return (\n isBlockGroupOfType<ContentModelFormatContainer>(block, 'FormatContainer') &&\n block.tagName == 'blockquote'\n );\n}\n\nfunction areAllBlockQuotes(\n blockAndParents: OperationalBlocks<ContentModelFormatContainer | ContentModelListItem>[]\n): blockAndParents is {\n block: ContentModelFormatContainer;\n parent: ContentModelBlockGroup;\n path: ContentModelBlockGroup[];\n}[] {\n return blockAndParents.every(blockAndParent => isQuote(blockAndParent.block));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearModelFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/common/clearModelFormat.ts"],"names":[],"mappings":";;;;IAsBA;;OAEG;IACH,SAAgB,gBAAgB,CAC5B,KAA2B,EAC3B,aAA8D,EAC9D,eAAsC,EACtC,aAA6C;QAE7C,IAAA,gDAAiB,EACb,KAAK,EACL,UAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ;YAChC,IAAI,QAAQ,EAAE;gBACV,eAAe,CAAC,IAAI,OAApB,eAAe,qDAAS,QAAQ,WAAE;aACrC;YAED,IAAI,KAAK,EAAE;gBACP,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;aACrC;iBAAM,IAAI,YAAY,EAAE;gBACrB,oBAAoB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;aACrD;QACL,CAAC,EACD;YACI,4FAA4F;YAC5F,6CAA6C;YAC7C,4FAA4F;YAC5F,2FAA2F;YAC3F,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAA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,KAAwB;QAClD,OAAO,CACF,KAAoB,CAAC,UAAU;YAChC,CAAC,KAAK,CAAC,SAAS,IAAI,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,UAAU,EAAZ,CAAY,CAAC,CAAC,CAC9E,CAAC;IACN,CAAC","sourcesContent":["import { adjustWordSelection } from '../selection/adjustWordSelection';\nimport { createFormatContainer } from 'roosterjs-content-model-dom';\nimport {\n iterateSelections,\n applyTableFormat,\n getClosestAncestorBlockGroupIndex,\n updateTableCellMetadata,\n updateTableMetadata,\n} from 'roosterjs-content-model-core';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelDocument,\n ContentModelFormatContainer,\n ContentModelListItem,\n ContentModelSegment,\n ContentModelSegmentFormat,\n ContentModelTable,\n Selectable,\n TableSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function clearModelFormat(\n model: ContentModelDocument,\n blocksToClear: [ContentModelBlockGroup[], ContentModelBlock][],\n segmentsToClear: ContentModelSegment[],\n tablesToClear: [ContentModelTable, boolean][]\n) {\n iterateSelections(\n model,\n (path, tableContext, block, segments) => {\n if (segments) {\n segmentsToClear.push(...segments);\n }\n\n if (block) {\n blocksToClear.push([path, block]);\n } else if (tableContext) {\n clearTableCellFormat(tableContext, tablesToClear);\n }\n },\n {\n // When there is a default format to apply, we know how to handle segment format under list.\n // So no need to clear format of list number.\n // Otherwise, we will clear all format of selected text. And since they are under LI tag, we\n // also need to clear the format of LI (format holder) so that the format is really cleared\n includeListFormatHolder: model.format ? 'never' : 'anySegment',\n }\n );\n\n const marker = segmentsToClear[0];\n\n // 2. If selection is collapsed, add selection to whole word to clear if any\n if (\n blocksToClear.length == 1 &&\n isOnlySelectionMarkerSelected(blocksToClear[0][1]) &&\n blocksToClear.length == 1\n ) {\n segmentsToClear.splice(0, segmentsToClear.length, ...adjustWordSelection(model, marker));\n clearListFormat(blocksToClear[0][0]);\n } else if (blocksToClear.length > 1 || blocksToClear.some(x => isWholeBlockSelected(x[1]))) {\n // 2. If a full block or multiple blocks are selected, clear block format\n for (let i = blocksToClear.length - 1; i >= 0; i--) {\n const [path, block] = blocksToClear[i];\n\n clearBlockFormat(path, block);\n clearListFormat(path);\n clearContainerFormat(path, block);\n }\n }\n\n // 3. Finally clear format for segments\n clearSegmentsFormat(segmentsToClear, model.format);\n\n // 4. Clear format for table if any\n createTablesFormat(tablesToClear);\n}\n\nfunction createTablesFormat(tablesToClear: [ContentModelTable, boolean][]) {\n tablesToClear.forEach(x => {\n const [table, isWholeTableSelected] = x;\n if (isWholeTableSelected) {\n table.format = {\n useBorderBox: table.format.useBorderBox,\n borderCollapse: table.format.borderCollapse,\n };\n updateTableMetadata(table, () => null);\n }\n\n applyTableFormat(table, undefined /*newFormat*/, true);\n });\n}\n\nfunction clearSegmentsFormat(\n segmentsToClear: ContentModelSegment[],\n defaultSegmentFormat: ContentModelSegmentFormat | undefined\n) {\n segmentsToClear.forEach(x => {\n x.format = { ...(defaultSegmentFormat || {}) };\n\n if (x.link) {\n delete x.link.format.textColor;\n }\n\n delete x.code;\n });\n}\n\nfunction clearTableCellFormat(\n tableContext: TableSelectionContext | undefined,\n tablesToClear: [ContentModelTable, boolean][]\n) {\n if (tableContext) {\n const { table, colIndex, rowIndex, isWholeTableSelected } = tableContext;\n const cell = table.rows[rowIndex].cells[colIndex];\n\n if (cell.isSelected) {\n updateTableCellMetadata(cell, () => null);\n cell.isHeader = false;\n cell.format = {\n useBorderBox: cell.format.useBorderBox,\n };\n }\n\n if (!tablesToClear.find(x => x[0] == table)) {\n tablesToClear.push([table, isWholeTableSelected]);\n }\n }\n}\n\nfunction clearContainerFormat(path: ContentModelBlockGroup[], block: ContentModelBlock) {\n const containerPathIndex = getClosestAncestorBlockGroupIndex(\n path,\n ['FormatContainer'],\n ['TableCell']\n );\n\n if (containerPathIndex >= 0 && containerPathIndex < path.length - 1) {\n const container = path[containerPathIndex] as ContentModelFormatContainer;\n const containerIndex = path[containerPathIndex + 1].blocks.indexOf(container);\n const blockIndex = container.blocks.indexOf(block);\n\n if (blockIndex >= 0 && containerIndex >= 0) {\n const newContainer = createFormatContainer(container.tagName, container.format);\n\n container.blocks.splice(blockIndex, 1);\n newContainer.blocks = container.blocks.splice(blockIndex);\n\n path[containerPathIndex + 1].blocks.splice(containerIndex + 1, 0, block, newContainer);\n }\n }\n}\n\nfunction clearListFormat(path: ContentModelBlockGroup[]) {\n const listItem = path[getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell'])] as\n | ContentModelListItem\n | undefined;\n\n if (listItem) {\n listItem.levels = [];\n }\n}\n\nfunction clearBlockFormat(path: ContentModelBlockGroup[], block: ContentModelBlock) {\n if (block.blockType == 'Divider') {\n const index = path[0].blocks.indexOf(block);\n\n if (index >= 0) {\n path[0].blocks.splice(index, 1);\n }\n } else if (block.blockType == 'Paragraph') {\n block.format = {};\n delete block.decorator;\n }\n}\n\nfunction isOnlySelectionMarkerSelected(block: ContentModelBlock) {\n const segments = block.blockType == 'Paragraph' ? block.segments.filter(x => x.isSelected) : [];\n\n return segments.length == 1 && segments[0].segmentType == 'SelectionMarker';\n}\n\nfunction isWholeBlockSelected(block: ContentModelBlock) {\n return (\n (block as Selectable).isSelected ||\n (block.blockType == 'Paragraph' && block.segments.every(x => x.isSelected))\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"clearModelFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/clearModelFormat.ts"],"names":[],"mappings":";;;;IAsBA;;OAEG;IACH,SAAgB,gBAAgB,CAC5B,KAA2B,EAC3B,aAA8D,EAC9D,eAAsC,EACtC,aAA6C;QAE7C,IAAA,gDAAiB,EACb,KAAK,EACL,UAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ;YAChC,IAAI,QAAQ,EAAE;gBACV,eAAe,CAAC,IAAI,OAApB,eAAe,qDAAS,QA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,CAAC,KAAwB;QAC3D,IAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,UAAU,EAAZ,CAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEhG,OAAO,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAAC;IAChF,CAAC;IAED,SAAS,oBAAoB,CAAC,KAAwB;QAClD,OAAO,CACF,KAAoB,CAAC,UAAU;YAChC,CAAC,KAAK,CAAC,SAAS,IAAI,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,UAAU,EAAZ,CAAY,CAAC,CAAC,CAC9E,CAAC;IACN,CAAC","sourcesContent":["import { adjustWordSelection } from '../selection/adjustWordSelection';\nimport { createFormatContainer } from 'roosterjs-content-model-dom';\nimport {\n iterateSelections,\n applyTableFormat,\n getClosestAncestorBlockGroupIndex,\n updateTableCellMetadata,\n updateTableMetadata,\n} from 'roosterjs-content-model-core';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelDocument,\n ContentModelFormatContainer,\n ContentModelListItem,\n ContentModelSegment,\n ContentModelSegmentFormat,\n ContentModelTable,\n Selectable,\n TableSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function clearModelFormat(\n model: ContentModelDocument,\n blocksToClear: [ContentModelBlockGroup[], ContentModelBlock][],\n segmentsToClear: ContentModelSegment[],\n tablesToClear: [ContentModelTable, boolean][]\n) {\n iterateSelections(\n model,\n (path, tableContext, block, segments) => {\n if (segments) {\n segmentsToClear.push(...segments);\n }\n\n if (block) {\n blocksToClear.push([path, block]);\n } else if (tableContext) {\n clearTableCellFormat(tableContext, tablesToClear);\n }\n },\n {\n // When there is a default format to apply, we know how to handle segment format under list.\n // So no need to clear format of list number.\n // Otherwise, we will clear all format of selected text. And since they are under LI tag, we\n // also need to clear the format of LI (format holder) so that the format is really cleared\n includeListFormatHolder: model.format ? 'never' : 'anySegment',\n }\n );\n\n const marker = segmentsToClear[0];\n\n // 2. If selection is collapsed, add selection to whole word to clear if any\n if (\n blocksToClear.length == 1 &&\n isOnlySelectionMarkerSelected(blocksToClear[0][1]) &&\n blocksToClear.length == 1\n ) {\n segmentsToClear.splice(0, segmentsToClear.length, ...adjustWordSelection(model, marker));\n clearListFormat(blocksToClear[0][0]);\n } else if (blocksToClear.length > 1 || blocksToClear.some(x => isWholeBlockSelected(x[1]))) {\n // 2. If a full block or multiple blocks are selected, clear block format\n for (let i = blocksToClear.length - 1; i >= 0; i--) {\n const [path, block] = blocksToClear[i];\n\n clearBlockFormat(path, block);\n clearListFormat(path);\n clearContainerFormat(path, block);\n }\n }\n\n // 3. Finally clear format for segments\n clearSegmentsFormat(segmentsToClear, model.format);\n\n // 4. Clear format for table if any\n createTablesFormat(tablesToClear);\n}\n\nfunction createTablesFormat(tablesToClear: [ContentModelTable, boolean][]) {\n tablesToClear.forEach(x => {\n const [table, isWholeTableSelected] = x;\n if (isWholeTableSelected) {\n table.format = {\n useBorderBox: table.format.useBorderBox,\n borderCollapse: table.format.borderCollapse,\n };\n updateTableMetadata(table, () => null);\n }\n\n applyTableFormat(table, undefined /*newFormat*/, true);\n });\n}\n\nfunction clearSegmentsFormat(\n segmentsToClear: ContentModelSegment[],\n defaultSegmentFormat: ContentModelSegmentFormat | undefined\n) {\n segmentsToClear.forEach(x => {\n x.format = { ...(defaultSegmentFormat || {}) };\n\n if (x.link) {\n delete x.link.format.textColor;\n }\n\n delete x.code;\n });\n}\n\nfunction clearTableCellFormat(\n tableContext: TableSelectionContext | undefined,\n tablesToClear: [ContentModelTable, boolean][]\n) {\n if (tableContext) {\n const { table, colIndex, rowIndex, isWholeTableSelected } = tableContext;\n const cell = table.rows[rowIndex].cells[colIndex];\n\n if (cell.isSelected) {\n updateTableCellMetadata(cell, () => null);\n cell.isHeader = false;\n cell.format = {\n useBorderBox: cell.format.useBorderBox,\n };\n }\n\n if (!tablesToClear.find(x => x[0] == table)) {\n tablesToClear.push([table, isWholeTableSelected]);\n }\n }\n}\n\nfunction clearContainerFormat(path: ContentModelBlockGroup[], block: ContentModelBlock) {\n const containerPathIndex = getClosestAncestorBlockGroupIndex(\n path,\n ['FormatContainer'],\n ['TableCell']\n );\n\n if (containerPathIndex >= 0 && containerPathIndex < path.length - 1) {\n const container = path[containerPathIndex] as ContentModelFormatContainer;\n const containerIndex = path[containerPathIndex + 1].blocks.indexOf(container);\n const blockIndex = container.blocks.indexOf(block);\n\n if (blockIndex >= 0 && containerIndex >= 0) {\n const newContainer = createFormatContainer(container.tagName, container.format);\n\n container.blocks.splice(blockIndex, 1);\n newContainer.blocks = container.blocks.splice(blockIndex);\n\n path[containerPathIndex + 1].blocks.splice(containerIndex + 1, 0, block, newContainer);\n }\n }\n}\n\nfunction clearListFormat(path: ContentModelBlockGroup[]) {\n const listItem = path[getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell'])] as\n | ContentModelListItem\n | undefined;\n\n if (listItem) {\n listItem.levels = [];\n }\n}\n\nfunction clearBlockFormat(path: ContentModelBlockGroup[], block: ContentModelBlock) {\n if (block.blockType == 'Divider') {\n const index = path[0].blocks.indexOf(block);\n\n if (index >= 0) {\n path[0].blocks.splice(index, 1);\n }\n } else if (block.blockType == 'Paragraph') {\n block.format = {};\n delete block.decorator;\n }\n}\n\nfunction isOnlySelectionMarkerSelected(block: ContentModelBlock) {\n const segments = block.blockType == 'Paragraph' ? block.segments.filter(x => x.isSelected) : [];\n\n return segments.length == 1 && segments[0].segmentType == 'SelectionMarker';\n}\n\nfunction isWholeBlockSelected(block: ContentModelBlock) {\n return (\n (block as Selectable).isSelected ||\n (block.blockType == 'Paragraph' && block.segments.every(x => x.isSelected))\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapBlock.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"wrapBlock.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/common/wrapBlock.ts"],"names":[],"mappings":";;;;IAWA;;OAEG;IACH,SAAgB,cAAc,CAC1B,WAAsC,EACtC,MAAqC,EACrC,WAA8B,EAC9B,OAA8B,EAC9B,QAAoE;;QAEpE,IAAM,KAAK,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,mCAAI,CAAC,CAAC,CAAC;QAExD,IAAI,MAAM,IAAI,KAAK,IAAI,CAAC,EAAE;YACtB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAE/B,IAAM,SAAS,GAAsB,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9D,IAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC;YACpD,IAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;gBACtC,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAElD,IAAA,qDAAuB,EAAC,WAAW,CAAC,CAAC;YACrC,IAAA,sCAAQ,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAE/B,gGAAgG;YAChG,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;SAC5C;IACL,CAAC;IAxBD,wCAwBC;IAED;;OAEG;IACH,SAAgB,cAAc,CAC1B,WAAsC,EACtC,QAAgF;QAEhF,WAAW,CAAC,OAAO,CAAC,UAAC,EAAmB;;gBAAjB,MAAM,YAAA,EAAE,OAAO,aAAA;YAClC,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7C,IAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC3C,IAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC;YAEhD,IAAI,KAAK,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE;gBACnD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,qDAAuB,CAAC,CAAC;gBAChD,CAAA,KAAA,OAAO,CAAC,MAAM,CAAA,CAAC,IAAI,8DAAI,SAAS,CAAC,MAAM,WAAE;gBACzC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;aACtC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAfD,wCAeC;IAED,SAAS,YAAY,CACjB,MAA8B,EAC9B,KAAa,EACb,OAA8B,EAC9B,KAAc;QAEd,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAE7B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC;IACjB,CAAC","sourcesContent":["import { addBlock, setParagraphNotImplicit } from 'roosterjs-content-model-dom';\nimport type { ContentModelBlock, ContentModelBlockGroup } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport interface WrapBlockStep1Result<T extends ContentModelBlockGroup & ContentModelBlock> {\n parent: ContentModelBlockGroup;\n wrapper: T;\n}\n\n/**\n * @internal\n */\nexport function wrapBlockStep1<T extends ContentModelBlockGroup & ContentModelBlock>(\n step1Result: WrapBlockStep1Result<T>[],\n parent: ContentModelBlockGroup | null,\n blockToWrap: ContentModelBlock,\n creator: (isRtl: boolean) => T,\n canMerge: (isRtl: boolean, target: ContentModelBlock) => target is T\n) {\n const index = parent?.blocks.indexOf(blockToWrap) ?? -1;\n\n if (parent && index >= 0) {\n parent.blocks.splice(index, 1);\n\n const prevBlock: ContentModelBlock = parent.blocks[index - 1];\n const isRtl = blockToWrap.format.direction == 'rtl';\n const wrapper = canMerge(isRtl, prevBlock)\n ? prevBlock\n : createAndAdd(parent, index, creator, isRtl);\n\n setParagraphNotImplicit(blockToWrap);\n addBlock(wrapper, blockToWrap);\n\n // Use reverse order, so that we can merge from last to first to avoid modifying unmerged quotes\n step1Result.unshift({ parent, wrapper });\n }\n}\n\n/**\n * @internal\n */\nexport function wrapBlockStep2<T extends ContentModelBlockGroup & ContentModelBlock>(\n step1Result: WrapBlockStep1Result<T>[],\n canMerge: (isRtl: boolean, target: ContentModelBlock, current: T) => target is T\n) {\n step1Result.forEach(({ parent, wrapper }) => {\n const index = parent.blocks.indexOf(wrapper);\n const nextBlock = parent.blocks[index + 1];\n const isRtl = wrapper.format.direction == 'rtl';\n\n if (index >= 0 && canMerge(isRtl, nextBlock, wrapper)) {\n wrapper.blocks.forEach(setParagraphNotImplicit);\n wrapper.blocks.push(...nextBlock.blocks);\n parent.blocks.splice(index + 1, 1);\n }\n });\n}\n\nfunction createAndAdd<T extends ContentModelBlockGroup & ContentModelBlock>(\n parent: ContentModelBlockGroup,\n index: number,\n creator: (isRtl: boolean) => T,\n isRtl: boolean\n): T {\n const block = creator(isRtl);\n\n parent.blocks.splice(index, 0, block);\n return block;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertEntityModel.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"insertEntityModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/entity/insertEntityModel.ts"],"names":[],"mappings":";;;;IAsBA;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,KAA2B,EAC3B,WAA+B,EAC/B,QAA8B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C,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;oBACxE,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,sCAAQ,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;oBACpD,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;iBACtC;aACJ;iBAAM;gBACH,aAAa,GAAG,IAAA,6CAAe,EAC3B,KAAK,CAAC,cAAc,EACpB,SAAS,CAAC,UAAU,EACpB,KAAK,CAAC,MAAM,CACf,CAAC;gBAEF,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACzC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACtC;YAED,CAAA,KAAA,WAAW,CAAC,MAAM,CAAA,CAAC,MAAM,uCAAC,UAAU,EAAE,CAAC,uBAAK,cAAc,WAAE;YAE5D,IAAI,gBAAgB,IAAI,aAAa,EAAE;gBACnC,IAAM,MAAM,GAAG,IAAA,mDAAqB,EAAC,CAAA,MAAA,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,MAAM,KAAI,KAAK,CAAC,MAAM,CAAC,CAAC;gBACxF,IAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;gBAExC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC3D,IAAA,2CAAY,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;aACvC;SACJ;IACL,CAAC;IAzFD,8CAyFC","sourcesContent":["import {\n deleteSelection,\n getClosestAncestorBlockGroupIndex,\n setSelection,\n} from 'roosterjs-content-model-core';\nimport {\n createBr,\n createParagraph,\n createSelectionMarker,\n normalizeContentModel,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelDocument,\n ContentModelEntity,\n ContentModelParagraph,\n DeleteSelectionResult,\n FormatContentModelContext,\n InsertEntityPosition,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function insertEntityModel(\n model: ContentModelDocument,\n entityModel: ContentModelEntity,\n position: InsertEntityPosition,\n isBlock: boolean,\n focusAfterEntity?: boolean,\n context?: FormatContentModelContext\n) {\n let blockParent: ContentModelBlockGroup | undefined;\n let blockIndex = -1;\n let deleteResult: DeleteSelectionResult;\n\n if (position == 'begin' || position == 'end') {\n blockParent = model;\n blockIndex = position == 'begin' ? 0 : model.blocks.length;\n\n if (!isBlock) {\n Object.assign(entityModel.format, model.format);\n }\n } else if ((deleteResult = deleteSelection(model, [], context)).insertPoint) {\n const { marker, paragraph, path } = deleteResult.insertPoint;\n\n if (deleteResult.deleteResult == 'range') {\n normalizeContentModel(model);\n }\n\n if (!isBlock) {\n const index = paragraph.segments.indexOf(marker);\n\n Object.assign(entityModel.format, marker.format);\n\n if (index >= 0) {\n paragraph.segments.splice(focusAfterEntity ? index : index + 1, 0, entityModel);\n }\n } else {\n const pathIndex =\n position == 'root'\n ? getClosestAncestorBlockGroupIndex(path, ['TableCell', 'Document'])\n : 0;\n blockParent = path[pathIndex];\n const child = path[pathIndex - 1];\n const directChild: ContentModelBlock =\n child?.blockGroupType == 'FormatContainer' ||\n child?.blockGroupType == 'General' ||\n child?.blockGroupType == 'ListItem'\n ? child\n : paragraph;\n const childIndex = blockParent.blocks.indexOf(directChild);\n blockIndex = childIndex >= 0 ? childIndex + 1 : -1;\n }\n }\n\n if (blockIndex >= 0 && blockParent) {\n const blocksToInsert: ContentModelBlock[] = [];\n let nextParagraph: ContentModelParagraph | undefined;\n\n if (isBlock) {\n const nextBlock = blockParent.blocks[blockIndex];\n\n blocksToInsert.push(entityModel);\n\n if (nextBlock?.blockType == 'Paragraph') {\n nextParagraph = nextBlock;\n } else if (!nextBlock || nextBlock.blockType == 'Entity' || focusAfterEntity) {\n nextParagraph = createParagraph(false /*isImplicit*/, {}, model.format);\n nextParagraph.segments.push(createBr(model.format));\n blocksToInsert.push(nextParagraph);\n }\n } else {\n nextParagraph = createParagraph(\n false /*isImplicit*/,\n undefined /*format*/,\n model.format\n );\n\n nextParagraph.segments.push(entityModel);\n blocksToInsert.push(nextParagraph);\n }\n\n blockParent.blocks.splice(blockIndex, 0, ...blocksToInsert);\n\n if (focusAfterEntity && nextParagraph) {\n const marker = createSelectionMarker(nextParagraph.segments[0]?.format || model.format);\n const segments = nextParagraph.segments;\n\n isBlock ? segments.unshift(marker) : segments.push(marker);\n setSelection(model, marker, marker);\n }\n }\n}\n"]}
|
|
@@ -2,4 +2,4 @@ import type { Border, ContentModelImage } from 'roosterjs-content-model-types';
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export declare function applyImageBorderFormat(image: ContentModelImage, border: Border | null, borderRadius?: string): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_core_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.applyImageBorderFormat = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
@@ -53,6 +54,6 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
53
54
|
image.format.borderRadius = borderRadius;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
exports.
|
|
57
|
+
exports.applyImageBorderFormat = applyImageBorderFormat;
|
|
57
58
|
});
|
|
58
59
|
//# sourceMappingURL=applyImageBorderFormat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyImageBorderFormat.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"applyImageBorderFormat.js","sourceRoot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CAAC;YACvC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC;YACtC,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;YACzC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,YAAY,CAAC;SAC3C;aAAM;YACH,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;YAC9B,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;SACnC;QAED,IAAI,YAAY,EAAE;YACd,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;SAC5C;IACL,CAAC;IAlDD,wDAkDC","sourcesContent":["import { extractBorderValues } from 'roosterjs-content-model-core';\nimport { parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport type { Border, ContentModelImage } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function applyImageBorderFormat(\n image: ContentModelImage,\n border: Border | null,\n borderRadius?: string\n) {\n if (border) {\n const format = image.format;\n const { width, style, color } = border;\n const borderKey = 'borderTop';\n const extractedBorder = extractBorderValues(format[borderKey]);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n let borderFormat = '';\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 image.format.borderLeft = borderFormat;\n image.format.borderTop = borderFormat;\n image.format.borderBottom = borderFormat;\n image.format.borderRight = borderFormat;\n } else {\n delete image.format.borderLeft;\n delete image.format.borderTop;\n delete image.format.borderBottom;\n delete image.format.borderRight;\n }\n\n if (borderRadius) {\n image.format.borderRadius = borderRadius;\n }\n}\n"]}
|