roosterjs-content-model-api 0.26.4 → 0.27.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/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/publicApi/block/setAlignment.d.ts +2 -2
- package/lib/publicApi/block/setAlignment.js.map +1 -1
- package/lib/publicApi/block/setDirection.d.ts +2 -2
- package/lib/publicApi/block/setDirection.js.map +1 -1
- package/lib/publicApi/block/setHeadingLevel.d.ts +2 -2
- package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
- package/lib/publicApi/block/setIndentation.d.ts +2 -2
- package/lib/publicApi/block/setIndentation.js.map +1 -1
- package/lib/publicApi/block/setParagraphMargin.d.ts +2 -2
- package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
- package/lib/publicApi/block/setSpacing.d.ts +2 -2
- package/lib/publicApi/block/setSpacing.js.map +1 -1
- package/lib/publicApi/block/toggleBlockQuote.d.ts +2 -2
- package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
- package/lib/publicApi/entity/insertEntity.d.ts +5 -5
- package/lib/publicApi/entity/insertEntity.js +22 -3
- package/lib/publicApi/entity/insertEntity.js.map +1 -1
- package/lib/publicApi/format/clearFormat.d.ts +2 -2
- package/lib/publicApi/format/clearFormat.js.map +1 -1
- package/lib/publicApi/format/getFormatState.d.ts +2 -2
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/adjustImageSelection.d.ts +2 -2
- package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
- package/lib/publicApi/image/changeImage.d.ts +2 -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.map +1 -1
- package/lib/publicApi/image/setImageAltText.d.ts +2 -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.map +1 -1
- package/lib/publicApi/image/setImageBoxShadow.d.ts +2 -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.map +1 -1
- package/lib/publicApi/link/insertLink.d.ts +2 -2
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/link/removeLink.d.ts +2 -2
- package/lib/publicApi/link/removeLink.js.map +1 -1
- package/lib/publicApi/list/setListStartNumber.d.ts +2 -2
- package/lib/publicApi/list/setListStartNumber.js.map +1 -1
- package/lib/publicApi/list/setListStyle.d.ts +2 -2
- package/lib/publicApi/list/setListStyle.js.map +1 -1
- package/lib/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib/publicApi/list/toggleBullet.js +4 -2
- package/lib/publicApi/list/toggleBullet.js.map +1 -1
- package/lib/publicApi/list/toggleNumbering.d.ts +3 -2
- package/lib/publicApi/list/toggleNumbering.js +4 -2
- package/lib/publicApi/list/toggleNumbering.js.map +1 -1
- package/lib/publicApi/segment/applySegmentFormat.d.ts +2 -2
- package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
- package/lib/publicApi/segment/changeCapitalization.d.ts +2 -2
- package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
- package/lib/publicApi/segment/changeFontSize.d.ts +2 -2
- package/lib/publicApi/segment/changeFontSize.js.map +1 -1
- package/lib/publicApi/segment/setBackgroundColor.d.ts +2 -2
- package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
- package/lib/publicApi/segment/setFontName.d.ts +2 -2
- package/lib/publicApi/segment/setFontName.js.map +1 -1
- package/lib/publicApi/segment/setFontSize.d.ts +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.map +1 -1
- package/lib/publicApi/segment/toggleBold.d.ts +2 -2
- package/lib/publicApi/segment/toggleBold.js.map +1 -1
- package/lib/publicApi/segment/toggleCode.d.ts +2 -2
- package/lib/publicApi/segment/toggleCode.js.map +1 -1
- package/lib/publicApi/segment/toggleItalic.d.ts +2 -2
- package/lib/publicApi/segment/toggleItalic.js.map +1 -1
- package/lib/publicApi/segment/toggleStrikethrough.d.ts +2 -2
- package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
- package/lib/publicApi/segment/toggleSubscript.d.ts +2 -2
- package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
- package/lib/publicApi/segment/toggleSuperscript.d.ts +2 -2
- package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
- package/lib/publicApi/segment/toggleUnderline.d.ts +2 -2
- package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +2 -2
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.d.ts +2 -2
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/formatTable.d.ts +2 -2
- package/lib/publicApi/table/formatTable.js.map +1 -1
- package/lib/publicApi/table/insertTable.d.ts +2 -2
- package/lib/publicApi/table/insertTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.d.ts +2 -2
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib/publicApi/utils/formatImageWithContentModel.d.ts +2 -2
- package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +2 -2
- package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +2 -2
- 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/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/publicApi/block/setAlignment.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/block/setHeadingLevel.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/block/setParagraphMargin.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +2 -2
- 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 +22 -3
- 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.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/image/changeImage.d.ts +2 -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.map +1 -1
- package/lib-amd/publicApi/image/setImageAltText.d.ts +2 -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.map +1 -1
- package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +2 -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.map +1 -1
- package/lib-amd/publicApi/link/insertLink.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/list/setListStartNumber.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/list/toggleBullet.d.ts +3 -2
- package/lib-amd/publicApi/list/toggleBullet.js +4 -2
- 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 +4 -2
- 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.map +1 -1
- package/lib-amd/publicApi/segment/changeCapitalization.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/segment/setFontSize.d.ts +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.map +1 -1
- package/lib-amd/publicApi/segment/toggleBold.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/segment/toggleItalic.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/segment/toggleSubscript.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/segment/toggleUnderline.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/table/editTable.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/table/insertTable.d.ts +2 -2
- 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.map +1 -1
- package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +2 -2
- package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +2 -2
- package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +2 -2
- 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/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/publicApi/block/setAlignment.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +2 -2
- 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 +22 -3
- 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.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.d.ts +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.map +1 -1
- package/lib-mjs/publicApi/image/setImageAltText.d.ts +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.map +1 -1
- package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +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.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/list/setListStartNumber.d.ts +2 -2
- 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.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.map +1 -1
- package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/segment/setFontSize.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/segment/toggleBold.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/segment/toggleItalic.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/table/editTable.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/table/insertTable.d.ts +2 -2
- 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.map +1 -1
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +2 -2
- package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +2 -2
- package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
- package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +2 -2
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setHeadingLevel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setHeadingLevel.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"setHeadingLevel.js","sourceRoot":"","sources":["../../../../../packages-content-model/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,SAAwB,eAAe,CAAC,MAAe,EAAE,YAAuC;QAC5F,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,kCA6BC;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 default 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 default function setIndentation(editor:
|
|
8
|
+
export default function setIndentation(editor: IEditor, indentation: 'indent' | 'outdent', length?: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setIndentation.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setIndentation.ts"],"names":[],"mappings":";;;IAIA;;;;;OAKG;IACH,SAAwB,cAAc,CAClC,
|
|
1
|
+
{"version":3,"file":"setIndentation.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setIndentation.ts"],"names":[],"mappings":";;;IAIA;;;;;OAKG;IACH,SAAwB,cAAc,CAClC,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,iCAuBC","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 default 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 default function setParagraphMargin(editor:
|
|
9
|
+
export default function setParagraphMargin(editor: IEditor, marginTop?: string | null, marginBottom?: string | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setParagraphMargin.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setParagraphMargin.ts"],"names":[],"mappings":";;;IAIA;;;;;;OAMG;IACH,SAAwB,kBAAkB,CACtC,
|
|
1
|
+
{"version":3,"file":"setParagraphMargin.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setParagraphMargin.ts"],"names":[],"mappings":";;;IAIA;;;;;;OAMG;IACH,SAAwB,kBAAkB,CACtC,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,qCAwBC","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 default 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 default function setSpacing(editor:
|
|
7
|
+
export default function setSpacing(editor: IEditor, spacing: number | string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setSpacing.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setSpacing.ts"],"names":[],"mappings":";;;IAGA;;;;OAIG;IACH,SAAwB,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"setSpacing.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setSpacing.ts"],"names":[],"mappings":";;;IAGA;;;;OAIG;IACH,SAAwB,UAAU,CAAC,MAAe,EAAE,OAAwB;QACxE,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,6BAWC","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 default 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 default function toggleBlockQuote(editor:
|
|
9
|
+
export default function toggleBlockQuote(editor: IEditor, quoteFormat?: ContentModelFormatContainerFormat, quoteFormatRtl?: ContentModelFormatContainerFormat): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleBlockQuote.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/toggleBlockQuote.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"toggleBlockQuote.js","sourceRoot":"","sources":["../../../../../packages-content-model/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,SAAwB,gBAAgB,CACpC,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,mCA6BC","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 default 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 default function insertEntity(editor:
|
|
13
|
+
export default 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 default function insertEntity(editor:
|
|
25
|
+
export default function insertEntity(editor: IEditor, type: string, isBlock: true, position: InsertEntityPosition | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
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
4
|
var BlockEntityTag = 'div';
|
|
5
5
|
var InlineEntityTag = 'span';
|
|
6
6
|
function insertEntity(editor, type, isBlock, position, options) {
|
|
7
|
-
var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot;
|
|
7
|
+
var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot, initialEntityState = _a.initialEntityState;
|
|
8
8
|
var document = editor.getDocument();
|
|
9
9
|
var wrapper = document.createElement(isBlock ? BlockEntityTag : InlineEntityTag);
|
|
10
10
|
var display = wrapperDisplay !== null && wrapperDisplay !== void 0 ? wrapperDisplay : (isBlock ? undefined : 'inline-block');
|
|
@@ -17,10 +17,13 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
17
17
|
wrapper.appendChild(contentNode);
|
|
18
18
|
}
|
|
19
19
|
var entityModel = (0, roosterjs_content_model_dom_1.createEntity)(wrapper, true /* isReadonly */, undefined /*format*/, type);
|
|
20
|
+
if (!skipUndoSnapshot) {
|
|
21
|
+
editor.takeSnapshot();
|
|
22
|
+
}
|
|
20
23
|
editor.formatContentModel(function (model, context) {
|
|
21
24
|
(0, insertEntityModel_1.insertEntityModel)(model, entityModel, typeof position == 'string' ? position : 'focus', isBlock, focusAfterEntity, context);
|
|
22
25
|
(0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
|
|
23
|
-
context.skipUndoSnapshot =
|
|
26
|
+
context.skipUndoSnapshot = true;
|
|
24
27
|
context.newEntities.push(entityModel);
|
|
25
28
|
return true;
|
|
26
29
|
}, {
|
|
@@ -34,6 +37,22 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
|
|
|
34
37
|
}); },
|
|
35
38
|
apiName: 'insertEntity',
|
|
36
39
|
});
|
|
40
|
+
if (!skipUndoSnapshot) {
|
|
41
|
+
var entityState = void 0;
|
|
42
|
+
if (initialEntityState) {
|
|
43
|
+
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(wrapper);
|
|
44
|
+
var id = format.id, entityType = format.entityType;
|
|
45
|
+
entityState =
|
|
46
|
+
id && entityType
|
|
47
|
+
? {
|
|
48
|
+
id: id,
|
|
49
|
+
type: entityType,
|
|
50
|
+
state: initialEntityState,
|
|
51
|
+
}
|
|
52
|
+
: undefined;
|
|
53
|
+
}
|
|
54
|
+
editor.takeSnapshot(entityState);
|
|
55
|
+
}
|
|
37
56
|
return entityModel;
|
|
38
57
|
}
|
|
39
58
|
exports.default = insertEntity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/entity/insertEntity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/entity/insertEntity.ts"],"names":[],"mappings":"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","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 default 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 default function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: true,\n position: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\nexport default 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 default function clearFormat(editor:
|
|
6
|
+
export default function clearFormat(editor: IEditor): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/clearFormat.ts"],"names":[],"mappings":";;;IAUA;;;OAGG;IACH,SAAwB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/clearFormat.ts"],"names":[],"mappings":";;;IAUA;;;OAGG;IACH,SAAwB,WAAW,CAAC,MAAe;QAC/C,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,8BAqBC","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 default 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 default function getFormatState(editor:
|
|
6
|
+
export default function getFormatState(editor: IEditor): ContentModelFormatState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts"],"names":[],"mappings":";;;IAGA;;;OAGG;IACH,SAAwB,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts"],"names":[],"mappings":";;;IAGA;;;OAGG;IACH,SAAwB,cAAc,CAAC,MAAe;QAClD,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,iCAaC","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 default 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 default function adjustImageSelection(editor:
|
|
6
|
+
export default function adjustImageSelection(editor: IEditor): ContentModelImage | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/adjustImageSelection.ts"],"names":[],"mappings":";;;IAGA;;;OAGG;IACH,SAAwB,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/adjustImageSelection.ts"],"names":[],"mappings":";;;IAGA;;;OAGG;IACH,SAAwB,oBAAoB,CAAC,MAAe;QACxD,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,uCAuBC","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 default 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 default function changeImage(editor:
|
|
7
|
+
export default function changeImage(editor: IEditor, file: File): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts"],"names":[],"mappings":";;;IAIA;;;;OAIG;IACH,SAAwB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts"],"names":[],"mappings":";;;IAIA;;;;OAIG;IACH,SAAwB,WAAW,CAAC,MAAe,EAAE,IAAU;QAC3D,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,qCAA2B,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,8BAyBC","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 default 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 default function insertImage(editor:
|
|
7
|
+
export default function insertImage(editor: IEditor, imageFileOrSrc: File | string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/insertImage.ts"],"names":[],"mappings":";;;IAIA;;;;OAIG;IACH,SAAwB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/insertImage.ts"],"names":[],"mappings":";;;IAIA;;;;OAIG;IACH,SAAwB,WAAW,CAAC,MAAe,EAAE,cAA6B;QAC9E,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,8BAYC;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 default 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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set image alt text for all selected images at selection. If no images is contained
|
|
4
4
|
* in selection, do nothing.
|
|
5
5
|
* @param editor The editor instance
|
|
6
6
|
* @param altText The image alt text
|
|
7
7
|
*/
|
|
8
|
-
export default function setImageAltText(editor:
|
|
8
|
+
export default function setImageAltText(editor: IEditor, altText: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageAltText.ts"],"names":[],"mappings":";;;IAGA;;;;;OAKG;IACH,SAAwB,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageAltText.ts"],"names":[],"mappings":";;;IAGA;;;;;OAKG;IACH,SAAwB,eAAe,CAAC,MAAe,EAAE,OAAe;QACpE,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAC,KAAwB;YAC5E,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAND,kCAMC","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 default function setImageAltText(editor: IEditor, altText: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageAltText', (image: ContentModelImage) => {\n image.alt = altText;\n });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Border,
|
|
1
|
+
import type { Border, IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set image border style for all selected images at selection.
|
|
4
4
|
* @param editor The editor instance
|
|
@@ -6,4 +6,4 @@ import type { Border, IStandaloneEditor } 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 default function setImageBorder(editor:
|
|
9
|
+
export default function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;;IAIA;;;;;;OAMG;IACH,SAAwB,cAAc,CAClC,
|
|
1
|
+
{"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;;IAIA;;;;;;OAMG;IACH,SAAwB,cAAc,CAClC,MAAe,EACf,MAAqB,EACrB,YAAqB;QAErB,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;YAC3E,IAAA,gCAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;IAVD,iCAUC","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 default function setImageBorder(\n editor: IEditor,\n border: Border | null,\n borderRadius?: string\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\n applyImageBorderFormat(image, border, borderRadius);\n });\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set image box shadow for all selected images at selection.
|
|
4
4
|
* @param editor The editor instance
|
|
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 default function setImageBoxShadow(editor:
|
|
8
|
+
export default function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;;IAGA;;;;;OAKG;IACH,SAAwB,iBAAiB,CACrC,
|
|
1
|
+
{"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;;IAGA;;;;;OAKG;IACH,SAAwB,iBAAiB,CACrC,MAAe,EACf,SAAiB,EACjB,MAAsB;QAEtB,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,IAAA,qCAA2B,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;IArBD,oCAqBC","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 default function setImageBoxShadow(\n editor: IEditor,\n boxShadow: string,\n margin?: string | null\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBoxShadow', (image: ContentModelImage) => {\n image.format.boxShadow = boxShadow;\n if (margin) {\n image.format.marginBottom = margin;\n image.format.marginLeft = margin;\n image.format.marginRight = margin;\n image.format.marginTop = margin;\n } else if (margin === null) {\n delete image.format.marginBottom;\n delete image.format.marginLeft;\n delete image.format.marginRight;\n delete image.format.marginTop;\n }\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
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 default function adjustLinkSelection(editor:
|
|
6
|
+
export default function adjustLinkSelection(editor: IEditor): [string, string | null];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"],"names":[],"mappings":";;;IAKA;;;OAGG;IACH,SAAwB,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"],"names":[],"mappings":";;;IAKA;;;OAGG;IACH,SAAwB,mBAAmB,CAAC,MAAe;QACvD,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,sCAkCC","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 default 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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert a hyperlink at cursor.
|
|
4
4
|
* When there is a selection, hyperlink will be applied to the selection,
|
|
@@ -12,4 +12,4 @@ import type { IStandaloneEditor } 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 default function insertLink(editor:
|
|
15
|
+
export default function insertLink(editor: IEditor, link: string, anchorTitle?: string, displayText?: string, target?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertLink.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/link/insertLink.ts"],"names":[],"mappings":";;;IAWA,4BAA4B;IAC5B,IAAM,SAAS,GAAG,cAAc,CAAC;IACjC,wCAAwC;IACxC,IAAM,YAAY,GAAG,cAAc,CAAC;IACpC,sDAAsD;IACtD,IAAM,SAAS,GAAG,SAAS,CAAC;IAE5B;;;;;;;;;;;;OAYG;IACH,SAAwB,UAAU,CAC9B,
|
|
1
|
+
{"version":3,"file":"insertLink.js","sourceRoot":"","sources":["../../../../../packages-content-model/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 default 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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Remove link at selection. If no links at selection, do nothing.
|
|
4
4
|
* If selection contains multiple links, all of the link styles will be removed.
|
|
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 default function removeLink(editor:
|
|
8
|
+
export default function removeLink(editor: IEditor): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeLink.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/link/removeLink.ts"],"names":[],"mappings":";;;IAIA;;;;;OAKG;IACH,SAAwB,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"removeLink.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/link/removeLink.ts"],"names":[],"mappings":";;;IAIA;;;;;OAKG;IACH,SAAwB,UAAU,CAAC,MAAe;QAC9C,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,6BA8BC","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 default 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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IEditor } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Set start number of a list item
|
|
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 default function setListStartNumber(editor:
|
|
7
|
+
export default function setListStartNumber(editor: IEditor, value: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setListStartNumber.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/list/setListStartNumber.ts"],"names":[],"mappings":";;;IAGA;;;;OAIG;IACH,SAAwB,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"setListStartNumber.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/list/setListStartNumber.ts"],"names":[],"mappings":";;;IAGA;;;;OAIG;IACH,SAAwB,kBAAkB,CAAC,MAAe,EAAE,KAAa;QACrE,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,qCAoBC","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 default 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"]}
|