roosterjs-content-model-api 9.43.0 → 9.45.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.
Files changed (820) hide show
  1. package/lib/index.d.ts +63 -63
  2. package/lib/index.js +131 -131
  3. package/lib/index.js.map +1 -1
  4. package/lib/modelApi/block/setModelAlignment.d.ts +5 -5
  5. package/lib/modelApi/block/setModelAlignment.js +65 -65
  6. package/lib/modelApi/block/setModelAlignment.js.map +1 -1
  7. package/lib/modelApi/block/setModelDirection.d.ts +5 -5
  8. package/lib/modelApi/block/setModelDirection.js +113 -109
  9. package/lib/modelApi/block/setModelDirection.js.map +1 -1
  10. package/lib/modelApi/block/setModelIndentation.d.ts +8 -8
  11. package/lib/modelApi/block/setModelIndentation.js +158 -152
  12. package/lib/modelApi/block/setModelIndentation.js.map +1 -1
  13. package/lib/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
  14. package/lib/modelApi/block/splitSelectedParagraphByBr.js +71 -71
  15. package/lib/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
  16. package/lib/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
  17. package/lib/modelApi/block/toggleModelBlockQuote.js +53 -53
  18. package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  19. package/lib/modelApi/common/adjustIndentation.d.ts +13 -13
  20. package/lib/modelApi/common/adjustIndentation.js +114 -114
  21. package/lib/modelApi/common/adjustIndentation.js.map +1 -1
  22. package/lib/modelApi/common/clearModelFormat.d.ts +5 -5
  23. package/lib/modelApi/common/clearModelFormat.js +143 -143
  24. package/lib/modelApi/common/clearModelFormat.js.map +1 -1
  25. package/lib/modelApi/common/queryContentModelBlocks.d.ts +10 -10
  26. package/lib/modelApi/common/queryContentModelBlocks.js +87 -87
  27. package/lib/modelApi/common/queryContentModelBlocks.js.map +1 -1
  28. package/lib/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
  29. package/lib/modelApi/common/reducedModelChildProcessor.js +63 -63
  30. package/lib/modelApi/common/reducedModelChildProcessor.js.map +1 -1
  31. package/lib/modelApi/common/wrapBlock.d.ts +16 -16
  32. package/lib/modelApi/common/wrapBlock.js +52 -52
  33. package/lib/modelApi/common/wrapBlock.js.map +1 -1
  34. package/lib/modelApi/entity/insertEntityModel.d.ts +5 -5
  35. package/lib/modelApi/entity/insertEntityModel.js +105 -105
  36. package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
  37. package/lib/modelApi/image/applyImageBorderFormat.d.ts +5 -5
  38. package/lib/modelApi/image/applyImageBorderFormat.js +57 -57
  39. package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -1
  40. package/lib/modelApi/link/getLinkUrl.d.ts +5 -5
  41. package/lib/modelApi/link/getLinkUrl.js +28 -28
  42. package/lib/modelApi/link/getLinkUrl.js.map +1 -1
  43. package/lib/modelApi/link/matchLink.d.ts +12 -12
  44. package/lib/modelApi/link/matchLink.js +93 -93
  45. package/lib/modelApi/link/matchLink.js.map +1 -1
  46. package/lib/modelApi/link/promoteLink.d.ts +20 -20
  47. package/lib/modelApi/link/promoteLink.js +54 -54
  48. package/lib/modelApi/link/promoteLink.js.map +1 -1
  49. package/lib/modelApi/list/findListItemsInSameThread.d.ts +13 -13
  50. package/lib/modelApi/list/findListItemsInSameThread.js +113 -113
  51. package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -1
  52. package/lib/modelApi/list/getListAnnounceData.d.ts +7 -7
  53. package/lib/modelApi/list/getListAnnounceData.js +68 -68
  54. package/lib/modelApi/list/getListAnnounceData.js.map +1 -1
  55. package/lib/modelApi/list/setListType.d.ts +8 -8
  56. package/lib/modelApi/list/setListType.js +117 -116
  57. package/lib/modelApi/list/setListType.js.map +1 -1
  58. package/lib/modelApi/list/setModelListStartNumber.d.ts +7 -7
  59. package/lib/modelApi/list/setModelListStartNumber.js +21 -21
  60. package/lib/modelApi/list/setModelListStartNumber.js.map +1 -1
  61. package/lib/modelApi/list/setModelListStyle.d.ts +7 -7
  62. package/lib/modelApi/list/setModelListStyle.js +25 -25
  63. package/lib/modelApi/list/setModelListStyle.js.map +1 -1
  64. package/lib/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
  65. package/lib/modelApi/selection/adjustSegmentSelection.js +47 -47
  66. package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  67. package/lib/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
  68. package/lib/modelApi/selection/adjustTrailingSpaceSelection.js +56 -56
  69. package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  70. package/lib/modelApi/selection/adjustWordSelection.d.ts +8 -8
  71. package/lib/modelApi/selection/adjustWordSelection.js +123 -123
  72. package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
  73. package/lib/modelApi/selection/collapseTableSelection.d.ts +5 -5
  74. package/lib/modelApi/selection/collapseTableSelection.js +16 -16
  75. package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
  76. package/lib/modelApi/table/alignTable.d.ts +5 -5
  77. package/lib/modelApi/table/alignTable.js +11 -11
  78. package/lib/modelApi/table/alignTable.js.map +1 -1
  79. package/lib/modelApi/table/alignTableCell.d.ts +9 -9
  80. package/lib/modelApi/table/alignTableCell.js +57 -57
  81. package/lib/modelApi/table/alignTableCell.js.map +1 -1
  82. package/lib/modelApi/table/canMergeCells.d.ts +5 -5
  83. package/lib/modelApi/table/canMergeCells.js +56 -56
  84. package/lib/modelApi/table/canMergeCells.js.map +1 -1
  85. package/lib/modelApi/table/clearSelectedCells.d.ts +7 -7
  86. package/lib/modelApi/table/clearSelectedCells.js +29 -29
  87. package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
  88. package/lib/modelApi/table/createTableStructure.d.ts +5 -5
  89. package/lib/modelApi/table/createTableStructure.js +19 -19
  90. package/lib/modelApi/table/createTableStructure.js.map +1 -1
  91. package/lib/modelApi/table/deleteTable.d.ts +5 -5
  92. package/lib/modelApi/table/deleteTable.js +10 -10
  93. package/lib/modelApi/table/deleteTable.js.map +1 -1
  94. package/lib/modelApi/table/deleteTableColumn.d.ts +5 -5
  95. package/lib/modelApi/table/deleteTableColumn.js +24 -24
  96. package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
  97. package/lib/modelApi/table/deleteTableRow.d.ts +5 -5
  98. package/lib/modelApi/table/deleteTableRow.js +23 -23
  99. package/lib/modelApi/table/deleteTableRow.js.map +1 -1
  100. package/lib/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
  101. package/lib/modelApi/table/ensureFocusableParagraphForTable.js +56 -56
  102. package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  103. package/lib/modelApi/table/insertTableColumn.d.ts +7 -7
  104. package/lib/modelApi/table/insertTableColumn.js +27 -27
  105. package/lib/modelApi/table/insertTableColumn.js.map +1 -1
  106. package/lib/modelApi/table/insertTableRow.d.ts +7 -7
  107. package/lib/modelApi/table/insertTableRow.js +31 -31
  108. package/lib/modelApi/table/insertTableRow.js.map +1 -1
  109. package/lib/modelApi/table/mergeTableCells.d.ts +5 -5
  110. package/lib/modelApi/table/mergeTableCells.js +25 -25
  111. package/lib/modelApi/table/mergeTableCells.js.map +1 -1
  112. package/lib/modelApi/table/mergeTableColumn.d.ts +5 -5
  113. package/lib/modelApi/table/mergeTableColumn.js +35 -35
  114. package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
  115. package/lib/modelApi/table/mergeTableRow.d.ts +5 -5
  116. package/lib/modelApi/table/mergeTableRow.js +35 -35
  117. package/lib/modelApi/table/mergeTableRow.js.map +1 -1
  118. package/lib/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
  119. package/lib/modelApi/table/splitTableCellHorizontally.js +54 -54
  120. package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  121. package/lib/modelApi/table/splitTableCellVertically.d.ts +5 -5
  122. package/lib/modelApi/table/splitTableCellVertically.js +53 -53
  123. package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
  124. package/lib/publicApi/block/setAlignment.d.ts +7 -7
  125. package/lib/publicApi/block/setAlignment.js +16 -16
  126. package/lib/publicApi/block/setAlignment.js.map +1 -1
  127. package/lib/publicApi/block/setDirection.d.ts +7 -7
  128. package/lib/publicApi/block/setDirection.js +16 -16
  129. package/lib/publicApi/block/setDirection.js.map +1 -1
  130. package/lib/publicApi/block/setHeadingLevel.d.ts +7 -7
  131. package/lib/publicApi/block/setHeadingLevel.js +50 -50
  132. package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
  133. package/lib/publicApi/block/setIndentation.d.ts +8 -8
  134. package/lib/publicApi/block/setIndentation.js +21 -25
  135. package/lib/publicApi/block/setIndentation.js.map +1 -1
  136. package/lib/publicApi/block/setParagraphMargin.d.ts +9 -9
  137. package/lib/publicApi/block/setParagraphMargin.js +33 -33
  138. package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
  139. package/lib/publicApi/block/setSpacing.d.ts +7 -7
  140. package/lib/publicApi/block/setSpacing.js +21 -21
  141. package/lib/publicApi/block/setSpacing.js.map +1 -1
  142. package/lib/publicApi/block/toggleBlockQuote.d.ts +9 -9
  143. package/lib/publicApi/block/toggleBlockQuote.js +39 -39
  144. package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
  145. package/lib/publicApi/entity/insertEntity.d.ts +25 -25
  146. package/lib/publicApi/entity/insertEntity.js +67 -67
  147. package/lib/publicApi/entity/insertEntity.js.map +1 -1
  148. package/lib/publicApi/format/clearFormat.d.ts +6 -6
  149. package/lib/publicApi/format/clearFormat.js +34 -34
  150. package/lib/publicApi/format/clearFormat.js.map +1 -1
  151. package/lib/publicApi/format/getFormatState.d.ts +7 -7
  152. package/lib/publicApi/format/getFormatState.js +31 -31
  153. package/lib/publicApi/format/getFormatState.js.map +1 -1
  154. package/lib/publicApi/image/adjustImageSelection.d.ts +6 -6
  155. package/lib/publicApi/image/adjustImageSelection.js +29 -29
  156. package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
  157. package/lib/publicApi/image/changeImage.d.ts +7 -7
  158. package/lib/publicApi/image/changeImage.js +35 -35
  159. package/lib/publicApi/image/changeImage.js.map +1 -1
  160. package/lib/publicApi/image/insertImage.d.ts +7 -7
  161. package/lib/publicApi/image/insertImage.js +38 -38
  162. package/lib/publicApi/image/insertImage.js.map +1 -1
  163. package/lib/publicApi/image/setImageAltText.d.ts +8 -8
  164. package/lib/publicApi/image/setImageAltText.js +17 -17
  165. package/lib/publicApi/image/setImageAltText.js.map +1 -1
  166. package/lib/publicApi/image/setImageBorder.d.ts +9 -9
  167. package/lib/publicApi/image/setImageBorder.js +19 -19
  168. package/lib/publicApi/image/setImageBorder.js.map +1 -1
  169. package/lib/publicApi/image/setImageBoxShadow.d.ts +8 -8
  170. package/lib/publicApi/image/setImageBoxShadow.js +29 -29
  171. package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
  172. package/lib/publicApi/link/adjustLinkSelection.d.ts +6 -6
  173. package/lib/publicApi/link/adjustLinkSelection.js +34 -34
  174. package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
  175. package/lib/publicApi/link/insertLink.d.ts +15 -15
  176. package/lib/publicApi/link/insertLink.js +120 -120
  177. package/lib/publicApi/link/insertLink.js.map +1 -1
  178. package/lib/publicApi/link/removeLink.d.ts +8 -8
  179. package/lib/publicApi/link/removeLink.js +32 -32
  180. package/lib/publicApi/link/removeLink.js.map +1 -1
  181. package/lib/publicApi/list/setListStartNumber.d.ts +7 -7
  182. package/lib/publicApi/list/setListStartNumber.js +18 -18
  183. package/lib/publicApi/list/setListStartNumber.js.map +1 -1
  184. package/lib/publicApi/list/setListStyle.d.ts +7 -7
  185. package/lib/publicApi/list/setListStyle.js +18 -18
  186. package/lib/publicApi/list/setListStyle.js.map +1 -1
  187. package/lib/publicApi/list/toggleBullet.d.ts +9 -9
  188. package/lib/publicApi/list/toggleBullet.js +22 -22
  189. package/lib/publicApi/list/toggleBullet.js.map +1 -1
  190. package/lib/publicApi/list/toggleNumbering.d.ts +9 -9
  191. package/lib/publicApi/list/toggleNumbering.js +22 -22
  192. package/lib/publicApi/list/toggleNumbering.js.map +1 -1
  193. package/lib/publicApi/segment/applySegmentFormat.d.ts +7 -7
  194. package/lib/publicApi/segment/applySegmentFormat.js +23 -23
  195. package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
  196. package/lib/publicApi/segment/changeCapitalization.d.ts +10 -10
  197. package/lib/publicApi/segment/changeCapitalization.js +49 -49
  198. package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
  199. package/lib/publicApi/segment/changeFontSize.d.ts +8 -8
  200. package/lib/publicApi/segment/changeFontSize.js +63 -63
  201. package/lib/publicApi/segment/changeFontSize.js.map +1 -1
  202. package/lib/publicApi/segment/setBackgroundColor.d.ts +7 -7
  203. package/lib/publicApi/segment/setBackgroundColor.js +35 -35
  204. package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
  205. package/lib/publicApi/segment/setFontName.d.ts +7 -7
  206. package/lib/publicApi/segment/setFontName.js +19 -19
  207. package/lib/publicApi/segment/setFontName.js.map +1 -1
  208. package/lib/publicApi/segment/setFontSize.d.ts +12 -12
  209. package/lib/publicApi/segment/setFontSize.js +33 -33
  210. package/lib/publicApi/segment/setFontSize.js.map +1 -1
  211. package/lib/publicApi/segment/setTextColor.d.ts +7 -7
  212. package/lib/publicApi/segment/setTextColor.js +26 -26
  213. package/lib/publicApi/segment/setTextColor.js.map +1 -1
  214. package/lib/publicApi/segment/splitTextSegment.d.ts +10 -10
  215. package/lib/publicApi/segment/splitTextSegment.js +30 -30
  216. package/lib/publicApi/segment/splitTextSegment.js.map +1 -1
  217. package/lib/publicApi/segment/toggleBold.d.ts +6 -6
  218. package/lib/publicApi/segment/toggleBold.js +27 -27
  219. package/lib/publicApi/segment/toggleBold.js.map +1 -1
  220. package/lib/publicApi/segment/toggleCode.d.ts +6 -6
  221. package/lib/publicApi/segment/toggleCode.js +28 -28
  222. package/lib/publicApi/segment/toggleCode.js.map +1 -1
  223. package/lib/publicApi/segment/toggleItalic.d.ts +6 -6
  224. package/lib/publicApi/segment/toggleItalic.js +21 -21
  225. package/lib/publicApi/segment/toggleItalic.js.map +1 -1
  226. package/lib/publicApi/segment/toggleStrikethrough.d.ts +6 -6
  227. package/lib/publicApi/segment/toggleStrikethrough.js +15 -15
  228. package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
  229. package/lib/publicApi/segment/toggleSubscript.d.ts +6 -6
  230. package/lib/publicApi/segment/toggleSubscript.js +15 -15
  231. package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
  232. package/lib/publicApi/segment/toggleSuperscript.d.ts +6 -6
  233. package/lib/publicApi/segment/toggleSuperscript.js +15 -15
  234. package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
  235. package/lib/publicApi/segment/toggleUnderline.d.ts +6 -6
  236. package/lib/publicApi/segment/toggleUnderline.js +24 -24
  237. package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
  238. package/lib/publicApi/table/applyTableBorderFormat.d.ts +8 -8
  239. package/lib/publicApi/table/applyTableBorderFormat.js +297 -297
  240. package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
  241. package/lib/publicApi/table/editTable.d.ts +7 -7
  242. package/lib/publicApi/table/editTable.js +95 -95
  243. package/lib/publicApi/table/editTable.js.map +1 -1
  244. package/lib/publicApi/table/formatTable.d.ts +8 -8
  245. package/lib/publicApi/table/formatTable.js +38 -38
  246. package/lib/publicApi/table/formatTable.js.map +1 -1
  247. package/lib/publicApi/table/insertTable.d.ts +12 -11
  248. package/lib/publicApi/table/insertTable.js +76 -52
  249. package/lib/publicApi/table/insertTable.js.map +1 -1
  250. package/lib/publicApi/table/setTableCellShade.d.ts +7 -7
  251. package/lib/publicApi/table/setTableCellShade.js +32 -32
  252. package/lib/publicApi/table/setTableCellShade.js.map +1 -1
  253. package/lib/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
  254. package/lib/publicApi/utils/createEditorContextForEntity.js +29 -29
  255. package/lib/publicApi/utils/createEditorContextForEntity.js.map +1 -1
  256. package/lib/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
  257. package/lib/publicApi/utils/formatImageWithContentModel.js +18 -18
  258. package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  259. package/lib/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
  260. package/lib/publicApi/utils/formatInsertPointWithContentModel.js +130 -130
  261. package/lib/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
  262. package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
  263. package/lib/publicApi/utils/formatParagraphWithContentModel.js +23 -23
  264. package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  265. package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
  266. package/lib/publicApi/utils/formatSegmentWithContentModel.js +117 -114
  267. package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  268. package/lib/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
  269. package/lib/publicApi/utils/formatTableWithContentModel.js +46 -46
  270. package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  271. package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
  272. package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +34 -34
  273. package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
  274. package/lib-amd/index.d.ts +63 -63
  275. package/lib-amd/index.js +69 -69
  276. package/lib-amd/index.js.map +1 -1
  277. package/lib-amd/modelApi/block/setModelAlignment.d.ts +5 -5
  278. package/lib-amd/modelApi/block/setModelAlignment.js +64 -64
  279. package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
  280. package/lib-amd/modelApi/block/setModelDirection.d.ts +5 -5
  281. package/lib-amd/modelApi/block/setModelDirection.js +112 -108
  282. package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
  283. package/lib-amd/modelApi/block/setModelIndentation.d.ts +8 -8
  284. package/lib-amd/modelApi/block/setModelIndentation.js +154 -148
  285. package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
  286. package/lib-amd/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
  287. package/lib-amd/modelApi/block/splitSelectedParagraphByBr.js +71 -71
  288. package/lib-amd/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
  289. package/lib-amd/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
  290. package/lib-amd/modelApi/block/toggleModelBlockQuote.js +52 -52
  291. package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  292. package/lib-amd/modelApi/common/adjustIndentation.d.ts +13 -13
  293. package/lib-amd/modelApi/common/adjustIndentation.js +114 -114
  294. package/lib-amd/modelApi/common/adjustIndentation.js.map +1 -1
  295. package/lib-amd/modelApi/common/clearModelFormat.d.ts +5 -5
  296. package/lib-amd/modelApi/common/clearModelFormat.js +142 -142
  297. package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
  298. package/lib-amd/modelApi/common/queryContentModelBlocks.d.ts +10 -10
  299. package/lib-amd/modelApi/common/queryContentModelBlocks.js +87 -87
  300. package/lib-amd/modelApi/common/queryContentModelBlocks.js.map +1 -1
  301. package/lib-amd/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
  302. package/lib-amd/modelApi/common/reducedModelChildProcessor.js +63 -63
  303. package/lib-amd/modelApi/common/reducedModelChildProcessor.js.map +1 -1
  304. package/lib-amd/modelApi/common/wrapBlock.d.ts +16 -16
  305. package/lib-amd/modelApi/common/wrapBlock.js +52 -52
  306. package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
  307. package/lib-amd/modelApi/entity/insertEntityModel.d.ts +5 -5
  308. package/lib-amd/modelApi/entity/insertEntityModel.js +105 -105
  309. package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
  310. package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +5 -5
  311. package/lib-amd/modelApi/image/applyImageBorderFormat.js +58 -58
  312. package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
  313. package/lib-amd/modelApi/link/getLinkUrl.d.ts +5 -5
  314. package/lib-amd/modelApi/link/getLinkUrl.js +29 -29
  315. package/lib-amd/modelApi/link/getLinkUrl.js.map +1 -1
  316. package/lib-amd/modelApi/link/matchLink.d.ts +12 -12
  317. package/lib-amd/modelApi/link/matchLink.js +93 -93
  318. package/lib-amd/modelApi/link/matchLink.js.map +1 -1
  319. package/lib-amd/modelApi/link/promoteLink.d.ts +20 -20
  320. package/lib-amd/modelApi/link/promoteLink.js +54 -54
  321. package/lib-amd/modelApi/link/promoteLink.js.map +1 -1
  322. package/lib-amd/modelApi/list/findListItemsInSameThread.d.ts +13 -13
  323. package/lib-amd/modelApi/list/findListItemsInSameThread.js +115 -115
  324. package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
  325. package/lib-amd/modelApi/list/getListAnnounceData.d.ts +7 -7
  326. package/lib-amd/modelApi/list/getListAnnounceData.js +68 -68
  327. package/lib-amd/modelApi/list/getListAnnounceData.js.map +1 -1
  328. package/lib-amd/modelApi/list/setListType.d.ts +8 -8
  329. package/lib-amd/modelApi/list/setListType.js +116 -115
  330. package/lib-amd/modelApi/list/setListType.js.map +1 -1
  331. package/lib-amd/modelApi/list/setModelListStartNumber.d.ts +7 -7
  332. package/lib-amd/modelApi/list/setModelListStartNumber.js +22 -22
  333. package/lib-amd/modelApi/list/setModelListStartNumber.js.map +1 -1
  334. package/lib-amd/modelApi/list/setModelListStyle.d.ts +7 -7
  335. package/lib-amd/modelApi/list/setModelListStyle.js +25 -25
  336. package/lib-amd/modelApi/list/setModelListStyle.js.map +1 -1
  337. package/lib-amd/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
  338. package/lib-amd/modelApi/selection/adjustSegmentSelection.js +48 -48
  339. package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  340. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
  341. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js +56 -56
  342. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  343. package/lib-amd/modelApi/selection/adjustWordSelection.d.ts +8 -8
  344. package/lib-amd/modelApi/selection/adjustWordSelection.js +123 -123
  345. package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
  346. package/lib-amd/modelApi/selection/collapseTableSelection.d.ts +5 -5
  347. package/lib-amd/modelApi/selection/collapseTableSelection.js +17 -17
  348. package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
  349. package/lib-amd/modelApi/table/alignTable.d.ts +5 -5
  350. package/lib-amd/modelApi/table/alignTable.js +13 -13
  351. package/lib-amd/modelApi/table/alignTable.js.map +1 -1
  352. package/lib-amd/modelApi/table/alignTableCell.d.ts +9 -9
  353. package/lib-amd/modelApi/table/alignTableCell.js +58 -58
  354. package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
  355. package/lib-amd/modelApi/table/canMergeCells.d.ts +5 -5
  356. package/lib-amd/modelApi/table/canMergeCells.js +58 -58
  357. package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
  358. package/lib-amd/modelApi/table/clearSelectedCells.d.ts +7 -7
  359. package/lib-amd/modelApi/table/clearSelectedCells.js +30 -30
  360. package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
  361. package/lib-amd/modelApi/table/createTableStructure.d.ts +5 -5
  362. package/lib-amd/modelApi/table/createTableStructure.js +20 -20
  363. package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
  364. package/lib-amd/modelApi/table/deleteTable.d.ts +5 -5
  365. package/lib-amd/modelApi/table/deleteTable.js +12 -12
  366. package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
  367. package/lib-amd/modelApi/table/deleteTableColumn.d.ts +5 -5
  368. package/lib-amd/modelApi/table/deleteTableColumn.js +24 -24
  369. package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
  370. package/lib-amd/modelApi/table/deleteTableRow.d.ts +5 -5
  371. package/lib-amd/modelApi/table/deleteTableRow.js +23 -23
  372. package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
  373. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
  374. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js +57 -57
  375. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  376. package/lib-amd/modelApi/table/insertTableColumn.d.ts +7 -7
  377. package/lib-amd/modelApi/table/insertTableColumn.js +27 -27
  378. package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
  379. package/lib-amd/modelApi/table/insertTableRow.d.ts +7 -7
  380. package/lib-amd/modelApi/table/insertTableRow.js +30 -30
  381. package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
  382. package/lib-amd/modelApi/table/mergeTableCells.d.ts +5 -5
  383. package/lib-amd/modelApi/table/mergeTableCells.js +25 -25
  384. package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
  385. package/lib-amd/modelApi/table/mergeTableColumn.d.ts +5 -5
  386. package/lib-amd/modelApi/table/mergeTableColumn.js +35 -35
  387. package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
  388. package/lib-amd/modelApi/table/mergeTableRow.d.ts +5 -5
  389. package/lib-amd/modelApi/table/mergeTableRow.js +35 -35
  390. package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
  391. package/lib-amd/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
  392. package/lib-amd/modelApi/table/splitTableCellHorizontally.js +54 -54
  393. package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  394. package/lib-amd/modelApi/table/splitTableCellVertically.d.ts +5 -5
  395. package/lib-amd/modelApi/table/splitTableCellVertically.js +53 -53
  396. package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
  397. package/lib-amd/publicApi/block/setAlignment.d.ts +7 -7
  398. package/lib-amd/publicApi/block/setAlignment.js +17 -17
  399. package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
  400. package/lib-amd/publicApi/block/setDirection.d.ts +7 -7
  401. package/lib-amd/publicApi/block/setDirection.js +17 -17
  402. package/lib-amd/publicApi/block/setDirection.js.map +1 -1
  403. package/lib-amd/publicApi/block/setHeadingLevel.d.ts +7 -7
  404. package/lib-amd/publicApi/block/setHeadingLevel.js +51 -51
  405. package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
  406. package/lib-amd/publicApi/block/setIndentation.d.ts +8 -8
  407. package/lib-amd/publicApi/block/setIndentation.js +22 -25
  408. package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
  409. package/lib-amd/publicApi/block/setParagraphMargin.d.ts +9 -9
  410. package/lib-amd/publicApi/block/setParagraphMargin.js +33 -33
  411. package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
  412. package/lib-amd/publicApi/block/setSpacing.d.ts +7 -7
  413. package/lib-amd/publicApi/block/setSpacing.js +22 -22
  414. package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
  415. package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +9 -9
  416. package/lib-amd/publicApi/block/toggleBlockQuote.js +39 -39
  417. package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
  418. package/lib-amd/publicApi/entity/insertEntity.d.ts +25 -25
  419. package/lib-amd/publicApi/entity/insertEntity.js +66 -66
  420. package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
  421. package/lib-amd/publicApi/format/clearFormat.d.ts +6 -6
  422. package/lib-amd/publicApi/format/clearFormat.js +34 -34
  423. package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
  424. package/lib-amd/publicApi/format/getFormatState.d.ts +7 -7
  425. package/lib-amd/publicApi/format/getFormatState.js +31 -31
  426. package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
  427. package/lib-amd/publicApi/image/adjustImageSelection.d.ts +6 -6
  428. package/lib-amd/publicApi/image/adjustImageSelection.js +29 -29
  429. package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
  430. package/lib-amd/publicApi/image/changeImage.d.ts +7 -7
  431. package/lib-amd/publicApi/image/changeImage.js +35 -35
  432. package/lib-amd/publicApi/image/changeImage.js.map +1 -1
  433. package/lib-amd/publicApi/image/insertImage.d.ts +7 -7
  434. package/lib-amd/publicApi/image/insertImage.js +39 -39
  435. package/lib-amd/publicApi/image/insertImage.js.map +1 -1
  436. package/lib-amd/publicApi/image/setImageAltText.d.ts +8 -8
  437. package/lib-amd/publicApi/image/setImageAltText.js +18 -18
  438. package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
  439. package/lib-amd/publicApi/image/setImageBorder.d.ts +9 -9
  440. package/lib-amd/publicApi/image/setImageBorder.js +19 -19
  441. package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
  442. package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +8 -8
  443. package/lib-amd/publicApi/image/setImageBoxShadow.js +30 -30
  444. package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
  445. package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +6 -6
  446. package/lib-amd/publicApi/link/adjustLinkSelection.js +33 -33
  447. package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
  448. package/lib-amd/publicApi/link/insertLink.d.ts +15 -15
  449. package/lib-amd/publicApi/link/insertLink.js +118 -118
  450. package/lib-amd/publicApi/link/insertLink.js.map +1 -1
  451. package/lib-amd/publicApi/link/removeLink.d.ts +8 -8
  452. package/lib-amd/publicApi/link/removeLink.js +32 -32
  453. package/lib-amd/publicApi/link/removeLink.js.map +1 -1
  454. package/lib-amd/publicApi/list/setListStartNumber.d.ts +7 -7
  455. package/lib-amd/publicApi/list/setListStartNumber.js +19 -19
  456. package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
  457. package/lib-amd/publicApi/list/setListStyle.d.ts +7 -7
  458. package/lib-amd/publicApi/list/setListStyle.js +19 -19
  459. package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
  460. package/lib-amd/publicApi/list/toggleBullet.d.ts +9 -9
  461. package/lib-amd/publicApi/list/toggleBullet.js +23 -23
  462. package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
  463. package/lib-amd/publicApi/list/toggleNumbering.d.ts +9 -9
  464. package/lib-amd/publicApi/list/toggleNumbering.js +23 -23
  465. package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
  466. package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +7 -7
  467. package/lib-amd/publicApi/segment/applySegmentFormat.js +24 -24
  468. package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
  469. package/lib-amd/publicApi/segment/changeCapitalization.d.ts +10 -10
  470. package/lib-amd/publicApi/segment/changeCapitalization.js +50 -50
  471. package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
  472. package/lib-amd/publicApi/segment/changeFontSize.d.ts +8 -8
  473. package/lib-amd/publicApi/segment/changeFontSize.js +62 -62
  474. package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
  475. package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +7 -7
  476. package/lib-amd/publicApi/segment/setBackgroundColor.js +35 -35
  477. package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
  478. package/lib-amd/publicApi/segment/setFontName.d.ts +7 -7
  479. package/lib-amd/publicApi/segment/setFontName.js +20 -20
  480. package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
  481. package/lib-amd/publicApi/segment/setFontSize.d.ts +12 -12
  482. package/lib-amd/publicApi/segment/setFontSize.js +34 -34
  483. package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
  484. package/lib-amd/publicApi/segment/setTextColor.d.ts +7 -7
  485. package/lib-amd/publicApi/segment/setTextColor.js +27 -27
  486. package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
  487. package/lib-amd/publicApi/segment/splitTextSegment.d.ts +10 -10
  488. package/lib-amd/publicApi/segment/splitTextSegment.js +30 -30
  489. package/lib-amd/publicApi/segment/splitTextSegment.js.map +1 -1
  490. package/lib-amd/publicApi/segment/toggleBold.d.ts +6 -6
  491. package/lib-amd/publicApi/segment/toggleBold.js +27 -27
  492. package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
  493. package/lib-amd/publicApi/segment/toggleCode.d.ts +6 -6
  494. package/lib-amd/publicApi/segment/toggleCode.js +28 -28
  495. package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
  496. package/lib-amd/publicApi/segment/toggleItalic.d.ts +6 -6
  497. package/lib-amd/publicApi/segment/toggleItalic.js +22 -22
  498. package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
  499. package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +6 -6
  500. package/lib-amd/publicApi/segment/toggleStrikethrough.js +16 -16
  501. package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
  502. package/lib-amd/publicApi/segment/toggleSubscript.d.ts +6 -6
  503. package/lib-amd/publicApi/segment/toggleSubscript.js +16 -16
  504. package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
  505. package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +6 -6
  506. package/lib-amd/publicApi/segment/toggleSuperscript.js +16 -16
  507. package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
  508. package/lib-amd/publicApi/segment/toggleUnderline.d.ts +6 -6
  509. package/lib-amd/publicApi/segment/toggleUnderline.js +25 -25
  510. package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
  511. package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +8 -8
  512. package/lib-amd/publicApi/table/applyTableBorderFormat.js +297 -297
  513. package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
  514. package/lib-amd/publicApi/table/editTable.d.ts +7 -7
  515. package/lib-amd/publicApi/table/editTable.js +84 -84
  516. package/lib-amd/publicApi/table/editTable.js.map +1 -1
  517. package/lib-amd/publicApi/table/formatTable.d.ts +8 -8
  518. package/lib-amd/publicApi/table/formatTable.js +38 -38
  519. package/lib-amd/publicApi/table/formatTable.js.map +1 -1
  520. package/lib-amd/publicApi/table/insertTable.d.ts +12 -11
  521. package/lib-amd/publicApi/table/insertTable.js +74 -50
  522. package/lib-amd/publicApi/table/insertTable.js.map +1 -1
  523. package/lib-amd/publicApi/table/setTableCellShade.d.ts +7 -7
  524. package/lib-amd/publicApi/table/setTableCellShade.js +32 -32
  525. package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
  526. package/lib-amd/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
  527. package/lib-amd/publicApi/utils/createEditorContextForEntity.js +30 -30
  528. package/lib-amd/publicApi/utils/createEditorContextForEntity.js.map +1 -1
  529. package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
  530. package/lib-amd/publicApi/utils/formatImageWithContentModel.js +19 -19
  531. package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  532. package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
  533. package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js +130 -130
  534. package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
  535. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
  536. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +23 -23
  537. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  538. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
  539. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +115 -112
  540. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  541. package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
  542. package/lib-amd/publicApi/utils/formatTableWithContentModel.js +45 -45
  543. package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  544. package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
  545. package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +35 -35
  546. package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
  547. package/lib-mjs/index.d.ts +63 -63
  548. package/lib-mjs/index.js +63 -63
  549. package/lib-mjs/index.js.map +1 -1
  550. package/lib-mjs/modelApi/block/setModelAlignment.d.ts +5 -5
  551. package/lib-mjs/modelApi/block/setModelAlignment.js +61 -61
  552. package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
  553. package/lib-mjs/modelApi/block/setModelDirection.d.ts +5 -5
  554. package/lib-mjs/modelApi/block/setModelDirection.js +109 -105
  555. package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
  556. package/lib-mjs/modelApi/block/setModelIndentation.d.ts +8 -8
  557. package/lib-mjs/modelApi/block/setModelIndentation.js +154 -148
  558. package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
  559. package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
  560. package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.js +67 -67
  561. package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
  562. package/lib-mjs/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
  563. package/lib-mjs/modelApi/block/toggleModelBlockQuote.js +49 -49
  564. package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  565. package/lib-mjs/modelApi/common/adjustIndentation.d.ts +13 -13
  566. package/lib-mjs/modelApi/common/adjustIndentation.js +109 -109
  567. package/lib-mjs/modelApi/common/adjustIndentation.js.map +1 -1
  568. package/lib-mjs/modelApi/common/clearModelFormat.d.ts +5 -5
  569. package/lib-mjs/modelApi/common/clearModelFormat.js +139 -139
  570. package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
  571. package/lib-mjs/modelApi/common/queryContentModelBlocks.d.ts +10 -10
  572. package/lib-mjs/modelApi/common/queryContentModelBlocks.js +83 -83
  573. package/lib-mjs/modelApi/common/queryContentModelBlocks.js.map +1 -1
  574. package/lib-mjs/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
  575. package/lib-mjs/modelApi/common/reducedModelChildProcessor.js +59 -59
  576. package/lib-mjs/modelApi/common/reducedModelChildProcessor.js.map +1 -1
  577. package/lib-mjs/modelApi/common/wrapBlock.d.ts +16 -16
  578. package/lib-mjs/modelApi/common/wrapBlock.js +47 -47
  579. package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
  580. package/lib-mjs/modelApi/entity/insertEntityModel.d.ts +5 -5
  581. package/lib-mjs/modelApi/entity/insertEntityModel.js +101 -101
  582. package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
  583. package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +5 -5
  584. package/lib-mjs/modelApi/image/applyImageBorderFormat.js +53 -53
  585. package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
  586. package/lib-mjs/modelApi/link/getLinkUrl.d.ts +5 -5
  587. package/lib-mjs/modelApi/link/getLinkUrl.js +24 -24
  588. package/lib-mjs/modelApi/link/getLinkUrl.js.map +1 -1
  589. package/lib-mjs/modelApi/link/matchLink.d.ts +12 -12
  590. package/lib-mjs/modelApi/link/matchLink.js +89 -89
  591. package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
  592. package/lib-mjs/modelApi/link/promoteLink.d.ts +20 -20
  593. package/lib-mjs/modelApi/link/promoteLink.js +49 -49
  594. package/lib-mjs/modelApi/link/promoteLink.js.map +1 -1
  595. package/lib-mjs/modelApi/list/findListItemsInSameThread.d.ts +13 -13
  596. package/lib-mjs/modelApi/list/findListItemsInSameThread.js +109 -109
  597. package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
  598. package/lib-mjs/modelApi/list/getListAnnounceData.d.ts +7 -7
  599. package/lib-mjs/modelApi/list/getListAnnounceData.js +64 -64
  600. package/lib-mjs/modelApi/list/getListAnnounceData.js.map +1 -1
  601. package/lib-mjs/modelApi/list/setListType.d.ts +8 -8
  602. package/lib-mjs/modelApi/list/setListType.js +113 -112
  603. package/lib-mjs/modelApi/list/setListType.js.map +1 -1
  604. package/lib-mjs/modelApi/list/setModelListStartNumber.d.ts +7 -7
  605. package/lib-mjs/modelApi/list/setModelListStartNumber.js +17 -17
  606. package/lib-mjs/modelApi/list/setModelListStartNumber.js.map +1 -1
  607. package/lib-mjs/modelApi/list/setModelListStyle.d.ts +7 -7
  608. package/lib-mjs/modelApi/list/setModelListStyle.js +21 -21
  609. package/lib-mjs/modelApi/list/setModelListStyle.js.map +1 -1
  610. package/lib-mjs/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
  611. package/lib-mjs/modelApi/selection/adjustSegmentSelection.js +43 -43
  612. package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  613. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
  614. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js +52 -52
  615. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  616. package/lib-mjs/modelApi/selection/adjustWordSelection.d.ts +8 -8
  617. package/lib-mjs/modelApi/selection/adjustWordSelection.js +119 -119
  618. package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
  619. package/lib-mjs/modelApi/selection/collapseTableSelection.d.ts +5 -5
  620. package/lib-mjs/modelApi/selection/collapseTableSelection.js +12 -12
  621. package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
  622. package/lib-mjs/modelApi/table/alignTable.d.ts +5 -5
  623. package/lib-mjs/modelApi/table/alignTable.js +7 -7
  624. package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
  625. package/lib-mjs/modelApi/table/alignTableCell.d.ts +9 -9
  626. package/lib-mjs/modelApi/table/alignTableCell.js +52 -52
  627. package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
  628. package/lib-mjs/modelApi/table/canMergeCells.d.ts +5 -5
  629. package/lib-mjs/modelApi/table/canMergeCells.js +52 -52
  630. package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
  631. package/lib-mjs/modelApi/table/clearSelectedCells.d.ts +7 -7
  632. package/lib-mjs/modelApi/table/clearSelectedCells.js +25 -25
  633. package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
  634. package/lib-mjs/modelApi/table/createTableStructure.d.ts +5 -5
  635. package/lib-mjs/modelApi/table/createTableStructure.js +15 -15
  636. package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
  637. package/lib-mjs/modelApi/table/deleteTable.d.ts +5 -5
  638. package/lib-mjs/modelApi/table/deleteTable.js +6 -6
  639. package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
  640. package/lib-mjs/modelApi/table/deleteTableColumn.d.ts +5 -5
  641. package/lib-mjs/modelApi/table/deleteTableColumn.js +20 -20
  642. package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
  643. package/lib-mjs/modelApi/table/deleteTableRow.d.ts +5 -5
  644. package/lib-mjs/modelApi/table/deleteTableRow.js +19 -19
  645. package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
  646. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
  647. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js +52 -52
  648. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  649. package/lib-mjs/modelApi/table/insertTableColumn.d.ts +7 -7
  650. package/lib-mjs/modelApi/table/insertTableColumn.js +23 -23
  651. package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
  652. package/lib-mjs/modelApi/table/insertTableRow.d.ts +7 -7
  653. package/lib-mjs/modelApi/table/insertTableRow.js +27 -27
  654. package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
  655. package/lib-mjs/modelApi/table/mergeTableCells.d.ts +5 -5
  656. package/lib-mjs/modelApi/table/mergeTableCells.js +21 -21
  657. package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
  658. package/lib-mjs/modelApi/table/mergeTableColumn.d.ts +5 -5
  659. package/lib-mjs/modelApi/table/mergeTableColumn.js +31 -31
  660. package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
  661. package/lib-mjs/modelApi/table/mergeTableRow.d.ts +5 -5
  662. package/lib-mjs/modelApi/table/mergeTableRow.js +31 -31
  663. package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
  664. package/lib-mjs/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
  665. package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +50 -50
  666. package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  667. package/lib-mjs/modelApi/table/splitTableCellVertically.d.ts +5 -5
  668. package/lib-mjs/modelApi/table/splitTableCellVertically.js +49 -49
  669. package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
  670. package/lib-mjs/publicApi/block/setAlignment.d.ts +7 -7
  671. package/lib-mjs/publicApi/block/setAlignment.js +12 -12
  672. package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
  673. package/lib-mjs/publicApi/block/setDirection.d.ts +7 -7
  674. package/lib-mjs/publicApi/block/setDirection.js +12 -12
  675. package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
  676. package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +7 -7
  677. package/lib-mjs/publicApi/block/setHeadingLevel.js +46 -46
  678. package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
  679. package/lib-mjs/publicApi/block/setIndentation.d.ts +8 -8
  680. package/lib-mjs/publicApi/block/setIndentation.js +17 -21
  681. package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
  682. package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +9 -9
  683. package/lib-mjs/publicApi/block/setParagraphMargin.js +29 -29
  684. package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
  685. package/lib-mjs/publicApi/block/setSpacing.d.ts +7 -7
  686. package/lib-mjs/publicApi/block/setSpacing.js +17 -17
  687. package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
  688. package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +9 -9
  689. package/lib-mjs/publicApi/block/toggleBlockQuote.js +35 -35
  690. package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
  691. package/lib-mjs/publicApi/entity/insertEntity.d.ts +25 -25
  692. package/lib-mjs/publicApi/entity/insertEntity.js +63 -63
  693. package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
  694. package/lib-mjs/publicApi/format/clearFormat.d.ts +6 -6
  695. package/lib-mjs/publicApi/format/clearFormat.js +30 -30
  696. package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
  697. package/lib-mjs/publicApi/format/getFormatState.d.ts +7 -7
  698. package/lib-mjs/publicApi/format/getFormatState.js +27 -27
  699. package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
  700. package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +6 -6
  701. package/lib-mjs/publicApi/image/adjustImageSelection.js +25 -25
  702. package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
  703. package/lib-mjs/publicApi/image/changeImage.d.ts +7 -7
  704. package/lib-mjs/publicApi/image/changeImage.js +31 -31
  705. package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
  706. package/lib-mjs/publicApi/image/insertImage.d.ts +7 -7
  707. package/lib-mjs/publicApi/image/insertImage.js +34 -34
  708. package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
  709. package/lib-mjs/publicApi/image/setImageAltText.d.ts +8 -8
  710. package/lib-mjs/publicApi/image/setImageAltText.js +13 -13
  711. package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
  712. package/lib-mjs/publicApi/image/setImageBorder.d.ts +9 -9
  713. package/lib-mjs/publicApi/image/setImageBorder.js +15 -15
  714. package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
  715. package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +8 -8
  716. package/lib-mjs/publicApi/image/setImageBoxShadow.js +25 -25
  717. package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
  718. package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +6 -6
  719. package/lib-mjs/publicApi/link/adjustLinkSelection.js +30 -30
  720. package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
  721. package/lib-mjs/publicApi/link/insertLink.d.ts +15 -15
  722. package/lib-mjs/publicApi/link/insertLink.js +116 -116
  723. package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
  724. package/lib-mjs/publicApi/link/removeLink.d.ts +8 -8
  725. package/lib-mjs/publicApi/link/removeLink.js +28 -28
  726. package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
  727. package/lib-mjs/publicApi/list/setListStartNumber.d.ts +7 -7
  728. package/lib-mjs/publicApi/list/setListStartNumber.js +14 -14
  729. package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
  730. package/lib-mjs/publicApi/list/setListStyle.d.ts +7 -7
  731. package/lib-mjs/publicApi/list/setListStyle.js +14 -14
  732. package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
  733. package/lib-mjs/publicApi/list/toggleBullet.d.ts +9 -9
  734. package/lib-mjs/publicApi/list/toggleBullet.js +18 -18
  735. package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
  736. package/lib-mjs/publicApi/list/toggleNumbering.d.ts +9 -9
  737. package/lib-mjs/publicApi/list/toggleNumbering.js +18 -18
  738. package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
  739. package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +7 -7
  740. package/lib-mjs/publicApi/segment/applySegmentFormat.js +19 -19
  741. package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
  742. package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +10 -10
  743. package/lib-mjs/publicApi/segment/changeCapitalization.js +45 -45
  744. package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
  745. package/lib-mjs/publicApi/segment/changeFontSize.d.ts +8 -8
  746. package/lib-mjs/publicApi/segment/changeFontSize.js +59 -59
  747. package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
  748. package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +7 -7
  749. package/lib-mjs/publicApi/segment/setBackgroundColor.js +31 -31
  750. package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
  751. package/lib-mjs/publicApi/segment/setFontName.d.ts +7 -7
  752. package/lib-mjs/publicApi/segment/setFontName.js +15 -15
  753. package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
  754. package/lib-mjs/publicApi/segment/setFontSize.d.ts +12 -12
  755. package/lib-mjs/publicApi/segment/setFontSize.js +28 -28
  756. package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
  757. package/lib-mjs/publicApi/segment/setTextColor.d.ts +7 -7
  758. package/lib-mjs/publicApi/segment/setTextColor.js +22 -22
  759. package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
  760. package/lib-mjs/publicApi/segment/splitTextSegment.d.ts +10 -10
  761. package/lib-mjs/publicApi/segment/splitTextSegment.js +26 -26
  762. package/lib-mjs/publicApi/segment/splitTextSegment.js.map +1 -1
  763. package/lib-mjs/publicApi/segment/toggleBold.d.ts +6 -6
  764. package/lib-mjs/publicApi/segment/toggleBold.js +23 -23
  765. package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
  766. package/lib-mjs/publicApi/segment/toggleCode.d.ts +6 -6
  767. package/lib-mjs/publicApi/segment/toggleCode.js +24 -24
  768. package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
  769. package/lib-mjs/publicApi/segment/toggleItalic.d.ts +6 -6
  770. package/lib-mjs/publicApi/segment/toggleItalic.js +17 -17
  771. package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
  772. package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +6 -6
  773. package/lib-mjs/publicApi/segment/toggleStrikethrough.js +11 -11
  774. package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
  775. package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +6 -6
  776. package/lib-mjs/publicApi/segment/toggleSubscript.js +11 -11
  777. package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
  778. package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +6 -6
  779. package/lib-mjs/publicApi/segment/toggleSuperscript.js +11 -11
  780. package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
  781. package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +6 -6
  782. package/lib-mjs/publicApi/segment/toggleUnderline.js +20 -20
  783. package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
  784. package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +8 -8
  785. package/lib-mjs/publicApi/table/applyTableBorderFormat.js +293 -293
  786. package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
  787. package/lib-mjs/publicApi/table/editTable.d.ts +7 -7
  788. package/lib-mjs/publicApi/table/editTable.js +91 -91
  789. package/lib-mjs/publicApi/table/editTable.js.map +1 -1
  790. package/lib-mjs/publicApi/table/formatTable.d.ts +8 -8
  791. package/lib-mjs/publicApi/table/formatTable.js +34 -34
  792. package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
  793. package/lib-mjs/publicApi/table/insertTable.d.ts +12 -11
  794. package/lib-mjs/publicApi/table/insertTable.js +72 -48
  795. package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
  796. package/lib-mjs/publicApi/table/setTableCellShade.d.ts +7 -7
  797. package/lib-mjs/publicApi/table/setTableCellShade.js +28 -28
  798. package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
  799. package/lib-mjs/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
  800. package/lib-mjs/publicApi/utils/createEditorContextForEntity.js +25 -25
  801. package/lib-mjs/publicApi/utils/createEditorContextForEntity.js.map +1 -1
  802. package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
  803. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +14 -14
  804. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  805. package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
  806. package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js +126 -126
  807. package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
  808. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
  809. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +19 -19
  810. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  811. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
  812. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +113 -110
  813. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  814. package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
  815. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js +42 -42
  816. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  817. package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
  818. package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +30 -30
  819. package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
  820. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
