roosterjs-content-model-api 0.27.0 → 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.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 +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 +2 -2
- package/lib/publicApi/entity/insertEntity.js +2 -1
- 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 +2 -1
- 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 +3 -2
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.d.ts +1 -1
- package/lib/publicApi/image/insertImage.js +2 -1
- 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 +2 -1
- package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +1 -1
- package/lib/publicApi/link/insertLink.js +2 -1
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +1 -1
- package/lib/publicApi/link/removeLink.js +2 -1
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +1 -1
- package/lib/publicApi/list/setListStartNumber.js +2 -1
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +1 -1
- package/lib/publicApi/list/setListStyle.js +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +1 -1
- package/lib/publicApi/table/insertTable.js +2 -1
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +1 -1
- package/lib/publicApi/table/setTableCellShade.js +2 -1
- 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/formatParagraphWithContentModel.d.ts +4 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.js +4 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.js +7 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
- 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.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 +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 +2 -2
- package/lib-amd/publicApi/entity/insertEntity.js +2 -1
- 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 +2 -1
- 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 +3 -2
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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/formatParagraphWithContentModel.d.ts +4 -1
- 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 +7 -1
- 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.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.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 +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 +2 -2
- package/lib-mjs/publicApi/entity/insertEntity.js +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/formatParagraphWithContentModel.d.ts +4 -1
- 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 +7 -1
- 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.js.map +1 -1
- package/package.json +4 -4
|
@@ -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"]}
|
|
@@ -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,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"]}
|
|
@@ -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,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"]}
|
|
@@ -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,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"]}
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-model-core"], function (require, exports, roosterjs_content_model_dom_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.insertImage = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Insert an image into current selected position
|
|
6
7
|
* @param editor The editor to operate on
|
|
@@ -19,7 +20,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-
|
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
exports.
|
|
23
|
+
exports.insertImage = insertImage;
|
|
23
24
|
function insertImageWithSrc(editor, src) {
|
|
24
25
|
editor.formatContentModel(function (model, context) {
|
|
25
26
|
var image = (0, roosterjs_content_model_dom_1.createImage)(src, { backgroundColor: '' });
|
|
@@ -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":";;;;IAIA;;;;OAIG;IACH,SAAgB,WAAW,CAAC,MAAe,EAAE,cAA6B;QACtE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAI,OAAO,cAAc,IAAI,QAAQ,EAAE;YACnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;SAC9C;aAAM;YACH,IAAA,uCAAQ,EAAC,cAAc,EAAE,UAAA,OAAO;gBAC5B,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE;oBACjC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;iBACvC;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAZD,kCAYC;IAED,SAAS,kBAAkB,CAAC,MAAe,EAAE,GAAW;QACpD,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;YACX,IAAM,KAAK,GAAG,IAAA,yCAAW,EAAC,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;YACxD,IAAM,GAAG,GAAG,IAAA,wDAA0B,GAAE,CAAC;YAEzC,IAAA,wCAAU,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACvB,IAAA,yCAAU,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;gBAC5B,WAAW,EAAE,UAAU;aAC1B,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QAChB,CAAC,EACD;YACI,OAAO,EAAE,aAAa;SACzB,CACJ,CAAC;IACN,CAAC","sourcesContent":["import { addSegment, createContentModelDocument, createImage } from 'roosterjs-content-model-dom';\nimport { mergeModel, readFile } from 'roosterjs-content-model-core';\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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../utils/formatImageWithContentModel"], function (require, exports, formatImageWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setImageAltText = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set image alt text for all selected images at selection. If no images is contained
|
|
6
7
|
* in selection, do nothing.
|
|
@@ -9,10 +10,10 @@ define(["require", "exports", "../utils/formatImageWithContentModel"], function
|
|
|
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
|
});
|
|
18
19
|
//# 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":";;;;IAGA;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,MAAe,EAAE,OAAe;QAC5D,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAC,KAAwB;YAC5E,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAND,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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/image/applyImageBorderFormat", "../utils/formatImageWithContentModel"], function (require, exports, applyImageBorderFormat_1, formatImageWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setImageBorder = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set image border style for all selected images at selection.
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -10,10 +11,10 @@ define(["require", "exports", "../../modelApi/image/applyImageBorderFormat", "..
|
|
|
10
11
|
*/
|
|
11
12
|
function setImageBorder(editor, border, borderRadius) {
|
|
12
13
|
editor.focus();
|
|
13
|
-
(0, formatImageWithContentModel_1.
|
|
14
|
-
(0, applyImageBorderFormat_1.
|
|
14
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBorder', function (image) {
|
|
15
|
+
(0, applyImageBorderFormat_1.applyImageBorderFormat)(image, border, borderRadius);
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
exports.
|
|
18
|
+
exports.setImageBorder = setImageBorder;
|
|
18
19
|
});
|
|
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":";;;;IAIA;;;;;;OAMG;IACH,SAAgB,cAAc,CAAC,MAAe,EAAE,MAAqB,EAAE,YAAqB;QACxF,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;YAC3E,IAAA,+CAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;IAND,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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../utils/formatImageWithContentModel"], function (require, exports, formatImageWithContentModel_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setImageBoxShadow = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set image box shadow for all selected images at selection.
|
|
6
7
|
* @param editor The editor instance
|
|
@@ -9,7 +10,7 @@ define(["require", "exports", "../utils/formatImageWithContentModel"], function
|
|
|
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,6 +26,6 @@ define(["require", "exports", "../utils/formatImageWithContentModel"], function
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
exports.
|
|
29
|
+
exports.setImageBoxShadow = setImageBoxShadow;
|
|
29
30
|
});
|
|
30
31
|
//# 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":";;;;IAGA;;;;;OAKG;IACH,SAAgB,iBAAiB,CAAC,MAAe,EAAE,SAAiB,EAAE,MAAsB;QACxF,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,mBAAmB,EAAE,UAAC,KAAwB;YAC9E,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;YACnC,IAAI,MAAM,EAAE;gBACR,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;gBACnC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;gBACjC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;gBAClC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;aACnC;iBAAM,IAAI,MAAM,KAAK,IAAI,EAAE;gBACxB,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;gBACjC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;gBAChC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;aACjC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAjBD,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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/selection/adjustSegmentSelection", "../../modelApi/selection/adjustWordSelection", "roosterjs-content-model-core"], function (require, exports, adjustSegmentSelection_1, adjustWordSelection_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.adjustLinkSelection = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
|
|
6
7
|
* @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
|
|
@@ -28,6 +29,6 @@ define(["require", "exports", "../../modelApi/selection/adjustSegmentSelection",
|
|
|
28
29
|
});
|
|
29
30
|
return [text, url];
|
|
30
31
|
}
|
|
31
|
-
exports.
|
|
32
|
+
exports.adjustLinkSelection = adjustLinkSelection;
|
|
32
33
|
});
|
|
33
34
|
//# 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":";;;;IAKA;;;OAGG;IACH,SAAgB,mBAAmB,CAAC,MAAe;QAC/C,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,GAAkB,IAAI,CAAC;QAE9B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;;YACD,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;YACF,IAAI,QAAQ,GAAG,IAAA,kDAAmB,EAAC,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC3E,IAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAEjC,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,WAAW,IAAI,iBAAiB,EAAE;gBACvE,QAAQ,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBAEpD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;oBACrB,OAAO,GAAG,IAAI,CAAC;oBACf,IAAA,2CAAY,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;iBACnE;aACJ;YAED,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;YAC3E,GAAG,GAAG,CAAA,MAAA,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,KAAI,IAAI,CAAC;YAE7C,OAAO,OAAO,CAAC;QACnB,CAAC,EACD;YACI,OAAO,EAAE,qBAAqB;SACjC,CACJ,CAAC;QAEF,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACvB,CAAC;IAlCD,kDAkCC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport { adjustWordSelection } from '../../modelApi/selection/adjustWordSelection';\nimport { getSelectedSegments, setSelection } from 'roosterjs-content-model-core';\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,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "tslib", "../../modelApi/selection/adjustTrailingSpaceSelection", "roosterjs-content-model-core", "../../modelApi/link/matchLink", "roosterjs-content-model-dom"], function (require, exports, tslib_1, adjustTrailingSpaceSelection_1, roosterjs_content_model_core_1, matchLink_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.insertLink = void 0;
|
|
4
5
|
// Regex matching Uri scheme
|
|
5
6
|
var URI_REGEX = /^[a-zA-Z]+:/i;
|
|
6
7
|
// Regex matching begin of email address
|
|
@@ -73,7 +74,7 @@ define(["require", "exports", "tslib", "../../modelApi/selection/adjustTrailingS
|
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
exports.
|
|
77
|
+
exports.insertLink = insertLink;
|
|
77
78
|
var createLink = function (url, anchorTitle, target, underline) {
|
|
78
79
|
if (underline === void 0) { underline = true; }
|
|
79
80
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertLink.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"insertLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/link/insertLink.ts"],"names":[],"mappings":"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","sourcesContent":["import { adjustTrailingSpaceSelection } from '../../modelApi/selection/adjustTrailingSpaceSelection';\nimport { ChangeSource, getSelectedSegments, mergeModel } from 'roosterjs-content-model-core';\nimport { matchLink } from '../../modelApi/link/matchLink';\nimport type { ContentModelLink, IEditor } from 'roosterjs-content-model-types';\nimport {\n addLink,\n addSegment,\n createContentModelDocument,\n createText,\n} from 'roosterjs-content-model-dom';\n\n// Regex matching Uri scheme\nconst URI_REGEX = /^[a-zA-Z]+:/i;\n// Regex matching begin of email address\nconst MAILTO_REGEX = /^[\\w.%+-]+@/i;\n// Regex matching begin of ftp, i.e. ftp.microsoft.com\nconst FTP_REGEX = /^ftp\\./i;\n\n/**\n * Insert a hyperlink at cursor.\n * When there is a selection, hyperlink will be applied to the selection,\n * otherwise a hyperlink will be inserted to the cursor position.\n * @param editor Editor object\n * @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.\n * When protocol is not specified, a best matched protocol will be predicted.\n * @param anchorTitle Optional alt text of the link, will be shown when hover on the link\n * @param displayText Optional display text for the link.\n * @param target Optional display target for the link (\"_blank\"|\"_self\"|\"_parent\"|\"_top\"|\"{framename}\")\n * If specified, the display text of link will be replaced with this text.\n * If not specified and there wasn't a link, the link url will be used as display text.\n */\nexport function insertLink(\n editor: IEditor,\n link: string,\n anchorTitle?: string,\n displayText?: string,\n target?: string\n) {\n editor.focus();\n\n const url = (checkXss(link) || '').trim();\n if (url) {\n const linkData = matchLink(url);\n const linkUrl = linkData ? linkData.normalizedUrl : applyLinkPrefix(url);\n const links: ContentModelLink[] = [];\n let anchorNode: Node | undefined;\n\n editor.formatContentModel(\n (model, context) => {\n const segments = getSelectedSegments(model, false /*includingFormatHolder*/);\n const originalText = segments\n .map(x => (x.segmentType == 'Text' ? x.text : ''))\n .join('');\n const text = displayText || originalText || '';\n\n if (\n segments.some(x => x.segmentType != 'SelectionMarker') &&\n originalText == text\n ) {\n segments.forEach(x => {\n const link = createLink(\n linkUrl,\n anchorTitle,\n target,\n x.segmentType == 'Text'\n );\n addLink(x, link);\n if (x.link) {\n links.push(x.link);\n }\n });\n } else if (\n segments.every(x => x.segmentType == 'SelectionMarker') ||\n (!!text && text != originalText)\n ) {\n const segment = createText(text || (linkData ? linkData.originalUrl : url), {\n ...segments[0]?.format,\n ...editor.getPendingFormat(),\n });\n const doc = createContentModelDocument();\n const link = createLink(linkUrl, anchorTitle, target);\n\n addLink(segment, link);\n addSegment(doc, segment);\n\n if (segment.link) {\n links.push(segment.link);\n }\n\n mergeModel(model, doc, context, {\n mergeFormat: 'mergeAll',\n });\n }\n\n adjustTrailingSpaceSelection(model);\n return segments.length > 0;\n },\n {\n changeSource: ChangeSource.CreateLink,\n onNodeCreated: (modelElement, node) => {\n if (!anchorNode && links.indexOf(modelElement as ContentModelLink) >= 0) {\n anchorNode = node;\n }\n },\n getChangeData: () => anchorNode,\n apiName: 'insertLink',\n }\n );\n }\n}\n\nconst createLink = (\n url: string,\n anchorTitle?: string,\n target?: string,\n underline: boolean = true\n): ContentModelLink => {\n return {\n dataset: {},\n format: {\n href: url,\n anchorTitle,\n target,\n underline: underline,\n },\n };\n};\n\nfunction applyLinkPrefix(url: string): string {\n if (!url) {\n return url;\n }\n\n // Add link prefix per rule:\n // (a) if the url always starts with a URI scheme, leave it as it is\n // (b) if the url is an email address, xxx@... add mailto: prefix\n // (c) if the url starts with ftp., add ftp:// prefix\n // (d) rest, add http:// prefix\n let prefix = '';\n if (url.search(URI_REGEX) < 0) {\n if (url.search(MAILTO_REGEX) == 0) {\n prefix = 'mailto:';\n } else if (url.search(FTP_REGEX) == 0) {\n prefix = 'ftp://';\n } else {\n // fallback to http://\n prefix = 'http://';\n }\n }\n\n return prefix + url;\n}\n\nfunction checkXss(link: string): string {\n return link.match(/s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\n}\n"]}
|
|
@@ -5,4 +5,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
5
5
|
* If only part of a link is selected, the whole link style will be removed.
|
|
6
6
|
* @param editor The editor instance
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function removeLink(editor: IEditor): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/selection/adjustSegmentSelection", "roosterjs-content-model-core"], function (require, exports, adjustSegmentSelection_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.removeLink = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Remove link at selection. If no links at selection, do nothing.
|
|
6
7
|
* If selection contains multiple links, all of the link styles will be removed.
|
|
@@ -27,6 +28,6 @@ define(["require", "exports", "../../modelApi/selection/adjustSegmentSelection",
|
|
|
27
28
|
apiName: 'removeLink',
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
exports.
|
|
31
|
+
exports.removeLink = removeLink;
|
|
31
32
|
});
|
|
32
33
|
//# sourceMappingURL=removeLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeLink.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"removeLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/link/removeLink.ts"],"names":[],"mappings":";;;;IAIA;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,MAAe;QACtC,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACD,IAAA,+CAAsB,EAClB,KAAK,EACL,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAApC,CAAoC,EAC9C,UAAC,MAAM,EAAE,GAAG;gBACR,OAAA,MAAM,CAAC,UAAU,IAAI,8FAA8F;oBACnH,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,IAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YADnE,CACmE,CAC1E,CAAC;YAEF,IAAM,QAAQ,GAAG,IAAA,kDAAmB,EAAC,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7E,IAAI,SAAS,GAAG,KAAK,CAAC;YAEtB,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;gBACpB,IAAI,OAAO,CAAC,IAAI,EAAE;oBACd,SAAS,GAAG,IAAI,CAAC;oBAEjB,OAAO,OAAO,CAAC,IAAI,CAAC;iBACvB;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,SAAS,CAAC;QACrB,CAAC,EACD;YACI,OAAO,EAAE,YAAY;SACxB,CACJ,CAAC;IACN,CAAC;IA9BD,gCA8BC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport { getSelectedSegments } from 'roosterjs-content-model-core';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Remove link at selection. If no links at selection, do nothing.\n * If selection contains multiple links, all of the link styles will be removed.\n * If only part of a link is selected, the whole link style will be removed.\n * @param editor The editor instance\n */\nexport function removeLink(editor: IEditor) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n adjustSegmentSelection(\n model,\n target => !!target.isSelected && !!target.link,\n (target, ref) =>\n target.isSelected || // Expand the selection to any link that is involved. So we can remove multiple links together\n (!!target.link && target.link.format.href == ref.link!.format.href)\n );\n\n const segments = getSelectedSegments(model, false /*includingFormatHolder*/);\n let isChanged = false;\n\n segments.forEach(segment => {\n if (segment.link) {\n isChanged = true;\n\n delete segment.link;\n }\n });\n\n return isChanged;\n },\n {\n apiName: 'removeLink',\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 value The number to set to, must be equal or greater than 1
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setListStartNumber(editor: IEditor, value: number): void;
|
|
@@ -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.setListStartNumber = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set start number of a list item
|
|
6
7
|
* @param editor The editor to operate on
|
|
@@ -22,6 +23,6 @@ define(["require", "exports", "roosterjs-content-model-core"], function (require
|
|
|
22
23
|
apiName: 'setListStartNumber',
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
|
-
exports.
|
|
26
|
+
exports.setListStartNumber = setListStartNumber;
|
|
26
27
|
});
|
|
27
28
|
//# sourceMappingURL=setListStartNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setListStartNumber.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setListStartNumber.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/list/setListStartNumber.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IACH,SAAgB,kBAAkB,CAAC,MAAe,EAAE,KAAa;QAC7D,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACD,IAAM,QAAQ,GAAG,IAAA,uDAAwB,EAAC,KAAK,CAAC,CAAC;YACjD,IAAM,KAAK,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,MAAM,IAAG,CAAC,CAAC,CAAC;YAE5D,IAAI,KAAK,EAAE;gBACP,KAAK,CAAC,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC;gBAEzC,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,OAAO,EAAE,oBAAoB;SAChC,CACJ,CAAC;IACN,CAAC;IApBD,gDAoBC","sourcesContent":["import { getFirstSelectedListItem } from 'roosterjs-content-model-core';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set start number of a list item\n * @param editor The editor to operate on\n * @param value The number to set to, must be equal or greater than 1\n */\nexport function setListStartNumber(editor: IEditor, value: number) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const listItem = getFirstSelectedListItem(model);\n const level = listItem?.levels[listItem?.levels.length - 1];\n\n if (level) {\n level.format.startNumberOverride = value;\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'setListStartNumber',\n }\n );\n}\n"]}
|
|
@@ -4,4 +4,4 @@ import type { IEditor, ListMetadataFormat } from 'roosterjs-content-model-types'
|
|
|
4
4
|
* @param editor The editor to operate on
|
|
5
5
|
* @param style The target list item style to set
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function setListStyle(editor: IEditor, style: ListMetadataFormat): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/list/findListItemsInSameThread", "roosterjs-content-model-core"], function (require, exports, findListItemsInSameThread_1, roosterjs_content_model_core_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setListStyle = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Set style of list items with in same thread of current item
|
|
6
7
|
* @param editor The editor to operate on
|
|
@@ -28,6 +29,6 @@ define(["require", "exports", "../../modelApi/list/findListItemsInSameThread", "
|
|
|
28
29
|
apiName: 'setListStyle',
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
exports.
|
|
32
|
+
exports.setListStyle = setListStyle;
|
|
32
33
|
});
|
|
33
34
|
//# sourceMappingURL=setListStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setListStyle.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"setListStyle.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/list/setListStyle.ts"],"names":[],"mappings":";;;;IAIA;;;;OAIG;IACH,SAAgB,YAAY,CAAC,MAAe,EAAE,KAAyB;QACnE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;YACD,IAAM,QAAQ,GAAG,IAAA,uDAAwB,EAAC,KAAK,CAAC,CAAC;YAEjD,IAAI,QAAQ,EAAE;gBACV,IAAM,SAAS,GAAG,IAAA,qDAAyB,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAC7D,IAAM,YAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAE9C,SAAS,CAAC,OAAO,CAAC,UAAA,QAAQ;oBACtB,IAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,YAAU,CAAC,CAAC;oBAE1C,IAAI,KAAK,EAAE;wBACP,IAAA,iDAAkB,EAAC,KAAK,EAAE,UAAA,QAAQ,IAAI,OAAA,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAlC,CAAkC,CAAC,CAAC;qBAC7E;gBACL,CAAC,CAAC,CAAC;gBAEH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD;YACI,OAAO,EAAE,cAAc;SAC1B,CACJ,CAAC;IACN,CAAC;IA5BD,oCA4BC","sourcesContent":["import { findListItemsInSameThread } from '../../modelApi/list/findListItemsInSameThread';\nimport { getFirstSelectedListItem, updateListMetadata } from 'roosterjs-content-model-core';\nimport type { IEditor, ListMetadataFormat } from 'roosterjs-content-model-types';\n\n/**\n * Set style of list items with in same thread of current item\n * @param editor The editor to operate on\n * @param style The target list item style to set\n */\nexport function setListStyle(editor: IEditor, style: ListMetadataFormat) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const listItem = getFirstSelectedListItem(model);\n\n if (listItem) {\n const listItems = findListItemsInSameThread(model, listItem);\n const levelIndex = listItem.levels.length - 1;\n\n listItems.forEach(listItem => {\n const level = listItem.levels[levelIndex];\n\n if (level) {\n updateListMetadata(level, metadata => Object.assign({}, metadata, style));\n }\n });\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'setListStyle',\n }\n );\n}\n"]}
|
|
@@ -6,4 +6,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
6
6
|
* @param editor The editor to operate on
|
|
7
7
|
* @param removeMargins true to remove margins, false to keep margins @default false
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function toggleBullet(editor: IEditor, removeMargins?: boolean): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/list/setListType"], function (require, exports, setListType_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.toggleBullet = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Toggle bullet list type
|
|
6
7
|
* - When there are some blocks not in bullet list, set all blocks to the given type
|
|
@@ -18,6 +19,6 @@ define(["require", "exports", "../../modelApi/list/setListType"], function (requ
|
|
|
18
19
|
apiName: 'toggleBullet',
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
exports.
|
|
22
|
+
exports.toggleBullet = toggleBullet;
|
|
22
23
|
});
|
|
23
24
|
//# sourceMappingURL=toggleBullet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleBullet.js","sourceRoot":"","sources":["../../../../../packages
|
|
1
|
+
{"version":3,"file":"toggleBullet.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/list/toggleBullet.ts"],"names":[],"mappings":";;;;IAGA;;;;;;OAMG;IACH,SAAgB,YAAY,CAAC,MAAe,EAAE,aAA8B;QAA9B,8BAAA,EAAA,qBAA8B;QACxE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;YACX,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;YAEtC,OAAO,IAAA,yBAAW,EAAC,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACnD,CAAC,EACD;YACI,OAAO,EAAE,cAAc;SAC1B,CACJ,CAAC;IACN,CAAC;IAbD,oCAaC","sourcesContent":["import { setListType } from '../../modelApi/list/setListType';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle bullet list type\n * - When there are some blocks not in bullet list, set all blocks to the given type\n * - When all blocks are already in bullet list, turn off / outdent there list type\n * @param editor The editor to operate on\n * @param removeMargins true to remove margins, false to keep margins @default false\n */\nexport function toggleBullet(editor: IEditor, removeMargins: boolean = false) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n context.newPendingFormat = 'preserve';\n\n return setListType(model, 'UL', removeMargins);\n },\n {\n apiName: 'toggleBullet',\n }\n );\n}\n"]}
|
|
@@ -6,4 +6,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
|
|
|
6
6
|
* @param editor The editor to operate on
|
|
7
7
|
* @param removeMargins true to remove margins, false to keep margins @default false
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function toggleNumbering(editor: IEditor, removeMargins?: boolean): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "../../modelApi/list/setListType"], function (require, exports, setListType_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.toggleNumbering = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Toggle numbering list type
|
|
6
7
|
* - When there are some blocks not in numbering list, set all blocks to the given type
|
|
@@ -18,6 +19,6 @@ define(["require", "exports", "../../modelApi/list/setListType"], function (requ
|
|
|
18
19
|
apiName: 'toggleNumbering',
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
exports.
|
|
22
|
+
exports.toggleNumbering = toggleNumbering;
|
|
22
23
|
});
|
|
23
24
|
//# sourceMappingURL=toggleNumbering.js.map
|