roosterjs-content-model-api 0.26.4 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +46 -42
- package/lib/index.js +52 -43
- package/lib/index.js.map +1 -1
- package/lib/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib/modelApi/block/setModelDirection.js.map +1 -1
- package/lib/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib/modelApi/common/wrapBlock.js.map +1 -1
- package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib/modelApi/image/applyImageBorderFormat.js +2 -1
- package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib/modelApi/link/matchLink.d.ts +1 -18
- package/lib/modelApi/link/matchLink.js +0 -1
- package/lib/modelApi/link/matchLink.js.map +1 -1
- package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib/modelApi/list/setListType.d.ts +2 -1
- package/lib/modelApi/list/setListType.js +5 -3
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib/modelApi/table/alignTable.js.map +1 -1
- package/lib/modelApi/table/alignTableCell.js.map +1 -1
- package/lib/modelApi/table/canMergeCells.js.map +1 -1
- package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib/modelApi/table/createTableStructure.js.map +1 -1
- package/lib/modelApi/table/deleteTable.js.map +1 -1
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/block/setAlignment.d.ts +2 -2
- package/lib/publicApi/block/setAlignment.js +2 -1
- package/lib/publicApi/block/setAlignment.js.map +1 -1
- package/lib/publicApi/block/setDirection.d.ts +2 -2
- package/lib/publicApi/block/setDirection.js +2 -1
- package/lib/publicApi/block/setDirection.js.map +1 -1
- package/lib/publicApi/block/setHeadingLevel.d.ts +2 -2
- package/lib/publicApi/block/setHeadingLevel.js +2 -1
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib/publicApi/block/setIndentation.d.ts +2 -2
- package/lib/publicApi/block/setIndentation.js +2 -1
- package/lib/publicApi/block/setIndentation.js.map +1 -1
- package/lib/publicApi/block/setParagraphMargin.d.ts +2 -2
- package/lib/publicApi/block/setParagraphMargin.js +2 -1
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib/publicApi/block/setSpacing.d.ts +2 -2
- package/lib/publicApi/block/setSpacing.js +2 -1
- package/lib/publicApi/block/setSpacing.js.map +1 -1
- package/lib/publicApi/block/toggleBlockQuote.d.ts +2 -2
- package/lib/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib/publicApi/entity/insertEntity.d.ts +5 -5
- package/lib/publicApi/entity/insertEntity.js +24 -4
- package/lib/publicApi/entity/insertEntity.js.map +1 -1
- package/lib/publicApi/format/clearFormat.d.ts +2 -2
- package/lib/publicApi/format/clearFormat.js +2 -1
- package/lib/publicApi/format/clearFormat.js.map +1 -1
- package/lib/publicApi/format/getFormatState.d.ts +2 -2
- package/lib/publicApi/format/getFormatState.js +2 -1
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/adjustImageSelection.d.ts +2 -2
- package/lib/publicApi/image/adjustImageSelection.js +2 -1
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib/publicApi/image/changeImage.d.ts +2 -2
- package/lib/publicApi/image/changeImage.js +3 -2
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.d.ts +2 -2
- package/lib/publicApi/image/insertImage.js +2 -1
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/image/setImageAltText.d.ts +2 -2
- package/lib/publicApi/image/setImageAltText.js +3 -2
- package/lib/publicApi/image/setImageAltText.js.map +1 -1
- package/lib/publicApi/image/setImageBorder.d.ts +2 -2
- package/lib/publicApi/image/setImageBorder.js +4 -3
- package/lib/publicApi/image/setImageBorder.js.map +1 -1
- package/lib/publicApi/image/setImageBoxShadow.d.ts +2 -2
- package/lib/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib/publicApi/link/adjustLinkSelection.d.ts +2 -2
- package/lib/publicApi/link/adjustLinkSelection.js +2 -1
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +2 -2
- package/lib/publicApi/link/insertLink.js +2 -1
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +2 -2
- package/lib/publicApi/link/removeLink.js +2 -1
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib/publicApi/list/setListStartNumber.js +2 -1
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +2 -2
- package/lib/publicApi/list/setListStyle.js +2 -1
- package/lib/publicApi/list/setListStyle.js.map +1 -1
- package/lib/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib/publicApi/list/toggleBullet.js +6 -3
- package/lib/publicApi/list/toggleBullet.js.map +1 -1
- package/lib/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib/publicApi/list/toggleNumbering.js +6 -3
- package/lib/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib/publicApi/segment/applySegmentFormat.d.ts +2 -2
- package/lib/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib/publicApi/segment/changeCapitalization.d.ts +2 -2
- package/lib/publicApi/segment/changeCapitalization.js +2 -1
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib/publicApi/segment/changeFontSize.d.ts +2 -2
- package/lib/publicApi/segment/changeFontSize.js +2 -1
- package/lib/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib/publicApi/segment/setBackgroundColor.d.ts +2 -2
- package/lib/publicApi/segment/setBackgroundColor.js +2 -1
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib/publicApi/segment/setFontName.d.ts +2 -2
- package/lib/publicApi/segment/setFontName.js +2 -1
- package/lib/publicApi/segment/setFontName.js.map +1 -1
- package/lib/publicApi/segment/setFontSize.d.ts +2 -2
- package/lib/publicApi/segment/setFontSize.js +2 -2
- package/lib/publicApi/segment/setFontSize.js.map +1 -1
- package/lib/publicApi/segment/setTextColor.d.ts +2 -2
- package/lib/publicApi/segment/setTextColor.js +2 -1
- package/lib/publicApi/segment/setTextColor.js.map +1 -1
- package/lib/publicApi/segment/toggleBold.d.ts +2 -2
- package/lib/publicApi/segment/toggleBold.js +2 -1
- package/lib/publicApi/segment/toggleBold.js.map +1 -1
- package/lib/publicApi/segment/toggleCode.d.ts +2 -2
- package/lib/publicApi/segment/toggleCode.js +2 -1
- package/lib/publicApi/segment/toggleCode.js.map +1 -1
- package/lib/publicApi/segment/toggleItalic.d.ts +2 -2
- package/lib/publicApi/segment/toggleItalic.js +2 -1
- package/lib/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +2 -2
- package/lib/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib/publicApi/segment/toggleSubscript.d.ts +2 -2
- package/lib/publicApi/segment/toggleSubscript.js +2 -1
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib/publicApi/segment/toggleSuperscript.d.ts +2 -2
- package/lib/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib/publicApi/segment/toggleUnderline.d.ts +2 -2
- package/lib/publicApi/segment/toggleUnderline.js +2 -1
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +2 -2
- package/lib/publicApi/table/applyTableBorderFormat.js +2 -1
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.d.ts +2 -2
- package/lib/publicApi/table/editTable.js +2 -1
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/formatTable.d.ts +2 -2
- package/lib/publicApi/table/formatTable.js +2 -1
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +2 -2
- package/lib/publicApi/table/insertTable.js +2 -1
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib/publicApi/table/setTableCellShade.js +2 -1
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
- package/lib/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
- package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-amd/index.d.ts +46 -42
- package/lib-amd/index.js +48 -44
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.js +2 -1
- package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-amd/modelApi/link/matchLink.d.ts +1 -18
- package/lib-amd/modelApi/link/matchLink.js +0 -1
- package/lib-amd/modelApi/link/matchLink.js.map +1 -1
- package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-amd/modelApi/list/setListType.d.ts +2 -1
- package/lib-amd/modelApi/list/setListType.js +5 -3
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-amd/modelApi/table/alignTable.js.map +1 -1
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/block/setAlignment.d.ts +2 -2
- package/lib-amd/publicApi/block/setAlignment.js +2 -1
- package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
- package/lib-amd/publicApi/block/setDirection.d.ts +2 -2
- package/lib-amd/publicApi/block/setDirection.js +2 -1
- package/lib-amd/publicApi/block/setDirection.js.map +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.d.ts +2 -2
- package/lib-amd/publicApi/block/setHeadingLevel.js +2 -1
- package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-amd/publicApi/block/setIndentation.d.ts +2 -2
- package/lib-amd/publicApi/block/setIndentation.js +2 -1
- package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.d.ts +2 -2
- package/lib-amd/publicApi/block/setParagraphMargin.js +2 -1
- package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-amd/publicApi/block/setSpacing.d.ts +2 -2
- package/lib-amd/publicApi/block/setSpacing.js +2 -1
- package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +2 -2
- package/lib-amd/publicApi/block/toggleBlockQuote.js +2 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-amd/publicApi/entity/insertEntity.d.ts +5 -5
- package/lib-amd/publicApi/entity/insertEntity.js +24 -4
- package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-amd/publicApi/format/clearFormat.d.ts +2 -2
- package/lib-amd/publicApi/format/clearFormat.js +2 -1
- package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.d.ts +2 -2
- package/lib-amd/publicApi/format/getFormatState.js +2 -1
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/adjustImageSelection.d.ts +2 -2
- package/lib-amd/publicApi/image/adjustImageSelection.js +2 -1
- package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-amd/publicApi/image/changeImage.d.ts +2 -2
- package/lib-amd/publicApi/image/changeImage.js +3 -2
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.d.ts +2 -2
- package/lib-amd/publicApi/image/insertImage.js +2 -1
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/image/setImageAltText.d.ts +2 -2
- package/lib-amd/publicApi/image/setImageAltText.js +3 -2
- package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBorder.d.ts +2 -2
- package/lib-amd/publicApi/image/setImageBorder.js +4 -3
- package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +2 -2
- package/lib-amd/publicApi/image/setImageBoxShadow.js +3 -2
- package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +2 -2
- package/lib-amd/publicApi/link/adjustLinkSelection.js +2 -1
- package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-amd/publicApi/link/insertLink.d.ts +2 -2
- package/lib-amd/publicApi/link/insertLink.js +2 -1
- package/lib-amd/publicApi/link/insertLink.js.map +1 -1
- package/lib-amd/publicApi/link/removeLink.d.ts +2 -2
- package/lib-amd/publicApi/link/removeLink.js +2 -1
- package/lib-amd/publicApi/link/removeLink.js.map +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib-amd/publicApi/list/setListStartNumber.js +2 -1
- package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-amd/publicApi/list/setListStyle.d.ts +2 -2
- package/lib-amd/publicApi/list/setListStyle.js +2 -1
- package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
- package/lib-amd/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib-amd/publicApi/list/toggleBullet.js +6 -3
- package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-amd/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib-amd/publicApi/list/toggleNumbering.js +6 -3
- package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +2 -2
- package/lib-amd/publicApi/segment/applySegmentFormat.js +2 -1
- package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.d.ts +2 -2
- package/lib-amd/publicApi/segment/changeCapitalization.js +2 -1
- package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-amd/publicApi/segment/changeFontSize.d.ts +2 -2
- package/lib-amd/publicApi/segment/changeFontSize.js +2 -1
- package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +2 -2
- package/lib-amd/publicApi/segment/setBackgroundColor.js +2 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontName.d.ts +2 -2
- package/lib-amd/publicApi/segment/setFontName.js +2 -1
- package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
- package/lib-amd/publicApi/segment/setFontSize.d.ts +2 -2
- package/lib-amd/publicApi/segment/setFontSize.js +2 -2
- package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-amd/publicApi/segment/setTextColor.d.ts +2 -2
- package/lib-amd/publicApi/segment/setTextColor.js +2 -1
- package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleBold.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleBold.js +2 -1
- package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleCode.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleCode.js +2 -1
- package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleItalic.js +2 -1
- package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleStrikethrough.js +2 -1
- package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleSubscript.js +2 -1
- package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleSuperscript.js +2 -1
- package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.d.ts +2 -2
- package/lib-amd/publicApi/segment/toggleUnderline.js +2 -1
- package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +2 -2
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +2 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.d.ts +2 -2
- package/lib-amd/publicApi/table/editTable.js +2 -1
- package/lib-amd/publicApi/table/editTable.js.map +1 -1
- package/lib-amd/publicApi/table/formatTable.d.ts +2 -2
- package/lib-amd/publicApi/table/formatTable.js +2 -1
- package/lib-amd/publicApi/table/formatTable.js.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +2 -2
- package/lib-amd/publicApi/table/insertTable.js +2 -1
- package/lib-amd/publicApi/table/insertTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib-amd/publicApi/table/setTableCellShade.js +2 -1
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js +6 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
- package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/lib-mjs/index.d.ts +46 -42
- package/lib-mjs/index.js +46 -42
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
- package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
- package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
- package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
- package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
- package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js +1 -1
- package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
- package/lib-mjs/modelApi/link/matchLink.d.ts +1 -18
- package/lib-mjs/modelApi/link/matchLink.js +0 -1
- package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
- package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
- package/lib-mjs/modelApi/list/setListType.d.ts +2 -1
- package/lib-mjs/modelApi/list/setListType.js +5 -3
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
- package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
- package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/block/setAlignment.d.ts +2 -2
- package/lib-mjs/publicApi/block/setAlignment.js +1 -1
- package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
- package/lib-mjs/publicApi/block/setDirection.d.ts +2 -2
- package/lib-mjs/publicApi/block/setDirection.js +1 -1
- package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +2 -2
- package/lib-mjs/publicApi/block/setHeadingLevel.js +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib-mjs/publicApi/block/setIndentation.d.ts +2 -2
- package/lib-mjs/publicApi/block/setIndentation.js +1 -1
- package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +2 -2
- package/lib-mjs/publicApi/block/setParagraphMargin.js +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib-mjs/publicApi/block/setSpacing.d.ts +2 -2
- package/lib-mjs/publicApi/block/setSpacing.js +1 -1
- package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +2 -2
- package/lib-mjs/publicApi/block/toggleBlockQuote.js +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib-mjs/publicApi/entity/insertEntity.d.ts +5 -5
- package/lib-mjs/publicApi/entity/insertEntity.js +23 -4
- package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
- package/lib-mjs/publicApi/format/clearFormat.d.ts +2 -2
- package/lib-mjs/publicApi/format/clearFormat.js +1 -1
- package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.d.ts +2 -2
- package/lib-mjs/publicApi/format/getFormatState.js +1 -1
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +2 -2
- package/lib-mjs/publicApi/image/adjustImageSelection.js +1 -1
- package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.d.ts +2 -2
- package/lib-mjs/publicApi/image/changeImage.js +2 -2
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.d.ts +2 -2
- package/lib-mjs/publicApi/image/insertImage.js +1 -1
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +2 -2
- package/lib-mjs/publicApi/image/setImageAltText.js +2 -2
- package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBorder.d.ts +2 -2
- package/lib-mjs/publicApi/image/setImageBorder.js +3 -3
- package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +2 -2
- package/lib-mjs/publicApi/image/setImageBoxShadow.js +2 -2
- package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +2 -2
- package/lib-mjs/publicApi/link/adjustLinkSelection.js +1 -1
- package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.d.ts +2 -2
- package/lib-mjs/publicApi/link/insertLink.js +1 -1
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
- package/lib-mjs/publicApi/link/removeLink.d.ts +2 -2
- package/lib-mjs/publicApi/link/removeLink.js +1 -1
- package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib-mjs/publicApi/list/setListStartNumber.js +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib-mjs/publicApi/list/setListStyle.d.ts +2 -2
- package/lib-mjs/publicApi/list/setListStyle.js +1 -1
- package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib-mjs/publicApi/list/toggleBullet.js +4 -2
- package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
- package/lib-mjs/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib-mjs/publicApi/list/toggleNumbering.js +4 -2
- package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +2 -2
- package/lib-mjs/publicApi/segment/applySegmentFormat.js +1 -1
- package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +2 -2
- package/lib-mjs/publicApi/segment/changeCapitalization.js +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.d.ts +2 -2
- package/lib-mjs/publicApi/segment/changeFontSize.js +1 -1
- package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +2 -2
- package/lib-mjs/publicApi/segment/setBackgroundColor.js +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontName.d.ts +2 -2
- package/lib-mjs/publicApi/segment/setFontName.js +1 -1
- package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.d.ts +2 -2
- package/lib-mjs/publicApi/segment/setFontSize.js +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.d.ts +2 -2
- package/lib-mjs/publicApi/segment/setTextColor.js +1 -1
- package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleBold.js +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleCode.js +1 -1
- package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleItalic.js +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js +1 -1
- package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleSubscript.js +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleSuperscript.js +1 -1
- package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +2 -2
- package/lib-mjs/publicApi/segment/toggleUnderline.js +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +2 -2
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.d.ts +2 -2
- package/lib-mjs/publicApi/table/editTable.js +1 -1
- package/lib-mjs/publicApi/table/editTable.js.map +1 -1
- package/lib-mjs/publicApi/table/formatTable.d.ts +2 -2
- package/lib-mjs/publicApi/table/formatTable.js +1 -1
- package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +2 -2
- package/lib-mjs/publicApi/table/insertTable.js +1 -1
- package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib-mjs/publicApi/table/setTableCellShade.js +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +5 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
- package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set text alignment of selected paragraphs
|
|
4
4
|
* @param editor The editor to set alignment
|
|
5
5
|
* @param alignment Alignment value: left, center or right
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setAlignment(editor: IEditor, alignment: 'left' | 'center' | 'right' | 'justify'): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/block/setModelAlignment"], function (require, exports, setModelAlignment_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setAlignment = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set text alignment of selected paragraphs
|
|
6
7
|
* @param editor The editor to set alignment
|
|
@@ -12,6 +13,6 @@ define(["require", "exports", "../../modelApi/block/setModelAlignment"], functio
|
|
|
12
13
|
apiName: 'setAlignment',
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
exports.
|
|
16
|
+
exports.setAlignment = setAlignment;
|
|
16
17
|
});
|
|
17
18
|
//# sourceMappingURL=setAlignment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setAlignment.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setAlignment.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/setAlignment.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IACH,SAAgB,YAAY,CAAC,MAAe,EAAE,SAAkD;QAC5F,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK,IAAI,OAAA,IAAA,qCAAiB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAnC,CAAmC,EAAE;YACpE,OAAO,EAAE,cAAc;SAC1B,CAAC,CAAC;IACP,CAAC;IAND,oCAMC","sourcesContent":["import { setModelAlignment } from '../../modelApi/block/setModelAlignment';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text alignment of selected paragraphs\n * @param editor The editor to set alignment\n * @param alignment Alignment value: left, center or right\n */\nexport function setAlignment(editor: IEditor, alignment: 'left' | 'center' | 'right' | 'justify') {\n editor.focus();\n\n editor.formatContentModel(model => setModelAlignment(model, alignment), {\n apiName: 'setAlignment',\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set text direction of selected paragraphs (Left to right or Right to left)
|
|
4
4
|
* @param editor The editor to set alignment
|
|
5
5
|
* @param direction Direction value: ltr (Left to right) or rtl (Right to left)
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setDirection(editor: IEditor, direction: 'ltr' | 'rtl'): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/block/setModelDirection"], function (require, exports, setModelDirection_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setDirection = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set text direction of selected paragraphs (Left to right or Right to left)
|
|
6
7
|
* @param editor The editor to set alignment
|
|
@@ -12,6 +13,6 @@ define(["require", "exports", "../../modelApi/block/setModelDirection"], functio
|
|
|
12
13
|
apiName: 'setDirection',
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
exports.
|
|
16
|
+
exports.setDirection = setDirection;
|
|
16
17
|
});
|
|
17
18
|
//# sourceMappingURL=setDirection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setDirection.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setDirection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/setDirection.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IACH,SAAgB,YAAY,CAAC,MAAe,EAAE,SAAwB;QAClE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK,IAAI,OAAA,IAAA,qCAAiB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAnC,CAAmC,EAAE;YACpE,OAAO,EAAE,cAAc;SAC1B,CAAC,CAAC;IACP,CAAC;IAND,oCAMC","sourcesContent":["import { setModelDirection } from '../../modelApi/block/setModelDirection';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text direction of selected paragraphs (Left to right or Right to left)\n * @param editor The editor to set alignment\n * @param direction Direction value: ltr (Left to right) or rtl (Right to left)\n */\nexport function setDirection(editor: IEditor, direction: 'ltr' | 'rtl') {\n editor.focus();\n\n editor.formatContentModel(model => setModelDirection(model, direction), {\n apiName: 'setDirection',\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set heading level of selected paragraphs
|
|
4
4
|
* @param editor The editor to set heading level to
|
|
5
5
|
* @param headingLevel Level of heading, from 1 to 6. Set to 0 means set it back to a regular paragraph
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setHeadingLevel(editor: IEditor, headingLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../utils/formatParagraphWithContentModel"], function (require, exports, formatParagraphWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setHeadingLevel = void 0;
|
|
4
5
|
var HeaderFontSizes = {
|
|
5
6
|
h1: '2em',
|
|
6
7
|
h2: '1.5em',
|
|
@@ -41,7 +42,7 @@ define(["require", "exports", "../utils/formatParagraphWithContentModel"], funct
|
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
|
-
exports.
|
|
45
|
+
exports.setHeadingLevel = setHeadingLevel;
|
|
45
46
|
function getExistingHeadingTag(decorator) {
|
|
46
47
|
var tag = (decorator === null || decorator === void 0 ? void 0 : decorator.tagName) || '';
|
|
47
48
|
var level = parseInt(tag.substring(1));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setHeadingLevel.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setHeadingLevel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/setHeadingLevel.ts"],"names":[],"mappings":";;;;IAKA,IAAM,eAAe,GAAqC;QACtD,EAAE,EAAE,KAAK;QACT,EAAE,EAAE,OAAO;QACX,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,KAAK;QACT,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,QAAQ;KACf,CAAC;IAEF;;;;OAIG;IACH,SAAgB,eAAe,CAAC,MAAe,EAAE,YAAuC;QACpF,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAA,IAAI;YAC3D,IAAM,OAAO,GACT,YAAY,GAAG,CAAC;gBACZ,CAAC,CAAE,CAAC,GAAG,GAAG,YAAY,CAA6B;gBACnD,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAEhD,IAAI,YAAY,GAAG,CAAC,EAAE;gBAClB,IAAI,CAAC,SAAS,GAAG;oBACb,OAAO,EAAE,OAAQ;oBACjB,MAAM,EAAE,OAAO;wBACX,CAAC,CAAC;4BACI,UAAU,EAAE,MAAM;4BAClB,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC;yBACrC;wBACH,CAAC,CAAC,EAAE;iBACX,CAAC;gBAEF,uEAAuE;gBACvE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;oBACzB,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;oBAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;gBACrC,CAAC,CAAC,CAAC;aACN;iBAAM,IAAI,OAAO,EAAE;gBAChB,OAAO,IAAI,CAAC,SAAS,CAAC;aACzB;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IA7BD,0CA6BC;IAED,SAAS,qBAAqB,CAC1B,SAA0C;QAE1C,IAAM,GAAG,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,KAAI,EAAE,CAAC;QACrC,IAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzC,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAE,GAAwB,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,CAAC","sourcesContent":["import { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { ContentModelParagraphDecorator, IEditor } from 'roosterjs-content-model-types';\n\ntype HeadingLevelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nconst HeaderFontSizes: Record<HeadingLevelTags, string> = {\n h1: '2em',\n h2: '1.5em',\n h3: '1.17em',\n h4: '1em',\n h5: '0.83em',\n h6: '0.67em',\n};\n\n/**\n * Set heading level of selected paragraphs\n * @param editor The editor to set heading level to\n * @param headingLevel Level of heading, from 1 to 6. Set to 0 means set it back to a regular paragraph\n */\nexport function setHeadingLevel(editor: IEditor, headingLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setHeadingLevel', para => {\n const tagName =\n headingLevel > 0\n ? (('h' + headingLevel) as HeadingLevelTags | null)\n : getExistingHeadingTag(para.decorator);\n\n if (headingLevel > 0) {\n para.decorator = {\n tagName: tagName!,\n format: tagName\n ? {\n fontWeight: 'bold',\n fontSize: HeaderFontSizes[tagName],\n }\n : {},\n };\n\n // Remove existing formats since tags have default font size and weight\n para.segments.forEach(segment => {\n delete segment.format.fontSize;\n delete segment.format.fontWeight;\n });\n } else if (tagName) {\n delete para.decorator;\n }\n });\n}\n\nfunction getExistingHeadingTag(\n decorator?: ContentModelParagraphDecorator\n): HeadingLevelTags | null {\n const tag = decorator?.tagName || '';\n const level = parseInt(tag.substring(1));\n\n return level >= 1 && level <= 6 ? (tag as HeadingLevelTags) : null;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Indent or outdent to selected paragraphs
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param indentation Whether indent or outdent
|
|
6
6
|
* @param length The length of pixel to indent/outdent @default 40
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function setIndentation(editor: IEditor, indentation: 'indent' | 'outdent', length?: number): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "roosterjs-content-model-dom", "../../modelApi/block/setModelIndentation"], function (require, exports, roosterjs_content_model_dom_1, setModelIndentation_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setIndentation = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Indent or outdent to selected paragraphs
|
|
6
7
|
* @param editor The editor to operate on
|
|
@@ -20,6 +21,6 @@ define(["require", "exports", "roosterjs-content-model-dom", "../../modelApi/blo
|
|
|
20
21
|
apiName: 'setIndentation',
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
exports.
|
|
24
|
+
exports.setIndentation = setIndentation;
|
|
24
25
|
});
|
|
25
26
|
//# sourceMappingURL=setIndentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setIndentation.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setIndentation.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/setIndentation.ts"],"names":[],"mappings":";;;;IAIA;;;;;OAKG;IACH,SAAgB,cAAc,CAC1B,MAAe,EACf,WAAiC,EACjC,MAAe;QAEf,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;YACX,IAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;YAE/D,IAAI,MAAM,EAAE;gBACR,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;aAChC;YAED,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;YAEtC,OAAO,MAAM,CAAC;QAClB,CAAC,EACD;YACI,OAAO,EAAE,gBAAgB;SAC5B,CACJ,CAAC;IACN,CAAC;IAvBD,wCAuBC","sourcesContent":["import { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from '../../modelApi/block/setModelIndentation';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Indent or outdent to selected paragraphs\n * @param editor The editor to operate on\n * @param indentation Whether indent or outdent\n * @param length The length of pixel to indent/outdent @default 40\n */\nexport function setIndentation(\n editor: IEditor,\n indentation: 'indent' | 'outdent',\n length?: number\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const result = setModelIndentation(model, indentation, length);\n\n if (result) {\n normalizeContentModel(model);\n }\n\n context.newPendingFormat = 'preserve';\n\n return result;\n },\n {\n apiName: 'setIndentation',\n }\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggles the current block(s) margin properties.
|
|
4
4
|
* null deletes any existing value, undefined is ignored
|
|
@@ -6,4 +6,4 @@ import type { IStandaloneEditor } from 'roosterjs-content-model-types';
|
|
|
6
6
|
* @param marginTop value for top margin
|
|
7
7
|
* @param marginBottom value for bottom margin
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function setParagraphMargin(editor: IEditor, marginTop?: string | null, marginBottom?: string | null): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "roosterjs-content-model-dom", "../utils/formatParagraphWithContentModel"], function (require, exports, roosterjs_content_model_dom_1, formatParagraphWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setParagraphMargin = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Toggles the current block(s) margin properties.
|
|
6
7
|
* null deletes any existing value, undefined is ignored
|
|
@@ -28,6 +29,6 @@ define(["require", "exports", "roosterjs-content-model-dom", "../utils/formatPar
|
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
exports.
|
|
32
|
+
exports.setParagraphMargin = setParagraphMargin;
|
|
32
33
|
});
|
|
33
34
|
//# sourceMappingURL=setParagraphMargin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setParagraphMargin.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setParagraphMargin.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/setParagraphMargin.ts"],"names":[],"mappings":";;;;IAIA;;;;;;OAMG;IACH,SAAgB,kBAAkB,CAC9B,MAAe,EACf,SAAyB,EACzB,YAA4B;QAE5B,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,oBAAoB,EAAE,UAAA,IAAI;YAC9D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACjB,IAAI,CAAC,SAAS,GAAG,IAAA,sDAAwB,EAAC,GAAG,CAAC,CAAC;aAClD;YAED,IAAI,SAAS,EAAE;gBACX,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;aACrC;iBAAM,IAAI,SAAS,KAAK,IAAI,EAAE;gBAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;aAChC;YAED,IAAI,YAAY,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;aAC3C;iBAAM,IAAI,YAAY,KAAK,IAAI,EAAE;gBAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;aACnC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAxBD,gDAwBC","sourcesContent":["import { createParagraphDecorator } from 'roosterjs-content-model-dom';\nimport { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggles the current block(s) margin properties.\n * null deletes any existing value, undefined is ignored\n * @param editor The editor to operate on\n * @param marginTop value for top margin\n * @param marginBottom value for bottom margin\n */\nexport function setParagraphMargin(\n editor: IEditor,\n marginTop?: string | null,\n marginBottom?: string | null\n) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setParagraphMargin', para => {\n if (!para.decorator) {\n para.decorator = createParagraphDecorator('p');\n }\n\n if (marginTop) {\n para.format.marginTop = marginTop;\n } else if (marginTop === null) {\n delete para.format.marginTop;\n }\n\n if (marginBottom) {\n para.format.marginBottom = marginBottom;\n } else if (marginBottom === null) {\n delete para.format.marginBottom;\n }\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Sets current selected block(s) line-height property and wipes such property from child segments
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param spacing Unitless/px value to set line height
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setSpacing(editor: IEditor, spacing: number | string): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../utils/formatParagraphWithContentModel"], function (require, exports, formatParagraphWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setSpacing = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Sets current selected block(s) line-height property and wipes such property from child segments
|
|
6
7
|
* @param editor The editor to operate on
|
|
@@ -17,6 +18,6 @@ define(["require", "exports", "../utils/formatParagraphWithContentModel"], funct
|
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
exports.
|
|
21
|
+
exports.setSpacing = setSpacing;
|
|
21
22
|
});
|
|
22
23
|
//# sourceMappingURL=setSpacing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setSpacing.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setSpacing.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/setSpacing.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IACH,SAAgB,UAAU,CAAC,MAAe,EAAE,OAAwB;QAChE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,YAAY,EAAE,UAAA,SAAS;YAC3D,SAAS,CAAC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YACjD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;gBAC9B,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;oBAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;iBACpC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAXD,gCAWC","sourcesContent":["import { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Sets current selected block(s) line-height property and wipes such property from child segments\n * @param editor The editor to operate on\n * @param spacing Unitless/px value to set line height\n */\nexport function setSpacing(editor: IEditor, spacing: number | string) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setSpacing', paragraph => {\n paragraph.format.lineHeight = spacing.toString();\n paragraph.segments.forEach(segment => {\n if (segment.format.lineHeight) {\n delete segment.format.lineHeight;\n }\n });\n });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContentModelFormatContainerFormat,
|
|
1
|
+
import type { ContentModelFormatContainerFormat, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Toggle BLOCKQUOTE state of selected paragraphs.
|
|
4
4
|
* If any selected paragraph is not under a BLOCKQUOTE, wrap them into a BLOCKQUOTE.
|
|
@@ -6,4 +6,4 @@ import type { ContentModelFormatContainerFormat, IStandaloneEditor } from 'roost
|
|
|
6
6
|
* @param editor The editor object to toggle BLOCKQUOTE onto
|
|
7
7
|
* @param quoteFormat @optional Block format for the new quote object
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function toggleBlockQuote(editor: IEditor, quoteFormat?: ContentModelFormatContainerFormat, quoteFormatRtl?: ContentModelFormatContainerFormat): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "tslib", "../../modelApi/block/toggleModelBlockQuote"], function (require, exports, tslib_1, toggleModelBlockQuote_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.toggleBlockQuote = void 0;
|
|
4
5
|
var DefaultQuoteFormatLtr = {
|
|
5
6
|
borderLeft: '3px solid rgb(200, 200, 200)',
|
|
6
7
|
textColor: 'rgb(102, 102, 102)',
|
|
@@ -34,6 +35,6 @@ define(["require", "exports", "tslib", "../../modelApi/block/toggleModelBlockQuo
|
|
|
34
35
|
apiName: 'toggleBlockQuote',
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
exports.
|
|
38
|
+
exports.toggleBlockQuote = toggleBlockQuote;
|
|
38
39
|
});
|
|
39
40
|
//# sourceMappingURL=toggleBlockQuote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleBlockQuote.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleBlockQuote.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/block/toggleBlockQuote.ts"],"names":[],"mappings":";;;;IAGA,IAAM,qBAAqB,GAAsC;QAC7D,UAAU,EAAE,8BAA8B;QAC1C,SAAS,EAAE,oBAAoB;KAClC,CAAC;IACF,IAAM,qBAAqB,GAAsC;QAC7D,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE,oBAAoB;KAClC,CAAC;IACF,IAAM,kBAAkB,GAAsC;QAC1D,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;KACtB,CAAC;IAEF;;;;;;OAMG;IACH,SAAgB,gBAAgB,CAC5B,MAAe,EACf,WAA+C,EAC/C,cAAkD;;QAElD,IAAM,kBAAkB,yEACjB,kBAAkB,KACrB,WAAW,EAAE,MAAM,KAChB,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,qBAAqB,CAAC,CAC5C,CAAC;QACF,IAAM,kBAAkB,yEACjB,kBAAkB,KACrB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,KAAK,KACb,CAAC,MAAA,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,WAAW,mCAAI,qBAAqB,CAAC,CAC9D,CAAC;QAEF,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;YACX,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;YAEtC,OAAO,IAAA,6CAAqB,EAAC,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QAChF,CAAC,EACD;YACI,OAAO,EAAE,kBAAkB;SAC9B,CACJ,CAAC;IACN,CAAC;IA7BD,4CA6BC","sourcesContent":["import { toggleModelBlockQuote } from '../../modelApi/block/toggleModelBlockQuote';\nimport type { ContentModelFormatContainerFormat, IEditor } from 'roosterjs-content-model-types';\n\nconst DefaultQuoteFormatLtr: ContentModelFormatContainerFormat = {\n borderLeft: '3px solid rgb(200, 200, 200)',\n textColor: 'rgb(102, 102, 102)',\n};\nconst DefaultQuoteFormatRtl: ContentModelFormatContainerFormat = {\n borderRight: '3px solid rgb(200, 200, 200)',\n textColor: 'rgb(102, 102, 102)',\n};\nconst BuildInQuoteFormat: ContentModelFormatContainerFormat = {\n marginTop: '1em',\n marginBottom: '1em',\n marginLeft: '40px',\n marginRight: '40px',\n};\n\n/**\n * Toggle BLOCKQUOTE state of selected paragraphs.\n * If any selected paragraph is not under a BLOCKQUOTE, wrap them into a BLOCKQUOTE.\n * Otherwise, unwrap all related BLOCKQUOTEs.\n * @param editor The editor object to toggle BLOCKQUOTE onto\n * @param quoteFormat @optional Block format for the new quote object\n */\nexport function toggleBlockQuote(\n editor: IEditor,\n quoteFormat?: ContentModelFormatContainerFormat,\n quoteFormatRtl?: ContentModelFormatContainerFormat\n) {\n const fullQuoteFormatLtr: ContentModelFormatContainerFormat = {\n ...BuildInQuoteFormat,\n paddingLeft: '10px',\n ...(quoteFormat ?? DefaultQuoteFormatLtr),\n };\n const fullQuoteFormatRtl: ContentModelFormatContainerFormat = {\n ...BuildInQuoteFormat,\n paddingRight: '10px',\n direction: 'rtl',\n ...(quoteFormatRtl ?? quoteFormat ?? DefaultQuoteFormatRtl),\n };\n\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n context.newPendingFormat = 'preserve';\n\n return toggleModelBlockQuote(model, fullQuoteFormatLtr, fullQuoteFormatRtl);\n },\n {\n apiName: 'toggleBlockQuote',\n }\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ContentModelEntity, DOMSelection, InsertEntityPosition, InsertEntityOptions,
|
|
1
|
+
import type { ContentModelEntity, DOMSelection, InsertEntityPosition, InsertEntityOptions, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert an entity into editor
|
|
4
|
-
* @param editor The
|
|
4
|
+
* @param editor The editor object
|
|
5
5
|
* @param type Type of entity
|
|
6
6
|
* @param isBlock True to insert a block entity, false to insert an inline entity
|
|
7
7
|
* @param position Position of the entity to insert. It can be
|
|
@@ -10,10 +10,10 @@ import type { ContentModelEntity, DOMSelection, InsertEntityPosition, InsertEnti
|
|
|
10
10
|
* the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)
|
|
11
11
|
* @param options Move options to insert. See InsertEntityOptions
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export declare function insertEntity(editor: IEditor, type: string, isBlock: boolean, position: 'focus' | 'begin' | 'end' | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
|
|
14
14
|
/**
|
|
15
15
|
* Insert a block entity into editor
|
|
16
|
-
* @param editor The
|
|
16
|
+
* @param editor The editor object
|
|
17
17
|
* @param type Type of entity
|
|
18
18
|
* @param isBlock Must be true for a block entity
|
|
19
19
|
* @param position Position of the entity to insert. It can be
|
|
@@ -22,4 +22,4 @@ export default function insertEntity(editor: IStandaloneEditor, type: string, is
|
|
|
22
22
|
* the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)
|
|
23
23
|
* @param options Move options to insert. See InsertEntityOptions
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export declare function insertEntity(editor: IEditor, type: string, isBlock: true, position: InsertEntityPosition | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content-model-dom"
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-core", "../../modelApi/entity/insertEntityModel", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_core_1, insertEntityModel_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.insertEntity = void 0;
|
|
4
5
|
var BlockEntityTag = 'div';
|
|
5
6
|
var InlineEntityTag = 'span';
|
|
6
7
|
function insertEntity(editor, type, isBlock, position, options) {
|
|
7
|
-
var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot;
|
|
8
|
+
var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot, initialEntityState = _a.initialEntityState;
|
|
8
9
|
var document = editor.getDocument();
|
|
9
10
|
var wrapper = document.createElement(isBlock ? BlockEntityTag : InlineEntityTag);
|
|
10
11
|
var display = wrapperDisplay !== null && wrapperDisplay !== void 0 ? wrapperDisplay : (isBlock ? undefined : 'inline-block');
|
|
@@ -17,10 +18,13 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
17
18
|
wrapper.appendChild(contentNode);
|
|
18
19
|
}
|
|
19
20
|
var entityModel = (0, roosterjs_content_model_dom_1.createEntity)(wrapper, true /* isReadonly */, undefined /*format*/, type);
|
|
21
|
+
if (!skipUndoSnapshot) {
|
|
22
|
+
editor.takeSnapshot();
|
|
23
|
+
}
|
|
20
24
|
editor.formatContentModel(function (model, context) {
|
|
21
25
|
(0, insertEntityModel_1.insertEntityModel)(model, entityModel, typeof position == 'string' ? position : 'focus', isBlock, focusAfterEntity, context);
|
|
22
26
|
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
23
|
-
context.skipUndoSnapshot =
|
|
27
|
+
context.skipUndoSnapshot = true;
|
|
24
28
|
context.newEntities.push(entityModel);
|
|
25
29
|
return true;
|
|
26
30
|
}, {
|
|
@@ -34,8 +38,24 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
34
38
|
}); },
|
|
35
39
|
apiName: 'insertEntity',
|
|
36
40
|
});
|
|
41
|
+
if (!skipUndoSnapshot) {
|
|
42
|
+
var entityState = void 0;
|
|
43
|
+
if (initialEntityState) {
|
|
44
|
+
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(wrapper);
|
|
45
|
+
var id = format.id, entityType = format.entityType;
|
|
46
|
+
entityState =
|
|
47
|
+
id && entityType
|
|
48
|
+
? {
|
|
49
|
+
id: id,
|
|
50
|
+
type: entityType,
|
|
51
|
+
state: initialEntityState,
|
|
52
|
+
}
|
|
53
|
+
: undefined;
|
|
54
|
+
}
|
|
55
|
+
editor.takeSnapshot(entityState);
|
|
56
|
+
}
|
|
37
57
|
return entityModel;
|
|
38
58
|
}
|
|
39
|
-
exports.
|
|
59
|
+
exports.insertEntity = insertEntity;
|
|
40
60
|
});
|
|
41
61
|
//# 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":";;;;IAgBA,IAAM,cAAc,GAAG,KAAK,CAAC;IAC7B,IAAM,eAAe,GAAG,MAAM,CAAC;IAwC/B,SAAgB,YAAY,CACxB,MAAe,EACf,IAAY,EACZ,OAAgB,EAChB,QAA8C,EAC9C,OAA6B;QAEvB,IAAA,KACF,OAAO,IAAI,EAAE,EADT,WAAW,iBAAA,EAAE,gBAAgB,sBAAA,EAAE,cAAc,oBAAA,EAAE,gBAAgB,sBAAA,EAAE,kBAAkB,wBAC1E,CAAC;QAClB,IAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACtC,IAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QACnF,IAAM,OAAO,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC;QAEtD,IAAI,OAAO,IAAI,SAAS,IAAI,OAAO,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC3C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;SACxD;QAED,IAAI,WAAW,EAAE;YACb,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;SACpC;QAED,IAAM,WAAW,GAAG,IAAA,0CAAY,EAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAE7F,IAAI,CAAC,gBAAgB,EAAE;YACnB,MAAM,CAAC,YAAY,EAAE,CAAC;SACzB;QAED,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;YACX,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;YAEF,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;YAE7B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAChC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEtC,OAAO,IAAI,CAAC;QAChB,CAAC,EACD;YACI,iBAAiB,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACtE,YAAY,EAAE,2CAAY,CAAC,YAAY;YACvC,aAAa,EAAE,cAAM,OAAA,CAAC;gBAClB,OAAO,SAAA;gBACP,IAAI,MAAA;gBACJ,EAAE,EAAE,EAAE;gBACN,UAAU,EAAE,IAAI;aACnB,CAAC,EALmB,CAKnB;YACF,OAAO,EAAE,cAAc;SAC1B,CACJ,CAAC;QAEF,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,WAAW,SAAyB,CAAC;YAEzC,IAAI,kBAAkB,EAAE;gBACpB,IAAM,MAAM,GAAG,IAAA,+CAAiB,EAAC,OAAO,CAAC,CAAC;gBAClC,IAAA,EAAE,GAAiB,MAAM,GAAvB,EAAE,UAAU,GAAK,MAAM,WAAX,CAAY;gBAElC,WAAW;oBACP,EAAE,IAAI,UAAU;wBACZ,CAAC,CAAC;4BACI,EAAE,EAAE,EAAE;4BACN,IAAI,EAAE,UAAU;4BAChB,KAAK,EAAE,kBAAkB;yBAC5B;wBACH,CAAC,CAAC,SAAS,CAAC;aACvB;YAED,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;SACpC;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;IAlFD,oCAkFC","sourcesContent":["import { ChangeSource } from 'roosterjs-content-model-core';\nimport { insertEntityModel } from '../../modelApi/entity/insertEntityModel';\nimport {\n createEntity,\n normalizeContentModel,\n parseEntityFormat,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelEntity,\n DOMSelection,\n InsertEntityPosition,\n InsertEntityOptions,\n IEditor,\n EntityState,\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' | DOMSelection,\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 | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\nexport function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: boolean,\n position?: InsertEntityPosition | DOMSelection,\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 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 = true;\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 wrapper,\n type,\n id: '',\n isReadonly: true,\n }),\n apiName: 'insertEntity',\n }\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,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Clear format of selection
|
|
4
4
|
* @param editor The editor to clear format from
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare function clearFormat(editor: IEditor): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/common/clearModelFormat", "roosterjs-content-model-dom"], function (require, exports, clearModelFormat_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearFormat = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Clear format of selection
|
|
6
7
|
* @param editor The editor to clear format from
|
|
@@ -18,6 +19,6 @@ define(["require", "exports", "../../modelApi/common/clearModelFormat", "rooster
|
|
|
18
19
|
apiName: 'clearFormat',
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
exports.
|
|
22
|
+
exports.clearFormat = clearFormat;
|
|
22
23
|
});
|
|
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":";;;;IAUA;;;OAGG;IACH,SAAgB,WAAW,CAAC,MAAe;QACvC,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACD,IAAM,aAAa,GAAoD,EAAE,CAAC;YAC1E,IAAM,eAAe,GAA0B,EAAE,CAAC;YAClD,IAAM,aAAa,GAAmC,EAAE,CAAC;YAEzD,IAAA,mCAAgB,EAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;YAEvE,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;YAE7B,OAAO,CACH,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CACrF,CAAC;QACN,CAAC,EACD;YACI,OAAO,EAAE,aAAa;SACzB,CACJ,CAAC;IACN,CAAC;IArBD,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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor, ContentModelFormatState } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "roosterjs-content-model-core"], function (require, exports, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getFormatState = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Get current format state
|
|
6
7
|
* @param editor The editor to get format from
|
|
@@ -17,6 +18,6 @@ define(["require", "exports", "roosterjs-content-model-core"], function (require
|
|
|
17
18
|
(0, roosterjs_content_model_core_1.retrieveModelFormatState)(model, pendingFormat, result);
|
|
18
19
|
return result;
|
|
19
20
|
}
|
|
20
|
-
exports.
|
|
21
|
+
exports.getFormatState = getFormatState;
|
|
21
22
|
});
|
|
22
23
|
//# 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":";;;;IAGA;;;OAGG;IACH,SAAgB,cAAc,CAAC,MAAe;QAC1C,IAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAChD,IAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpD,IAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC7C,IAAM,MAAM,GAA4B;YACpC,OAAO,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACrD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;SAClC,CAAC;QAEF,IAAA,uDAAwB,EAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAEvD,OAAO,MAAM,CAAC;IAClB,CAAC;IAbD,wCAaC","sourcesContent":["import { retrieveModelFormatState } from 'roosterjs-content-model-core';\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 model = editor.getContentModelCopy('reduced');\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 retrieveModelFormatState(model, pendingFormat, result);\n\n return result;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ContentModelImage,
|
|
1
|
+
import type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/selection/adjustSegmentSelection"], function (require, exports, adjustSegmentSelection_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.adjustImageSelection = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Adjust selection to make sure select an image if any
|
|
6
7
|
* @return Content Model Image object if an image is select, or null
|
|
@@ -22,6 +23,6 @@ define(["require", "exports", "../../modelApi/selection/adjustSegmentSelection"]
|
|
|
22
23
|
});
|
|
23
24
|
return image;
|
|
24
25
|
}
|
|
25
|
-
exports.
|
|
26
|
+
exports.adjustImageSelection = adjustImageSelection;
|
|
26
27
|
});
|
|
27
28
|
//# 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":";;;;IAGA;;;OAGG;IACH,SAAgB,oBAAoB,CAAC,MAAe;QAChD,IAAI,KAAK,GAA6B,IAAI,CAAC;QAE3C,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACD,OAAA,IAAA,+CAAsB,EAClB,KAAK,EACL,UAAA,MAAM;gBACF,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,WAAW,IAAI,OAAO,EAAE;oBACpD,KAAK,GAAG,MAAM,CAAC;oBACf,OAAO,IAAI,CAAC;iBACf;qBAAM;oBACH,OAAO,KAAK,CAAC;iBAChB;YACL,CAAC,EACD,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,MAAM,IAAI,GAAG,EAAb,CAAa,CACjC;QAXD,CAWC,EACL;YACI,OAAO,EAAE,sBAAsB;SAClC,CACJ,CAAC;QAEF,OAAO,KAAK,CAAC;IACjB,CAAC;IAvBD,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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Change the selected image src
|
|
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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../utils/formatImageWithContentModel", "roosterjs-content-model-core"], function (require, exports, formatImageWithContentModel_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.changeImage = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Change the selected image src
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -11,7 +12,7 @@ define(["require", "exports", "../utils/formatImageWithContentModel", "roosterjs
|
|
|
11
12
|
var selection = editor.getDOMSelection();
|
|
12
13
|
(0, roosterjs_content_model_core_1.readFile)(file, function (dataUrl) {
|
|
13
14
|
if (dataUrl && !editor.isDisposed() && (selection === null || selection === void 0 ? void 0 : selection.type) === 'image') {
|
|
14
|
-
(0, formatImageWithContentModel_1.
|
|
15
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'changeImage', function (image) {
|
|
15
16
|
var _a, _b;
|
|
16
17
|
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 : '';
|
|
17
18
|
var previousSrc = image.src;
|
|
@@ -30,6 +31,6 @@ define(["require", "exports", "../utils/formatImageWithContentModel", "roosterjs
|
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
exports.
|
|
34
|
+
exports.changeImage = changeImage;
|
|
34
35
|
});
|
|
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":";;;;IAIA;;;;OAIG;IACH,SAAgB,WAAW,CAAC,MAAe,EAAE,IAAU;QACnD,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3C,IAAA,uCAAQ,EAAC,IAAI,EAAE,UAAA,OAAO;YAClB,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,OAAO,EAAE;gBAChE,IAAA,yDAA2B,EAAC,MAAM,EAAE,aAAa,EAAE,UAAC,KAAwB;;oBACxE,IAAM,WAAW,GAAG,MAAA,MAAA,IAAA,kDAAmB,EAAC,KAAK,CAAC,0CAAE,GAAG,mCAAI,EAAE,CAAC;oBAC1D,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC;oBAE9B,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;oBACpB,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;oBACnB,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;oBACxB,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;oBACzB,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;oBAEf,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE;wBAC7B,KAAK,EAAE,SAAS,CAAC,KAAK;wBACtB,WAAW,aAAA;wBACX,MAAM,EAAE,OAAO;wBACf,WAAW,aAAA;qBACd,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAzBD,kCAyBC","sourcesContent":["import { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport { readFile, updateImageMetadata } from 'roosterjs-content-model-core';\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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert an image into current selected position
|
|
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;
|