- import type { Border, IEditor } from 'roosterjs-content-model-types';
2
- /**
3
- * Set image border style for all selected images at selection.
4
- * @param editor The editor instance
5
- * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined
6
- * its value will not be changed. Passing null instead of an object will remove the border
7
- * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
8
- */
9
- export declare function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string): void;
1
+ import type { Border, IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Set image border style for all selected images at selection.
4
+ * @param editor The editor instance
5
+ * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined
6
+ * its value will not be changed. Passing null instead of an object will remove the border
7
+ * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
8
+ */
9
+ export declare function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string): void;
@@ -1,20 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setImageBorder = void 0;
4
- var applyImageBorderFormat_1 = require("../../modelApi/image/applyImageBorderFormat");
5
- var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
6
- /**
7
- * Set image border style for all selected images at selection.
8
- * @param editor The editor instance
9
- * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined
10
- * its value will not be changed. Passing null instead of an object will remove the border
11
- * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
12
- */
13
- function setImageBorder(editor, border, borderRadius) {
14
- editor.focus();
15
- (0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBorder', function (image) {
16
- (0, applyImageBorderFormat_1.applyImageBorderFormat)(image, border, borderRadius);
17
- });
18
- }
19
- exports.setImageBorder = setImageBorder;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setImageBorder = void 0;
4
+ var applyImageBorderFormat_1 = require("../../modelApi/image/applyImageBorderFormat");
5
+ var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
6
+ /**
7
+ * Set image border style for all selected images at selection.
8
+ * @param editor The editor instance
9
+ * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined
10
+ * its value will not be changed. Passing null instead of an object will remove the border
11
+ * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
12
+ */
13
+ function setImageBorder(editor, border, borderRadius) {
14
+ editor.focus();
15
+ (0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBorder', function (image) {
16
+ (0, applyImageBorderFormat_1.applyImageBorderFormat)(image, border, borderRadius);
17
+ });
18
+ }
19
+ exports.setImageBorder = setImageBorder;
20
20
  //# sourceMappingURL=setImageBorder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;;AAAA,sFAAqF;AACrF,oFAAmF;AAGnF;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,MAAe,EAAE,MAAqB,EAAE,YAAqB;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;QAC3E,IAAA,+CAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAND,wCAMC","sourcesContent":["import { applyImageBorderFormat } from '../../modelApi/image/applyImageBorderFormat';\nimport { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport type { Border, ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image border style for all selected images at selection.\n * @param editor The editor instance\n * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined\n * its value will not be changed. Passing null instead of an object will remove the border\n * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value\n */\nexport function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\n applyImageBorderFormat(image, border, borderRadius);\n });\n}\n"]}
