roosterjs-content-model-api 0.20.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/LICENSE +25 -0
- package/README.md +262 -0
- package/lib/index.d.ts +45 -0
- package/lib/index.js +94 -0
- package/lib/index.js.map +1 -0
- package/lib/modelApi/block/setModelAlignment.d.ts +5 -0
- package/lib/modelApi/block/setModelAlignment.js +53 -0
- package/lib/modelApi/block/setModelAlignment.js.map +1 -0
- package/lib/modelApi/block/setModelDirection.d.ts +5 -0
- package/lib/modelApi/block/setModelDirection.js +53 -0
- package/lib/modelApi/block/setModelDirection.js.map +1 -0
- package/lib/modelApi/block/setModelIndentation.d.ts +5 -0
- package/lib/modelApi/block/setModelIndentation.js +48 -0
- package/lib/modelApi/block/setModelIndentation.js.map +1 -0
- package/lib/modelApi/block/toggleModelBlockQuote.d.ts +5 -0
- package/lib/modelApi/block/toggleModelBlockQuote.js +49 -0
- package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -0
- package/lib/modelApi/common/clearModelFormat.d.ts +5 -0
- package/lib/modelApi/common/clearModelFormat.js +130 -0
- package/lib/modelApi/common/clearModelFormat.js.map +1 -0
- package/lib/modelApi/common/retrieveModelFormatState.d.ts +5 -0
- package/lib/modelApi/common/retrieveModelFormatState.js +172 -0
- package/lib/modelApi/common/retrieveModelFormatState.js.map +1 -0
- package/lib/modelApi/common/wrapBlock.d.ts +16 -0
- package/lib/modelApi/common/wrapBlock.js +45 -0
- package/lib/modelApi/common/wrapBlock.js.map +1 -0
- package/lib/modelApi/domUtils/readFile.d.ts +8 -0
- package/lib/modelApi/domUtils/readFile.js +24 -0
- package/lib/modelApi/domUtils/readFile.js.map +1 -0
- package/lib/modelApi/entity/insertEntityModel.d.ts +5 -0
- package/lib/modelApi/entity/insertEntityModel.js +76 -0
- package/lib/modelApi/entity/insertEntityModel.js.map +1 -0
- package/lib/modelApi/image/applyImageBorderFormat.d.ts +5 -0
- package/lib/modelApi/image/applyImageBorderFormat.js +58 -0
- package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -0
- package/lib/modelApi/list/findListItemsInSameThread.d.ts +5 -0
- package/lib/modelApi/list/findListItemsInSameThread.js +113 -0
- package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -0
- package/lib/modelApi/list/setListType.d.ts +5 -0
- package/lib/modelApi/list/setListType.js +92 -0
- package/lib/modelApi/list/setListType.js.map +1 -0
- package/lib/modelApi/selection/adjustSegmentSelection.d.ts +5 -0
- package/lib/modelApi/selection/adjustSegmentSelection.js +48 -0
- package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -0
- package/lib/modelApi/selection/adjustWordSelection.d.ts +5 -0
- package/lib/modelApi/selection/adjustWordSelection.js +122 -0
- package/lib/modelApi/selection/adjustWordSelection.js.map +1 -0
- package/lib/modelApi/selection/collapseTableSelection.d.ts +6 -0
- package/lib/modelApi/selection/collapseTableSelection.js +17 -0
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -0
- package/lib/modelApi/table/alignTable.d.ts +5 -0
- package/lib/modelApi/table/alignTable.js +13 -0
- package/lib/modelApi/table/alignTable.js.map +1 -0
- package/lib/modelApi/table/alignTableCell.d.ts +9 -0
- package/lib/modelApi/table/alignTableCell.js +60 -0
- package/lib/modelApi/table/alignTableCell.js.map +1 -0
- package/lib/modelApi/table/canMergeCells.d.ts +5 -0
- package/lib/modelApi/table/canMergeCells.js +57 -0
- package/lib/modelApi/table/canMergeCells.js.map +1 -0
- package/lib/modelApi/table/createTableStructure.d.ts +5 -0
- package/lib/modelApi/table/createTableStructure.js +20 -0
- package/lib/modelApi/table/createTableStructure.js.map +1 -0
- package/lib/modelApi/table/deleteTable.d.ts +5 -0
- package/lib/modelApi/table/deleteTable.js +12 -0
- package/lib/modelApi/table/deleteTable.js.map +1 -0
- package/lib/modelApi/table/deleteTableColumn.d.ts +5 -0
- package/lib/modelApi/table/deleteTableColumn.js +25 -0
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -0
- package/lib/modelApi/table/deleteTableRow.d.ts +5 -0
- package/lib/modelApi/table/deleteTableRow.js +24 -0
- package/lib/modelApi/table/deleteTableRow.js.map +1 -0
- package/lib/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -0
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js +57 -0
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -0
- package/lib/modelApi/table/getSelectedCells.d.ts +14 -0
- package/lib/modelApi/table/getSelectedCells.js +32 -0
- package/lib/modelApi/table/getSelectedCells.js.map +1 -0
- package/lib/modelApi/table/insertTableColumn.d.ts +5 -0
- package/lib/modelApi/table/insertTableColumn.js +23 -0
- package/lib/modelApi/table/insertTableColumn.js.map +1 -0
- package/lib/modelApi/table/insertTableRow.d.ts +5 -0
- package/lib/modelApi/table/insertTableRow.js +27 -0
- package/lib/modelApi/table/insertTableRow.js.map +1 -0
- package/lib/modelApi/table/mergeTableCells.d.ts +5 -0
- package/lib/modelApi/table/mergeTableCells.js +26 -0
- package/lib/modelApi/table/mergeTableCells.js.map +1 -0
- package/lib/modelApi/table/mergeTableColumn.d.ts +5 -0
- package/lib/modelApi/table/mergeTableColumn.js +38 -0
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -0
- package/lib/modelApi/table/mergeTableRow.d.ts +5 -0
- package/lib/modelApi/table/mergeTableRow.js +39 -0
- package/lib/modelApi/table/mergeTableRow.js.map +1 -0
- package/lib/modelApi/table/splitTableCellHorizontally.d.ts +5 -0
- package/lib/modelApi/table/splitTableCellHorizontally.js +55 -0
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -0
- package/lib/modelApi/table/splitTableCellVertically.d.ts +5 -0
- package/lib/modelApi/table/splitTableCellVertically.js +56 -0
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -0
- package/lib/publicApi/block/setAlignment.d.ts +7 -0
- package/lib/publicApi/block/setAlignment.js +16 -0
- package/lib/publicApi/block/setAlignment.js.map +1 -0
- package/lib/publicApi/block/setDirection.d.ts +7 -0
- package/lib/publicApi/block/setDirection.js +16 -0
- package/lib/publicApi/block/setDirection.js.map +1 -0
- package/lib/publicApi/block/setHeadingLevel.d.ts +7 -0
- package/lib/publicApi/block/setHeadingLevel.js +50 -0
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -0
- package/lib/publicApi/block/setIndentation.d.ts +8 -0
- package/lib/publicApi/block/setIndentation.js +25 -0
- package/lib/publicApi/block/setIndentation.js.map +1 -0
- package/lib/publicApi/block/setParagraphMargin.d.ts +9 -0
- package/lib/publicApi/block/setParagraphMargin.js +33 -0
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -0
- package/lib/publicApi/block/setSpacing.d.ts +7 -0
- package/lib/publicApi/block/setSpacing.js +21 -0
- package/lib/publicApi/block/setSpacing.js.map +1 -0
- package/lib/publicApi/block/toggleBlockQuote.d.ts +9 -0
- package/lib/publicApi/block/toggleBlockQuote.js +35 -0
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -0
- package/lib/publicApi/entity/insertEntity.d.ts +25 -0
- package/lib/publicApi/entity/insertEntity.js +41 -0
- package/lib/publicApi/entity/insertEntity.js.map +1 -0
- package/lib/publicApi/format/clearFormat.d.ts +6 -0
- package/lib/publicApi/format/clearFormat.js +23 -0
- package/lib/publicApi/format/clearFormat.js.map +1 -0
- package/lib/publicApi/format/getFormatState.d.ts +26 -0
- package/lib/publicApi/format/getFormatState.js +83 -0
- package/lib/publicApi/format/getFormatState.js.map +1 -0
- package/lib/publicApi/image/adjustImageSelection.d.ts +6 -0
- package/lib/publicApi/image/adjustImageSelection.js +26 -0
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -0
- package/lib/publicApi/image/changeImage.d.ts +7 -0
- package/lib/publicApi/image/changeImage.js +36 -0
- package/lib/publicApi/image/changeImage.js.map +1 -0
- package/lib/publicApi/image/insertImage.d.ts +7 -0
- package/lib/publicApi/image/insertImage.js +38 -0
- package/lib/publicApi/image/insertImage.js.map +1 -0
- package/lib/publicApi/image/setImageAltText.d.ts +8 -0
- package/lib/publicApi/image/setImageAltText.js +17 -0
- package/lib/publicApi/image/setImageAltText.js.map +1 -0
- package/lib/publicApi/image/setImageBorder.d.ts +9 -0
- package/lib/publicApi/image/setImageBorder.js +19 -0
- package/lib/publicApi/image/setImageBorder.js.map +1 -0
- package/lib/publicApi/image/setImageBoxShadow.d.ts +8 -0
- package/lib/publicApi/image/setImageBoxShadow.js +29 -0
- package/lib/publicApi/image/setImageBoxShadow.js.map +1 -0
- package/lib/publicApi/link/adjustLinkSelection.d.ts +6 -0
- package/lib/publicApi/link/adjustLinkSelection.js +34 -0
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -0
- package/lib/publicApi/link/insertLink.d.ts +15 -0
- package/lib/publicApi/link/insertLink.js +127 -0
- package/lib/publicApi/link/insertLink.js.map +1 -0
- package/lib/publicApi/link/removeLink.d.ts +8 -0
- package/lib/publicApi/link/removeLink.js +32 -0
- package/lib/publicApi/link/removeLink.js.map +1 -0
- package/lib/publicApi/list/setListStartNumber.d.ts +7 -0
- package/lib/publicApi/list/setListStartNumber.js +26 -0
- package/lib/publicApi/list/setListStartNumber.js.map +1 -0
- package/lib/publicApi/list/setListStyle.d.ts +7 -0
- package/lib/publicApi/list/setListStyle.js +33 -0
- package/lib/publicApi/list/setListStyle.js.map +1 -0
- package/lib/publicApi/list/toggleBullet.d.ts +8 -0
- package/lib/publicApi/list/toggleBullet.js +20 -0
- package/lib/publicApi/list/toggleBullet.js.map +1 -0
- package/lib/publicApi/list/toggleNumbering.d.ts +8 -0
- package/lib/publicApi/list/toggleNumbering.js +20 -0
- package/lib/publicApi/list/toggleNumbering.js.map +1 -0
- package/lib/publicApi/segment/applySegmentFormat.d.ts +7 -0
- package/lib/publicApi/segment/applySegmentFormat.js +23 -0
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -0
- package/lib/publicApi/segment/changeCapitalization.d.ts +10 -0
- package/lib/publicApi/segment/changeCapitalization.js +50 -0
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -0
- package/lib/publicApi/segment/changeFontSize.d.ts +8 -0
- package/lib/publicApi/segment/changeFontSize.js +62 -0
- package/lib/publicApi/segment/changeFontSize.js.map +1 -0
- package/lib/publicApi/segment/setBackgroundColor.d.ts +7 -0
- package/lib/publicApi/segment/setBackgroundColor.js +36 -0
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -0
- package/lib/publicApi/segment/setFontName.d.ts +7 -0
- package/lib/publicApi/segment/setFontName.js +19 -0
- package/lib/publicApi/segment/setFontName.js.map +1 -0
- package/lib/publicApi/segment/setFontSize.d.ts +12 -0
- package/lib/publicApi/segment/setFontSize.js +34 -0
- package/lib/publicApi/segment/setFontSize.js.map +1 -0
- package/lib/publicApi/segment/setTextColor.d.ts +7 -0
- package/lib/publicApi/segment/setTextColor.js +26 -0
- package/lib/publicApi/segment/setTextColor.js.map +1 -0
- package/lib/publicApi/segment/toggleBold.d.ts +10 -0
- package/lib/publicApi/segment/toggleBold.js +28 -0
- package/lib/publicApi/segment/toggleBold.js.map +1 -0
- package/lib/publicApi/segment/toggleCode.d.ts +6 -0
- package/lib/publicApi/segment/toggleCode.js +28 -0
- package/lib/publicApi/segment/toggleCode.js.map +1 -0
- package/lib/publicApi/segment/toggleItalic.d.ts +6 -0
- package/lib/publicApi/segment/toggleItalic.js +15 -0
- package/lib/publicApi/segment/toggleItalic.js.map +1 -0
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +6 -0
- package/lib/publicApi/segment/toggleStrikethrough.js +15 -0
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -0
- package/lib/publicApi/segment/toggleSubscript.d.ts +6 -0
- package/lib/publicApi/segment/toggleSubscript.js +15 -0
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -0
- package/lib/publicApi/segment/toggleSuperscript.d.ts +6 -0
- package/lib/publicApi/segment/toggleSuperscript.js +15 -0
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -0
- package/lib/publicApi/segment/toggleUnderline.d.ts +6 -0
- package/lib/publicApi/segment/toggleUnderline.js +18 -0
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -0
- package/lib/publicApi/selection/hasSelectionInBlock.d.ts +6 -0
- package/lib/publicApi/selection/hasSelectionInBlock.js +25 -0
- package/lib/publicApi/selection/hasSelectionInBlock.js.map +1 -0
- package/lib/publicApi/selection/hasSelectionInBlockGroup.d.ts +6 -0
- package/lib/publicApi/selection/hasSelectionInBlockGroup.js +18 -0
- package/lib/publicApi/selection/hasSelectionInBlockGroup.js.map +1 -0
- package/lib/publicApi/selection/hasSelectionInSegment.d.ts +6 -0
- package/lib/publicApi/selection/hasSelectionInSegment.js +13 -0
- package/lib/publicApi/selection/hasSelectionInSegment.js.map +1 -0
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +8 -0
- package/lib/publicApi/table/applyTableBorderFormat.js +293 -0
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -0
- package/lib/publicApi/table/editTable.d.ts +7 -0
- package/lib/publicApi/table/editTable.js +104 -0
- package/lib/publicApi/table/editTable.js.map +1 -0
- package/lib/publicApi/table/formatTable.d.ts +8 -0
- package/lib/publicApi/table/formatTable.js +38 -0
- package/lib/publicApi/table/formatTable.js.map +1 -0
- package/lib/publicApi/table/insertTable.d.ts +11 -0
- package/lib/publicApi/table/insertTable.js +47 -0
- package/lib/publicApi/table/insertTable.js.map +1 -0
- package/lib/publicApi/table/setTableCellShade.d.ts +7 -0
- package/lib/publicApi/table/setTableCellShade.js +34 -0
- package/lib/publicApi/table/setTableCellShade.js.map +1 -0
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +5 -0
- package/lib/publicApi/utils/formatImageWithContentModel.js +15 -0
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -0
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +5 -0
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +19 -0
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -0
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +5 -0
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +52 -0
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -0
- package/lib-amd/index.d.ts +45 -0
- package/lib-amd/index.js +51 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/modelApi/block/setModelAlignment.d.ts +5 -0
- package/lib-amd/modelApi/block/setModelAlignment.js +53 -0
- package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -0
- package/lib-amd/modelApi/block/setModelDirection.d.ts +5 -0
- package/lib-amd/modelApi/block/setModelDirection.js +53 -0
- package/lib-amd/modelApi/block/setModelDirection.js.map +1 -0
- package/lib-amd/modelApi/block/setModelIndentation.d.ts +5 -0
- package/lib-amd/modelApi/block/setModelIndentation.js +48 -0
- package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -0
- package/lib-amd/modelApi/block/toggleModelBlockQuote.d.ts +5 -0
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js +48 -0
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -0
- package/lib-amd/modelApi/common/clearModelFormat.d.ts +5 -0
- package/lib-amd/modelApi/common/clearModelFormat.js +128 -0
- package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -0
- package/lib-amd/modelApi/common/retrieveModelFormatState.d.ts +5 -0
- package/lib-amd/modelApi/common/retrieveModelFormatState.js +172 -0
- package/lib-amd/modelApi/common/retrieveModelFormatState.js.map +1 -0
- package/lib-amd/modelApi/common/wrapBlock.d.ts +16 -0
- package/lib-amd/modelApi/common/wrapBlock.js +45 -0
- package/lib-amd/modelApi/common/wrapBlock.js.map +1 -0
- package/lib-amd/modelApi/domUtils/readFile.d.ts +8 -0
- package/lib-amd/modelApi/domUtils/readFile.js +26 -0
- package/lib-amd/modelApi/domUtils/readFile.js.map +1 -0
- package/lib-amd/modelApi/entity/insertEntityModel.d.ts +5 -0
- package/lib-amd/modelApi/entity/insertEntityModel.js +75 -0
- package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -0
- package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +5 -0
- package/lib-amd/modelApi/image/applyImageBorderFormat.js +58 -0
- package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -0
- package/lib-amd/modelApi/list/findListItemsInSameThread.d.ts +5 -0
- package/lib-amd/modelApi/list/findListItemsInSameThread.js +115 -0
- package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -0
- package/lib-amd/modelApi/list/setListType.d.ts +5 -0
- package/lib-amd/modelApi/list/setListType.js +92 -0
- package/lib-amd/modelApi/list/setListType.js.map +1 -0
- package/lib-amd/modelApi/selection/adjustSegmentSelection.d.ts +5 -0
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js +49 -0
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -0
- package/lib-amd/modelApi/selection/adjustWordSelection.d.ts +5 -0
- package/lib-amd/modelApi/selection/adjustWordSelection.js +121 -0
- package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -0
- package/lib-amd/modelApi/selection/collapseTableSelection.d.ts +6 -0
- package/lib-amd/modelApi/selection/collapseTableSelection.js +18 -0
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -0
- package/lib-amd/modelApi/table/alignTable.d.ts +5 -0
- package/lib-amd/modelApi/table/alignTable.js +15 -0
- package/lib-amd/modelApi/table/alignTable.js.map +1 -0
- package/lib-amd/modelApi/table/alignTableCell.d.ts +9 -0
- package/lib-amd/modelApi/table/alignTableCell.js +60 -0
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -0
- package/lib-amd/modelApi/table/canMergeCells.d.ts +5 -0
- package/lib-amd/modelApi/table/canMergeCells.js +59 -0
- package/lib-amd/modelApi/table/canMergeCells.js.map +1 -0
- package/lib-amd/modelApi/table/createTableStructure.d.ts +5 -0
- package/lib-amd/modelApi/table/createTableStructure.js +21 -0
- package/lib-amd/modelApi/table/createTableStructure.js.map +1 -0
- package/lib-amd/modelApi/table/deleteTable.d.ts +5 -0
- package/lib-amd/modelApi/table/deleteTable.js +14 -0
- package/lib-amd/modelApi/table/deleteTable.js.map +1 -0
- package/lib-amd/modelApi/table/deleteTableColumn.d.ts +5 -0
- package/lib-amd/modelApi/table/deleteTableColumn.js +25 -0
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -0
- package/lib-amd/modelApi/table/deleteTableRow.d.ts +5 -0
- package/lib-amd/modelApi/table/deleteTableRow.js +24 -0
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -0
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -0
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js +58 -0
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -0
- package/lib-amd/modelApi/table/getSelectedCells.d.ts +14 -0
- package/lib-amd/modelApi/table/getSelectedCells.js +33 -0
- package/lib-amd/modelApi/table/getSelectedCells.js.map +1 -0
- package/lib-amd/modelApi/table/insertTableColumn.d.ts +5 -0
- package/lib-amd/modelApi/table/insertTableColumn.js +23 -0
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -0
- package/lib-amd/modelApi/table/insertTableRow.d.ts +5 -0
- package/lib-amd/modelApi/table/insertTableRow.js +26 -0
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -0
- package/lib-amd/modelApi/table/mergeTableCells.d.ts +5 -0
- package/lib-amd/modelApi/table/mergeTableCells.js +26 -0
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -0
- package/lib-amd/modelApi/table/mergeTableColumn.d.ts +5 -0
- package/lib-amd/modelApi/table/mergeTableColumn.js +38 -0
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -0
- package/lib-amd/modelApi/table/mergeTableRow.d.ts +5 -0
- package/lib-amd/modelApi/table/mergeTableRow.js +39 -0
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -0
- package/lib-amd/modelApi/table/splitTableCellHorizontally.d.ts +5 -0
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js +54 -0
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -0
- package/lib-amd/modelApi/table/splitTableCellVertically.d.ts +5 -0
- package/lib-amd/modelApi/table/splitTableCellVertically.js +55 -0
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -0
- package/lib-amd/publicApi/block/setAlignment.d.ts +7 -0
- package/lib-amd/publicApi/block/setAlignment.js +17 -0
- package/lib-amd/publicApi/block/setAlignment.js.map +1 -0
- package/lib-amd/publicApi/block/setDirection.d.ts +7 -0
- package/lib-amd/publicApi/block/setDirection.js +17 -0
- package/lib-amd/publicApi/block/setDirection.js.map +1 -0
- package/lib-amd/publicApi/block/setHeadingLevel.d.ts +7 -0
- package/lib-amd/publicApi/block/setHeadingLevel.js +51 -0
- package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -0
- package/lib-amd/publicApi/block/setIndentation.d.ts +8 -0
- package/lib-amd/publicApi/block/setIndentation.js +25 -0
- package/lib-amd/publicApi/block/setIndentation.js.map +1 -0
- package/lib-amd/publicApi/block/setParagraphMargin.d.ts +9 -0
- package/lib-amd/publicApi/block/setParagraphMargin.js +33 -0
- package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -0
- package/lib-amd/publicApi/block/setSpacing.d.ts +7 -0
- package/lib-amd/publicApi/block/setSpacing.js +22 -0
- package/lib-amd/publicApi/block/setSpacing.js.map +1 -0
- package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +9 -0
- package/lib-amd/publicApi/block/toggleBlockQuote.js +35 -0
- package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -0
- package/lib-amd/publicApi/entity/insertEntity.d.ts +25 -0
- package/lib-amd/publicApi/entity/insertEntity.js +40 -0
- package/lib-amd/publicApi/entity/insertEntity.js.map +1 -0
- package/lib-amd/publicApi/format/clearFormat.d.ts +6 -0
- package/lib-amd/publicApi/format/clearFormat.js +23 -0
- package/lib-amd/publicApi/format/clearFormat.js.map +1 -0
- package/lib-amd/publicApi/format/getFormatState.d.ts +26 -0
- package/lib-amd/publicApi/format/getFormatState.js +81 -0
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -0
- package/lib-amd/publicApi/image/adjustImageSelection.d.ts +6 -0
- package/lib-amd/publicApi/image/adjustImageSelection.js +27 -0
- package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -0
- package/lib-amd/publicApi/image/changeImage.d.ts +7 -0
- package/lib-amd/publicApi/image/changeImage.js +35 -0
- package/lib-amd/publicApi/image/changeImage.js.map +1 -0
- package/lib-amd/publicApi/image/insertImage.d.ts +7 -0
- package/lib-amd/publicApi/image/insertImage.js +37 -0
- package/lib-amd/publicApi/image/insertImage.js.map +1 -0
- package/lib-amd/publicApi/image/setImageAltText.d.ts +8 -0
- package/lib-amd/publicApi/image/setImageAltText.js +18 -0
- package/lib-amd/publicApi/image/setImageAltText.js.map +1 -0
- package/lib-amd/publicApi/image/setImageBorder.d.ts +9 -0
- package/lib-amd/publicApi/image/setImageBorder.js +19 -0
- package/lib-amd/publicApi/image/setImageBorder.js.map +1 -0
- package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +8 -0
- package/lib-amd/publicApi/image/setImageBoxShadow.js +30 -0
- package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -0
- package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +6 -0
- package/lib-amd/publicApi/link/adjustLinkSelection.js +33 -0
- package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -0
- package/lib-amd/publicApi/link/insertLink.d.ts +15 -0
- package/lib-amd/publicApi/link/insertLink.js +125 -0
- package/lib-amd/publicApi/link/insertLink.js.map +1 -0
- package/lib-amd/publicApi/link/removeLink.d.ts +8 -0
- package/lib-amd/publicApi/link/removeLink.js +32 -0
- package/lib-amd/publicApi/link/removeLink.js.map +1 -0
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +7 -0
- package/lib-amd/publicApi/list/setListStartNumber.js +27 -0
- package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -0
- package/lib-amd/publicApi/list/setListStyle.d.ts +7 -0
- package/lib-amd/publicApi/list/setListStyle.js +33 -0
- package/lib-amd/publicApi/list/setListStyle.js.map +1 -0
- package/lib-amd/publicApi/list/toggleBullet.d.ts +8 -0
- package/lib-amd/publicApi/list/toggleBullet.js +21 -0
- package/lib-amd/publicApi/list/toggleBullet.js.map +1 -0
- package/lib-amd/publicApi/list/toggleNumbering.d.ts +8 -0
- package/lib-amd/publicApi/list/toggleNumbering.js +21 -0
- package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -0
- package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +7 -0
- package/lib-amd/publicApi/segment/applySegmentFormat.js +24 -0
- package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -0
- package/lib-amd/publicApi/segment/changeCapitalization.d.ts +10 -0
- package/lib-amd/publicApi/segment/changeCapitalization.js +51 -0
- package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -0
- package/lib-amd/publicApi/segment/changeFontSize.d.ts +8 -0
- package/lib-amd/publicApi/segment/changeFontSize.js +61 -0
- package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -0
- package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +7 -0
- package/lib-amd/publicApi/segment/setBackgroundColor.js +35 -0
- package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -0
- package/lib-amd/publicApi/segment/setFontName.d.ts +7 -0
- package/lib-amd/publicApi/segment/setFontName.js +20 -0
- package/lib-amd/publicApi/segment/setFontName.js.map +1 -0
- package/lib-amd/publicApi/segment/setFontSize.d.ts +12 -0
- package/lib-amd/publicApi/segment/setFontSize.js +35 -0
- package/lib-amd/publicApi/segment/setFontSize.js.map +1 -0
- package/lib-amd/publicApi/segment/setTextColor.d.ts +7 -0
- package/lib-amd/publicApi/segment/setTextColor.js +27 -0
- package/lib-amd/publicApi/segment/setTextColor.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleBold.d.ts +10 -0
- package/lib-amd/publicApi/segment/toggleBold.js +29 -0
- package/lib-amd/publicApi/segment/toggleBold.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleCode.d.ts +6 -0
- package/lib-amd/publicApi/segment/toggleCode.js +28 -0
- package/lib-amd/publicApi/segment/toggleCode.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleItalic.d.ts +6 -0
- package/lib-amd/publicApi/segment/toggleItalic.js +16 -0
- package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +6 -0
- package/lib-amd/publicApi/segment/toggleStrikethrough.js +16 -0
- package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleSubscript.d.ts +6 -0
- package/lib-amd/publicApi/segment/toggleSubscript.js +16 -0
- package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +6 -0
- package/lib-amd/publicApi/segment/toggleSuperscript.js +16 -0
- package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -0
- package/lib-amd/publicApi/segment/toggleUnderline.d.ts +6 -0
- package/lib-amd/publicApi/segment/toggleUnderline.js +19 -0
- package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -0
- package/lib-amd/publicApi/selection/hasSelectionInBlock.d.ts +6 -0
- package/lib-amd/publicApi/selection/hasSelectionInBlock.js +25 -0
- package/lib-amd/publicApi/selection/hasSelectionInBlock.js.map +1 -0
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.d.ts +6 -0
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.js +19 -0
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.js.map +1 -0
- package/lib-amd/publicApi/selection/hasSelectionInSegment.d.ts +6 -0
- package/lib-amd/publicApi/selection/hasSelectionInSegment.js +14 -0
- package/lib-amd/publicApi/selection/hasSelectionInSegment.js.map +1 -0
- package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +8 -0
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +291 -0
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -0
- package/lib-amd/publicApi/table/editTable.d.ts +7 -0
- package/lib-amd/publicApi/table/editTable.js +89 -0
- package/lib-amd/publicApi/table/editTable.js.map +1 -0
- package/lib-amd/publicApi/table/formatTable.d.ts +8 -0
- package/lib-amd/publicApi/table/formatTable.js +38 -0
- package/lib-amd/publicApi/table/formatTable.js.map +1 -0
- package/lib-amd/publicApi/table/insertTable.d.ts +11 -0
- package/lib-amd/publicApi/table/insertTable.js +46 -0
- package/lib-amd/publicApi/table/insertTable.js.map +1 -0
- package/lib-amd/publicApi/table/setTableCellShade.d.ts +7 -0
- package/lib-amd/publicApi/table/setTableCellShade.js +33 -0
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -0
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +5 -0
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js +16 -0
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -0
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +5 -0
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +20 -0
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -0
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +5 -0
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +51 -0
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -0
- package/lib-mjs/index.d.ts +45 -0
- package/lib-mjs/index.js +46 -0
- package/lib-mjs/index.js.map +1 -0
- package/lib-mjs/modelApi/block/setModelAlignment.d.ts +5 -0
- package/lib-mjs/modelApi/block/setModelAlignment.js +49 -0
- package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -0
- package/lib-mjs/modelApi/block/setModelDirection.d.ts +5 -0
- package/lib-mjs/modelApi/block/setModelDirection.js +49 -0
- package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -0
- package/lib-mjs/modelApi/block/setModelIndentation.d.ts +5 -0
- package/lib-mjs/modelApi/block/setModelIndentation.js +44 -0
- package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -0
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.d.ts +5 -0
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js +45 -0
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -0
- package/lib-mjs/modelApi/common/clearModelFormat.d.ts +5 -0
- package/lib-mjs/modelApi/common/clearModelFormat.js +126 -0
- package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -0
- package/lib-mjs/modelApi/common/retrieveModelFormatState.d.ts +5 -0
- package/lib-mjs/modelApi/common/retrieveModelFormatState.js +168 -0
- package/lib-mjs/modelApi/common/retrieveModelFormatState.js.map +1 -0
- package/lib-mjs/modelApi/common/wrapBlock.d.ts +16 -0
- package/lib-mjs/modelApi/common/wrapBlock.js +40 -0
- package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -0
- package/lib-mjs/modelApi/domUtils/readFile.d.ts +8 -0
- package/lib-mjs/modelApi/domUtils/readFile.js +20 -0
- package/lib-mjs/modelApi/domUtils/readFile.js.map +1 -0
- package/lib-mjs/modelApi/entity/insertEntityModel.d.ts +5 -0
- package/lib-mjs/modelApi/entity/insertEntityModel.js +72 -0
- package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -0
- package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +5 -0
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js +55 -0
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -0
- package/lib-mjs/modelApi/list/findListItemsInSameThread.d.ts +5 -0
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js +109 -0
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -0
- package/lib-mjs/modelApi/list/setListType.d.ts +5 -0
- package/lib-mjs/modelApi/list/setListType.js +88 -0
- package/lib-mjs/modelApi/list/setListType.js.map +1 -0
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.d.ts +5 -0
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js +44 -0
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -0
- package/lib-mjs/modelApi/selection/adjustWordSelection.d.ts +5 -0
- package/lib-mjs/modelApi/selection/adjustWordSelection.js +118 -0
- package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -0
- package/lib-mjs/modelApi/selection/collapseTableSelection.d.ts +6 -0
- package/lib-mjs/modelApi/selection/collapseTableSelection.js +13 -0
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -0
- package/lib-mjs/modelApi/table/alignTable.d.ts +5 -0
- package/lib-mjs/modelApi/table/alignTable.js +9 -0
- package/lib-mjs/modelApi/table/alignTable.js.map +1 -0
- package/lib-mjs/modelApi/table/alignTableCell.d.ts +9 -0
- package/lib-mjs/modelApi/table/alignTableCell.js +55 -0
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -0
- package/lib-mjs/modelApi/table/canMergeCells.d.ts +5 -0
- package/lib-mjs/modelApi/table/canMergeCells.js +53 -0
- package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -0
- package/lib-mjs/modelApi/table/createTableStructure.d.ts +5 -0
- package/lib-mjs/modelApi/table/createTableStructure.js +16 -0
- package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -0
- package/lib-mjs/modelApi/table/deleteTable.d.ts +5 -0
- package/lib-mjs/modelApi/table/deleteTable.js +8 -0
- package/lib-mjs/modelApi/table/deleteTable.js.map +1 -0
- package/lib-mjs/modelApi/table/deleteTableColumn.d.ts +5 -0
- package/lib-mjs/modelApi/table/deleteTableColumn.js +21 -0
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -0
- package/lib-mjs/modelApi/table/deleteTableRow.d.ts +5 -0
- package/lib-mjs/modelApi/table/deleteTableRow.js +20 -0
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -0
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -0
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js +53 -0
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -0
- package/lib-mjs/modelApi/table/getSelectedCells.d.ts +14 -0
- package/lib-mjs/modelApi/table/getSelectedCells.js +28 -0
- package/lib-mjs/modelApi/table/getSelectedCells.js.map +1 -0
- package/lib-mjs/modelApi/table/insertTableColumn.d.ts +5 -0
- package/lib-mjs/modelApi/table/insertTableColumn.js +19 -0
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -0
- package/lib-mjs/modelApi/table/insertTableRow.d.ts +5 -0
- package/lib-mjs/modelApi/table/insertTableRow.js +23 -0
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -0
- package/lib-mjs/modelApi/table/mergeTableCells.d.ts +5 -0
- package/lib-mjs/modelApi/table/mergeTableCells.js +22 -0
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -0
- package/lib-mjs/modelApi/table/mergeTableColumn.d.ts +5 -0
- package/lib-mjs/modelApi/table/mergeTableColumn.js +34 -0
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -0
- package/lib-mjs/modelApi/table/mergeTableRow.d.ts +5 -0
- package/lib-mjs/modelApi/table/mergeTableRow.js +35 -0
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -0
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.d.ts +5 -0
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +51 -0
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -0
- package/lib-mjs/modelApi/table/splitTableCellVertically.d.ts +5 -0
- package/lib-mjs/modelApi/table/splitTableCellVertically.js +52 -0
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -0
- package/lib-mjs/publicApi/block/setAlignment.d.ts +7 -0
- package/lib-mjs/publicApi/block/setAlignment.js +13 -0
- package/lib-mjs/publicApi/block/setAlignment.js.map +1 -0
- package/lib-mjs/publicApi/block/setDirection.d.ts +7 -0
- package/lib-mjs/publicApi/block/setDirection.js +13 -0
- package/lib-mjs/publicApi/block/setDirection.js.map +1 -0
- package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +7 -0
- package/lib-mjs/publicApi/block/setHeadingLevel.js +47 -0
- package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -0
- package/lib-mjs/publicApi/block/setIndentation.d.ts +8 -0
- package/lib-mjs/publicApi/block/setIndentation.js +22 -0
- package/lib-mjs/publicApi/block/setIndentation.js.map +1 -0
- package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +9 -0
- package/lib-mjs/publicApi/block/setParagraphMargin.js +30 -0
- package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -0
- package/lib-mjs/publicApi/block/setSpacing.d.ts +7 -0
- package/lib-mjs/publicApi/block/setSpacing.js +18 -0
- package/lib-mjs/publicApi/block/setSpacing.js.map +1 -0
- package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +9 -0
- package/lib-mjs/publicApi/block/toggleBlockQuote.js +32 -0
- package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -0
- package/lib-mjs/publicApi/entity/insertEntity.d.ts +25 -0
- package/lib-mjs/publicApi/entity/insertEntity.js +38 -0
- package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -0
- package/lib-mjs/publicApi/format/clearFormat.d.ts +6 -0
- package/lib-mjs/publicApi/format/clearFormat.js +20 -0
- package/lib-mjs/publicApi/format/clearFormat.js.map +1 -0
- package/lib-mjs/publicApi/format/getFormatState.d.ts +26 -0
- package/lib-mjs/publicApi/format/getFormatState.js +78 -0
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -0
- package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +6 -0
- package/lib-mjs/publicApi/image/adjustImageSelection.js +23 -0
- package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -0
- package/lib-mjs/publicApi/image/changeImage.d.ts +7 -0
- package/lib-mjs/publicApi/image/changeImage.js +33 -0
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -0
- package/lib-mjs/publicApi/image/insertImage.d.ts +7 -0
- package/lib-mjs/publicApi/image/insertImage.js +35 -0
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -0
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +8 -0
- package/lib-mjs/publicApi/image/setImageAltText.js +14 -0
- package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -0
- package/lib-mjs/publicApi/image/setImageBorder.d.ts +9 -0
- package/lib-mjs/publicApi/image/setImageBorder.js +16 -0
- package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -0
- package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +8 -0
- package/lib-mjs/publicApi/image/setImageBoxShadow.js +26 -0
- package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -0
- package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +6 -0
- package/lib-mjs/publicApi/link/adjustLinkSelection.js +31 -0
- package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -0
- package/lib-mjs/publicApi/link/insertLink.d.ts +15 -0
- package/lib-mjs/publicApi/link/insertLink.js +124 -0
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -0
- package/lib-mjs/publicApi/link/removeLink.d.ts +8 -0
- package/lib-mjs/publicApi/link/removeLink.js +29 -0
- package/lib-mjs/publicApi/link/removeLink.js.map +1 -0
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +7 -0
- package/lib-mjs/publicApi/list/setListStartNumber.js +23 -0
- package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -0
- package/lib-mjs/publicApi/list/setListStyle.d.ts +7 -0
- package/lib-mjs/publicApi/list/setListStyle.js +30 -0
- package/lib-mjs/publicApi/list/setListStyle.js.map +1 -0
- package/lib-mjs/publicApi/list/toggleBullet.d.ts +8 -0
- package/lib-mjs/publicApi/list/toggleBullet.js +17 -0
- package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -0
- package/lib-mjs/publicApi/list/toggleNumbering.d.ts +8 -0
- package/lib-mjs/publicApi/list/toggleNumbering.js +17 -0
- package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -0
- package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +7 -0
- package/lib-mjs/publicApi/segment/applySegmentFormat.js +20 -0
- package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -0
- package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +10 -0
- package/lib-mjs/publicApi/segment/changeCapitalization.js +47 -0
- package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -0
- package/lib-mjs/publicApi/segment/changeFontSize.d.ts +8 -0
- package/lib-mjs/publicApi/segment/changeFontSize.js +59 -0
- package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -0
- package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +7 -0
- package/lib-mjs/publicApi/segment/setBackgroundColor.js +33 -0
- package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -0
- package/lib-mjs/publicApi/segment/setFontName.d.ts +7 -0
- package/lib-mjs/publicApi/segment/setFontName.js +16 -0
- package/lib-mjs/publicApi/segment/setFontName.js.map +1 -0
- package/lib-mjs/publicApi/segment/setFontSize.d.ts +12 -0
- package/lib-mjs/publicApi/segment/setFontSize.js +29 -0
- package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -0
- package/lib-mjs/publicApi/segment/setTextColor.d.ts +7 -0
- package/lib-mjs/publicApi/segment/setTextColor.js +23 -0
- package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleBold.d.ts +10 -0
- package/lib-mjs/publicApi/segment/toggleBold.js +23 -0
- package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleCode.d.ts +6 -0
- package/lib-mjs/publicApi/segment/toggleCode.js +25 -0
- package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleItalic.d.ts +6 -0
- package/lib-mjs/publicApi/segment/toggleItalic.js +12 -0
- package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +6 -0
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js +12 -0
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +6 -0
- package/lib-mjs/publicApi/segment/toggleSubscript.js +12 -0
- package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +6 -0
- package/lib-mjs/publicApi/segment/toggleSuperscript.js +12 -0
- package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -0
- package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +6 -0
- package/lib-mjs/publicApi/segment/toggleUnderline.js +15 -0
- package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -0
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.d.ts +6 -0
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.js +22 -0
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.js.map +1 -0
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.d.ts +6 -0
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.js +15 -0
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.js.map +1 -0
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.d.ts +6 -0
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.js +10 -0
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.js.map +1 -0
- package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +8 -0
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +290 -0
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -0
- package/lib-mjs/publicApi/table/editTable.d.ts +7 -0
- package/lib-mjs/publicApi/table/editTable.js +101 -0
- package/lib-mjs/publicApi/table/editTable.js.map +1 -0
- package/lib-mjs/publicApi/table/formatTable.d.ts +8 -0
- package/lib-mjs/publicApi/table/formatTable.js +35 -0
- package/lib-mjs/publicApi/table/formatTable.js.map +1 -0
- package/lib-mjs/publicApi/table/insertTable.d.ts +11 -0
- package/lib-mjs/publicApi/table/insertTable.js +44 -0
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -0
- package/lib-mjs/publicApi/table/setTableCellShade.d.ts +7 -0
- package/lib-mjs/publicApi/table/setTableCellShade.js +31 -0
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -0
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +5 -0
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +12 -0
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -0
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +5 -0
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +15 -0
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -0
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +5 -0
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +48 -0
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -0
- package/package.json +21 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
4
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
|
+
var insertEntityModel_1 = require("../../modelApi/entity/insertEntityModel");
|
|
6
|
+
var BlockEntityTag = 'div';
|
|
7
|
+
var InlineEntityTag = 'span';
|
|
8
|
+
function insertEntity(editor, type, isBlock, position, options) {
|
|
9
|
+
var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot;
|
|
10
|
+
var wrapper = editor.getDocument().createElement(isBlock ? BlockEntityTag : InlineEntityTag);
|
|
11
|
+
var display = wrapperDisplay !== null && wrapperDisplay !== void 0 ? wrapperDisplay : (isBlock ? undefined : 'inline-block');
|
|
12
|
+
wrapper.style.setProperty('display', display || null);
|
|
13
|
+
if (contentNode) {
|
|
14
|
+
wrapper.appendChild(contentNode);
|
|
15
|
+
}
|
|
16
|
+
var entityModel = (0, roosterjs_content_model_dom_1.createEntity)(wrapper, true /*isReadonly*/, undefined /*format*/, type);
|
|
17
|
+
editor.formatContentModel(function (model, context) {
|
|
18
|
+
(0, insertEntityModel_1.insertEntityModel)(model, entityModel, typeof position == 'string' ? position : 'focus', isBlock, focusAfterEntity, context);
|
|
19
|
+
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
20
|
+
context.skipUndoSnapshot = skipUndoSnapshot;
|
|
21
|
+
context.newEntities.push(entityModel);
|
|
22
|
+
return true;
|
|
23
|
+
}, {
|
|
24
|
+
selectionOverride: typeof position === 'object' ? position : undefined,
|
|
25
|
+
changeSource: roosterjs_content_model_core_1.ChangeSource.InsertEntity,
|
|
26
|
+
getChangeData: function () {
|
|
27
|
+
// TODO: Remove this entity when we have standalone editor
|
|
28
|
+
var entity = {
|
|
29
|
+
wrapper: wrapper,
|
|
30
|
+
type: type,
|
|
31
|
+
id: '',
|
|
32
|
+
isReadonly: true,
|
|
33
|
+
};
|
|
34
|
+
return entity;
|
|
35
|
+
},
|
|
36
|
+
apiName: 'insertEntity',
|
|
37
|
+
});
|
|
38
|
+
return entityModel;
|
|
39
|
+
}
|
|
40
|
+
exports.default = insertEntity;
|
|
41
|
+
//# sourceMappingURL=insertEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/entity/insertEntity.ts"],"names":[],"mappings":";;AAAA,6EAA4D;AAC5D,2EAAkF;AAClF,6EAA4E;AAU5E,IAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,IAAM,eAAe,GAAG,MAAM,CAAC;AAwC/B,SAAwB,YAAY,CAChC,MAAyB,EACzB,IAAY,EACZ,OAAgB,EAChB,QAA8C,EAC9C,OAA6B;IAEvB,IAAA,KAAsE,OAAO,IAAI,EAAE,EAAjF,WAAW,iBAAA,EAAE,gBAAgB,sBAAA,EAAE,cAAc,oBAAA,EAAE,gBAAgB,sBAAkB,CAAC;IAC1F,IAAM,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC/F,IAAM,OAAO,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAEzE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC;IAEtD,IAAI,WAAW,EAAE;QACb,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;KACpC;IAED,IAAM,WAAW,GAAG,IAAA,0CAAY,EAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAE3F,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,IAAA,qCAAiB,EACb,KAAK,EACL,WAAW,EACX,OAAO,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAChD,OAAO,EACP,gBAAgB,EAChB,OAAO,CACV,CAAC;QAEF,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QAC5C,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IAChB,CAAC,EACD;QACI,iBAAiB,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACtE,YAAY,EAAE,2CAAY,CAAC,YAAY;QACvC,aAAa,EAAE;YACX,0DAA0D;YAC1D,IAAM,MAAM,GAAW;gBACnB,OAAO,SAAA;gBACP,IAAI,MAAA;gBACJ,EAAE,EAAE,EAAE;gBACN,UAAU,EAAE,IAAI;aACnB,CAAC;YAEF,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,OAAO,EAAE,cAAc;KAC1B,CACJ,CAAC;IAEF,OAAO,WAAW,CAAC;AACvB,CAAC;AAxDD,+BAwDC","sourcesContent":["import { ChangeSource } from 'roosterjs-content-model-core';\nimport { createEntity, normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { insertEntityModel } from '../../modelApi/entity/insertEntityModel';\nimport type {\n ContentModelEntity,\n DOMSelection,\n InsertEntityPosition,\n InsertEntityOptions,\n IStandaloneEditor,\n} from 'roosterjs-content-model-types';\nimport type { Entity } from 'roosterjs-editor-types';\n\nconst BlockEntityTag = 'div';\nconst InlineEntityTag = 'span';\n\n/**\n * Insert an entity into editor\n * @param editor The Content Model editor\n * @param type Type of entity\n * @param isBlock True to insert a block entity, false to insert an inline entity\n * @param position Position of the entity to insert. It can be\n * Value of InsertEntityPosition: see InsertEntityPosition\n * selectionRangeEx: Use this range instead of current focus position to insert. After insert, focus will be moved to\n * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)\n * @param options Move options to insert. See InsertEntityOptions\n */\nexport default function insertEntity(\n editor: IStandaloneEditor,\n type: string,\n isBlock: boolean,\n position: 'focus' | 'begin' | 'end' | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\n/**\n * Insert a block entity into editor\n * @param editor The Content Model editor\n * @param type Type of entity\n * @param isBlock Must be true for a block entity\n * @param position Position of the entity to insert. It can be\n * Value of InsertEntityPosition: see InsertEntityPosition\n * selectionRangeEx: Use this range instead of current focus position to insert. After insert, focus will be moved to\n * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)\n * @param options Move options to insert. See InsertEntityOptions\n */\nexport default function insertEntity(\n editor: IStandaloneEditor,\n type: string,\n isBlock: true,\n position: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\nexport default function insertEntity(\n editor: IStandaloneEditor,\n type: string,\n isBlock: boolean,\n position?: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null {\n const { contentNode, focusAfterEntity, wrapperDisplay, skipUndoSnapshot } = options || {};\n const wrapper = editor.getDocument().createElement(isBlock ? BlockEntityTag : InlineEntityTag);\n const display = wrapperDisplay ?? (isBlock ? undefined : 'inline-block');\n\n wrapper.style.setProperty('display', display || null);\n\n if (contentNode) {\n wrapper.appendChild(contentNode);\n }\n\n const entityModel = createEntity(wrapper, true /*isReadonly*/, undefined /*format*/, type);\n\n editor.formatContentModel(\n (model, context) => {\n insertEntityModel(\n model,\n entityModel,\n typeof position == 'string' ? position : 'focus',\n isBlock,\n focusAfterEntity,\n context\n );\n\n normalizeContentModel(model);\n\n context.skipUndoSnapshot = skipUndoSnapshot;\n context.newEntities.push(entityModel);\n\n return true;\n },\n {\n selectionOverride: typeof position === 'object' ? position : undefined,\n changeSource: ChangeSource.InsertEntity,\n getChangeData: () => {\n // TODO: Remove this entity when we have standalone editor\n const entity: Entity = {\n wrapper,\n type,\n id: '',\n isReadonly: true,\n };\n\n return entity;\n },\n apiName: 'insertEntity',\n }\n );\n\n return entityModel;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var clearModelFormat_1 = require("../../modelApi/common/clearModelFormat");
|
|
4
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
|
+
/**
|
|
6
|
+
* Clear format of selection
|
|
7
|
+
* @param editor The editor to clear format from
|
|
8
|
+
*/
|
|
9
|
+
function clearFormat(editor) {
|
|
10
|
+
editor.focus();
|
|
11
|
+
editor.formatContentModel(function (model) {
|
|
12
|
+
var blocksToClear = [];
|
|
13
|
+
var segmentsToClear = [];
|
|
14
|
+
var tablesToClear = [];
|
|
15
|
+
(0, clearModelFormat_1.clearModelFormat)(model, blocksToClear, segmentsToClear, tablesToClear);
|
|
16
|
+
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
17
|
+
return (blocksToClear.length > 0 || segmentsToClear.length > 0 || tablesToClear.length > 0);
|
|
18
|
+
}, {
|
|
19
|
+
apiName: 'clearFormat',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.default = clearFormat;
|
|
23
|
+
//# sourceMappingURL=clearFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/clearFormat.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAC1E,2EAAoE;AASpE;;;GAGG;AACH,SAAwB,WAAW,CAAC,MAAyB;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,IAAM,aAAa,GAAoD,EAAE,CAAC;QAC1E,IAAM,eAAe,GAA0B,EAAE,CAAC;QAClD,IAAM,aAAa,GAAmC,EAAE,CAAC;QAEzD,IAAA,mCAAgB,EAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;QAEvE,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,CACH,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CACrF,CAAC;IACN,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC;AArBD,8BAqBC","sourcesContent":["import { clearModelFormat } from '../../modelApi/common/clearModelFormat';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport type {\n IStandaloneEditor,\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelSegment,\n ContentModelTable,\n} from 'roosterjs-content-model-types';\n\n/**\n * Clear format of selection\n * @param editor The editor to clear format from\n */\nexport default function clearFormat(editor: IStandaloneEditor) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const blocksToClear: [ContentModelBlockGroup[], ContentModelBlock][] = [];\n const segmentsToClear: ContentModelSegment[] = [];\n const tablesToClear: [ContentModelTable, boolean][] = [];\n\n clearModelFormat(model, blocksToClear, segmentsToClear, tablesToClear);\n\n normalizeContentModel(model);\n\n return (\n blocksToClear.length > 0 || segmentsToClear.length > 0 || tablesToClear.length > 0\n );\n },\n {\n apiName: 'clearFormat',\n }\n );\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IStandaloneEditor, ContentModelBlockGroup, ContentModelFormatState, DomToModelContext } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Get current format state
|
|
4
|
+
* @param editor The editor to get format from
|
|
5
|
+
*/
|
|
6
|
+
export default function getFormatState(editor: IStandaloneEditor): ContentModelFormatState;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
interface FormatStateContext extends DomToModelContext {
|
|
11
|
+
/**
|
|
12
|
+
* An optional stack of parent elements to process. When provided, the child nodes of current parent element will be ignored,
|
|
13
|
+
* but use the top element in this stack instead in childProcessor.
|
|
14
|
+
*/
|
|
15
|
+
nodeStack?: Node[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
* Export for test only
|
|
20
|
+
* In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create
|
|
21
|
+
* content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.
|
|
22
|
+
* This "reduced" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,
|
|
23
|
+
* then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state
|
|
24
|
+
*/
|
|
25
|
+
export declare function reducedModelChildProcessor(group: ContentModelBlockGroup, parent: ParentNode, context: FormatStateContext): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reducedModelChildProcessor = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
6
|
+
var retrieveModelFormatState_1 = require("../../modelApi/common/retrieveModelFormatState");
|
|
7
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
8
|
+
/**
|
|
9
|
+
* Get current format state
|
|
10
|
+
* @param editor The editor to get format from
|
|
11
|
+
*/
|
|
12
|
+
function getFormatState(editor) {
|
|
13
|
+
var pendingFormat = editor.getPendingFormat();
|
|
14
|
+
var model = editor.createContentModel({
|
|
15
|
+
processorOverride: {
|
|
16
|
+
child: reducedModelChildProcessor,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
var result = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, editor.getUndoState()), { isDarkMode: editor.isDarkMode(), zoomScale: editor.getZoomScale() });
|
|
20
|
+
(0, retrieveModelFormatState_1.retrieveModelFormatState)(model, pendingFormat, result);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
exports.default = getFormatState;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
* Export for test only
|
|
27
|
+
* In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create
|
|
28
|
+
* content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.
|
|
29
|
+
* This "reduced" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,
|
|
30
|
+
* then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state
|
|
31
|
+
*/
|
|
32
|
+
function reducedModelChildProcessor(group, parent, context) {
|
|
33
|
+
if (!context.nodeStack) {
|
|
34
|
+
var selectionRootNode = (0, roosterjs_content_model_core_1.getSelectionRootNode)(context.selection);
|
|
35
|
+
context.nodeStack = selectionRootNode ? createNodeStack(parent, selectionRootNode) : [];
|
|
36
|
+
}
|
|
37
|
+
var stackChild = context.nodeStack.pop();
|
|
38
|
+
if (stackChild) {
|
|
39
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getRegularSelectionOffsets)(context, parent), 2), nodeStartOffset = _a[0], nodeEndOffset = _a[1];
|
|
40
|
+
// If selection is not on this node, skip getting node index to save some time since we don't need it here
|
|
41
|
+
var index = nodeStartOffset >= 0 || nodeEndOffset >= 0 ? getChildIndex(parent, stackChild) : -1;
|
|
42
|
+
if (index >= 0) {
|
|
43
|
+
(0, roosterjs_content_model_dom_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
|
|
44
|
+
}
|
|
45
|
+
(0, roosterjs_content_model_dom_1.processChildNode)(group, stackChild, context);
|
|
46
|
+
if (index >= 0) {
|
|
47
|
+
(0, roosterjs_content_model_dom_1.handleRegularSelection)(index + 1, context, group, nodeStartOffset, nodeEndOffset);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// No child node from node stack, that means we have reached the deepest node of selection.
|
|
52
|
+
// Now we can use default child processor to perform full sub tree scanning for content model,
|
|
53
|
+
// So that all selected node will be included.
|
|
54
|
+
context.defaultElementProcessors.child(group, parent, context);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.reducedModelChildProcessor = reducedModelChildProcessor;
|
|
58
|
+
function createNodeStack(root, startNode) {
|
|
59
|
+
var result = [];
|
|
60
|
+
var node = startNode;
|
|
61
|
+
while (node && root != node && root.contains(node)) {
|
|
62
|
+
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(node, 'ELEMENT_NODE') && node.tagName == 'TABLE') {
|
|
63
|
+
// For table, we can't do a reduced model creation since we need to handle their cells and indexes,
|
|
64
|
+
// so clean up whatever we already have, and just put table into the stack
|
|
65
|
+
result.splice(0, result.length, node);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
result.push(node);
|
|
69
|
+
}
|
|
70
|
+
node = node.parentNode;
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
function getChildIndex(parent, stackChild) {
|
|
75
|
+
var index = 0;
|
|
76
|
+
var child = parent.firstChild;
|
|
77
|
+
while (child && child != stackChild) {
|
|
78
|
+
index++;
|
|
79
|
+
child = child.nextSibling;
|
|
80
|
+
}
|
|
81
|
+
return index;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=getFormatState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts"],"names":[],"mappings":";;;;AAAA,6EAAoE;AACpE,2FAA0F;AAQ1F,2EAKqC;AAErC;;;GAGG;AACH,SAAwB,cAAc,CAAC,MAAyB;IAC5D,IAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAChD,IAAM,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACpC,iBAAiB,EAAE;YACf,KAAK,EAAE,0BAA0B;SACpC;KACJ,CAAC,CAAC;IACH,IAAM,MAAM,mDACL,MAAM,CAAC,YAAY,EAAE,KACxB,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,EAC/B,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,GACnC,CAAC;IAEF,IAAA,mDAAwB,EAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAClB,CAAC;AAhBD,iCAgBC;AAaD;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CACtC,KAA6B,EAC7B,MAAkB,EAClB,OAA2B;IAE3B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACpB,IAAM,iBAAiB,GAAG,IAAA,mDAAoB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAClE,OAAO,CAAC,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3F;IAED,IAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;IAE3C,IAAI,UAAU,EAAE;QACN,IAAA,KAAA,oBAAmC,IAAA,wDAA0B,EAAC,OAAO,EAAE,MAAM,CAAC,IAAA,EAA7E,eAAe,QAAA,EAAE,aAAa,QAA+C,CAAC;QAErF,0GAA0G;QAC1G,IAAM,KAAK,GACP,eAAe,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExF,IAAI,KAAK,IAAI,CAAC,EAAE;YACZ,IAAA,oDAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;SACjF;QAED,IAAA,8CAAgB,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAE7C,IAAI,KAAK,IAAI,CAAC,EAAE;YACZ,IAAA,oDAAsB,EAAC,KAAK,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;SACrF;KACJ;SAAM;QACH,2FAA2F;QAC3F,8FAA8F;QAC9F,8CAA8C;QAC9C,OAAO,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAClE;AACL,CAAC;AAlCD,gEAkCC;AAED,SAAS,eAAe,CAAC,IAAU,EAAE,SAAe;IAChD,IAAM,MAAM,GAAW,EAAE,CAAC;IAC1B,IAAI,IAAI,GAAgB,SAAS,CAAC;IAElC,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAChD,IAAI,IAAA,0CAAY,EAAC,IAAI,EAAE,cAAc,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE;YAC/D,mGAAmG;YACnG,0EAA0E;YAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACzC;aAAM;YACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAED,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;KAC1B;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,aAAa,CAAC,MAAkB,EAAE,UAAgB;IACvD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;IAE9B,OAAO,KAAK,IAAI,KAAK,IAAI,UAAU,EAAE;QACjC,KAAK,EAAE,CAAC;QACR,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;KAC7B;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { getSelectionRootNode } from 'roosterjs-content-model-core';\nimport { retrieveModelFormatState } from '../../modelApi/common/retrieveModelFormatState';\nimport type {\n IStandaloneEditor,\n ContentModelBlockGroup,\n ContentModelFormatState,\n DomToModelContext,\n} from 'roosterjs-content-model-types';\n\nimport {\n getRegularSelectionOffsets,\n handleRegularSelection,\n isNodeOfType,\n processChildNode,\n} from 'roosterjs-content-model-dom';\n\n/**\n * Get current format state\n * @param editor The editor to get format from\n */\nexport default function getFormatState(editor: IStandaloneEditor): ContentModelFormatState {\n const pendingFormat = editor.getPendingFormat();\n const model = editor.createContentModel({\n processorOverride: {\n child: reducedModelChildProcessor,\n },\n });\n const result: ContentModelFormatState = {\n ...editor.getUndoState(),\n isDarkMode: editor.isDarkMode(),\n zoomScale: editor.getZoomScale(),\n };\n\n retrieveModelFormatState(model, pendingFormat, result);\n\n return result;\n}\n\n/**\n * @internal\n */\ninterface FormatStateContext extends DomToModelContext {\n /**\n * An optional stack of parent elements to process. When provided, the child nodes of current parent element will be ignored,\n * but use the top element in this stack instead in childProcessor.\n */\n nodeStack?: Node[];\n}\n\n/**\n * @internal\n * Export for test only\n * In order to get format, we can still use the regular child processor. However, to improve performance, we don't need to create\n * content model for the whole doc, instead we only need to traverse the tree path that can arrive current selected node.\n * This \"reduced\" child processor will first create a node stack that stores DOM node from root to current common ancestor node of selection,\n * then use this stack as a faked DOM tree to create a reduced content model which we can use to retrieve format state\n */\nexport function reducedModelChildProcessor(\n group: ContentModelBlockGroup,\n parent: ParentNode,\n context: FormatStateContext\n) {\n if (!context.nodeStack) {\n const selectionRootNode = getSelectionRootNode(context.selection);\n context.nodeStack = selectionRootNode ? createNodeStack(parent, selectionRootNode) : [];\n }\n\n const stackChild = context.nodeStack.pop();\n\n if (stackChild) {\n const [nodeStartOffset, nodeEndOffset] = getRegularSelectionOffsets(context, parent);\n\n // If selection is not on this node, skip getting node index to save some time since we don't need it here\n const index =\n nodeStartOffset >= 0 || nodeEndOffset >= 0 ? getChildIndex(parent, stackChild) : -1;\n\n if (index >= 0) {\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n }\n\n processChildNode(group, stackChild, context);\n\n if (index >= 0) {\n handleRegularSelection(index + 1, context, group, nodeStartOffset, nodeEndOffset);\n }\n } else {\n // No child node from node stack, that means we have reached the deepest node of selection.\n // Now we can use default child processor to perform full sub tree scanning for content model,\n // So that all selected node will be included.\n context.defaultElementProcessors.child(group, parent, context);\n }\n}\n\nfunction createNodeStack(root: Node, startNode: Node): Node[] {\n const result: Node[] = [];\n let node: Node | null = startNode;\n\n while (node && root != node && root.contains(node)) {\n if (isNodeOfType(node, 'ELEMENT_NODE') && node.tagName == 'TABLE') {\n // For table, we can't do a reduced model creation since we need to handle their cells and indexes,\n // so clean up whatever we already have, and just put table into the stack\n result.splice(0, result.length, node);\n } else {\n result.push(node);\n }\n\n node = node.parentNode;\n }\n\n return result;\n}\n\nfunction getChildIndex(parent: ParentNode, stackChild: Node) {\n let index = 0;\n let child = parent.firstChild;\n\n while (child && child != stackChild) {\n index++;\n child = child.nextSibling;\n }\n return index;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Adjust selection to make sure select an image if any
|
|
4
|
+
* @return Content Model Image object if an image is select, or null
|
|
5
|
+
*/
|
|
6
|
+
export default function adjustImageSelection(editor: IStandaloneEditor): ContentModelImage | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var adjustSegmentSelection_1 = require("../../modelApi/selection/adjustSegmentSelection");
|
|
4
|
+
/**
|
|
5
|
+
* Adjust selection to make sure select an image if any
|
|
6
|
+
* @return Content Model Image object if an image is select, or null
|
|
7
|
+
*/
|
|
8
|
+
function adjustImageSelection(editor) {
|
|
9
|
+
var image = null;
|
|
10
|
+
editor.formatContentModel(function (model) {
|
|
11
|
+
return (0, adjustSegmentSelection_1.adjustSegmentSelection)(model, function (target) {
|
|
12
|
+
if (target.isSelected && target.segmentType == 'Image') {
|
|
13
|
+
image = target;
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}, function (target, ref) { return target == ref; });
|
|
20
|
+
}, {
|
|
21
|
+
apiName: 'adjustImageSelection',
|
|
22
|
+
});
|
|
23
|
+
return image;
|
|
24
|
+
}
|
|
25
|
+
exports.default = adjustImageSelection;
|
|
26
|
+
//# sourceMappingURL=adjustImageSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/adjustImageSelection.ts"],"names":[],"mappings":";;AAAA,0FAAyF;AAGzF;;;GAGG;AACH,SAAwB,oBAAoB,CAAC,MAAyB;IAClE,IAAI,KAAK,GAA6B,IAAI,CAAC;IAE3C,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,OAAA,IAAA,+CAAsB,EAClB,KAAK,EACL,UAAA,MAAM;YACF,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,WAAW,IAAI,OAAO,EAAE;gBACpD,KAAK,GAAG,MAAM,CAAC;gBACf,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,MAAM,IAAI,GAAG,EAAb,CAAa,CACjC;IAXD,CAWC,EACL;QACI,OAAO,EAAE,sBAAsB;KAClC,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC;AACjB,CAAC;AAvBD,uCAuBC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Adjust selection to make sure select an image if any\n * @return Content Model Image object if an image is select, or null\n */\nexport default function adjustImageSelection(editor: IStandaloneEditor): ContentModelImage | null {\n let image: ContentModelImage | null = null;\n\n editor.formatContentModel(\n model =>\n adjustSegmentSelection(\n model,\n target => {\n if (target.isSelected && target.segmentType == 'Image') {\n image = target;\n return true;\n } else {\n return false;\n }\n },\n (target, ref) => target == ref\n ),\n {\n apiName: 'adjustImageSelection',\n }\n );\n\n return image;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Change the selected image src
|
|
4
|
+
* @param editor The editor instance
|
|
5
|
+
* @param file The image file
|
|
6
|
+
*/
|
|
7
|
+
export default function changeImage(editor: IStandaloneEditor, file: File): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
4
|
+
var readFile_1 = require("../../modelApi/domUtils/readFile");
|
|
5
|
+
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
6
|
+
/**
|
|
7
|
+
* Change the selected image src
|
|
8
|
+
* @param editor The editor instance
|
|
9
|
+
* @param file The image file
|
|
10
|
+
*/
|
|
11
|
+
function changeImage(editor, file) {
|
|
12
|
+
editor.focus();
|
|
13
|
+
var selection = editor.getDOMSelection();
|
|
14
|
+
(0, readFile_1.readFile)(file, function (dataUrl) {
|
|
15
|
+
if (dataUrl && !editor.isDisposed() && (selection === null || selection === void 0 ? void 0 : selection.type) === 'image') {
|
|
16
|
+
(0, formatImageWithContentModel_1.default)(editor, 'changeImage', function (image) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
var originalSrc = (_b = (_a = (0, roosterjs_content_model_core_1.updateImageMetadata)(image)) === null || _a === void 0 ? void 0 : _a.src) !== null && _b !== void 0 ? _b : '';
|
|
19
|
+
var previousSrc = image.src;
|
|
20
|
+
image.src = dataUrl;
|
|
21
|
+
image.dataset = {};
|
|
22
|
+
image.format.width = '';
|
|
23
|
+
image.format.height = '';
|
|
24
|
+
image.alt = '';
|
|
25
|
+
editor.triggerPluginEvent(19 /* EditImage */, {
|
|
26
|
+
image: selection.image,
|
|
27
|
+
previousSrc: previousSrc,
|
|
28
|
+
newSrc: dataUrl,
|
|
29
|
+
originalSrc: originalSrc,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.default = changeImage;
|
|
36
|
+
//# sourceMappingURL=changeImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAE/E,6DAA4D;AAC5D,6EAAmE;AAGnE;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAyB,EAAE,IAAU;IACrE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3C,IAAA,mBAAQ,EAAC,IAAI,EAAE,UAAA,OAAO;QAClB,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,OAAO,EAAE;YAChE,IAAA,qCAA2B,EAAC,MAAM,EAAE,aAAa,EAAE,UAAC,KAAwB;;gBACxE,IAAM,WAAW,GAAG,MAAA,MAAA,IAAA,kDAAmB,EAAC,KAAK,CAAC,0CAAE,GAAG,mCAAI,EAAE,CAAC;gBAC1D,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC;gBAE9B,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;gBACpB,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;gBACnB,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;gBACxB,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;gBACzB,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;gBAEf,MAAM,CAAC,kBAAkB,qBAA4B;oBACjD,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,WAAW,aAAA;oBACX,MAAM,EAAE,OAAO;oBACf,WAAW,aAAA;iBACd,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAzBD,8BAyBC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport { PluginEventType } from 'roosterjs-editor-types';\nimport { readFile } from '../../modelApi/domUtils/readFile';\nimport { updateImageMetadata } from 'roosterjs-content-model-core';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Change the selected image src\n * @param editor The editor instance\n * @param file The image file\n */\nexport default function changeImage(editor: IStandaloneEditor, file: File) {\n editor.focus();\n\n const selection = editor.getDOMSelection();\n readFile(file, dataUrl => {\n if (dataUrl && !editor.isDisposed() && selection?.type === 'image') {\n formatImageWithContentModel(editor, 'changeImage', (image: ContentModelImage) => {\n const originalSrc = updateImageMetadata(image)?.src ?? '';\n const previousSrc = image.src;\n\n image.src = dataUrl;\n image.dataset = {};\n image.format.width = '';\n image.format.height = '';\n image.alt = '';\n\n editor.triggerPluginEvent(PluginEventType.EditImage, {\n image: selection.image,\n previousSrc,\n newSrc: dataUrl,\n originalSrc,\n });\n });\n }\n });\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Insert an image into current selected position
|
|
4
|
+
* @param editor The editor to operate on
|
|
5
|
+
* @param file Image Blob file or source string
|
|
6
|
+
*/
|
|
7
|
+
export default function insertImage(editor: IStandaloneEditor, imageFileOrSrc: File | string): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
4
|
+
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
5
|
+
var readFile_1 = require("../../modelApi/domUtils/readFile");
|
|
6
|
+
/**
|
|
7
|
+
* Insert an image into current selected position
|
|
8
|
+
* @param editor The editor to operate on
|
|
9
|
+
* @param file Image Blob file or source string
|
|
10
|
+
*/
|
|
11
|
+
function insertImage(editor, imageFileOrSrc) {
|
|
12
|
+
editor.focus();
|
|
13
|
+
if (typeof imageFileOrSrc == 'string') {
|
|
14
|
+
insertImageWithSrc(editor, imageFileOrSrc);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
(0, readFile_1.readFile)(imageFileOrSrc, function (dataUrl) {
|
|
18
|
+
if (dataUrl && !editor.isDisposed()) {
|
|
19
|
+
insertImageWithSrc(editor, dataUrl);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = insertImage;
|
|
25
|
+
function insertImageWithSrc(editor, src) {
|
|
26
|
+
editor.formatContentModel(function (model, context) {
|
|
27
|
+
var image = (0, roosterjs_content_model_dom_1.createImage)(src, { backgroundColor: '' });
|
|
28
|
+
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
29
|
+
(0, roosterjs_content_model_dom_1.addSegment)(doc, image);
|
|
30
|
+
(0, roosterjs_content_model_core_1.mergeModel)(model, doc, context, {
|
|
31
|
+
mergeFormat: 'mergeAll',
|
|
32
|
+
});
|
|
33
|
+
return true;
|
|
34
|
+
}, {
|
|
35
|
+
apiName: 'insertImage',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=insertImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/insertImage.ts"],"names":[],"mappings":";;AAAA,2EAAkG;AAClG,6EAA0D;AAC1D,6DAA4D;AAG5D;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAyB,EAAE,cAA6B;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAI,OAAO,cAAc,IAAI,QAAQ,EAAE;QACnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;KAC9C;SAAM;QACH,IAAA,mBAAQ,EAAC,cAAc,EAAE,UAAA,OAAO;YAC5B,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE;gBACjC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;aACvC;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC;AAZD,8BAYC;AAED,SAAS,kBAAkB,CAAC,MAAyB,EAAE,GAAW;IAC9D,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,IAAM,KAAK,GAAG,IAAA,yCAAW,EAAC,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,IAAM,GAAG,GAAG,IAAA,wDAA0B,GAAE,CAAC;QAEzC,IAAA,wCAAU,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,IAAA,yCAAU,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;YAC5B,WAAW,EAAE,UAAU;SAC1B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import { addSegment, createContentModelDocument, createImage } from 'roosterjs-content-model-dom';\nimport { mergeModel } from 'roosterjs-content-model-core';\nimport { readFile } from '../../modelApi/domUtils/readFile';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Insert an image into current selected position\n * @param editor The editor to operate on\n * @param file Image Blob file or source string\n */\nexport default function insertImage(editor: IStandaloneEditor, imageFileOrSrc: File | string) {\n editor.focus();\n\n if (typeof imageFileOrSrc == 'string') {\n insertImageWithSrc(editor, imageFileOrSrc);\n } else {\n readFile(imageFileOrSrc, dataUrl => {\n if (dataUrl && !editor.isDisposed()) {\n insertImageWithSrc(editor, dataUrl);\n }\n });\n }\n}\n\nfunction insertImageWithSrc(editor: IStandaloneEditor, src: string) {\n editor.formatContentModel(\n (model, context) => {\n const image = createImage(src, { backgroundColor: '' });\n const doc = createContentModelDocument();\n\n addSegment(doc, image);\n mergeModel(model, doc, context, {\n mergeFormat: 'mergeAll',\n });\n\n return true;\n },\n {\n apiName: 'insertImage',\n }\n );\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Set image alt text for all selected images at selection. If no images is contained
|
|
4
|
+
* in selection, do nothing.
|
|
5
|
+
* @param editor The editor instance
|
|
6
|
+
* @param altText The image alt text
|
|
7
|
+
*/
|
|
8
|
+
export default function setImageAltText(editor: IStandaloneEditor, altText: string): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
4
|
+
/**
|
|
5
|
+
* Set image alt text for all selected images at selection. If no images is contained
|
|
6
|
+
* in selection, do nothing.
|
|
7
|
+
* @param editor The editor instance
|
|
8
|
+
* @param altText The image alt text
|
|
9
|
+
*/
|
|
10
|
+
function setImageAltText(editor, altText) {
|
|
11
|
+
editor.focus();
|
|
12
|
+
(0, formatImageWithContentModel_1.default)(editor, 'setImageAltText', function (image) {
|
|
13
|
+
image.alt = altText;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.default = setImageAltText;
|
|
17
|
+
//# sourceMappingURL=setImageAltText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageAltText.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,eAAe,CAAC,MAAyB,EAAE,OAAe;IAC9E,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAC,KAAwB;QAC5E,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC;AAND,kCAMC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image alt text for all selected images at selection. If no images is contained\n * in selection, do nothing.\n * @param editor The editor instance\n * @param altText The image alt text\n */\nexport default function setImageAltText(editor: IStandaloneEditor, altText: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageAltText', (image: ContentModelImage) => {\n image.alt = altText;\n });\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Border, IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Set image border style for all selected images at selection.
|
|
4
|
+
* @param editor The editor instance
|
|
5
|
+
* @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined
|
|
6
|
+
* its value will not be changed. Passing null instead of an object will remove the border
|
|
7
|
+
* @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
|
|
8
|
+
*/
|
|
9
|
+
export default function setImageBorder(editor: IStandaloneEditor, border: Border | null, borderRadius?: string): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var applyImageBorderFormat_1 = require("../../modelApi/image/applyImageBorderFormat");
|
|
4
|
+
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
5
|
+
/**
|
|
6
|
+
* Set image border style for all selected images at selection.
|
|
7
|
+
* @param editor The editor instance
|
|
8
|
+
* @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined
|
|
9
|
+
* its value will not be changed. Passing null instead of an object will remove the border
|
|
10
|
+
* @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
|
|
11
|
+
*/
|
|
12
|
+
function setImageBorder(editor, border, borderRadius) {
|
|
13
|
+
editor.focus();
|
|
14
|
+
(0, formatImageWithContentModel_1.default)(editor, 'setImageBorder', function (image) {
|
|
15
|
+
(0, applyImageBorderFormat_1.default)(image, border, borderRadius);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.default = setImageBorder;
|
|
19
|
+
//# sourceMappingURL=setImageBorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;AAAA,sFAAiF;AACjF,oFAA+E;AAG/E;;;;;;GAMG;AACH,SAAwB,cAAc,CAClC,MAAyB,EACzB,MAAqB,EACrB,YAAqB;IAErB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;QAC3E,IAAA,gCAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAVD,iCAUC","sourcesContent":["import applyImageBorderFormat from '../../modelApi/image/applyImageBorderFormat';\nimport formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { Border, ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image border style for all selected images at selection.\n * @param editor The editor instance\n * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined\n * its value will not be changed. Passing null instead of an object will remove the border\n * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value\n */\nexport default function setImageBorder(\n editor: IStandaloneEditor,\n border: Border | null,\n borderRadius?: string\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\n applyImageBorderFormat(image, border, borderRadius);\n });\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Set image box shadow for all selected images at selection.
|
|
4
|
+
* @param editor The editor instance
|
|
5
|
+
* @param boxShadow The image box boxShadow
|
|
6
|
+
* @param margin The image margin for all sides (eg. "4px"), null to remove margin
|
|
7
|
+
*/
|
|
8
|
+
export default function setImageBoxShadow(editor: IStandaloneEditor, boxShadow: string, margin?: string | null): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
4
|
+
/**
|
|
5
|
+
* Set image box shadow for all selected images at selection.
|
|
6
|
+
* @param editor The editor instance
|
|
7
|
+
* @param boxShadow The image box boxShadow
|
|
8
|
+
* @param margin The image margin for all sides (eg. "4px"), null to remove margin
|
|
9
|
+
*/
|
|
10
|
+
function setImageBoxShadow(editor, boxShadow, margin) {
|
|
11
|
+
editor.focus();
|
|
12
|
+
(0, formatImageWithContentModel_1.default)(editor, 'setImageBoxShadow', function (image) {
|
|
13
|
+
image.format.boxShadow = boxShadow;
|
|
14
|
+
if (margin) {
|
|
15
|
+
image.format.marginBottom = margin;
|
|
16
|
+
image.format.marginLeft = margin;
|
|
17
|
+
image.format.marginRight = margin;
|
|
18
|
+
image.format.marginTop = margin;
|
|
19
|
+
}
|
|
20
|
+
else if (margin === null) {
|
|
21
|
+
delete image.format.marginBottom;
|
|
22
|
+
delete image.format.marginLeft;
|
|
23
|
+
delete image.format.marginRight;
|
|
24
|
+
delete image.format.marginTop;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.default = setImageBoxShadow;
|
|
29
|
+
//# sourceMappingURL=setImageBoxShadow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,iBAAiB,CACrC,MAAyB,EACzB,SAAiB,EACjB,MAAsB;IAEtB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,mBAAmB,EAAE,UAAC,KAAwB;QAC9E,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;YACnC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;YAClC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;SACnC;aAAM,IAAI,MAAM,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;YAChC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AArBD,oCAqBC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image box shadow for all selected images at selection.\n * @param editor The editor instance\n * @param boxShadow The image box boxShadow\n * @param margin The image margin for all sides (eg. \"4px\"), null to remove margin\n */\nexport default function setImageBoxShadow(\n editor: IStandaloneEditor,\n boxShadow: string,\n margin?: string | null\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBoxShadow', (image: ContentModelImage) => {\n image.format.boxShadow = boxShadow;\n if (margin) {\n image.format.marginBottom = margin;\n image.format.marginLeft = margin;\n image.format.marginRight = margin;\n image.format.marginTop = margin;\n } else if (margin === null) {\n delete image.format.marginBottom;\n delete image.format.marginLeft;\n delete image.format.marginRight;\n delete image.format.marginTop;\n }\n });\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
|
|
4
|
+
* @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
|
|
5
|
+
*/
|
|
6
|
+
export default function adjustLinkSelection(editor: IStandaloneEditor): [string, string | null];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var adjustSegmentSelection_1 = require("../../modelApi/selection/adjustSegmentSelection");
|
|
4
|
+
var adjustWordSelection_1 = require("../../modelApi/selection/adjustWordSelection");
|
|
5
|
+
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
6
|
+
/**
|
|
7
|
+
* Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
|
|
8
|
+
* @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
|
|
9
|
+
*/
|
|
10
|
+
function adjustLinkSelection(editor) {
|
|
11
|
+
var text = '';
|
|
12
|
+
var url = null;
|
|
13
|
+
editor.formatContentModel(function (model) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
var changed = (0, adjustSegmentSelection_1.adjustSegmentSelection)(model, function (target) { return !!target.isSelected && !!target.link; }, function (target, ref) { return !!target.link && target.link.format.href == ref.link.format.href; });
|
|
16
|
+
var segments = (0, roosterjs_content_model_core_1.getSelectedSegments)(model, false /*includingFormatHolder*/);
|
|
17
|
+
var firstSegment = segments[0];
|
|
18
|
+
if (segments.length == 1 && firstSegment.segmentType == 'SelectionMarker') {
|
|
19
|
+
segments = (0, adjustWordSelection_1.adjustWordSelection)(model, firstSegment);
|
|
20
|
+
if (segments.length > 1) {
|
|
21
|
+
changed = true;
|
|
22
|
+
(0, roosterjs_content_model_core_1.setSelection)(model, segments[0], segments[segments.length - 1]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
text = segments.map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); }).join('');
|
|
26
|
+
url = ((_b = (_a = segments[0]) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.format.href) || null;
|
|
27
|
+
return changed;
|
|
28
|
+
}, {
|
|
29
|
+
apiName: 'adjustLinkSelection',
|
|
30
|
+
});
|
|
31
|
+
return [text, url];
|
|
32
|
+
}
|
|
33
|
+
exports.default = adjustLinkSelection;
|
|
34
|
+
//# sourceMappingURL=adjustLinkSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"],"names":[],"mappings":";;AAAA,0FAAyF;AACzF,oFAAmF;AACnF,6EAAiF;AAGjF;;;GAGG;AACH,SAAwB,mBAAmB,CAAC,MAAyB;IACjE,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,GAAG,GAAkB,IAAI,CAAC;IAE9B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;;QACD,IAAI,OAAO,GAAG,IAAA,+CAAsB,EAChC,KAAK,EACL,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAApC,CAAoC,EAC9C,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,IAAK,CAAC,MAAM,CAAC,IAAI,EAAjE,CAAiE,CACrF,CAAC;QACF,IAAI,QAAQ,GAAG,IAAA,kDAAmB,EAAC,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC3E,IAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,WAAW,IAAI,iBAAiB,EAAE;YACvE,QAAQ,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAEpD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,OAAO,GAAG,IAAI,CAAC;gBACf,IAAA,2CAAY,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;aACnE;SACJ;QAED,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAvC,CAAuC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,GAAG,GAAG,CAAA,MAAA,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,KAAI,IAAI,CAAC;QAE7C,OAAO,OAAO,CAAC;IACnB,CAAC,EACD;QACI,OAAO,EAAE,qBAAqB;KACjC,CACJ,CAAC;IAEF,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AAlCD,sCAkCC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport { adjustWordSelection } from '../../modelApi/selection/adjustWordSelection';\nimport { getSelectedSegments, setSelection } from 'roosterjs-content-model-core';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed\n * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null\n */\nexport default function adjustLinkSelection(editor: IStandaloneEditor): [string, string | null] {\n let text = '';\n let url: string | null = null;\n\n editor.formatContentModel(\n model => {\n let changed = adjustSegmentSelection(\n model,\n target => !!target.isSelected && !!target.link,\n (target, ref) => !!target.link && target.link.format.href == ref.link!.format.href\n );\n let segments = getSelectedSegments(model, false /*includingFormatHolder*/);\n const firstSegment = segments[0];\n\n if (segments.length == 1 && firstSegment.segmentType == 'SelectionMarker') {\n segments = adjustWordSelection(model, firstSegment);\n\n if (segments.length > 1) {\n changed = true;\n setSelection(model, segments[0], segments[segments.length - 1]);\n }\n }\n\n text = segments.map(x => (x.segmentType == 'Text' ? x.text : '')).join('');\n url = segments[0]?.link?.format.href || null;\n\n return changed;\n },\n {\n apiName: 'adjustLinkSelection',\n }\n );\n\n return [text, url];\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* Insert a hyperlink at cursor.
|
|
4
|
+
* When there is a selection, hyperlink will be applied to the selection,
|
|
5
|
+
* otherwise a hyperlink will be inserted to the cursor position.
|
|
6
|
+
* @param editor Editor object
|
|
7
|
+
* @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.
|
|
8
|
+
* When protocol is not specified, a best matched protocol will be predicted.
|
|
9
|
+
* @param anchorTitle Optional alt text of the link, will be shown when hover on the link
|
|
10
|
+
* @param displayText Optional display text for the link.
|
|
11
|
+
* @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
|
|
12
|
+
* If specified, the display text of link will be replaced with this text.
|
|
13
|
+
* If not specified and there wasn't a link, the link url will be used as display text.
|
|
14
|
+
*/
|
|
15
|
+
export default function insertLink(editor: IStandaloneEditor, link: string, anchorTitle?: string, displayText?: string, target?: string): void;
|