roosterjs-content-model-api 0.27.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -37
- package/lib/index.d.ts +48 -42
- package/lib/index.js +56 -43
- package/lib/index.js.map +1 -1
- package/lib/modelApi/block/setModelAlignment.js +2 -2
- package/lib/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib/modelApi/block/setModelDirection.js +5 -5
- package/lib/modelApi/block/setModelDirection.js.map +1 -1
- package/lib/modelApi/block/setModelIndentation.js +6 -7
- package/lib/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib/modelApi/block/toggleModelBlockQuote.js +3 -4
- package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib/modelApi/common/clearModelFormat.js +6 -7
- package/lib/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib/modelApi/common/reducedModelChildProcessor.d.ts +20 -0
- package/lib/modelApi/common/reducedModelChildProcessor.js +64 -0
- package/lib/modelApi/common/reducedModelChildProcessor.js.map +1 -0
- package/lib/modelApi/common/wrapBlock.js.map +1 -1
- package/lib/modelApi/entity/insertEntityModel.d.ts +2 -2
- package/lib/modelApi/entity/insertEntityModel.js +19 -10
- package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.js +3 -3
- package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib/modelApi/link/matchLink.d.ts +1 -18
- package/lib/modelApi/link/matchLink.js +0 -1
- package/lib/modelApi/link/matchLink.js.map +1 -1
- package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib/modelApi/list/setListType.js +3 -4
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/list/setModelListStartNumber.d.ts +7 -0
- package/lib/modelApi/list/setModelListStartNumber.js +22 -0
- package/lib/modelApi/list/setModelListStartNumber.js.map +1 -0
- package/lib/modelApi/list/setModelListStyle.d.ts +7 -0
- package/lib/modelApi/list/setModelListStyle.js +26 -0
- package/lib/modelApi/list/setModelListStyle.js.map +1 -0
- package/lib/modelApi/selection/adjustSegmentSelection.js +3 -3
- package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js +1 -2
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustWordSelection.js +3 -4
- package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib/modelApi/table/alignTable.js.map +1 -1
- package/lib/modelApi/table/alignTableCell.js +3 -3
- package/lib/modelApi/table/alignTableCell.js.map +1 -1
- package/lib/modelApi/table/canMergeCells.js.map +1 -1
- package/lib/modelApi/table/clearSelectedCells.js +2 -2
- package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib/modelApi/table/createTableStructure.js.map +1 -1
- package/lib/modelApi/table/deleteTable.js.map +1 -1
- package/lib/modelApi/table/deleteTableColumn.js +2 -2
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib/modelApi/table/deleteTableRow.js +2 -2
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.js +1 -2
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.js +1 -2
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.js +2 -2
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js +2 -2
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js +2 -2
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.js +1 -2
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.js +1 -2
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/block/setAlignment.d.ts +1 -1
- package/lib/publicApi/block/setAlignment.js +2 -1
- package/lib/publicApi/block/setAlignment.js.map +1 -1
- package/lib/publicApi/block/setDirection.d.ts +1 -1
- package/lib/publicApi/block/setDirection.js +2 -1
- package/lib/publicApi/block/setDirection.js.map +1 -1
- package/lib/publicApi/block/setHeadingLevel.d.ts +1 -1
- package/lib/publicApi/block/setHeadingLevel.js +2 -1
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib/publicApi/block/setIndentation.d.ts +1 -1
- package/lib/publicApi/block/setIndentation.js +2 -1
- package/lib/publicApi/block/setIndentation.js.map +1 -1
- package/lib/publicApi/block/setParagraphMargin.d.ts +1 -1
- package/lib/publicApi/block/setParagraphMargin.js +2 -1
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib/publicApi/block/setSpacing.d.ts +1 -1
- package/lib/publicApi/block/setSpacing.js +2 -1
- package/lib/publicApi/block/setSpacing.js.map +1 -1
- package/lib/publicApi/block/toggleBlockQuote.d.ts +1 -1
- package/lib/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib/publicApi/entity/insertEntity.d.ts +3 -3
- package/lib/publicApi/entity/insertEntity.js +19 -12
- package/lib/publicApi/entity/insertEntity.js.map +1 -1
- package/lib/publicApi/format/clearFormat.d.ts +1 -1
- package/lib/publicApi/format/clearFormat.js +2 -1
- package/lib/publicApi/format/clearFormat.js.map +1 -1
- package/lib/publicApi/format/getFormatState.d.ts +1 -1
- package/lib/publicApi/format/getFormatState.js +13 -4
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/adjustImageSelection.d.ts +1 -1
- package/lib/publicApi/image/adjustImageSelection.js +2 -1
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib/publicApi/image/changeImage.d.ts +1 -1
- package/lib/publicApi/image/changeImage.js +6 -5
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.d.ts +1 -1
- package/lib/publicApi/image/insertImage.js +4 -4
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/image/setImageAltText.d.ts +1 -1
- package/lib/publicApi/image/setImageAltText.js +3 -2
- package/lib/publicApi/image/setImageAltText.js.map +1 -1
- package/lib/publicApi/image/setImageBorder.d.ts +1 -1
- package/lib/publicApi/image/setImageBorder.js +4 -3
- package/lib/publicApi/image/setImageBorder.js.map +1 -1
- package/lib/publicApi/image/setImageBoxShadow.d.ts +1 -1
- package/lib/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib/publicApi/link/adjustLinkSelection.d.ts +1 -1
- package/lib/publicApi/link/adjustLinkSelection.js +5 -4
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +1 -1
- package/lib/publicApi/link/insertLink.js +5 -5
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +1 -1
- package/lib/publicApi/link/removeLink.js +4 -3
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib/publicApi/list/setListStartNumber.js +4 -11
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +1 -1
- package/lib/publicApi/list/setListStyle.js +4 -18
- package/lib/publicApi/list/setListStyle.js.map +1 -1
- package/lib/publicApi/list/toggleBullet.d.ts +1 -1
- package/lib/publicApi/list/toggleBullet.js +2 -1
- package/lib/publicApi/list/toggleBullet.js.map +1 -1
- package/lib/publicApi/list/toggleNumbering.d.ts +1 -1
- package/lib/publicApi/list/toggleNumbering.js +2 -1
- package/lib/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib/publicApi/segment/applySegmentFormat.d.ts +1 -1
- package/lib/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib/publicApi/segment/changeCapitalization.d.ts +1 -1
- package/lib/publicApi/segment/changeCapitalization.js +2 -1
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib/publicApi/segment/changeFontSize.d.ts +1 -1
- package/lib/publicApi/segment/changeFontSize.js +2 -1
- package/lib/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib/publicApi/segment/setBackgroundColor.d.ts +1 -1
- package/lib/publicApi/segment/setBackgroundColor.js +3 -3
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib/publicApi/segment/setFontName.d.ts +1 -1
- package/lib/publicApi/segment/setFontName.js +2 -1
- package/lib/publicApi/segment/setFontName.js.map +1 -1
- package/lib/publicApi/segment/setFontSize.d.ts +1 -1
- package/lib/publicApi/segment/setFontSize.js +2 -2
- package/lib/publicApi/segment/setFontSize.js.map +1 -1
- package/lib/publicApi/segment/setTextColor.d.ts +1 -1
- package/lib/publicApi/segment/setTextColor.js +2 -1
- package/lib/publicApi/segment/setTextColor.js.map +1 -1
- package/lib/publicApi/segment/toggleBold.d.ts +1 -1
- package/lib/publicApi/segment/toggleBold.js +4 -3
- package/lib/publicApi/segment/toggleBold.js.map +1 -1
- package/lib/publicApi/segment/toggleCode.d.ts +1 -1
- package/lib/publicApi/segment/toggleCode.js +2 -1
- package/lib/publicApi/segment/toggleCode.js.map +1 -1
- package/lib/publicApi/segment/toggleItalic.d.ts +1 -1
- package/lib/publicApi/segment/toggleItalic.js +2 -1
- package/lib/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib/publicApi/segment/toggleSubscript.d.ts +1 -1
- package/lib/publicApi/segment/toggleSubscript.js +2 -1
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib/publicApi/segment/toggleSuperscript.d.ts +1 -1
- package/lib/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib/publicApi/segment/toggleUnderline.d.ts +1 -1
- package/lib/publicApi/segment/toggleUnderline.js +2 -1
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.js +6 -6
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.d.ts +1 -1
- package/lib/publicApi/table/editTable.js +2 -1
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/formatTable.d.ts +1 -1
- package/lib/publicApi/table/formatTable.js +6 -5
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +1 -1
- package/lib/publicApi/table/insertTable.js +8 -8
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib/publicApi/table/setTableCellShade.js +7 -6
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatInsertPointWithContentModel.d.ts +5 -0
- package/lib/publicApi/utils/formatInsertPointWithContentModel.js +127 -0
- package/lib/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -0
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +6 -3
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +9 -3
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatTableWithContentModel.js +5 -6
- package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-amd/index.d.ts +48 -42
- package/lib-amd/index.js +50 -44
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/block/setModelAlignment.js +2 -2
- package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-amd/modelApi/block/setModelDirection.js +5 -5
- package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-amd/modelApi/block/setModelIndentation.js +6 -6
- package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js +3 -3
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-amd/modelApi/common/clearModelFormat.js +7 -7
- package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-amd/modelApi/common/reducedModelChildProcessor.d.ts +20 -0
- package/lib-amd/modelApi/common/reducedModelChildProcessor.js +64 -0
- package/lib-amd/modelApi/common/reducedModelChildProcessor.js.map +1 -0
- package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-amd/modelApi/entity/insertEntityModel.d.ts +2 -2
- package/lib-amd/modelApi/entity/insertEntityModel.js +20 -10
- package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.js +4 -3
- package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-amd/modelApi/link/matchLink.d.ts +1 -18
- package/lib-amd/modelApi/link/matchLink.js +0 -1
- package/lib-amd/modelApi/link/matchLink.js.map +1 -1
- package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-amd/modelApi/list/setListType.js +4 -4
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/list/setModelListStartNumber.d.ts +7 -0
- package/lib-amd/modelApi/list/setModelListStartNumber.js +23 -0
- package/lib-amd/modelApi/list/setModelListStartNumber.js.map +1 -0
- package/lib-amd/modelApi/list/setModelListStyle.d.ts +7 -0
- package/lib-amd/modelApi/list/setModelListStyle.js +26 -0
- package/lib-amd/modelApi/list/setModelListStyle.js.map +1 -0
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js +3 -3
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js +2 -2
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustWordSelection.js +4 -4
- package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-amd/modelApi/table/alignTable.js.map +1 -1
- package/lib-amd/modelApi/table/alignTableCell.js +3 -3
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-amd/modelApi/table/clearSelectedCells.js +2 -2
- package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableColumn.js +2 -2
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableRow.js +2 -2
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableColumn.js +2 -2
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.js +2 -2
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js +2 -2
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js +2 -2
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js +2 -2
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js +2 -2
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.js +2 -2
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/block/setAlignment.d.ts +1 -1
- package/lib-amd/publicApi/block/setAlignment.js +2 -1
- package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
- package/lib-amd/publicApi/block/setDirection.d.ts +1 -1
- package/lib-amd/publicApi/block/setDirection.js +2 -1
- package/lib-amd/publicApi/block/setDirection.js.map +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.d.ts +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.js +2 -1
- package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-amd/publicApi/block/setIndentation.d.ts +1 -1
- package/lib-amd/publicApi/block/setIndentation.js +2 -1
- package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.d.ts +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.js +2 -1
- package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-amd/publicApi/block/setSpacing.d.ts +1 -1
- package/lib-amd/publicApi/block/setSpacing.js +2 -1
- package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-amd/publicApi/entity/insertEntity.d.ts +3 -3
- package/lib-amd/publicApi/entity/insertEntity.js +19 -12
- package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-amd/publicApi/format/clearFormat.d.ts +1 -1
- package/lib-amd/publicApi/format/clearFormat.js +2 -1
- package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.d.ts +1 -1
- package/lib-amd/publicApi/format/getFormatState.js +12 -4
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.d.ts +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.js +2 -1
- package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-amd/publicApi/image/changeImage.d.ts +1 -1
- package/lib-amd/publicApi/image/changeImage.js +6 -5
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.d.ts +1 -1
- package/lib-amd/publicApi/image/insertImage.js +5 -4
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/image/setImageAltText.d.ts +1 -1
- package/lib-amd/publicApi/image/setImageAltText.js +3 -2
- package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBorder.d.ts +1 -1
- package/lib-amd/publicApi/image/setImageBorder.js +4 -3
- package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +1 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.js +5 -4
- package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-amd/publicApi/link/insertLink.d.ts +1 -1
- package/lib-amd/publicApi/link/insertLink.js +6 -5
- package/lib-amd/publicApi/link/insertLink.js.map +1 -1
- package/lib-amd/publicApi/link/removeLink.d.ts +1 -1
- package/lib-amd/publicApi/link/removeLink.js +4 -3
- package/lib-amd/publicApi/link/removeLink.js.map +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.js +4 -11
- package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-amd/publicApi/list/setListStyle.d.ts +1 -1
- package/lib-amd/publicApi/list/setListStyle.js +4 -17
- package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
- package/lib-amd/publicApi/list/toggleBullet.d.ts +1 -1
- package/lib-amd/publicApi/list/toggleBullet.js +2 -1
- package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.d.ts +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.js +2 -1
- package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.d.ts +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.js +2 -1
- package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-amd/publicApi/segment/changeFontSize.d.ts +1 -1
- package/lib-amd/publicApi/segment/changeFontSize.js +2 -1
- package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.js +4 -3
- package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontName.d.ts +1 -1
- package/lib-amd/publicApi/segment/setFontName.js +2 -1
- package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontSize.d.ts +1 -1
- package/lib-amd/publicApi/segment/setFontSize.js +2 -2
- package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setTextColor.d.ts +1 -1
- package/lib-amd/publicApi/segment/setTextColor.js +2 -1
- package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleBold.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleBold.js +4 -3
- package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleCode.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleCode.js +2 -1
- package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.js +2 -1
- package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.js +2 -1
- package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.d.ts +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.js +2 -1
- package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +7 -6
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.d.ts +1 -1
- package/lib-amd/publicApi/table/editTable.js +2 -1
- package/lib-amd/publicApi/table/editTable.js.map +1 -1
- package/lib-amd/publicApi/table/formatTable.d.ts +1 -1
- package/lib-amd/publicApi/table/formatTable.js +6 -5
- package/lib-amd/publicApi/table/formatTable.js.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +1 -1
- package/lib-amd/publicApi/table/insertTable.js +8 -7
- package/lib-amd/publicApi/table/insertTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.js +7 -6
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.d.ts +5 -0
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js +127 -0
- package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -0
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +6 -3
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +9 -3
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js +6 -6
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-mjs/index.d.ts +48 -42
- package/lib-mjs/index.js +48 -42
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.js +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.js +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelIndentation.js +1 -2
- package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js +1 -2
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-mjs/modelApi/common/clearModelFormat.js +1 -2
- package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.d.ts +20 -0
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.js +60 -0
- package/lib-mjs/modelApi/common/reducedModelChildProcessor.js.map +1 -0
- package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-mjs/modelApi/entity/insertEntityModel.d.ts +2 -2
- package/lib-mjs/modelApi/entity/insertEntityModel.js +18 -9
- package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js +2 -3
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-mjs/modelApi/link/matchLink.d.ts +1 -18
- package/lib-mjs/modelApi/link/matchLink.js +0 -1
- package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-mjs/modelApi/list/setListType.js +1 -2
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/list/setModelListStartNumber.d.ts +7 -0
- package/lib-mjs/modelApi/list/setModelListStartNumber.js +18 -0
- package/lib-mjs/modelApi/list/setModelListStartNumber.js.map +1 -0
- package/lib-mjs/modelApi/list/setModelListStyle.d.ts +7 -0
- package/lib-mjs/modelApi/list/setModelListStyle.js +22 -0
- package/lib-mjs/modelApi/list/setModelListStyle.js.map +1 -0
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js +1 -1
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js +1 -2
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustWordSelection.js +1 -2
- package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableColumn.js +1 -2
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.js +1 -2
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +1 -2
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.js +1 -2
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/block/setAlignment.d.ts +1 -1
- package/lib-mjs/publicApi/block/setAlignment.js +1 -1
- package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
- package/lib-mjs/publicApi/block/setDirection.d.ts +1 -1
- package/lib-mjs/publicApi/block/setDirection.js +1 -1
- package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.js +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-mjs/publicApi/block/setIndentation.d.ts +1 -1
- package/lib-mjs/publicApi/block/setIndentation.js +1 -1
- package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.js +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-mjs/publicApi/block/setSpacing.d.ts +1 -1
- package/lib-mjs/publicApi/block/setSpacing.js +1 -1
- package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.js +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-mjs/publicApi/entity/insertEntity.d.ts +3 -3
- package/lib-mjs/publicApi/entity/insertEntity.js +18 -12
- package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-mjs/publicApi/format/clearFormat.d.ts +1 -1
- package/lib-mjs/publicApi/format/clearFormat.js +1 -1
- package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.d.ts +1 -1
- package/lib-mjs/publicApi/format/getFormatState.js +12 -4
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.js +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.d.ts +1 -1
- package/lib-mjs/publicApi/image/changeImage.js +3 -3
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.d.ts +1 -1
- package/lib-mjs/publicApi/image/insertImage.js +2 -3
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.js +2 -2
- package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBorder.d.ts +1 -1
- package/lib-mjs/publicApi/image/setImageBorder.js +3 -3
- package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.js +2 -2
- package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.js +2 -2
- package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.d.ts +1 -1
- package/lib-mjs/publicApi/link/insertLink.js +2 -3
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
- package/lib-mjs/publicApi/link/removeLink.d.ts +1 -1
- package/lib-mjs/publicApi/link/removeLink.js +2 -2
- package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.js +3 -11
- package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStyle.d.ts +1 -1
- package/lib-mjs/publicApi/list/setListStyle.js +3 -18
- package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.d.ts +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.js +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.d.ts +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.js +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.js +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.js +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.d.ts +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.js +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.js +2 -3
- package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontName.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setFontName.js +1 -1
- package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.js +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.d.ts +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.js +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.js +2 -2
- package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.js +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.js +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.js +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.js +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.js +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +2 -3
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.d.ts +1 -1
- package/lib-mjs/publicApi/table/editTable.js +1 -1
- package/lib-mjs/publicApi/table/editTable.js.map +1 -1
- package/lib-mjs/publicApi/table/formatTable.d.ts +1 -1
- package/lib-mjs/publicApi/table/formatTable.js +2 -2
- package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +1 -1
- package/lib-mjs/publicApi/table/insertTable.js +2 -3
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.js +2 -2
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +5 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.d.ts +5 -0
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js +123 -0
- package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -0
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +5 -2
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +8 -2
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js +1 -2
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/package.json +4 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.insertEntity = void 0;
|
|
4
|
+
var formatInsertPointWithContentModel_1 = require("../utils/formatInsertPointWithContentModel");
|
|
4
5
|
var insertEntityModel_1 = require("../../modelApi/entity/insertEntityModel");
|
|
5
6
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
6
7
|
var BlockEntityTag = 'div';
|
|
@@ -22,15 +23,8 @@ function insertEntity(editor, type, isBlock, position, options) {
|
|
|
22
23
|
if (!skipUndoSnapshot) {
|
|
23
24
|
editor.takeSnapshot();
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
28
|
-
context.skipUndoSnapshot = true;
|
|
29
|
-
context.newEntities.push(entityModel);
|
|
30
|
-
return true;
|
|
31
|
-
}, {
|
|
32
|
-
selectionOverride: typeof position === 'object' ? position : undefined,
|
|
33
|
-
changeSource: roosterjs_content_model_core_1.ChangeSource.InsertEntity,
|
|
26
|
+
var formatOptions = {
|
|
27
|
+
changeSource: roosterjs_content_model_dom_1.ChangeSource.InsertEntity,
|
|
34
28
|
getChangeData: function () { return ({
|
|
35
29
|
wrapper: wrapper,
|
|
36
30
|
type: type,
|
|
@@ -38,7 +32,20 @@ function insertEntity(editor, type, isBlock, position, options) {
|
|
|
38
32
|
isReadonly: true,
|
|
39
33
|
}); },
|
|
40
34
|
apiName: 'insertEntity',
|
|
41
|
-
}
|
|
35
|
+
};
|
|
36
|
+
var callback = function (model, context, insertPoint) {
|
|
37
|
+
(0, insertEntityModel_1.insertEntityModel)(model, entityModel, typeof position == 'string' ? position : 'focus', isBlock, focusAfterEntity, context, insertPoint);
|
|
38
|
+
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
39
|
+
context.skipUndoSnapshot = true;
|
|
40
|
+
context.newEntities.push(entityModel);
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
if (typeof position == 'object') {
|
|
44
|
+
(0, formatInsertPointWithContentModel_1.formatInsertPointWithContentModel)(editor, position, callback, formatOptions);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
editor.formatContentModel(callback, formatOptions);
|
|
48
|
+
}
|
|
42
49
|
if (!skipUndoSnapshot) {
|
|
43
50
|
var entityState = void 0;
|
|
44
51
|
if (initialEntityState) {
|
|
@@ -57,5 +64,5 @@ function insertEntity(editor, type, isBlock, position, options) {
|
|
|
57
64
|
}
|
|
58
65
|
return entityModel;
|
|
59
66
|
}
|
|
60
|
-
exports.
|
|
67
|
+
exports.insertEntity = insertEntity;
|
|
61
68
|
//# sourceMappingURL=insertEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/entity/insertEntity.ts"],"names":[],"mappings":";;;AAAA,gGAA+F;AAC/F,6EAA4E;AAC5E,2EAKqC;AAcrC,IAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,IAAM,eAAe,GAAG,MAAM,CAAC;AAwC/B,SAAgB,YAAY,CACxB,MAAe,EACf,IAAY,EACZ,OAAgB,EAChB,QAAgD,EAChD,OAA6B;IAEvB,IAAA,KACF,OAAO,IAAI,EAAE,EADT,WAAW,iBAAA,EAAE,gBAAgB,sBAAA,EAAE,cAAc,oBAAA,EAAE,gBAAgB,sBAAA,EAAE,kBAAkB,wBAC1E,CAAC;IAClB,IAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACtC,IAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IACnF,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,OAAO,IAAI,SAAS,IAAI,OAAO,EAAE;QACjC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;KACxD;IAED,IAAI,WAAW,EAAE;QACb,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;KACpC;IAED,IAAM,WAAW,GAAG,IAAA,0CAAY,EAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAE7F,IAAI,CAAC,gBAAgB,EAAE;QACnB,MAAM,CAAC,YAAY,EAAE,CAAC;KACzB;IAED,IAAM,aAAa,GAA8B;QAC7C,YAAY,EAAE,0CAAY,CAAC,YAAY;QACvC,aAAa,EAAE,cAAM,OAAA,CAAC;YAClB,OAAO,SAAA;YACP,IAAI,MAAA;YACJ,EAAE,EAAE,EAAE;YACN,UAAU,EAAE,IAAI;SACnB,CAAC,EALmB,CAKnB;QACF,OAAO,EAAE,cAAc;KAC1B,CAAC;IAEF,IAAM,QAAQ,GAAG,UACb,KAA2B,EAC3B,OAAkC,EAClC,WAAyB;QAEzB,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,EACP,WAAW,CACd,CAAC;QAEF,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAChC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;IAEF,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE;QAC7B,IAAA,qEAAiC,EAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;KAChF;SAAM;QACH,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;KACtD;IAED,IAAI,CAAC,gBAAgB,EAAE;QACnB,IAAI,WAAW,SAAyB,CAAC;QAEzC,IAAI,kBAAkB,EAAE;YACpB,IAAM,MAAM,GAAG,IAAA,+CAAiB,EAAC,OAAO,CAAC,CAAC;YAClC,IAAA,EAAE,GAAiB,MAAM,GAAvB,EAAE,UAAU,GAAK,MAAM,WAAX,CAAY;YAElC,WAAW;gBACP,EAAE,IAAI,UAAU;oBACZ,CAAC,CAAC;wBACI,EAAE,EAAE,EAAE;wBACN,IAAI,EAAE,UAAU;wBAChB,KAAK,EAAE,kBAAkB;qBAC5B;oBACH,CAAC,CAAC,SAAS,CAAC;SACvB;QAED,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;KACpC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC;AA3FD,oCA2FC","sourcesContent":["import { formatInsertPointWithContentModel } from '../utils/formatInsertPointWithContentModel';\nimport { insertEntityModel } from '../../modelApi/entity/insertEntityModel';\nimport {\n ChangeSource,\n createEntity,\n normalizeContentModel,\n parseEntityFormat,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelEntity,\n InsertEntityPosition,\n InsertEntityOptions,\n IEditor,\n EntityState,\n DOMInsertPoint,\n FormatContentModelOptions,\n ContentModelDocument,\n FormatContentModelContext,\n InsertPoint,\n} from 'roosterjs-content-model-types';\n\nconst BlockEntityTag = 'div';\nconst InlineEntityTag = 'span';\n\n/**\n * Insert an entity into editor\n * @param editor The editor object\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 function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: boolean,\n position: 'focus' | 'begin' | 'end' | DOMInsertPoint,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\n/**\n * Insert a block entity into editor\n * @param editor The editor object\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 function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: true,\n position: InsertEntityPosition | DOMInsertPoint,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\nexport function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: boolean,\n position?: InsertEntityPosition | DOMInsertPoint,\n options?: InsertEntityOptions\n): ContentModelEntity | null {\n const { contentNode, focusAfterEntity, wrapperDisplay, skipUndoSnapshot, initialEntityState } =\n options || {};\n const document = editor.getDocument();\n const wrapper = document.createElement(isBlock ? BlockEntityTag : InlineEntityTag);\n const display = wrapperDisplay ?? (isBlock ? undefined : 'inline-block');\n\n wrapper.style.setProperty('display', display || null);\n\n if (display == undefined && isBlock) {\n wrapper.style.setProperty('width', '100%');\n wrapper.style.setProperty('display', 'inline-block');\n }\n\n if (contentNode) {\n wrapper.appendChild(contentNode);\n }\n\n const entityModel = createEntity(wrapper, true /* isReadonly */, undefined /*format*/, type);\n\n if (!skipUndoSnapshot) {\n editor.takeSnapshot();\n }\n\n const formatOptions: FormatContentModelOptions = {\n changeSource: ChangeSource.InsertEntity,\n getChangeData: () => ({\n wrapper,\n type,\n id: '',\n isReadonly: true,\n }),\n apiName: 'insertEntity',\n };\n\n const callback = (\n model: ContentModelDocument,\n context: FormatContentModelContext,\n insertPoint?: InsertPoint\n ) => {\n insertEntityModel(\n model,\n entityModel,\n typeof position == 'string' ? position : 'focus',\n isBlock,\n focusAfterEntity,\n context,\n insertPoint\n );\n\n normalizeContentModel(model);\n\n context.skipUndoSnapshot = true;\n context.newEntities.push(entityModel);\n\n return true;\n };\n\n if (typeof position == 'object') {\n formatInsertPointWithContentModel(editor, position, callback, formatOptions);\n } else {\n editor.formatContentModel(callback, formatOptions);\n }\n\n if (!skipUndoSnapshot) {\n let entityState: EntityState | undefined;\n\n if (initialEntityState) {\n const format = parseEntityFormat(wrapper);\n const { id, entityType } = format;\n\n entityState =\n id && entityType\n ? {\n id: id,\n type: entityType,\n state: initialEntityState,\n }\n : undefined;\n }\n\n editor.takeSnapshot(entityState);\n }\n\n return entityModel;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearFormat = void 0;
|
|
3
4
|
var clearModelFormat_1 = require("../../modelApi/common/clearModelFormat");
|
|
4
5
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
6
|
/**
|
|
@@ -19,5 +20,5 @@ function clearFormat(editor) {
|
|
|
19
20
|
apiName: 'clearFormat',
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
exports.
|
|
23
|
+
exports.clearFormat = clearFormat;
|
|
23
24
|
//# sourceMappingURL=clearFormat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/format/clearFormat.ts"],"names":[],"mappings":";;;AAAA,2EAA0E;AAC1E,2EAAoE;AASpE;;;GAGG;AACH,SAAgB,WAAW,CAAC,MAAe;IACvC,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,kCAqBC","sourcesContent":["import { clearModelFormat } from '../../modelApi/common/clearModelFormat';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport type {\n IEditor,\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 function clearFormat(editor: IEditor) {\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"]}
|
|
@@ -3,4 +3,4 @@ import type { IEditor, ContentModelFormatState } from 'roosterjs-content-model-t
|
|
|
3
3
|
* Get current format state
|
|
4
4
|
* @param editor The editor to get format from
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function getFormatState(editor: IEditor): ContentModelFormatState;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.getFormatState = void 0;
|
|
4
|
+
var reducedModelChildProcessor_1 = require("../../modelApi/common/reducedModelChildProcessor");
|
|
5
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
4
6
|
/**
|
|
5
7
|
* Get current format state
|
|
6
8
|
* @param editor The editor to get format from
|
|
7
9
|
*/
|
|
8
10
|
function getFormatState(editor) {
|
|
9
11
|
var pendingFormat = editor.getPendingFormat();
|
|
10
|
-
var model = editor.getContentModelCopy('reduced');
|
|
11
12
|
var manager = editor.getSnapshotsManager();
|
|
12
13
|
var result = {
|
|
13
14
|
canUndo: manager.hasNewContent || manager.canMove(-1),
|
|
14
15
|
canRedo: manager.canMove(1),
|
|
15
16
|
isDarkMode: editor.isDarkMode(),
|
|
16
17
|
};
|
|
17
|
-
(
|
|
18
|
+
editor.formatContentModel(function (model) {
|
|
19
|
+
(0, roosterjs_content_model_dom_1.retrieveModelFormatState)(model, pendingFormat, result);
|
|
20
|
+
return false;
|
|
21
|
+
}, undefined /*options*/, {
|
|
22
|
+
processorOverride: {
|
|
23
|
+
child: reducedModelChildProcessor_1.reducedModelChildProcessor,
|
|
24
|
+
},
|
|
25
|
+
tryGetFromCache: true,
|
|
26
|
+
});
|
|
18
27
|
return result;
|
|
19
28
|
}
|
|
20
|
-
exports.
|
|
29
|
+
exports.getFormatState = getFormatState;
|
|
21
30
|
//# sourceMappingURL=getFormatState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts"],"names":[],"mappings":";;;AAAA,+FAA8F;AAC9F,2EAAuE;AAGvE;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAe;IAC1C,IAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAChD,IAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC7C,IAAM,MAAM,GAA4B;QACpC,OAAO,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;KAClC,CAAC;IAEF,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,IAAA,sDAAwB,EAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAEvD,OAAO,KAAK,CAAC;IACjB,CAAC,EACD,SAAS,CAAC,WAAW,EACrB;QACI,iBAAiB,EAAE;YACf,KAAK,EAAE,uDAA0B;SACpC;QACD,eAAe,EAAE,IAAI;KACxB,CACJ,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC;AAzBD,wCAyBC","sourcesContent":["import { reducedModelChildProcessor } from '../../modelApi/common/reducedModelChildProcessor';\nimport { retrieveModelFormatState } from 'roosterjs-content-model-dom';\nimport type { IEditor, ContentModelFormatState } from 'roosterjs-content-model-types';\n\n/**\n * Get current format state\n * @param editor The editor to get format from\n */\nexport function getFormatState(editor: IEditor): ContentModelFormatState {\n const pendingFormat = editor.getPendingFormat();\n const manager = editor.getSnapshotsManager();\n const result: ContentModelFormatState = {\n canUndo: manager.hasNewContent || manager.canMove(-1),\n canRedo: manager.canMove(1),\n isDarkMode: editor.isDarkMode(),\n };\n\n editor.formatContentModel(\n model => {\n retrieveModelFormatState(model, pendingFormat, result);\n\n return false;\n },\n undefined /*options*/,\n {\n processorOverride: {\n child: reducedModelChildProcessor,\n },\n tryGetFromCache: true,\n }\n );\n\n return result;\n}\n"]}
|
|
@@ -3,4 +3,4 @@ import type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';
|
|
|
3
3
|
* Adjust selection to make sure select an image if any
|
|
4
4
|
* @return Content Model Image object if an image is select, or null
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function adjustImageSelection(editor: IEditor): ContentModelImage | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adjustImageSelection = void 0;
|
|
3
4
|
var adjustSegmentSelection_1 = require("../../modelApi/selection/adjustSegmentSelection");
|
|
4
5
|
/**
|
|
5
6
|
* Adjust selection to make sure select an image if any
|
|
@@ -22,5 +23,5 @@ function adjustImageSelection(editor) {
|
|
|
22
23
|
});
|
|
23
24
|
return image;
|
|
24
25
|
}
|
|
25
|
-
exports.
|
|
26
|
+
exports.adjustImageSelection = adjustImageSelection;
|
|
26
27
|
//# sourceMappingURL=adjustImageSelection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/adjustImageSelection.ts"],"names":[],"mappings":";;;AAAA,0FAAyF;AAGzF;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,MAAe;IAChD,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,oDAuBC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport type { ContentModelImage, IEditor } 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 function adjustImageSelection(editor: IEditor): 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"]}
|
|
@@ -4,4 +4,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
4
4
|
* @param editor The editor instance
|
|
5
5
|
* @param file The image file
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function changeImage(editor: IEditor, file: File): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeImage = void 0;
|
|
3
4
|
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
4
|
-
var
|
|
5
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
6
|
/**
|
|
6
7
|
* Change the selected image src
|
|
7
8
|
* @param editor The editor instance
|
|
@@ -10,11 +11,11 @@ var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
|
10
11
|
function changeImage(editor, file) {
|
|
11
12
|
editor.focus();
|
|
12
13
|
var selection = editor.getDOMSelection();
|
|
13
|
-
(0,
|
|
14
|
+
(0, roosterjs_content_model_dom_1.readFile)(file, function (dataUrl) {
|
|
14
15
|
if (dataUrl && !editor.isDisposed() && (selection === null || selection === void 0 ? void 0 : selection.type) === 'image') {
|
|
15
|
-
(0, formatImageWithContentModel_1.
|
|
16
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'changeImage', function (image) {
|
|
16
17
|
var _a, _b;
|
|
17
|
-
var originalSrc = (_b = (_a = (0,
|
|
18
|
+
var originalSrc = (_b = (_a = (0, roosterjs_content_model_dom_1.updateImageMetadata)(image)) === null || _a === void 0 ? void 0 : _a.src) !== null && _b !== void 0 ? _b : '';
|
|
18
19
|
var previousSrc = image.src;
|
|
19
20
|
image.src = dataUrl;
|
|
20
21
|
image.dataset = {};
|
|
@@ -31,5 +32,5 @@ function changeImage(editor, file) {
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
exports.
|
|
35
|
+
exports.changeImage = changeImage;
|
|
35
36
|
//# sourceMappingURL=changeImage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AACnF,2EAA4E;AAG5E;;;;GAIG;AACH,SAAgB,WAAW,CAAC,MAAe,EAAE,IAAU;IACnD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3C,IAAA,sCAAQ,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,yDAA2B,EAAC,MAAM,EAAE,aAAa,EAAE,UAAC,KAAwB;;gBACxE,IAAM,WAAW,GAAG,MAAA,MAAA,IAAA,iDAAmB,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,YAAY,CAAC,WAAW,EAAE;oBAC7B,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,kCAyBC","sourcesContent":["import { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport { readFile, updateImageMetadata } from 'roosterjs-content-model-dom';\nimport type { ContentModelImage, IEditor } 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 function changeImage(editor: IEditor, 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.triggerEvent('editImage', {\n image: selection.image,\n previousSrc,\n newSrc: dataUrl,\n originalSrc,\n });\n });\n }\n });\n}\n"]}
|
|
@@ -4,4 +4,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param file Image Blob file or source string
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function insertImage(editor: IEditor, imageFileOrSrc: File | string): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insertImage = void 0;
|
|
3
4
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
4
|
-
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
5
5
|
/**
|
|
6
6
|
* Insert an image into current selected position
|
|
7
7
|
* @param editor The editor to operate on
|
|
@@ -13,20 +13,20 @@ function insertImage(editor, imageFileOrSrc) {
|
|
|
13
13
|
insertImageWithSrc(editor, imageFileOrSrc);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
(0,
|
|
16
|
+
(0, roosterjs_content_model_dom_1.readFile)(imageFileOrSrc, function (dataUrl) {
|
|
17
17
|
if (dataUrl && !editor.isDisposed()) {
|
|
18
18
|
insertImageWithSrc(editor, dataUrl);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.
|
|
23
|
+
exports.insertImage = insertImage;
|
|
24
24
|
function insertImageWithSrc(editor, src) {
|
|
25
25
|
editor.formatContentModel(function (model, context) {
|
|
26
26
|
var image = (0, roosterjs_content_model_dom_1.createImage)(src, { backgroundColor: '' });
|
|
27
27
|
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
28
28
|
(0, roosterjs_content_model_dom_1.addSegment)(doc, image);
|
|
29
|
-
(0,
|
|
29
|
+
(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
|
|
30
30
|
mergeFormat: 'mergeAll',
|
|
31
31
|
});
|
|
32
32
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/insertImage.ts"],"names":[],"mappings":";;;AAAA,2EAMqC;AAGrC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,MAAe,EAAE,cAA6B;IACtE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAI,OAAO,cAAc,IAAI,QAAQ,EAAE;QACnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;KAC9C;SAAM;QACH,IAAA,sCAAQ,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,kCAYC;AAED,SAAS,kBAAkB,CAAC,MAAe,EAAE,GAAW;IACpD,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,wCAAU,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 {\n mergeModel,\n readFile,\n addSegment,\n createContentModelDocument,\n createImage,\n} from 'roosterjs-content-model-dom';\nimport type { IEditor } 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 function insertImage(editor: IEditor, 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: IEditor, 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"]}
|
|
@@ -5,4 +5,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
5
5
|
* @param editor The editor instance
|
|
6
6
|
* @param altText The image alt text
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function setImageAltText(editor: IEditor, altText: string): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setImageAltText = void 0;
|
|
3
4
|
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
4
5
|
/**
|
|
5
6
|
* Set image alt text for all selected images at selection. If no images is contained
|
|
@@ -9,9 +10,9 @@ var formatImageWithContentModel_1 = require("../utils/formatImageWithContentMode
|
|
|
9
10
|
*/
|
|
10
11
|
function setImageAltText(editor, altText) {
|
|
11
12
|
editor.focus();
|
|
12
|
-
(0, formatImageWithContentModel_1.
|
|
13
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageAltText', function (image) {
|
|
13
14
|
image.alt = altText;
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
exports.
|
|
17
|
+
exports.setImageAltText = setImageAltText;
|
|
17
18
|
//# sourceMappingURL=setImageAltText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageAltText.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AAGnF;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,MAAe,EAAE,OAAe;IAC5D,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAC,KAAwB;QAC5E,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC;AAND,0CAMC","sourcesContent":["import { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IEditor } 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 function setImageAltText(editor: IEditor, altText: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageAltText', (image: ContentModelImage) => {\n image.alt = altText;\n });\n}\n"]}
|
|
@@ -6,4 +6,4 @@ import type { Border, IEditor } from 'roosterjs-content-model-types';
|
|
|
6
6
|
* its value will not be changed. Passing null instead of an object will remove the border
|
|
7
7
|
* @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setImageBorder = void 0;
|
|
3
4
|
var applyImageBorderFormat_1 = require("../../modelApi/image/applyImageBorderFormat");
|
|
4
5
|
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
5
6
|
/**
|
|
@@ -11,9 +12,9 @@ var formatImageWithContentModel_1 = require("../utils/formatImageWithContentMode
|
|
|
11
12
|
*/
|
|
12
13
|
function setImageBorder(editor, border, borderRadius) {
|
|
13
14
|
editor.focus();
|
|
14
|
-
(0, formatImageWithContentModel_1.
|
|
15
|
-
(0, applyImageBorderFormat_1.
|
|
15
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBorder', function (image) {
|
|
16
|
+
(0, applyImageBorderFormat_1.applyImageBorderFormat)(image, border, borderRadius);
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
|
-
exports.
|
|
19
|
+
exports.setImageBorder = setImageBorder;
|
|
19
20
|
//# sourceMappingURL=setImageBorder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;;AAAA,sFAAqF;AACrF,oFAAmF;AAGnF;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,MAAe,EAAE,MAAqB,EAAE,YAAqB;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;QAC3E,IAAA,+CAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAND,wCAMC","sourcesContent":["import { applyImageBorderFormat } from '../../modelApi/image/applyImageBorderFormat';\nimport { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport type { Border, ContentModelImage, IEditor } 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 function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\n applyImageBorderFormat(image, border, borderRadius);\n });\n}\n"]}
|
|
@@ -5,4 +5,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
5
5
|
* @param boxShadow The image box boxShadow
|
|
6
6
|
* @param margin The image margin for all sides (eg. "4px"), null to remove margin
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setImageBoxShadow = void 0;
|
|
3
4
|
var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
|
|
4
5
|
/**
|
|
5
6
|
* Set image box shadow for all selected images at selection.
|
|
@@ -9,7 +10,7 @@ var formatImageWithContentModel_1 = require("../utils/formatImageWithContentMode
|
|
|
9
10
|
*/
|
|
10
11
|
function setImageBoxShadow(editor, boxShadow, margin) {
|
|
11
12
|
editor.focus();
|
|
12
|
-
(0, formatImageWithContentModel_1.
|
|
13
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBoxShadow', function (image) {
|
|
13
14
|
image.format.boxShadow = boxShadow;
|
|
14
15
|
if (margin) {
|
|
15
16
|
image.format.marginBottom = margin;
|
|
@@ -25,5 +26,5 @@ function setImageBoxShadow(editor, boxShadow, margin) {
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
exports.
|
|
29
|
+
exports.setImageBoxShadow = setImageBoxShadow;
|
|
29
30
|
//# sourceMappingURL=setImageBoxShadow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AAGnF;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,MAAe,EAAE,SAAiB,EAAE,MAAsB;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,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;AAjBD,8CAiBC","sourcesContent":["import { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IEditor } 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 function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null) {\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"]}
|
|
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
3
3
|
* Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
|
|
4
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
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function adjustLinkSelection(editor: IEditor): [string, string | null];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adjustLinkSelection = void 0;
|
|
3
4
|
var adjustSegmentSelection_1 = require("../../modelApi/selection/adjustSegmentSelection");
|
|
4
5
|
var adjustWordSelection_1 = require("../../modelApi/selection/adjustWordSelection");
|
|
5
|
-
var
|
|
6
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
6
7
|
/**
|
|
7
8
|
* Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
|
|
8
9
|
* @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
|
|
@@ -13,13 +14,13 @@ function adjustLinkSelection(editor) {
|
|
|
13
14
|
editor.formatContentModel(function (model) {
|
|
14
15
|
var _a, _b;
|
|
15
16
|
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,
|
|
17
|
+
var segments = (0, roosterjs_content_model_dom_1.getSelectedSegments)(model, false /*includingFormatHolder*/);
|
|
17
18
|
var firstSegment = segments[0];
|
|
18
19
|
if (segments.length == 1 && firstSegment.segmentType == 'SelectionMarker') {
|
|
19
20
|
segments = (0, adjustWordSelection_1.adjustWordSelection)(model, firstSegment);
|
|
20
21
|
if (segments.length > 1) {
|
|
21
22
|
changed = true;
|
|
22
|
-
(0,
|
|
23
|
+
(0, roosterjs_content_model_dom_1.setSelection)(model, segments[0], segments[segments.length - 1]);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
text = segments.map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); }).join('');
|
|
@@ -30,5 +31,5 @@ function adjustLinkSelection(editor) {
|
|
|
30
31
|
});
|
|
31
32
|
return [text, url];
|
|
32
33
|
}
|
|
33
|
-
exports.
|
|
34
|
+
exports.adjustLinkSelection = adjustLinkSelection;
|
|
34
35
|
//# sourceMappingURL=adjustLinkSelection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"],"names":[],"mappings":";;;AAAA,0FAAyF;AACzF,oFAAmF;AACnF,2EAAgF;AAGhF;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAe;IAC/C,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,iDAAmB,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,0CAAY,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,kDAkCC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport { adjustWordSelection } from '../../modelApi/selection/adjustWordSelection';\nimport { getSelectedSegments, setSelection } from 'roosterjs-content-model-dom';\nimport type { IEditor } 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 function adjustLinkSelection(editor: IEditor): [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"]}
|
|
@@ -12,4 +12,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
12
12
|
* If specified, the display text of link will be replaced with this text.
|
|
13
13
|
* If not specified and there wasn't a link, the link url will be used as display text.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare function insertLink(editor: IEditor, link: string, anchorTitle?: string, displayText?: string, target?: string): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insertLink = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var adjustTrailingSpaceSelection_1 = require("../../modelApi/selection/adjustTrailingSpaceSelection");
|
|
5
|
-
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
6
6
|
var matchLink_1 = require("../../modelApi/link/matchLink");
|
|
7
7
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
8
8
|
// Regex matching Uri scheme
|
|
@@ -34,7 +34,7 @@ function insertLink(editor, link, anchorTitle, displayText, target) {
|
|
|
34
34
|
var anchorNode_1;
|
|
35
35
|
editor.formatContentModel(function (model, context) {
|
|
36
36
|
var _a;
|
|
37
|
-
var segments = (0,
|
|
37
|
+
var segments = (0, roosterjs_content_model_dom_1.getSelectedSegments)(model, false /*includingFormatHolder*/);
|
|
38
38
|
var originalText = segments
|
|
39
39
|
.map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); })
|
|
40
40
|
.join('');
|
|
@@ -59,14 +59,14 @@ function insertLink(editor, link, anchorTitle, displayText, target) {
|
|
|
59
59
|
if (segment.link) {
|
|
60
60
|
links_1.push(segment.link);
|
|
61
61
|
}
|
|
62
|
-
(0,
|
|
62
|
+
(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
|
|
63
63
|
mergeFormat: 'mergeAll',
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
(0, adjustTrailingSpaceSelection_1.adjustTrailingSpaceSelection)(model);
|
|
67
67
|
return segments.length > 0;
|
|
68
68
|
}, {
|
|
69
|
-
changeSource:
|
|
69
|
+
changeSource: roosterjs_content_model_dom_1.ChangeSource.CreateLink,
|
|
70
70
|
onNodeCreated: function (modelElement, node) {
|
|
71
71
|
if (!anchorNode_1 && links_1.indexOf(modelElement) >= 0) {
|
|
72
72
|
anchorNode_1 = node;
|
|
@@ -77,7 +77,7 @@ function insertLink(editor, link, anchorTitle, displayText, target) {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
exports.
|
|
80
|
+
exports.insertLink = insertLink;
|
|
81
81
|
var createLink = function (url, anchorTitle, target, underline) {
|
|
82
82
|
if (underline === void 0) { underline = true; }
|
|
83
83
|
return {
|