1
+ {"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;;AAAA,sFAAqF;AACrF,oFAAmF;AAGnF;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,MAAe,EAAE,MAAqB,EAAE,YAAqB;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;QAC3E,IAAA,+CAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAND,wCAMC","sourcesContent":["import { applyImageBorderFormat } from '../../modelApi/image/applyImageBorderFormat';\r\nimport { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\r\nimport type { Border, ContentModelImage, IEditor } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Set image border style for all selected images at selection.\r\n * @param editor The editor instance\r\n * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined\r\n * its value will not be changed. Passing null instead of an object will remove the border\r\n * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value\r\n */\r\nexport function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string) {\r\n editor.focus();\r\n\r\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\r\n applyImageBorderFormat(image, border, borderRadius);\r\n });\r\n}\r\n"]}
@@ -1,8 +1,8 @@
1
- import type { IEditor } from 'roosterjs-content-model-types';
2
- /**
3
- * Set image box shadow for all selected images at selection.
4
- * @param editor The editor instance
5
- * @param boxShadow The image box boxShadow
6
- * @param margin The image margin for all sides (eg. "4px"), null to remove margin
7
- */
8
- export declare function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Set image box shadow for all selected images at selection.
4
+ * @param editor The editor instance
5
+ * @param boxShadow The image box boxShadow
6
+ * @param margin The image margin for all sides (eg. "4px"), null to remove margin
7
+ */
8
+ export declare function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
@@ -1,30 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setImageBoxShadow = void 0;
4
- var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
5
- /**
6
- * Set image box shadow for all selected images at selection.
7
- * @param editor The editor instance
8
- * @param boxShadow The image box boxShadow
9
- * @param margin The image margin for all sides (eg. "4px"), null to remove margin
10
- */
11
- function setImageBoxShadow(editor, boxShadow, margin) {
12
- editor.focus();
13
- (0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBoxShadow', function (image) {
14
- image.format.boxShadow = boxShadow;
15
- if (margin) {
16
- image.format.marginBottom = margin;
17
- image.format.marginLeft = margin;
18
- image.format.marginRight = margin;
19
- image.format.marginTop = margin;
20
- }
21
- else if (margin === null) {
22
- delete image.format.marginBottom;
23
- delete image.format.marginLeft;
24
- delete image.format.marginRight;
25
- delete image.format.marginTop;
26
- }
27
- });
28
- }
29
- exports.setImageBoxShadow = setImageBoxShadow;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setImageBoxShadow = void 0;
4
+ var formatImageWithContentModel_1 = require("../utils/formatImageWithContentModel");
5
+ /**
6
+ * Set image box shadow for all selected images at selection.
7
+ * @param editor The editor instance
8
+ * @param boxShadow The image box boxShadow
9
+ * @param margin The image margin for all sides (eg. "4px"), null to remove margin
10
+ */
11
+ function setImageBoxShadow(editor, boxShadow, margin) {
12
+ editor.focus();
13
+ (0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageBoxShadow', function (image) {
14
+ image.format.boxShadow = boxShadow;
15
+ if (margin) {
16
+ image.format.marginBottom = margin;
17
+ image.format.marginLeft = margin;
18
+ image.format.marginRight = margin;
19
+ image.format.marginTop = margin;
20
+ }
21
+ else if (margin === null) {
22
+ delete image.format.marginBottom;
23
+ delete image.format.marginLeft;
24
+ delete image.format.marginRight;
25
+ delete image.format.marginTop;
26
+ }
27
+ });
28
+ }
29
+ exports.setImageBoxShadow = setImageBoxShadow;
30
30
  //# sourceMappingURL=setImageBoxShadow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AAGnF;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,MAAe,EAAE,SAAiB,EAAE,MAAsB;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,mBAAmB,EAAE,UAAC,KAAwB;QAC9E,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;YACnC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;YAClC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;SACnC;aAAM,IAAI,MAAM,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;YAChC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAjBD,8CAiBC","sourcesContent":["import { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image box shadow for all selected images at selection.\n * @param editor The editor instance\n * @param boxShadow The image box boxShadow\n * @param margin The image margin for all sides (eg. \"4px\"), null to remove margin\n */\nexport function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBoxShadow', (image: ContentModelImage) => {\n image.format.boxShadow = boxShadow;\n if (margin) {\n image.format.marginBottom = margin;\n image.format.marginLeft = margin;\n image.format.marginRight = margin;\n image.format.marginTop = margin;\n } else if (margin === null) {\n delete image.format.marginBottom;\n delete image.format.marginLeft;\n delete image.format.marginRight;\n delete image.format.marginTop;\n }\n });\n}\n"]}
1
+ {"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AAGnF;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,MAAe,EAAE,SAAiB,EAAE,MAAsB;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,mBAAmB,EAAE,UAAC,KAAwB;QAC9E,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;YACnC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;YAClC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;SACnC;aAAM,IAAI,MAAM,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;YAChC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAjBD,8CAiBC","sourcesContent":["import { formatImageWithContentModel } from '../utils/formatImageWithContentModel';\r\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Set image box shadow for all selected images at selection.\r\n * @param editor The editor instance\r\n * @param boxShadow The image box boxShadow\r\n * @param margin The image margin for all sides (eg. \"4px\"), null to remove margin\r\n */\r\nexport function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null) {\r\n editor.focus();\r\n\r\n formatImageWithContentModel(editor, 'setImageBoxShadow', (image: ContentModelImage) => {\r\n image.format.boxShadow = boxShadow;\r\n if (margin) {\r\n image.format.marginBottom = margin;\r\n image.format.marginLeft = margin;\r\n image.format.marginRight = margin;\r\n image.format.marginTop = margin;\r\n } else if (margin === null) {\r\n delete image.format.marginBottom;\r\n delete image.format.marginLeft;\r\n delete image.format.marginRight;\r\n delete image.format.marginTop;\r\n }\r\n });\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
- import type { IEditor } from 'roosterjs-content-model-types';
2
- /**
3
- * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
4
- * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
5
- */
6
- export declare function adjustLinkSelection(editor: IEditor): [string, string | null];
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
4
+ * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
5
+ */
6
+ export declare function adjustLinkSelection(editor: IEditor): [string, string | null];
@@ -1,35 +1,35 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.adjustLinkSelection = void 0;
4
- var adjustSegmentSelection_1 = require("../../modelApi/selection/adjustSegmentSelection");
5
- var adjustWordSelection_1 = require("../../modelApi/selection/adjustWordSelection");
6
- var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
7
- /**
8
- * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
9
- * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
10
- */
11
- function adjustLinkSelection(editor) {
12
- var text = '';
13
- var url = null;
14
- editor.formatContentModel(function (model) {
15
- var _a, _b;
16
- var changed = (0, adjustSegmentSelection_1.adjustSegmentSelection)(model, function (target) { return !!target.isSelected && !!target.link; }, function (target, ref) { return !!target.link && target.link.format.href == ref.link.format.href; });
17
- var segments = (0, roosterjs_content_model_dom_1.getSelectedSegments)(model, false /*includingFormatHolder*/, true /*mutate*/);
18
- var firstSegment = segments[0];
19
- if (segments.length == 1 && firstSegment.segmentType == 'SelectionMarker') {
20
- segments = (0, adjustWordSelection_1.adjustWordSelection)(model, firstSegment);
21
- if (segments.length > 1) {
22
- changed = true;
23
- (0, roosterjs_content_model_dom_1.setSelection)(model, segments[0], segments[segments.length - 1]);
24
- }
25
- }
26
- text = segments.map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); }).join('');
27
- url = ((_b = (_a = segments[0]) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.format.href) || null;
28
- return changed;
29
- }, {
30
- apiName: 'adjustLinkSelection',
31
- });
32
- return [text, url];
33
- }
34
- exports.adjustLinkSelection = adjustLinkSelection;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.adjustLinkSelection = void 0;
4
+ var adjustSegmentSelection_1 = require("../../modelApi/selection/adjustSegmentSelection");
5
+ var adjustWordSelection_1 = require("../../modelApi/selection/adjustWordSelection");
6
+ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
7
+ /**
8
+ * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
9
+ * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
10
+ */
11
+ function adjustLinkSelection(editor) {
12
+ var text = '';
13
+ var url = null;
14
+ editor.formatContentModel(function (model) {
15
+ var _a, _b;
16
+ var changed = (0, adjustSegmentSelection_1.adjustSegmentSelection)(model, function (target) { return !!target.isSelected && !!target.link; }, function (target, ref) { return !!target.link && target.link.format.href == ref.link.format.href; });
17
+ var segments = (0, roosterjs_content_model_dom_1.getSelectedSegments)(model, false /*includingFormatHolder*/, true /*mutate*/);
18
+ var firstSegment = segments[0];
19
+ if (segments.length == 1 && firstSegment.segmentType == 'SelectionMarker') {
20
+ segments = (0, adjustWordSelection_1.adjustWordSelection)(model, firstSegment);
21
+ if (segments.length > 1) {
22
+ changed = true;
23
+ (0, roosterjs_content_model_dom_1.setSelection)(model, segments[0], segments[segments.length - 1]);
24
+ }
25
+ }
26
+ text = segments.map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); }).join('');
27
+ url = ((_b = (_a = segments[0]) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.format.href) || null;
28
+ return changed;
29
+ }, {
30
+ apiName: 'adjustLinkSelection',
31
+ });
32
+ return [text, url];
33
+ }
34
+ exports.adjustLinkSelection = adjustLinkSelection;
35
35
  //# sourceMappingURL=adjustLinkSelection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"],"names":[],"mappings":";;;AAAA,0FAAyF;AACzF,oFAAmF;AACnF,2EAAgF;AAGhF;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAe;IAC/C,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,GAAG,GAAkB,IAAI,CAAC;IAE9B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;;QACD,IAAI,OAAO,GAAG,IAAA,+CAAsB,EAChC,KAAK,EACL,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAApC,CAAoC,EAC9C,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,IAAK,CAAC,MAAM,CAAC,IAAI,EAAjE,CAAiE,CACrF,CAAC;QACF,IAAI,QAAQ,GAAG,IAAA,iDAAmB,EAC9B,KAAK,EACL,KAAK,CAAC,yBAAyB,EAC/B,IAAI,CAAC,UAAU,CAClB,CAAC;QACF,IAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,WAAW,IAAI,iBAAiB,EAAE;YACvE,QAAQ,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAEpD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,OAAO,GAAG,IAAI,CAAC;gBACf,IAAA,0CAAY,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;aACnE;SACJ;QAED,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAvC,CAAuC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,GAAG,GAAG,CAAA,MAAA,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,KAAI,IAAI,CAAC;QAE7C,OAAO,OAAO,CAAC;IACnB,CAAC,EACD;QACI,OAAO,EAAE,qBAAqB;KACjC,CACJ,CAAC;IAEF,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AAtCD,kDAsCC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport { adjustWordSelection } from '../../modelApi/selection/adjustWordSelection';\nimport { getSelectedSegments, setSelection } from 'roosterjs-content-model-dom';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed\n * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null\n */\nexport function adjustLinkSelection(editor: IEditor): [string, string | null] {\n let text = '';\n let url: string | null = null;\n\n editor.formatContentModel(\n model => {\n let changed = adjustSegmentSelection(\n model,\n target => !!target.isSelected && !!target.link,\n (target, ref) => !!target.link && target.link.format.href == ref.link!.format.href\n );\n let segments = getSelectedSegments(\n model,\n false /*includingFormatHolder*/,\n true /*mutate*/\n );\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
+ {"version":3,"file":"adjustLinkSelection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"],"names":[],"mappings":";;;AAAA,0FAAyF;AACzF,oFAAmF;AACnF,2EAAgF;AAGhF;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAe;IAC/C,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,GAAG,GAAkB,IAAI,CAAC;IAE9B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;;QACD,IAAI,OAAO,GAAG,IAAA,+CAAsB,EAChC,KAAK,EACL,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAApC,CAAoC,EAC9C,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,IAAK,CAAC,MAAM,CAAC,IAAI,EAAjE,CAAiE,CACrF,CAAC;QACF,IAAI,QAAQ,GAAG,IAAA,iDAAmB,EAC9B,KAAK,EACL,KAAK,CAAC,yBAAyB,EAC/B,IAAI,CAAC,UAAU,CAClB,CAAC;QACF,IAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,WAAW,IAAI,iBAAiB,EAAE;YACvE,QAAQ,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAEpD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,OAAO,GAAG,IAAI,CAAC;gBACf,IAAA,0CAAY,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;aACnE;SACJ;QAED,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAvC,CAAuC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,GAAG,GAAG,CAAA,MAAA,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,KAAI,IAAI,CAAC;QAE7C,OAAO,OAAO,CAAC;IACnB,CAAC,EACD;QACI,OAAO,EAAE,qBAAqB;KACjC,CACJ,CAAC;IAEF,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AAtCD,kDAsCC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\r\nimport { adjustWordSelection } from '../../modelApi/selection/adjustWordSelection';\r\nimport { getSelectedSegments, setSelection } from 'roosterjs-content-model-dom';\r\nimport type { IEditor } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed\r\n * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null\r\n */\r\nexport function adjustLinkSelection(editor: IEditor): [string, string | null] {\r\n let text = '';\r\n let url: string | null = null;\r\n\r\n editor.formatContentModel(\r\n model => {\r\n let changed = adjustSegmentSelection(\r\n model,\r\n target => !!target.isSelected && !!target.link,\r\n (target, ref) => !!target.link && target.link.format.href == ref.link!.format.href\r\n );\r\n let segments = getSelectedSegments(\r\n model,\r\n false /*includingFormatHolder*/,\r\n true /*mutate*/\r\n );\r\n const firstSegment = segments[0];\r\n\r\n if (segments.length == 1 && firstSegment.segmentType == 'SelectionMarker') {\r\n segments = adjustWordSelection(model, firstSegment);\r\n\r\n if (segments.length > 1) {\r\n changed = true;\r\n setSelection(model, segments[0], segments[segments.length - 1]);\r\n }\r\n }\r\n\r\n text = segments.map(x => (x.segmentType == 'Text' ? x.text : '')).join('');\r\n url = segments[0]?.link?.format.href || null;\r\n\r\n return changed;\r\n },\r\n {\r\n apiName: 'adjustLinkSelection',\r\n }\r\n );\r\n\r\n return [text, url];\r\n}\r\n"]}
@@ -1,15 +1,15 @@
1
- import type { IEditor } from 'roosterjs-content-model-types';
2
- /**
3
- * Insert a hyperlink at cursor.
4
- * When there is a selection, hyperlink will be applied to the selection,
5
- * otherwise a hyperlink will be inserted to the cursor position.
6
- * @param editor Editor object
7
- * @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.
8
- * When protocol is not specified, a best matched protocol will be predicted.
9
- * @param anchorTitle Optional alt text of the link, will be shown when hover on the link
10
- * @param displayText Optional display text for the link.
11
- * @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
12
- * If specified, the display text of link will be replaced with this text.
13
- * If not specified and there wasn't a link, the link url will be used as display text.
14
- */
15
- export declare function insertLink(editor: IEditor, link: string, anchorTitle?: string, displayText?: string, target?: string): void;
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Insert a hyperlink at cursor.
4
+ * When there is a selection, hyperlink will be applied to the selection,
5
+ * otherwise a hyperlink will be inserted to the cursor position.
6
+ * @param editor Editor object
7
+ * @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.
8
+ * When protocol is not specified, a best matched protocol will be predicted.
9
+ * @param anchorTitle Optional alt text of the link, will be shown when hover on the link
10
+ * @param displayText Optional display text for the link.
11
+ * @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
12
+ * If specified, the display text of link will be replaced with this text.
13
+ * If not specified and there wasn't a link, the link url will be used as display text.
14
+ */
15
+ export declare function insertLink(editor: IEditor, link: string, anchorTitle?: string, displayText?: string, target?: string): void;
@@ -1,121 +1,121 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insertLink = void 0;
4
- var tslib_1 = require("tslib");
5
- var adjustTrailingSpaceSelection_1 = require("../../modelApi/selection/adjustTrailingSpaceSelection");
6
- var matchLink_1 = require("../../modelApi/link/matchLink");
7
- var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
8
- // Regex matching Uri scheme
9
- var URI_REGEX = /^[a-zA-Z]+:/i;
10
- // Regex matching begin of email address
11
- var MAILTO_REGEX = /^[\w.%+-]+@/i;
12
- // Regex matching begin of ftp, i.e. ftp.microsoft.com
13
- var FTP_REGEX = /^ftp\./i;
14
- /**
15
- * Insert a hyperlink at cursor.
16
- * When there is a selection, hyperlink will be applied to the selection,
17
- * otherwise a hyperlink will be inserted to the cursor position.
18
- * @param editor Editor object
19
- * @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.
20
- * When protocol is not specified, a best matched protocol will be predicted.
21
- * @param anchorTitle Optional alt text of the link, will be shown when hover on the link
22
- * @param displayText Optional display text for the link.
23
- * @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
24
- * If specified, the display text of link will be replaced with this text.
25
- * If not specified and there wasn't a link, the link url will be used as display text.
26
- */
27
- function insertLink(editor, link, anchorTitle, displayText, target) {
28
- editor.focus();
29
- var url = (checkXss(link) || '').trim();
30
- if (url) {
31
- var linkData_1 = (0, matchLink_1.matchLink)(url);
32
- var linkUrl_1 = linkData_1 ? linkData_1.normalizedUrl : applyLinkPrefix(url);
33
- var links_1 = [];
34
- var anchorNode_1;
35
- editor.formatContentModel(function (model, context) {
36
- var _a;
37
- var segments = (0, roosterjs_content_model_dom_1.getSelectedSegments)(model, false /*includingFormatHolder*/, true /*mutate*/);
38
- var originalText = segments
39
- .map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); })
40
- .join('');
41
- var text = displayText || originalText || '';
42
- if ((segments.some(function (x) { return x.segmentType != 'SelectionMarker'; }) &&
43
- originalText == text) ||
44
- (segments.length == 1 && segments[0].segmentType == 'Image')) {
45
- segments.forEach(function (x) {
46
- var link = createLink(linkUrl_1, anchorTitle, target, x.segmentType == 'Text');
47
- (0, roosterjs_content_model_dom_1.addLink)(x, link);
48
- if (x.link) {
49
- links_1.push(x.link);
50
- }
51
- });
52
- }
53
- else if (segments.every(function (x) { return x.segmentType == 'SelectionMarker'; }) ||
54
- (!!text && text != originalText)) {
55
- var segment = (0, roosterjs_content_model_dom_1.createText)(text || (linkData_1 ? linkData_1.originalUrl : url), (0, tslib_1.__assign)((0, tslib_1.__assign)({}, (_a = segments[0]) === null || _a === void 0 ? void 0 : _a.format), editor.getPendingFormat()));
56
- var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
57
- var link_1 = createLink(linkUrl_1, anchorTitle, target);
58
- (0, roosterjs_content_model_dom_1.addLink)(segment, link_1);
59
- (0, roosterjs_content_model_dom_1.addSegment)(doc, segment);
60
- if (segment.link) {
61
- links_1.push(segment.link);
62
- }
63
- (0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
64
- mergeFormat: 'mergeAll',
65
- });
66
- }
67
- (0, adjustTrailingSpaceSelection_1.adjustTrailingSpaceSelection)(model);
68
- return segments.length > 0;
69
- }, {
70
- changeSource: roosterjs_content_model_dom_1.ChangeSource.CreateLink,
71
- onNodeCreated: function (modelElement, node) {
72
- if (!anchorNode_1 && links_1.indexOf(modelElement) >= 0) {
73
- anchorNode_1 = node;
74
- }
75
- },
76
- getChangeData: function () { return anchorNode_1; },
77
- apiName: 'insertLink',
78
- });
79
- }
80
- }
81
- exports.insertLink = insertLink;
82
- var createLink = function (url, anchorTitle, target, underline) {
83
- if (underline === void 0) { underline = true; }
84
- return {
85
- dataset: {},
86
- format: {
87
- href: url,
88
- anchorTitle: anchorTitle,
89
- target: target,
90
- underline: underline,
91
- },
92
- };
93
- };
94
- function applyLinkPrefix(url) {
95
- if (!url) {
96
- return url;
97
- }
98
- // Add link prefix per rule:
99
- // (a) if the url always starts with a URI scheme, leave it as it is
100
- // (b) if the url is an email address, xxx@... add mailto: prefix
101
- // (c) if the url starts with ftp., add ftp:// prefix
102
- // (d) rest, add http:// prefix
103
- var prefix = '';
104
- if (url.search(URI_REGEX) < 0) {
105
- if (url.search(MAILTO_REGEX) == 0) {
106
- prefix = 'mailto:';
107
- }
108
- else if (url.search(FTP_REGEX) == 0) {
109
- prefix = 'ftp://';
110
- }
111
- else {
112
- // fallback to http://
113
- prefix = 'http://';
114
- }
115
- }
116
- return prefix + url;
117
- }
118
- function checkXss(link) {
119
- return link.match(/s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
120
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertLink = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var adjustTrailingSpaceSelection_1 = require("../../modelApi/selection/adjustTrailingSpaceSelection");
6
+ var matchLink_1 = require("../../modelApi/link/matchLink");
7
+ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
8
+ // Regex matching Uri scheme
9
+ var URI_REGEX = /^[a-zA-Z]+:/i;
10
+ // Regex matching begin of email address
11
+ var MAILTO_REGEX = /^[\w.%+-]+@/i;
12
+ // Regex matching begin of ftp, i.e. ftp.microsoft.com
13
+ var FTP_REGEX = /^ftp\./i;
14
+ /**
15
+ * Insert a hyperlink at cursor.
16
+ * When there is a selection, hyperlink will be applied to the selection,
17
+ * otherwise a hyperlink will be inserted to the cursor position.
18
+ * @param editor Editor object
19
+ * @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.
20
+ * When protocol is not specified, a best matched protocol will be predicted.
21
+ * @param anchorTitle Optional alt text of the link, will be shown when hover on the link
22
+ * @param displayText Optional display text for the link.
23
+ * @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
24
+ * If specified, the display text of link will be replaced with this text.
25
+ * If not specified and there wasn't a link, the link url will be used as display text.
26
+ */
27
+ function insertLink(editor, link, anchorTitle, displayText, target) {
28
+ editor.focus();
29
+ var url = (checkXss(link) || '').trim();
30
+ if (url) {
31
+ var linkData_1 = (0, matchLink_1.matchLink)(url);
32
+ var linkUrl_1 = linkData_1 ? linkData_1.normalizedUrl : applyLinkPrefix(url);
33
+ var links_1 = [];
34
+ var anchorNode_1;
35
+ editor.formatContentModel(function (model, context) {
36
+ var _a;
37
+ var segments = (0, roosterjs_content_model_dom_1.getSelectedSegments)(model, false /*includingFormatHolder*/, true /*mutate*/);
38
+ var originalText = segments
39
+ .map(function (x) { return (x.segmentType == 'Text' ? x.text : ''); })
40
+ .join('');
41
+ var text = displayText || originalText || '';
42
+ if ((segments.some(function (x) { return x.segmentType != 'SelectionMarker'; }) &&
43
+ originalText == text) ||
44
+ (segments.length == 1 && segments[0].segmentType == 'Image')) {
45
+ segments.forEach(function (x) {
46
+ var link = createLink(linkUrl_1, anchorTitle, target, x.segmentType == 'Text');
47
+ (0, roosterjs_content_model_dom_1.addLink)(x, link);
48
+ if (x.link) {
49
+ links_1.push(x.link);
50
+ }
51
+ });
52
+ }
53
+ else if (segments.every(function (x) { return x.segmentType == 'SelectionMarker'; }) ||
54
+ (!!text && text != originalText)) {
55
+ var segment = (0, roosterjs_content_model_dom_1.createText)(text || (linkData_1 ? linkData_1.originalUrl : url), (0, tslib_1.__assign)((0, tslib_1.__assign)({}, (_a = segments[0]) === null || _a === void 0 ? void 0 : _a.format), editor.getPendingFormat()));
56
+ var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
57
+ var link_1 = createLink(linkUrl_1, anchorTitle, target);
58
+ (0, roosterjs_content_model_dom_1.addLink)(segment, link_1);
59
+ (0, roosterjs_content_model_dom_1.addSegment)(doc, segment);
60
+ if (segment.link) {
61
+ links_1.push(segment.link);
62
+ }
63
+ (0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context, {
64
+ mergeFormat: 'mergeAll',
65
+ });
66
+ }
67
+ (0, adjustTrailingSpaceSelection_1.adjustTrailingSpaceSelection)(model);
68
+ return segments.length > 0;
69
+ }, {
70
+ changeSource: roosterjs_content_model_dom_1.ChangeSource.CreateLink,
71
+ onNodeCreated: function (modelElement, node) {
72
+ if (!anchorNode_1 && links_1.indexOf(modelElement) >= 0) {
73
+ anchorNode_1 = node;
74
+ }
75
+ },
76
+ getChangeData: function () { return anchorNode_1; },
77
+ apiName: 'insertLink',
78
+ });
79
+ }
80
+ }
81
+ exports.insertLink = insertLink;
82
+ var createLink = function (url, anchorTitle, target, underline) {
83
+ if (underline === void 0) { underline = true; }
84
+ return {
85
+ dataset: {},
86
+ format: {
87
+ href: url,
88
+ anchorTitle: anchorTitle,
89
+ target: target,
90
+ underline: underline,
91
+ },
92
+ };
93
+ };
94
+ function applyLinkPrefix(url) {
95
+ if (!url) {
96
+ return url;
97
+ }
98
+ // Add link prefix per rule:
99
+ // (a) if the url always starts with a URI scheme, leave it as it is
100
+ // (b) if the url is an email address, xxx@... add mailto: prefix
101
+ // (c) if the url starts with ftp., add ftp:// prefix
102
+ // (d) rest, add http:// prefix
103
+ var prefix = '';
104
+ if (url.search(URI_REGEX) < 0) {
105
+ if (url.search(MAILTO_REGEX) == 0) {
106
+ prefix = 'mailto:';
107
+ }
108
+ else if (url.search(FTP_REGEX) == 0) {
109
+ prefix = 'ftp://';
110
+ }
111
+ else {
112
+ // fallback to http://
113
+ prefix = 'http://';
114
+ }
115
+ }
116
+ return prefix + url;
117
+ }
118
+ function checkXss(link) {
119
+ return link.match(/s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
120
+ }
121
121
  //# sourceMappingURL=insertLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insertLink.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/link/insertLink.ts"],"names":[],"mappings":";;;;AAAA,sGAAqG;AACrG,2DAA0D;AAC1D,2EAQqC;AAGrC,4BAA4B;AAC5B,IAAM,SAAS,GAAG,cAAc,CAAC;AACjC,wCAAwC;AACxC,IAAM,YAAY,GAAG,cAAc,CAAC;AACpC,sDAAsD;AACtD,IAAM,SAAS,GAAG,SAAS,CAAC;AAE5B;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CACtB,MAAe,EACf,IAAY,EACZ,WAAoB,EACpB,WAAoB,EACpB,MAAe;IAEf,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,IAAI,GAAG,EAAE;QACL,IAAM,UAAQ,GAAG,IAAA,qBAAS,EAAC,GAAG,CAAC,CAAC;QAChC,IAAM,SAAO,GAAG,UAAQ,CAAC,CAAC,CAAC,UAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QACzE,IAAM,OAAK,GAAuB,EAAE,CAAC;QACrC,IAAI,YAA4B,CAAC;QAEjC,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;;YACX,IAAM,QAAQ,GAAG,IAAA,iDAAmB,EAChC,KAAK,EACL,KAAK,CAAC,yBAAyB,EAC/B,IAAI,CAAC,UAAU,CAClB,CAAC;YAEF,IAAM,YAAY,GAAG,QAAQ;iBACxB,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;iBACjD,IAAI,CAAC,EAAE,CAAC,CAAC;YACd,IAAM,IAAI,GAAG,WAAW,IAAI,YAAY,IAAI,EAAE,CAAC;YAE/C,IACI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,WAAW,IAAI,iBAAiB,EAAlC,CAAkC,CAAC;gBACnD,YAAY,IAAI,IAAI,CAAC;gBACzB,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,OAAO,CAAC,EAC9D;gBACE,QAAQ,CAAC,OAAO,CAAC,UAAA,CAAC;oBACd,IAAM,IAAI,GAAG,UAAU,CACnB,SAAO,EACP,WAAW,EACX,MAAM,EACN,CAAC,CAAC,WAAW,IAAI,MAAM,CAC1B,CAAC;oBACF,IAAA,qCAAO,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC;oBACjB,IAAI,CAAC,CAAC,IAAI,EAAE;wBACR,OAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;qBACtB;gBACL,CAAC,CAAC,CAAC;aACN;iBAAM,IACH,QAAQ,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,WAAW,IAAI,iBAAiB,EAAlC,CAAkC,CAAC;gBACvD,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,EAClC;gBACE,IAAM,OAAO,GAAG,IAAA,wCAAU,EAAC,IAAI,IAAI,CAAC,UAAQ,CAAC,CAAC,CAAC,UAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,kDACnE,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,MAAM,GACnB,MAAM,CAAC,gBAAgB,EAAE,EAC9B,CAAC;gBACH,IAAM,GAAG,GAAG,IAAA,wDAA0B,GAAE,CAAC;gBACzC,IAAM,MAAI,GAAG,UAAU,CAAC,SAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;gBAEtD,IAAA,qCAAO,EAAC,OAAO,EAAE,MAAI,CAAC,CAAC;gBACvB,IAAA,wCAAU,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBAEzB,IAAI,OAAO,CAAC,IAAI,EAAE;oBACd,OAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBAC5B;gBAED,IAAA,wCAAU,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;oBAC5B,WAAW,EAAE,UAAU;iBAC1B,CAAC,CAAC;aACN;YAED,IAAA,2DAA4B,EAAC,KAAK,CAAC,CAAC;YACpC,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,CAAC,EACD;YACI,YAAY,EAAE,0CAAY,CAAC,UAAU;YACrC,aAAa,EAAE,UAAC,YAAY,EAAE,IAAI;gBAC9B,IAAI,CAAC,YAAU,IAAI,OAAK,CAAC,OAAO,CAAC,YAAgC,CAAC,IAAI,CAAC,EAAE;oBACrE,YAAU,GAAG,IAAI,CAAC;iBACrB;YACL,CAAC;YACD,aAAa,EAAE,cAAM,OAAA,YAAU,EAAV,CAAU;YAC/B,OAAO,EAAE,YAAY;SACxB,CACJ,CAAC;KACL;AACL,CAAC;AApFD,gCAoFC;AAED,IAAM,UAAU,GAAG,UACf,GAAW,EACX,WAAoB,EACpB,MAAe,EACf,SAAyB;IAAzB,0BAAA,EAAA,gBAAyB;IAEzB,OAAO;QACH,OAAO,EAAE,EAAE;QACX,MAAM,EAAE;YACJ,IAAI,EAAE,GAAG;YACT,WAAW,aAAA;YACX,MAAM,QAAA;YACN,SAAS,EAAE,SAAS;SACvB;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,GAAW;IAChC,IAAI,CAAC,GAAG,EAAE;QACN,OAAO,GAAG,CAAC;KACd;IAED,4BAA4B;IAC5B,oEAAoE;IACpE,iEAAiE;IACjE,qDAAqD;IACrD,+BAA+B;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAC3B,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;YAC/B,MAAM,GAAG,SAAS,CAAC;SACtB;aAAM,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YACnC,MAAM,GAAG,QAAQ,CAAC;SACrB;aAAM;YACH,sBAAsB;YACtB,MAAM,GAAG,SAAS,CAAC;SACtB;KACJ;IAED,OAAO,MAAM,GAAG,GAAG,CAAC;AACxB,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC","sourcesContent":["import { adjustTrailingSpaceSelection } from '../../modelApi/selection/adjustTrailingSpaceSelection';\nimport { matchLink } from '../../modelApi/link/matchLink';\nimport {\n addLink,\n addSegment,\n ChangeSource,\n createContentModelDocument,\n createText,\n getSelectedSegments,\n mergeModel,\n} from 'roosterjs-content-model-dom';\nimport type { ContentModelLink, IEditor } from 'roosterjs-content-model-types';\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(\n model,\n false /*includingFormatHolder*/,\n true /*mutate*/\n );\n\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 (segments.length == 1 && segments[0].segmentType == 'Image')\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
+ {"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';\r\nimport { matchLink } from '../../modelApi/link/matchLink';\r\nimport {\r\n addLink,\r\n addSegment,\r\n ChangeSource,\r\n createContentModelDocument,\r\n createText,\r\n getSelectedSegments,\r\n mergeModel,\r\n} from 'roosterjs-content-model-dom';\r\nimport type { ContentModelLink, IEditor } from 'roosterjs-content-model-types';\r\n\r\n// Regex matching Uri scheme\r\nconst URI_REGEX = /^[a-zA-Z]+:/i;\r\n// Regex matching begin of email address\r\nconst MAILTO_REGEX = /^[\\w.%+-]+@/i;\r\n// Regex matching begin of ftp, i.e. ftp.microsoft.com\r\nconst FTP_REGEX = /^ftp\\./i;\r\n\r\n/**\r\n * Insert a hyperlink at cursor.\r\n * When there is a selection, hyperlink will be applied to the selection,\r\n * otherwise a hyperlink will be inserted to the cursor position.\r\n * @param editor Editor object\r\n * @param link Link address, can be http(s), mailto, notes, file, unc, ftp, news, telnet, gopher, wais.\r\n * When protocol is not specified, a best matched protocol will be predicted.\r\n * @param anchorTitle Optional alt text of the link, will be shown when hover on the link\r\n * @param displayText Optional display text for the link.\r\n * @param target Optional display target for the link (\"_blank\"|\"_self\"|\"_parent\"|\"_top\"|\"{framename}\")\r\n * If specified, the display text of link will be replaced with this text.\r\n * If not specified and there wasn't a link, the link url will be used as display text.\r\n */\r\nexport function insertLink(\r\n editor: IEditor,\r\n link: string,\r\n anchorTitle?: string,\r\n displayText?: string,\r\n target?: string\r\n) {\r\n editor.focus();\r\n\r\n const url = (checkXss(link) || '').trim();\r\n if (url) {\r\n const linkData = matchLink(url);\r\n const linkUrl = linkData ? linkData.normalizedUrl : applyLinkPrefix(url);\r\n const links: ContentModelLink[] = [];\r\n let anchorNode: Node | undefined;\r\n\r\n editor.formatContentModel(\r\n (model, context) => {\r\n const segments = getSelectedSegments(\r\n model,\r\n false /*includingFormatHolder*/,\r\n true /*mutate*/\r\n );\r\n\r\n const originalText = segments\r\n .map(x => (x.segmentType == 'Text' ? x.text : ''))\r\n .join('');\r\n const text = displayText || originalText || '';\r\n\r\n if (\r\n (segments.some(x => x.segmentType != 'SelectionMarker') &&\r\n originalText == text) ||\r\n (segments.length == 1 && segments[0].segmentType == 'Image')\r\n ) {\r\n segments.forEach(x => {\r\n const link = createLink(\r\n linkUrl,\r\n anchorTitle,\r\n target,\r\n x.segmentType == 'Text'\r\n );\r\n addLink(x, link);\r\n if (x.link) {\r\n links.push(x.link);\r\n }\r\n });\r\n } else if (\r\n segments.every(x => x.segmentType == 'SelectionMarker') ||\r\n (!!text && text != originalText)\r\n ) {\r\n const segment = createText(text || (linkData ? linkData.originalUrl : url), {\r\n ...segments[0]?.format,\r\n ...editor.getPendingFormat(),\r\n });\r\n const doc = createContentModelDocument();\r\n const link = createLink(linkUrl, anchorTitle, target);\r\n\r\n addLink(segment, link);\r\n addSegment(doc, segment);\r\n\r\n if (segment.link) {\r\n links.push(segment.link);\r\n }\r\n\r\n mergeModel(model, doc, context, {\r\n mergeFormat: 'mergeAll',\r\n });\r\n }\r\n\r\n adjustTrailingSpaceSelection(model);\r\n return segments.length > 0;\r\n },\r\n {\r\n changeSource: ChangeSource.CreateLink,\r\n onNodeCreated: (modelElement, node) => {\r\n if (!anchorNode && links.indexOf(modelElement as ContentModelLink) >= 0) {\r\n anchorNode = node;\r\n }\r\n },\r\n getChangeData: () => anchorNode,\r\n apiName: 'insertLink',\r\n }\r\n );\r\n }\r\n}\r\n\r\nconst createLink = (\r\n url: string,\r\n anchorTitle?: string,\r\n target?: string,\r\n underline: boolean = true\r\n): ContentModelLink => {\r\n return {\r\n dataset: {},\r\n format: {\r\n href: url,\r\n anchorTitle,\r\n target,\r\n underline: underline,\r\n },\r\n };\r\n};\r\n\r\nfunction applyLinkPrefix(url: string): string {\r\n if (!url) {\r\n return url;\r\n }\r\n\r\n // Add link prefix per rule:\r\n // (a) if the url always starts with a URI scheme, leave it as it is\r\n // (b) if the url is an email address, xxx@... add mailto: prefix\r\n // (c) if the url starts with ftp., add ftp:// prefix\r\n // (d) rest, add http:// prefix\r\n let prefix = '';\r\n if (url.search(URI_REGEX) < 0) {\r\n if (url.search(MAILTO_REGEX) == 0) {\r\n prefix = 'mailto:';\r\n } else if (url.search(FTP_REGEX) == 0) {\r\n prefix = 'ftp://';\r\n } else {\r\n // fallback to http://\r\n prefix = 'http://';\r\n }\r\n }\r\n\r\n return prefix + url;\r\n}\r\n\r\nfunction checkXss(link: string): string {\r\n return link.match(/s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\r\n}\r\n"]}
@@ -1,8 +1,8 @@
1
- import type { IEditor } from 'roosterjs-content-model-types';
2
- /**
3
- * Remove link at selection. If no links at selection, do nothing.
4
- * If selection contains multiple links, all of the link styles will be removed.
5
- * If only part of a link is selected, the whole link style will be removed.
6
- * @param editor The editor instance
7
- */
8
- export declare function removeLink(editor: IEditor): void;
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Remove link at selection. If no links at selection, do nothing.
4
+ * If selection contains multiple links, all of the link styles will be removed.
5
+ * If only part of a link is selected, the whole link style will be removed.
6
+ * @param editor The editor instance
7
+ */
8
+ export declare function removeLink(editor: IEditor): void;