roosterjs-content-model-api 9.45.0 → 9.45.2

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 (829) 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 -113
  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 -158
  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 +121 -117
  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 +67 -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/copyPreviousCellSegmentFormat.d.ts +5 -0
  89. package/lib/modelApi/table/copyPreviousCellSegmentFormat.js +24 -0
  90. package/lib/modelApi/table/copyPreviousCellSegmentFormat.js.map +1 -0
  91. package/lib/modelApi/table/createTableStructure.d.ts +5 -5
  92. package/lib/modelApi/table/createTableStructure.js +19 -19
  93. package/lib/modelApi/table/createTableStructure.js.map +1 -1
  94. package/lib/modelApi/table/deleteTable.d.ts +5 -5
  95. package/lib/modelApi/table/deleteTable.js +10 -10
  96. package/lib/modelApi/table/deleteTable.js.map +1 -1
  97. package/lib/modelApi/table/deleteTableColumn.d.ts +5 -5
  98. package/lib/modelApi/table/deleteTableColumn.js +24 -24
  99. package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
  100. package/lib/modelApi/table/deleteTableRow.d.ts +5 -5
  101. package/lib/modelApi/table/deleteTableRow.js +23 -23
  102. package/lib/modelApi/table/deleteTableRow.js.map +1 -1
  103. package/lib/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
  104. package/lib/modelApi/table/ensureFocusableParagraphForTable.js +56 -56
  105. package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  106. package/lib/modelApi/table/insertTableColumn.d.ts +7 -7
  107. package/lib/modelApi/table/insertTableColumn.js +29 -27
  108. package/lib/modelApi/table/insertTableColumn.js.map +1 -1
  109. package/lib/modelApi/table/insertTableRow.d.ts +7 -7
  110. package/lib/modelApi/table/insertTableRow.js +33 -31
  111. package/lib/modelApi/table/insertTableRow.js.map +1 -1
  112. package/lib/modelApi/table/mergeTableCells.d.ts +5 -5
  113. package/lib/modelApi/table/mergeTableCells.js +25 -25
  114. package/lib/modelApi/table/mergeTableCells.js.map +1 -1
  115. package/lib/modelApi/table/mergeTableColumn.d.ts +5 -5
  116. package/lib/modelApi/table/mergeTableColumn.js +35 -35
  117. package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
  118. package/lib/modelApi/table/mergeTableRow.d.ts +5 -5
  119. package/lib/modelApi/table/mergeTableRow.js +35 -35
  120. package/lib/modelApi/table/mergeTableRow.js.map +1 -1
  121. package/lib/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
  122. package/lib/modelApi/table/splitTableCellHorizontally.js +54 -54
  123. package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  124. package/lib/modelApi/table/splitTableCellVertically.d.ts +5 -5
  125. package/lib/modelApi/table/splitTableCellVertically.js +53 -53
  126. package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
  127. package/lib/publicApi/block/setAlignment.d.ts +7 -7
  128. package/lib/publicApi/block/setAlignment.js +16 -16
  129. package/lib/publicApi/block/setAlignment.js.map +1 -1
  130. package/lib/publicApi/block/setDirection.d.ts +7 -7
  131. package/lib/publicApi/block/setDirection.js +16 -16
  132. package/lib/publicApi/block/setDirection.js.map +1 -1
  133. package/lib/publicApi/block/setHeadingLevel.d.ts +7 -7
  134. package/lib/publicApi/block/setHeadingLevel.js +50 -50
  135. package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
  136. package/lib/publicApi/block/setIndentation.d.ts +8 -8
  137. package/lib/publicApi/block/setIndentation.js +21 -21
  138. package/lib/publicApi/block/setIndentation.js.map +1 -1
  139. package/lib/publicApi/block/setParagraphMargin.d.ts +9 -9
  140. package/lib/publicApi/block/setParagraphMargin.js +33 -33
  141. package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
  142. package/lib/publicApi/block/setSpacing.d.ts +7 -7
  143. package/lib/publicApi/block/setSpacing.js +21 -21
  144. package/lib/publicApi/block/setSpacing.js.map +1 -1
  145. package/lib/publicApi/block/toggleBlockQuote.d.ts +9 -9
  146. package/lib/publicApi/block/toggleBlockQuote.js +39 -39
  147. package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
  148. package/lib/publicApi/entity/insertEntity.d.ts +25 -25
  149. package/lib/publicApi/entity/insertEntity.js +67 -67
  150. package/lib/publicApi/entity/insertEntity.js.map +1 -1
  151. package/lib/publicApi/format/clearFormat.d.ts +6 -6
  152. package/lib/publicApi/format/clearFormat.js +34 -34
  153. package/lib/publicApi/format/clearFormat.js.map +1 -1
  154. package/lib/publicApi/format/getFormatState.d.ts +7 -7
  155. package/lib/publicApi/format/getFormatState.js +31 -31
  156. package/lib/publicApi/format/getFormatState.js.map +1 -1
  157. package/lib/publicApi/image/adjustImageSelection.d.ts +6 -6
  158. package/lib/publicApi/image/adjustImageSelection.js +29 -29
  159. package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
  160. package/lib/publicApi/image/changeImage.d.ts +7 -7
  161. package/lib/publicApi/image/changeImage.js +35 -35
  162. package/lib/publicApi/image/changeImage.js.map +1 -1
  163. package/lib/publicApi/image/insertImage.d.ts +7 -7
  164. package/lib/publicApi/image/insertImage.js +38 -38
  165. package/lib/publicApi/image/insertImage.js.map +1 -1
  166. package/lib/publicApi/image/setImageAltText.d.ts +8 -8
  167. package/lib/publicApi/image/setImageAltText.js +17 -17
  168. package/lib/publicApi/image/setImageAltText.js.map +1 -1
  169. package/lib/publicApi/image/setImageBorder.d.ts +9 -9
  170. package/lib/publicApi/image/setImageBorder.js +19 -19
  171. package/lib/publicApi/image/setImageBorder.js.map +1 -1
  172. package/lib/publicApi/image/setImageBoxShadow.d.ts +8 -8
  173. package/lib/publicApi/image/setImageBoxShadow.js +29 -29
  174. package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
  175. package/lib/publicApi/link/adjustLinkSelection.d.ts +6 -6
  176. package/lib/publicApi/link/adjustLinkSelection.js +34 -34
  177. package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
  178. package/lib/publicApi/link/insertLink.d.ts +15 -15
  179. package/lib/publicApi/link/insertLink.js +120 -120
  180. package/lib/publicApi/link/insertLink.js.map +1 -1
  181. package/lib/publicApi/link/removeLink.d.ts +8 -8
  182. package/lib/publicApi/link/removeLink.js +32 -32
  183. package/lib/publicApi/link/removeLink.js.map +1 -1
  184. package/lib/publicApi/list/setListStartNumber.d.ts +7 -7
  185. package/lib/publicApi/list/setListStartNumber.js +18 -18
  186. package/lib/publicApi/list/setListStartNumber.js.map +1 -1
  187. package/lib/publicApi/list/setListStyle.d.ts +7 -7
  188. package/lib/publicApi/list/setListStyle.js +18 -18
  189. package/lib/publicApi/list/setListStyle.js.map +1 -1
  190. package/lib/publicApi/list/toggleBullet.d.ts +9 -9
  191. package/lib/publicApi/list/toggleBullet.js +22 -22
  192. package/lib/publicApi/list/toggleBullet.js.map +1 -1
  193. package/lib/publicApi/list/toggleNumbering.d.ts +9 -9
  194. package/lib/publicApi/list/toggleNumbering.js +22 -22
  195. package/lib/publicApi/list/toggleNumbering.js.map +1 -1
  196. package/lib/publicApi/segment/applySegmentFormat.d.ts +7 -7
  197. package/lib/publicApi/segment/applySegmentFormat.js +23 -23
  198. package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
  199. package/lib/publicApi/segment/changeCapitalization.d.ts +10 -10
  200. package/lib/publicApi/segment/changeCapitalization.js +49 -49
  201. package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
  202. package/lib/publicApi/segment/changeFontSize.d.ts +8 -8
  203. package/lib/publicApi/segment/changeFontSize.js +63 -63
  204. package/lib/publicApi/segment/changeFontSize.js.map +1 -1
  205. package/lib/publicApi/segment/setBackgroundColor.d.ts +7 -7
  206. package/lib/publicApi/segment/setBackgroundColor.js +35 -35
  207. package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
  208. package/lib/publicApi/segment/setFontName.d.ts +7 -7
  209. package/lib/publicApi/segment/setFontName.js +19 -19
  210. package/lib/publicApi/segment/setFontName.js.map +1 -1
  211. package/lib/publicApi/segment/setFontSize.d.ts +12 -12
  212. package/lib/publicApi/segment/setFontSize.js +33 -33
  213. package/lib/publicApi/segment/setFontSize.js.map +1 -1
  214. package/lib/publicApi/segment/setTextColor.d.ts +7 -7
  215. package/lib/publicApi/segment/setTextColor.js +26 -26
  216. package/lib/publicApi/segment/setTextColor.js.map +1 -1
  217. package/lib/publicApi/segment/splitTextSegment.d.ts +10 -10
  218. package/lib/publicApi/segment/splitTextSegment.js +30 -30
  219. package/lib/publicApi/segment/splitTextSegment.js.map +1 -1
  220. package/lib/publicApi/segment/toggleBold.d.ts +6 -6
  221. package/lib/publicApi/segment/toggleBold.js +27 -27
  222. package/lib/publicApi/segment/toggleBold.js.map +1 -1
  223. package/lib/publicApi/segment/toggleCode.d.ts +6 -6
  224. package/lib/publicApi/segment/toggleCode.js +28 -28
  225. package/lib/publicApi/segment/toggleCode.js.map +1 -1
  226. package/lib/publicApi/segment/toggleItalic.d.ts +6 -6
  227. package/lib/publicApi/segment/toggleItalic.js +21 -21
  228. package/lib/publicApi/segment/toggleItalic.js.map +1 -1
  229. package/lib/publicApi/segment/toggleStrikethrough.d.ts +6 -6
  230. package/lib/publicApi/segment/toggleStrikethrough.js +15 -15
  231. package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
  232. package/lib/publicApi/segment/toggleSubscript.d.ts +6 -6
  233. package/lib/publicApi/segment/toggleSubscript.js +15 -15
  234. package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
  235. package/lib/publicApi/segment/toggleSuperscript.d.ts +6 -6
  236. package/lib/publicApi/segment/toggleSuperscript.js +15 -15
  237. package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
  238. package/lib/publicApi/segment/toggleUnderline.d.ts +6 -6
  239. package/lib/publicApi/segment/toggleUnderline.js +24 -24
  240. package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
  241. package/lib/publicApi/table/applyTableBorderFormat.d.ts +8 -8
  242. package/lib/publicApi/table/applyTableBorderFormat.js +297 -297
  243. package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
  244. package/lib/publicApi/table/editTable.d.ts +7 -7
  245. package/lib/publicApi/table/editTable.js +95 -95
  246. package/lib/publicApi/table/editTable.js.map +1 -1
  247. package/lib/publicApi/table/formatTable.d.ts +8 -8
  248. package/lib/publicApi/table/formatTable.js +38 -38
  249. package/lib/publicApi/table/formatTable.js.map +1 -1
  250. package/lib/publicApi/table/insertTable.d.ts +12 -12
  251. package/lib/publicApi/table/insertTable.js +76 -76
  252. package/lib/publicApi/table/insertTable.js.map +1 -1
  253. package/lib/publicApi/table/setTableCellShade.d.ts +7 -7
  254. package/lib/publicApi/table/setTableCellShade.js +32 -32
  255. package/lib/publicApi/table/setTableCellShade.js.map +1 -1
  256. package/lib/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
  257. package/lib/publicApi/utils/createEditorContextForEntity.js +29 -29
  258. package/lib/publicApi/utils/createEditorContextForEntity.js.map +1 -1
  259. package/lib/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
  260. package/lib/publicApi/utils/formatImageWithContentModel.js +18 -18
  261. package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  262. package/lib/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
  263. package/lib/publicApi/utils/formatInsertPointWithContentModel.js +130 -130
  264. package/lib/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
  265. package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
  266. package/lib/publicApi/utils/formatParagraphWithContentModel.js +23 -23
  267. package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  268. package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
  269. package/lib/publicApi/utils/formatSegmentWithContentModel.js +117 -117
  270. package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  271. package/lib/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
  272. package/lib/publicApi/utils/formatTableWithContentModel.js +46 -46
  273. package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  274. package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
  275. package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +34 -34
  276. package/lib/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
  277. package/lib-amd/index.d.ts +63 -63
  278. package/lib-amd/index.js +69 -69
  279. package/lib-amd/index.js.map +1 -1
  280. package/lib-amd/modelApi/block/setModelAlignment.d.ts +5 -5
  281. package/lib-amd/modelApi/block/setModelAlignment.js +64 -64
  282. package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
  283. package/lib-amd/modelApi/block/setModelDirection.d.ts +5 -5
  284. package/lib-amd/modelApi/block/setModelDirection.js +112 -112
  285. package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
  286. package/lib-amd/modelApi/block/setModelIndentation.d.ts +8 -8
  287. package/lib-amd/modelApi/block/setModelIndentation.js +154 -154
  288. package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
  289. package/lib-amd/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
  290. package/lib-amd/modelApi/block/splitSelectedParagraphByBr.js +71 -71
  291. package/lib-amd/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
  292. package/lib-amd/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
  293. package/lib-amd/modelApi/block/toggleModelBlockQuote.js +52 -52
  294. package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  295. package/lib-amd/modelApi/common/adjustIndentation.d.ts +13 -13
  296. package/lib-amd/modelApi/common/adjustIndentation.js +114 -114
  297. package/lib-amd/modelApi/common/adjustIndentation.js.map +1 -1
  298. package/lib-amd/modelApi/common/clearModelFormat.d.ts +5 -5
  299. package/lib-amd/modelApi/common/clearModelFormat.js +142 -142
  300. package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
  301. package/lib-amd/modelApi/common/queryContentModelBlocks.d.ts +10 -10
  302. package/lib-amd/modelApi/common/queryContentModelBlocks.js +87 -87
  303. package/lib-amd/modelApi/common/queryContentModelBlocks.js.map +1 -1
  304. package/lib-amd/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
  305. package/lib-amd/modelApi/common/reducedModelChildProcessor.js +63 -63
  306. package/lib-amd/modelApi/common/reducedModelChildProcessor.js.map +1 -1
  307. package/lib-amd/modelApi/common/wrapBlock.d.ts +16 -16
  308. package/lib-amd/modelApi/common/wrapBlock.js +52 -52
  309. package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
  310. package/lib-amd/modelApi/entity/insertEntityModel.d.ts +5 -5
  311. package/lib-amd/modelApi/entity/insertEntityModel.js +105 -105
  312. package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
  313. package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +5 -5
  314. package/lib-amd/modelApi/image/applyImageBorderFormat.js +58 -58
  315. package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
  316. package/lib-amd/modelApi/link/getLinkUrl.d.ts +5 -5
  317. package/lib-amd/modelApi/link/getLinkUrl.js +29 -29
  318. package/lib-amd/modelApi/link/getLinkUrl.js.map +1 -1
  319. package/lib-amd/modelApi/link/matchLink.d.ts +12 -12
  320. package/lib-amd/modelApi/link/matchLink.js +93 -93
  321. package/lib-amd/modelApi/link/matchLink.js.map +1 -1
  322. package/lib-amd/modelApi/link/promoteLink.d.ts +20 -20
  323. package/lib-amd/modelApi/link/promoteLink.js +54 -54
  324. package/lib-amd/modelApi/link/promoteLink.js.map +1 -1
  325. package/lib-amd/modelApi/list/findListItemsInSameThread.d.ts +13 -13
  326. package/lib-amd/modelApi/list/findListItemsInSameThread.js +115 -115
  327. package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
  328. package/lib-amd/modelApi/list/getListAnnounceData.d.ts +7 -7
  329. package/lib-amd/modelApi/list/getListAnnounceData.js +68 -68
  330. package/lib-amd/modelApi/list/getListAnnounceData.js.map +1 -1
  331. package/lib-amd/modelApi/list/setListType.d.ts +8 -8
  332. package/lib-amd/modelApi/list/setListType.js +120 -116
  333. package/lib-amd/modelApi/list/setListType.js.map +1 -1
  334. package/lib-amd/modelApi/list/setModelListStartNumber.d.ts +7 -7
  335. package/lib-amd/modelApi/list/setModelListStartNumber.js +22 -22
  336. package/lib-amd/modelApi/list/setModelListStartNumber.js.map +1 -1
  337. package/lib-amd/modelApi/list/setModelListStyle.d.ts +7 -7
  338. package/lib-amd/modelApi/list/setModelListStyle.js +25 -25
  339. package/lib-amd/modelApi/list/setModelListStyle.js.map +1 -1
  340. package/lib-amd/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
  341. package/lib-amd/modelApi/selection/adjustSegmentSelection.js +48 -48
  342. package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  343. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
  344. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js +56 -56
  345. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  346. package/lib-amd/modelApi/selection/adjustWordSelection.d.ts +8 -8
  347. package/lib-amd/modelApi/selection/adjustWordSelection.js +123 -123
  348. package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
  349. package/lib-amd/modelApi/selection/collapseTableSelection.d.ts +5 -5
  350. package/lib-amd/modelApi/selection/collapseTableSelection.js +17 -17
  351. package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
  352. package/lib-amd/modelApi/table/alignTable.d.ts +5 -5
  353. package/lib-amd/modelApi/table/alignTable.js +13 -13
  354. package/lib-amd/modelApi/table/alignTable.js.map +1 -1
  355. package/lib-amd/modelApi/table/alignTableCell.d.ts +9 -9
  356. package/lib-amd/modelApi/table/alignTableCell.js +68 -58
  357. package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
  358. package/lib-amd/modelApi/table/canMergeCells.d.ts +5 -5
  359. package/lib-amd/modelApi/table/canMergeCells.js +58 -58
  360. package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
  361. package/lib-amd/modelApi/table/clearSelectedCells.d.ts +7 -7
  362. package/lib-amd/modelApi/table/clearSelectedCells.js +30 -30
  363. package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
  364. package/lib-amd/modelApi/table/copyPreviousCellSegmentFormat.d.ts +5 -0
  365. package/lib-amd/modelApi/table/copyPreviousCellSegmentFormat.js +25 -0
  366. package/lib-amd/modelApi/table/copyPreviousCellSegmentFormat.js.map +1 -0
  367. package/lib-amd/modelApi/table/createTableStructure.d.ts +5 -5
  368. package/lib-amd/modelApi/table/createTableStructure.js +20 -20
  369. package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
  370. package/lib-amd/modelApi/table/deleteTable.d.ts +5 -5
  371. package/lib-amd/modelApi/table/deleteTable.js +12 -12
  372. package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
  373. package/lib-amd/modelApi/table/deleteTableColumn.d.ts +5 -5
  374. package/lib-amd/modelApi/table/deleteTableColumn.js +24 -24
  375. package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
  376. package/lib-amd/modelApi/table/deleteTableRow.d.ts +5 -5
  377. package/lib-amd/modelApi/table/deleteTableRow.js +23 -23
  378. package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
  379. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
  380. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js +57 -57
  381. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  382. package/lib-amd/modelApi/table/insertTableColumn.d.ts +7 -7
  383. package/lib-amd/modelApi/table/insertTableColumn.js +28 -27
  384. package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
  385. package/lib-amd/modelApi/table/insertTableRow.d.ts +7 -7
  386. package/lib-amd/modelApi/table/insertTableRow.js +31 -30
  387. package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
  388. package/lib-amd/modelApi/table/mergeTableCells.d.ts +5 -5
  389. package/lib-amd/modelApi/table/mergeTableCells.js +25 -25
  390. package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
  391. package/lib-amd/modelApi/table/mergeTableColumn.d.ts +5 -5
  392. package/lib-amd/modelApi/table/mergeTableColumn.js +35 -35
  393. package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
  394. package/lib-amd/modelApi/table/mergeTableRow.d.ts +5 -5
  395. package/lib-amd/modelApi/table/mergeTableRow.js +35 -35
  396. package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
  397. package/lib-amd/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
  398. package/lib-amd/modelApi/table/splitTableCellHorizontally.js +54 -54
  399. package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  400. package/lib-amd/modelApi/table/splitTableCellVertically.d.ts +5 -5
  401. package/lib-amd/modelApi/table/splitTableCellVertically.js +53 -53
  402. package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
  403. package/lib-amd/publicApi/block/setAlignment.d.ts +7 -7
  404. package/lib-amd/publicApi/block/setAlignment.js +17 -17
  405. package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
  406. package/lib-amd/publicApi/block/setDirection.d.ts +7 -7
  407. package/lib-amd/publicApi/block/setDirection.js +17 -17
  408. package/lib-amd/publicApi/block/setDirection.js.map +1 -1
  409. package/lib-amd/publicApi/block/setHeadingLevel.d.ts +7 -7
  410. package/lib-amd/publicApi/block/setHeadingLevel.js +51 -51
  411. package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
  412. package/lib-amd/publicApi/block/setIndentation.d.ts +8 -8
  413. package/lib-amd/publicApi/block/setIndentation.js +22 -22
  414. package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
  415. package/lib-amd/publicApi/block/setParagraphMargin.d.ts +9 -9
  416. package/lib-amd/publicApi/block/setParagraphMargin.js +33 -33
  417. package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
  418. package/lib-amd/publicApi/block/setSpacing.d.ts +7 -7
  419. package/lib-amd/publicApi/block/setSpacing.js +22 -22
  420. package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
  421. package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +9 -9
  422. package/lib-amd/publicApi/block/toggleBlockQuote.js +39 -39
  423. package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
  424. package/lib-amd/publicApi/entity/insertEntity.d.ts +25 -25
  425. package/lib-amd/publicApi/entity/insertEntity.js +66 -66
  426. package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
  427. package/lib-amd/publicApi/format/clearFormat.d.ts +6 -6
  428. package/lib-amd/publicApi/format/clearFormat.js +34 -34
  429. package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
  430. package/lib-amd/publicApi/format/getFormatState.d.ts +7 -7
  431. package/lib-amd/publicApi/format/getFormatState.js +31 -31
  432. package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
  433. package/lib-amd/publicApi/image/adjustImageSelection.d.ts +6 -6
  434. package/lib-amd/publicApi/image/adjustImageSelection.js +29 -29
  435. package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
  436. package/lib-amd/publicApi/image/changeImage.d.ts +7 -7
  437. package/lib-amd/publicApi/image/changeImage.js +35 -35
  438. package/lib-amd/publicApi/image/changeImage.js.map +1 -1
  439. package/lib-amd/publicApi/image/insertImage.d.ts +7 -7
  440. package/lib-amd/publicApi/image/insertImage.js +39 -39
  441. package/lib-amd/publicApi/image/insertImage.js.map +1 -1
  442. package/lib-amd/publicApi/image/setImageAltText.d.ts +8 -8
  443. package/lib-amd/publicApi/image/setImageAltText.js +18 -18
  444. package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
  445. package/lib-amd/publicApi/image/setImageBorder.d.ts +9 -9
  446. package/lib-amd/publicApi/image/setImageBorder.js +19 -19
  447. package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
  448. package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +8 -8
  449. package/lib-amd/publicApi/image/setImageBoxShadow.js +30 -30
  450. package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
  451. package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +6 -6
  452. package/lib-amd/publicApi/link/adjustLinkSelection.js +33 -33
  453. package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
  454. package/lib-amd/publicApi/link/insertLink.d.ts +15 -15
  455. package/lib-amd/publicApi/link/insertLink.js +118 -118
  456. package/lib-amd/publicApi/link/insertLink.js.map +1 -1
  457. package/lib-amd/publicApi/link/removeLink.d.ts +8 -8
  458. package/lib-amd/publicApi/link/removeLink.js +32 -32
  459. package/lib-amd/publicApi/link/removeLink.js.map +1 -1
  460. package/lib-amd/publicApi/list/setListStartNumber.d.ts +7 -7
  461. package/lib-amd/publicApi/list/setListStartNumber.js +19 -19
  462. package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
  463. package/lib-amd/publicApi/list/setListStyle.d.ts +7 -7
  464. package/lib-amd/publicApi/list/setListStyle.js +19 -19
  465. package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
  466. package/lib-amd/publicApi/list/toggleBullet.d.ts +9 -9
  467. package/lib-amd/publicApi/list/toggleBullet.js +23 -23
  468. package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
  469. package/lib-amd/publicApi/list/toggleNumbering.d.ts +9 -9
  470. package/lib-amd/publicApi/list/toggleNumbering.js +23 -23
  471. package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
  472. package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +7 -7
  473. package/lib-amd/publicApi/segment/applySegmentFormat.js +24 -24
  474. package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
  475. package/lib-amd/publicApi/segment/changeCapitalization.d.ts +10 -10
  476. package/lib-amd/publicApi/segment/changeCapitalization.js +50 -50
  477. package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
  478. package/lib-amd/publicApi/segment/changeFontSize.d.ts +8 -8
  479. package/lib-amd/publicApi/segment/changeFontSize.js +62 -62
  480. package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
  481. package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +7 -7
  482. package/lib-amd/publicApi/segment/setBackgroundColor.js +35 -35
  483. package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
  484. package/lib-amd/publicApi/segment/setFontName.d.ts +7 -7
  485. package/lib-amd/publicApi/segment/setFontName.js +20 -20
  486. package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
  487. package/lib-amd/publicApi/segment/setFontSize.d.ts +12 -12
  488. package/lib-amd/publicApi/segment/setFontSize.js +34 -34
  489. package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
  490. package/lib-amd/publicApi/segment/setTextColor.d.ts +7 -7
  491. package/lib-amd/publicApi/segment/setTextColor.js +27 -27
  492. package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
  493. package/lib-amd/publicApi/segment/splitTextSegment.d.ts +10 -10
  494. package/lib-amd/publicApi/segment/splitTextSegment.js +30 -30
  495. package/lib-amd/publicApi/segment/splitTextSegment.js.map +1 -1
  496. package/lib-amd/publicApi/segment/toggleBold.d.ts +6 -6
  497. package/lib-amd/publicApi/segment/toggleBold.js +27 -27
  498. package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
  499. package/lib-amd/publicApi/segment/toggleCode.d.ts +6 -6
  500. package/lib-amd/publicApi/segment/toggleCode.js +28 -28
  501. package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
  502. package/lib-amd/publicApi/segment/toggleItalic.d.ts +6 -6
  503. package/lib-amd/publicApi/segment/toggleItalic.js +22 -22
  504. package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
  505. package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +6 -6
  506. package/lib-amd/publicApi/segment/toggleStrikethrough.js +16 -16
  507. package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
  508. package/lib-amd/publicApi/segment/toggleSubscript.d.ts +6 -6
  509. package/lib-amd/publicApi/segment/toggleSubscript.js +16 -16
  510. package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
  511. package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +6 -6
  512. package/lib-amd/publicApi/segment/toggleSuperscript.js +16 -16
  513. package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
  514. package/lib-amd/publicApi/segment/toggleUnderline.d.ts +6 -6
  515. package/lib-amd/publicApi/segment/toggleUnderline.js +25 -25
  516. package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
  517. package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +8 -8
  518. package/lib-amd/publicApi/table/applyTableBorderFormat.js +297 -297
  519. package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
  520. package/lib-amd/publicApi/table/editTable.d.ts +7 -7
  521. package/lib-amd/publicApi/table/editTable.js +84 -84
  522. package/lib-amd/publicApi/table/editTable.js.map +1 -1
  523. package/lib-amd/publicApi/table/formatTable.d.ts +8 -8
  524. package/lib-amd/publicApi/table/formatTable.js +38 -38
  525. package/lib-amd/publicApi/table/formatTable.js.map +1 -1
  526. package/lib-amd/publicApi/table/insertTable.d.ts +12 -12
  527. package/lib-amd/publicApi/table/insertTable.js +74 -74
  528. package/lib-amd/publicApi/table/insertTable.js.map +1 -1
  529. package/lib-amd/publicApi/table/setTableCellShade.d.ts +7 -7
  530. package/lib-amd/publicApi/table/setTableCellShade.js +32 -32
  531. package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
  532. package/lib-amd/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
  533. package/lib-amd/publicApi/utils/createEditorContextForEntity.js +30 -30
  534. package/lib-amd/publicApi/utils/createEditorContextForEntity.js.map +1 -1
  535. package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
  536. package/lib-amd/publicApi/utils/formatImageWithContentModel.js +19 -19
  537. package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  538. package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
  539. package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js +130 -130
  540. package/lib-amd/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
  541. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
  542. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +23 -23
  543. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  544. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
  545. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +115 -115
  546. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  547. package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
  548. package/lib-amd/publicApi/utils/formatTableWithContentModel.js +45 -45
  549. package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  550. package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
  551. package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +35 -35
  552. package/lib-amd/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
  553. package/lib-mjs/index.d.ts +63 -63
  554. package/lib-mjs/index.js +63 -63
  555. package/lib-mjs/index.js.map +1 -1
  556. package/lib-mjs/modelApi/block/setModelAlignment.d.ts +5 -5
  557. package/lib-mjs/modelApi/block/setModelAlignment.js +61 -61
  558. package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
  559. package/lib-mjs/modelApi/block/setModelDirection.d.ts +5 -5
  560. package/lib-mjs/modelApi/block/setModelDirection.js +109 -109
  561. package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
  562. package/lib-mjs/modelApi/block/setModelIndentation.d.ts +8 -8
  563. package/lib-mjs/modelApi/block/setModelIndentation.js +154 -154
  564. package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
  565. package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.d.ts +7 -7
  566. package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.js +67 -67
  567. package/lib-mjs/modelApi/block/splitSelectedParagraphByBr.js.map +1 -1
  568. package/lib-mjs/modelApi/block/toggleModelBlockQuote.d.ts +5 -5
  569. package/lib-mjs/modelApi/block/toggleModelBlockQuote.js +49 -49
  570. package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  571. package/lib-mjs/modelApi/common/adjustIndentation.d.ts +13 -13
  572. package/lib-mjs/modelApi/common/adjustIndentation.js +109 -109
  573. package/lib-mjs/modelApi/common/adjustIndentation.js.map +1 -1
  574. package/lib-mjs/modelApi/common/clearModelFormat.d.ts +5 -5
  575. package/lib-mjs/modelApi/common/clearModelFormat.js +139 -139
  576. package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
  577. package/lib-mjs/modelApi/common/queryContentModelBlocks.d.ts +10 -10
  578. package/lib-mjs/modelApi/common/queryContentModelBlocks.js +83 -83
  579. package/lib-mjs/modelApi/common/queryContentModelBlocks.js.map +1 -1
  580. package/lib-mjs/modelApi/common/reducedModelChildProcessor.d.ts +20 -20
  581. package/lib-mjs/modelApi/common/reducedModelChildProcessor.js +59 -59
  582. package/lib-mjs/modelApi/common/reducedModelChildProcessor.js.map +1 -1
  583. package/lib-mjs/modelApi/common/wrapBlock.d.ts +16 -16
  584. package/lib-mjs/modelApi/common/wrapBlock.js +47 -47
  585. package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
  586. package/lib-mjs/modelApi/entity/insertEntityModel.d.ts +5 -5
  587. package/lib-mjs/modelApi/entity/insertEntityModel.js +101 -101
  588. package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
  589. package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +5 -5
  590. package/lib-mjs/modelApi/image/applyImageBorderFormat.js +53 -53
  591. package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
  592. package/lib-mjs/modelApi/link/getLinkUrl.d.ts +5 -5
  593. package/lib-mjs/modelApi/link/getLinkUrl.js +24 -24
  594. package/lib-mjs/modelApi/link/getLinkUrl.js.map +1 -1
  595. package/lib-mjs/modelApi/link/matchLink.d.ts +12 -12
  596. package/lib-mjs/modelApi/link/matchLink.js +89 -89
  597. package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
  598. package/lib-mjs/modelApi/link/promoteLink.d.ts +20 -20
  599. package/lib-mjs/modelApi/link/promoteLink.js +49 -49
  600. package/lib-mjs/modelApi/link/promoteLink.js.map +1 -1
  601. package/lib-mjs/modelApi/list/findListItemsInSameThread.d.ts +13 -13
  602. package/lib-mjs/modelApi/list/findListItemsInSameThread.js +109 -109
  603. package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
  604. package/lib-mjs/modelApi/list/getListAnnounceData.d.ts +7 -7
  605. package/lib-mjs/modelApi/list/getListAnnounceData.js +64 -64
  606. package/lib-mjs/modelApi/list/getListAnnounceData.js.map +1 -1
  607. package/lib-mjs/modelApi/list/setListType.d.ts +8 -8
  608. package/lib-mjs/modelApi/list/setListType.js +117 -113
  609. package/lib-mjs/modelApi/list/setListType.js.map +1 -1
  610. package/lib-mjs/modelApi/list/setModelListStartNumber.d.ts +7 -7
  611. package/lib-mjs/modelApi/list/setModelListStartNumber.js +17 -17
  612. package/lib-mjs/modelApi/list/setModelListStartNumber.js.map +1 -1
  613. package/lib-mjs/modelApi/list/setModelListStyle.d.ts +7 -7
  614. package/lib-mjs/modelApi/list/setModelListStyle.js +21 -21
  615. package/lib-mjs/modelApi/list/setModelListStyle.js.map +1 -1
  616. package/lib-mjs/modelApi/selection/adjustSegmentSelection.d.ts +5 -5
  617. package/lib-mjs/modelApi/selection/adjustSegmentSelection.js +43 -43
  618. package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  619. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.d.ts +6 -6
  620. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js +52 -52
  621. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  622. package/lib-mjs/modelApi/selection/adjustWordSelection.d.ts +8 -8
  623. package/lib-mjs/modelApi/selection/adjustWordSelection.js +119 -119
  624. package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
  625. package/lib-mjs/modelApi/selection/collapseTableSelection.d.ts +5 -5
  626. package/lib-mjs/modelApi/selection/collapseTableSelection.js +12 -12
  627. package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
  628. package/lib-mjs/modelApi/table/alignTable.d.ts +5 -5
  629. package/lib-mjs/modelApi/table/alignTable.js +7 -7
  630. package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
  631. package/lib-mjs/modelApi/table/alignTableCell.d.ts +9 -9
  632. package/lib-mjs/modelApi/table/alignTableCell.js +62 -52
  633. package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
  634. package/lib-mjs/modelApi/table/canMergeCells.d.ts +5 -5
  635. package/lib-mjs/modelApi/table/canMergeCells.js +52 -52
  636. package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
  637. package/lib-mjs/modelApi/table/clearSelectedCells.d.ts +7 -7
  638. package/lib-mjs/modelApi/table/clearSelectedCells.js +25 -25
  639. package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
  640. package/lib-mjs/modelApi/table/copyPreviousCellSegmentFormat.d.ts +5 -0
  641. package/lib-mjs/modelApi/table/copyPreviousCellSegmentFormat.js +20 -0
  642. package/lib-mjs/modelApi/table/copyPreviousCellSegmentFormat.js.map +1 -0
  643. package/lib-mjs/modelApi/table/createTableStructure.d.ts +5 -5
  644. package/lib-mjs/modelApi/table/createTableStructure.js +15 -15
  645. package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
  646. package/lib-mjs/modelApi/table/deleteTable.d.ts +5 -5
  647. package/lib-mjs/modelApi/table/deleteTable.js +6 -6
  648. package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
  649. package/lib-mjs/modelApi/table/deleteTableColumn.d.ts +5 -5
  650. package/lib-mjs/modelApi/table/deleteTableColumn.js +20 -20
  651. package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
  652. package/lib-mjs/modelApi/table/deleteTableRow.d.ts +5 -5
  653. package/lib-mjs/modelApi/table/deleteTableRow.js +19 -19
  654. package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
  655. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.d.ts +8 -8
  656. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js +52 -52
  657. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  658. package/lib-mjs/modelApi/table/insertTableColumn.d.ts +7 -7
  659. package/lib-mjs/modelApi/table/insertTableColumn.js +25 -23
  660. package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
  661. package/lib-mjs/modelApi/table/insertTableRow.d.ts +7 -7
  662. package/lib-mjs/modelApi/table/insertTableRow.js +29 -27
  663. package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
  664. package/lib-mjs/modelApi/table/mergeTableCells.d.ts +5 -5
  665. package/lib-mjs/modelApi/table/mergeTableCells.js +21 -21
  666. package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
  667. package/lib-mjs/modelApi/table/mergeTableColumn.d.ts +5 -5
  668. package/lib-mjs/modelApi/table/mergeTableColumn.js +31 -31
  669. package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
  670. package/lib-mjs/modelApi/table/mergeTableRow.d.ts +5 -5
  671. package/lib-mjs/modelApi/table/mergeTableRow.js +31 -31
  672. package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
  673. package/lib-mjs/modelApi/table/splitTableCellHorizontally.d.ts +5 -5
  674. package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +50 -50
  675. package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  676. package/lib-mjs/modelApi/table/splitTableCellVertically.d.ts +5 -5
  677. package/lib-mjs/modelApi/table/splitTableCellVertically.js +49 -49
  678. package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
  679. package/lib-mjs/publicApi/block/setAlignment.d.ts +7 -7
  680. package/lib-mjs/publicApi/block/setAlignment.js +12 -12
  681. package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
  682. package/lib-mjs/publicApi/block/setDirection.d.ts +7 -7
  683. package/lib-mjs/publicApi/block/setDirection.js +12 -12
  684. package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
  685. package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +7 -7
  686. package/lib-mjs/publicApi/block/setHeadingLevel.js +46 -46
  687. package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
  688. package/lib-mjs/publicApi/block/setIndentation.d.ts +8 -8
  689. package/lib-mjs/publicApi/block/setIndentation.js +17 -17
  690. package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
  691. package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +9 -9
  692. package/lib-mjs/publicApi/block/setParagraphMargin.js +29 -29
  693. package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
  694. package/lib-mjs/publicApi/block/setSpacing.d.ts +7 -7
  695. package/lib-mjs/publicApi/block/setSpacing.js +17 -17
  696. package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
  697. package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +9 -9
  698. package/lib-mjs/publicApi/block/toggleBlockQuote.js +35 -35
  699. package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
  700. package/lib-mjs/publicApi/entity/insertEntity.d.ts +25 -25
  701. package/lib-mjs/publicApi/entity/insertEntity.js +63 -63
  702. package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
  703. package/lib-mjs/publicApi/format/clearFormat.d.ts +6 -6
  704. package/lib-mjs/publicApi/format/clearFormat.js +30 -30
  705. package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
  706. package/lib-mjs/publicApi/format/getFormatState.d.ts +7 -7
  707. package/lib-mjs/publicApi/format/getFormatState.js +27 -27
  708. package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
  709. package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +6 -6
  710. package/lib-mjs/publicApi/image/adjustImageSelection.js +25 -25
  711. package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
  712. package/lib-mjs/publicApi/image/changeImage.d.ts +7 -7
  713. package/lib-mjs/publicApi/image/changeImage.js +31 -31
  714. package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
  715. package/lib-mjs/publicApi/image/insertImage.d.ts +7 -7
  716. package/lib-mjs/publicApi/image/insertImage.js +34 -34
  717. package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
  718. package/lib-mjs/publicApi/image/setImageAltText.d.ts +8 -8
  719. package/lib-mjs/publicApi/image/setImageAltText.js +13 -13
  720. package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
  721. package/lib-mjs/publicApi/image/setImageBorder.d.ts +9 -9
  722. package/lib-mjs/publicApi/image/setImageBorder.js +15 -15
  723. package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
  724. package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +8 -8
  725. package/lib-mjs/publicApi/image/setImageBoxShadow.js +25 -25
  726. package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
  727. package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +6 -6
  728. package/lib-mjs/publicApi/link/adjustLinkSelection.js +30 -30
  729. package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
  730. package/lib-mjs/publicApi/link/insertLink.d.ts +15 -15
  731. package/lib-mjs/publicApi/link/insertLink.js +116 -116
  732. package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
  733. package/lib-mjs/publicApi/link/removeLink.d.ts +8 -8
  734. package/lib-mjs/publicApi/link/removeLink.js +28 -28
  735. package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
  736. package/lib-mjs/publicApi/list/setListStartNumber.d.ts +7 -7
  737. package/lib-mjs/publicApi/list/setListStartNumber.js +14 -14
  738. package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
  739. package/lib-mjs/publicApi/list/setListStyle.d.ts +7 -7
  740. package/lib-mjs/publicApi/list/setListStyle.js +14 -14
  741. package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
  742. package/lib-mjs/publicApi/list/toggleBullet.d.ts +9 -9
  743. package/lib-mjs/publicApi/list/toggleBullet.js +18 -18
  744. package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
  745. package/lib-mjs/publicApi/list/toggleNumbering.d.ts +9 -9
  746. package/lib-mjs/publicApi/list/toggleNumbering.js +18 -18
  747. package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
  748. package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +7 -7
  749. package/lib-mjs/publicApi/segment/applySegmentFormat.js +19 -19
  750. package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
  751. package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +10 -10
  752. package/lib-mjs/publicApi/segment/changeCapitalization.js +45 -45
  753. package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
  754. package/lib-mjs/publicApi/segment/changeFontSize.d.ts +8 -8
  755. package/lib-mjs/publicApi/segment/changeFontSize.js +59 -59
  756. package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
  757. package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +7 -7
  758. package/lib-mjs/publicApi/segment/setBackgroundColor.js +31 -31
  759. package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
  760. package/lib-mjs/publicApi/segment/setFontName.d.ts +7 -7
  761. package/lib-mjs/publicApi/segment/setFontName.js +15 -15
  762. package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
  763. package/lib-mjs/publicApi/segment/setFontSize.d.ts +12 -12
  764. package/lib-mjs/publicApi/segment/setFontSize.js +28 -28
  765. package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
  766. package/lib-mjs/publicApi/segment/setTextColor.d.ts +7 -7
  767. package/lib-mjs/publicApi/segment/setTextColor.js +22 -22
  768. package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
  769. package/lib-mjs/publicApi/segment/splitTextSegment.d.ts +10 -10
  770. package/lib-mjs/publicApi/segment/splitTextSegment.js +26 -26
  771. package/lib-mjs/publicApi/segment/splitTextSegment.js.map +1 -1
  772. package/lib-mjs/publicApi/segment/toggleBold.d.ts +6 -6
  773. package/lib-mjs/publicApi/segment/toggleBold.js +23 -23
  774. package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
  775. package/lib-mjs/publicApi/segment/toggleCode.d.ts +6 -6
  776. package/lib-mjs/publicApi/segment/toggleCode.js +24 -24
  777. package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
  778. package/lib-mjs/publicApi/segment/toggleItalic.d.ts +6 -6
  779. package/lib-mjs/publicApi/segment/toggleItalic.js +17 -17
  780. package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
  781. package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +6 -6
  782. package/lib-mjs/publicApi/segment/toggleStrikethrough.js +11 -11
  783. package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
  784. package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +6 -6
  785. package/lib-mjs/publicApi/segment/toggleSubscript.js +11 -11
  786. package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
  787. package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +6 -6
  788. package/lib-mjs/publicApi/segment/toggleSuperscript.js +11 -11
  789. package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
  790. package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +6 -6
  791. package/lib-mjs/publicApi/segment/toggleUnderline.js +20 -20
  792. package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
  793. package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +8 -8
  794. package/lib-mjs/publicApi/table/applyTableBorderFormat.js +293 -293
  795. package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
  796. package/lib-mjs/publicApi/table/editTable.d.ts +7 -7
  797. package/lib-mjs/publicApi/table/editTable.js +91 -91
  798. package/lib-mjs/publicApi/table/editTable.js.map +1 -1
  799. package/lib-mjs/publicApi/table/formatTable.d.ts +8 -8
  800. package/lib-mjs/publicApi/table/formatTable.js +34 -34
  801. package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
  802. package/lib-mjs/publicApi/table/insertTable.d.ts +12 -12
  803. package/lib-mjs/publicApi/table/insertTable.js +72 -72
  804. package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
  805. package/lib-mjs/publicApi/table/setTableCellShade.d.ts +7 -7
  806. package/lib-mjs/publicApi/table/setTableCellShade.js +28 -28
  807. package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
  808. package/lib-mjs/publicApi/utils/createEditorContextForEntity.d.ts +8 -8
  809. package/lib-mjs/publicApi/utils/createEditorContextForEntity.js +25 -25
  810. package/lib-mjs/publicApi/utils/createEditorContextForEntity.js.map +1 -1
  811. package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +8 -8
  812. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +14 -14
  813. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  814. package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.d.ts +9 -9
  815. package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js +126 -126
  816. package/lib-mjs/publicApi/utils/formatInsertPointWithContentModel.js.map +1 -1
  817. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +8 -8
  818. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +19 -19
  819. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  820. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +11 -11
  821. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +113 -113
  822. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  823. package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +9 -9
  824. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js +42 -42
  825. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  826. package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.d.ts +8 -8
  827. package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js +30 -30
  828. package/lib-mjs/publicApi/utils/formatTextSegmentBeforeSelectionMarker.js.map +1 -1
  829. package/package.json +3 -3
@@ -1,110 +1,110 @@
1
- import { findListItemsInSameThread } from '../list/findListItemsInSameThread';
2
- import { splitSelectedParagraphByBr } from './splitSelectedParagraphByBr';
3
- import { applyTableFormat, getOperationalBlocks, isBlockGroupOfType, mutateBlock, updateTableCellMetadata, } from 'roosterjs-content-model-dom';
4
- // Regexes for character direction detection
5
- // Strongly typed RTL character ranges. Referenced unicode's DerivedBidiClass.txt, excluding things in the 2 bit range.
6
- var RTL_CHAR_REGEX = /[\u0590-\u05FF\u0600-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/g;
7
- var URL_CHAR_REGEX = /http\S+|www\S+|https\S+|<a\s+(?:[^>]*?\s+)?href=(["']).*?\1.*?>.*?<\/a>/g;
8
- var WHITESPACE_REGEX = /\s/g;
9
- /**
10
- * @internal
11
- */
12
- export function setModelDirection(model, direction) {
13
- splitSelectedParagraphByBr(model);
14
- var paragraphOrListItemOrTable = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
15
- paragraphOrListItemOrTable.forEach(function (_a) {
16
- var block = _a.block;
17
- var calcDirection;
18
- if (direction === 'auto') {
19
- calcDirection = determineTextDirection(block);
20
- }
21
- else {
22
- calcDirection = direction;
23
- }
24
- if (isBlockGroupOfType(block, 'ListItem')) {
25
- var items = findListItemsInSameThread(model, block);
26
- items.forEach(function (readonlyItem) {
27
- var item = mutateBlock(readonlyItem);
28
- item.levels.forEach(function (level) {
29
- level.format.direction = calcDirection;
30
- });
31
- // We already set direction on levels, no need to keep it on list item level
32
- delete item.format.direction;
33
- // Remove textAlign to let it be calculated based on direction change
34
- delete item.format.textAlign;
35
- item.blocks.forEach(function (block) { return internalSetDirection(block, calcDirection); });
36
- });
37
- }
38
- else if (block) {
39
- internalSetDirection(block, calcDirection);
40
- }
41
- });
42
- return paragraphOrListItemOrTable.length > 0;
43
- }
44
- function internalSetDirection(block, direction) {
45
- var wasRtl = block.format.direction == 'rtl';
46
- var isRtl = direction == 'rtl';
47
- if (wasRtl != isRtl) {
48
- var format = mutateBlock(block).format;
49
- format.direction = direction;
50
- // Adjust margin when change direction
51
- var marginLeft = format.marginLeft;
52
- var paddingLeft = format.paddingLeft;
53
- setProperty(format, 'marginLeft', format.marginRight);
54
- setProperty(format, 'marginRight', marginLeft);
55
- setProperty(format, 'paddingLeft', format.paddingRight);
56
- setProperty(format, 'paddingRight', paddingLeft);
57
- // If whole Table direction changed, flip cell side borders
58
- if (block && block.blockType == 'Table') {
59
- block.rows.forEach(function (row) {
60
- row.cells.forEach(function (cell) {
61
- // Optimise by skipping cells with unchanged borders
62
- updateTableCellMetadata(mutateBlock(cell), function (metadata) {
63
- if (metadata === null || metadata === void 0 ? void 0 : metadata.borderOverride) {
64
- var storeBorderLeft = cell.format.borderLeft;
65
- setProperty(cell.format, 'borderLeft', cell.format.borderRight);
66
- setProperty(cell.format, 'borderRight', storeBorderLeft);
67
- }
68
- return metadata;
69
- });
70
- });
71
- });
72
- // Apply changed borders
73
- applyTableFormat(block, undefined /* newFormat */, true /* keepCellShade*/);
74
- }
75
- }
76
- }
77
- function setProperty(format, key, value) {
78
- if (value) {
79
- format[key] = value;
80
- }
81
- else {
82
- delete format[key];
83
- }
84
- }
85
- // Designed to match browser's 'auto' detection, by scanning over the inner text until it hits a strong LTR/RTL character
86
- function determineTextDirection(block) {
87
- if (block.blockType === 'Paragraph') {
88
- var findTextSegements = block.segments.filter(function (seg) { return seg.segmentType === 'Text'; });
89
- var innerText = findTextSegements.length > 0
90
- ? findTextSegements.reduce(function (prev, seg) { return prev + seg.text; }, '')
91
- : undefined;
92
- if (!!innerText) {
93
- // Remove links
94
- innerText = innerText.replace(URL_CHAR_REGEX, '');
95
- // Remove whitespace
96
- innerText = innerText.replace(WHITESPACE_REGEX, '');
97
- var rtlMatches = innerText.match(RTL_CHAR_REGEX);
98
- var rtlCount = rtlMatches ? rtlMatches.length : 0;
99
- var ltrCount = innerText.length - rtlCount;
100
- return rtlCount > ltrCount ? 'rtl' : 'ltr';
101
- }
102
- else {
103
- return 'ltr'; // Default to LTR if no text is found
104
- }
105
- }
106
- else {
107
- return 'ltr';
108
- }
109
- }
1
+ import { findListItemsInSameThread } from '../list/findListItemsInSameThread';
2
+ import { splitSelectedParagraphByBr } from './splitSelectedParagraphByBr';
3
+ import { applyTableFormat, getOperationalBlocks, isBlockGroupOfType, mutateBlock, updateTableCellMetadata, } from 'roosterjs-content-model-dom';
4
+ // Regexes for character direction detection
5
+ // Strongly typed RTL character ranges. Referenced unicode's DerivedBidiClass.txt, excluding things in the 2 bit range.
6
+ var RTL_CHAR_REGEX = /[\u0590-\u05FF\u0600-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/g;
7
+ var URL_CHAR_REGEX = /http\S+|www\S+|https\S+|<a\s+(?:[^>]*?\s+)?href=(["']).*?\1.*?>.*?<\/a>/g;
8
+ var WHITESPACE_REGEX = /\s/g;
9
+ /**
10
+ * @internal
11
+ */
12
+ export function setModelDirection(model, direction) {
13
+ splitSelectedParagraphByBr(model);
14
+ var paragraphOrListItemOrTable = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
15
+ paragraphOrListItemOrTable.forEach(function (_a) {
16
+ var block = _a.block;
17
+ var calcDirection;
18
+ if (direction === 'auto') {
19
+ calcDirection = determineTextDirection(block);
20
+ }
21
+ else {
22
+ calcDirection = direction;
23
+ }
24
+ if (isBlockGroupOfType(block, 'ListItem')) {
25
+ var items = findListItemsInSameThread(model, block);
26
+ items.forEach(function (readonlyItem) {
27
+ var item = mutateBlock(readonlyItem);
28
+ item.levels.forEach(function (level) {
29
+ level.format.direction = calcDirection;
30
+ });
31
+ // We already set direction on levels, no need to keep it on list item level
32
+ delete item.format.direction;
33
+ // Remove textAlign to let it be calculated based on direction change
34
+ delete item.format.textAlign;
35
+ item.blocks.forEach(function (block) { return internalSetDirection(block, calcDirection); });
36
+ });
37
+ }
38
+ else if (block) {
39
+ internalSetDirection(block, calcDirection);
40
+ }
41
+ });
42
+ return paragraphOrListItemOrTable.length > 0;
43
+ }
44
+ function internalSetDirection(block, direction) {
45
+ var wasRtl = block.format.direction == 'rtl';
46
+ var isRtl = direction == 'rtl';
47
+ if (wasRtl != isRtl) {
48
+ var format = mutateBlock(block).format;
49
+ format.direction = direction;
50
+ // Adjust margin when change direction
51
+ var marginLeft = format.marginLeft;
52
+ var paddingLeft = format.paddingLeft;
53
+ setProperty(format, 'marginLeft', format.marginRight);
54
+ setProperty(format, 'marginRight', marginLeft);
55
+ setProperty(format, 'paddingLeft', format.paddingRight);
56
+ setProperty(format, 'paddingRight', paddingLeft);
57
+ // If whole Table direction changed, flip cell side borders
58
+ if (block && block.blockType == 'Table') {
59
+ block.rows.forEach(function (row) {
60
+ row.cells.forEach(function (cell) {
61
+ // Optimise by skipping cells with unchanged borders
62
+ updateTableCellMetadata(mutateBlock(cell), function (metadata) {
63
+ if (metadata === null || metadata === void 0 ? void 0 : metadata.borderOverride) {
64
+ var storeBorderLeft = cell.format.borderLeft;
65
+ setProperty(cell.format, 'borderLeft', cell.format.borderRight);
66
+ setProperty(cell.format, 'borderRight', storeBorderLeft);
67
+ }
68
+ return metadata;
69
+ });
70
+ });
71
+ });
72
+ // Apply changed borders
73
+ applyTableFormat(block, undefined /* newFormat */, true /* keepCellShade*/);
74
+ }
75
+ }
76
+ }
77
+ function setProperty(format, key, value) {
78
+ if (value) {
79
+ format[key] = value;
80
+ }
81
+ else {
82
+ delete format[key];
83
+ }
84
+ }
85
+ // Designed to match browser's 'auto' detection, by scanning over the inner text until it hits a strong LTR/RTL character
86
+ function determineTextDirection(block) {
87
+ if (block.blockType === 'Paragraph') {
88
+ var findTextSegements = block.segments.filter(function (seg) { return seg.segmentType === 'Text'; });
89
+ var innerText = findTextSegements.length > 0
90
+ ? findTextSegements.reduce(function (prev, seg) { return prev + seg.text; }, '')
91
+ : undefined;
92
+ if (!!innerText) {
93
+ // Remove links
94
+ innerText = innerText.replace(URL_CHAR_REGEX, '');
95
+ // Remove whitespace
96
+ innerText = innerText.replace(WHITESPACE_REGEX, '');
97
+ var rtlMatches = innerText.match(RTL_CHAR_REGEX);
98
+ var rtlCount = rtlMatches ? rtlMatches.length : 0;
99
+ var ltrCount = innerText.length - rtlCount;
100
+ return rtlCount > ltrCount ? 'rtl' : 'ltr';
101
+ }
102
+ else {
103
+ return 'ltr'; // Default to LTR if no text is found
104
+ }
105
+ }
106
+ else {
107
+ return 'ltr';
108
+ }
109
+ }
110
110
  //# sourceMappingURL=setModelDirection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setModelDirection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/block/setModelDirection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,uBAAuB,GAC1B,MAAM,6BAA6B,CAAC;AAWrC,4CAA4C;AAC5C,uHAAuH;AACvH,IAAM,cAAc,GAAG,yDAAyD,CAAC;AACjF,IAAM,cAAc,GAAG,0EAA0E,CAAC;AAClG,IAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC7B,KAAmC,EACnC,SAAiC;IAEjC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAElC,IAAM,0BAA0B,GAAG,oBAAoB,CACnD,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,CAAC,WAAW,CAAC,CAChB,CAAC;IAEF,0BAA0B,CAAC,OAAO,CAAC,UAAC,EAAS;YAAP,KAAK,WAAA;QACvC,IAAI,aAA4B,CAAC;QACjC,IAAI,SAAS,KAAK,MAAM,EAAE;YACtB,aAAa,GAAG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sourcesContent":["import { findListItemsInSameThread } from '../list/findListItemsInSameThread';\r\nimport { splitSelectedParagraphByBr } from './splitSelectedParagraphByBr';\r\nimport {\r\n applyTableFormat,\r\n getOperationalBlocks,\r\n isBlockGroupOfType,\r\n mutateBlock,\r\n updateTableCellMetadata,\r\n} from 'roosterjs-content-model-dom';\r\nimport type {\r\n BorderFormat,\r\n ContentModelListItem,\r\n MarginFormat,\r\n PaddingFormat,\r\n ReadonlyContentModelBlock,\r\n ReadonlyContentModelDocument,\r\n ReadonlyContentModelText,\r\n} from 'roosterjs-content-model-types';\r\n\r\n// Regexes for character direction detection\r\n// Strongly typed RTL character ranges. Referenced unicode's DerivedBidiClass.txt, excluding things in the 2 bit range.\r\nconst RTL_CHAR_REGEX = /[\\u0590-\\u05FF\\u0600-\\u08FF\\uFB1D-\\uFDFF\\uFE70-\\uFEFF]/g;\r\nconst URL_CHAR_REGEX = /http\\S+|www\\S+|https\\S+|<a\\s+(?:[^>]*?\\s+)?href=([\"']).*?\\1.*?>.*?<\\/a>/g;\r\nconst WHITESPACE_REGEX = /\\s/g;\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function setModelDirection(\r\n model: ReadonlyContentModelDocument,\r\n direction: 'ltr' | 'rtl' | 'auto'\r\n) {\r\n splitSelectedParagraphByBr(model);\r\n\r\n const paragraphOrListItemOrTable = getOperationalBlocks<ContentModelListItem>(\r\n model,\r\n ['ListItem'],\r\n ['TableCell']\r\n );\r\n\r\n paragraphOrListItemOrTable.forEach(({ block }) => {\r\n let calcDirection: 'ltr' | 'rtl';\r\n if (direction === 'auto') {\r\n calcDirection = determineTextDirection(block);\r\n } else {\r\n calcDirection = direction;\r\n }\r\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\r\n const items = findListItemsInSameThread(model, block);\r\n\r\n items.forEach(readonlyItem => {\r\n const item = mutateBlock(readonlyItem);\r\n\r\n item.levels.forEach(level => {\r\n level.format.direction = calcDirection;\r\n });\r\n\r\n // We already set direction on levels, no need to keep it on list item level\r\n delete item.format.direction;\r\n\r\n // Remove textAlign to let it be calculated based on direction change\r\n delete item.format.textAlign;\r\n\r\n item.blocks.forEach(block => internalSetDirection(block, calcDirection));\r\n });\r\n } else if (block) {\r\n internalSetDirection(block, calcDirection);\r\n }\r\n });\r\n\r\n return paragraphOrListItemOrTable.length > 0;\r\n}\r\n\r\nfunction internalSetDirection(block: ReadonlyContentModelBlock, direction: 'ltr' | 'rtl') {\r\n const wasRtl = block.format.direction == 'rtl';\r\n const isRtl = direction == 'rtl';\r\n\r\n if (wasRtl != isRtl) {\r\n const { format } = mutateBlock(block);\r\n format.direction = direction;\r\n\r\n // Adjust margin when change direction\r\n const marginLeft = format.marginLeft;\r\n const paddingLeft = format.paddingLeft;\r\n\r\n setProperty(format, 'marginLeft', format.marginRight);\r\n setProperty(format, 'marginRight', marginLeft);\r\n setProperty(format, 'paddingLeft', format.paddingRight);\r\n setProperty(format, 'paddingRight', paddingLeft);\r\n\r\n // If whole Table direction changed, flip cell side borders\r\n if (block && block.blockType == 'Table') {\r\n block.rows.forEach(row => {\r\n row.cells.forEach(cell => {\r\n // Optimise by skipping cells with unchanged borders\r\n updateTableCellMetadata(mutateBlock(cell), metadata => {\r\n if (metadata?.borderOverride) {\r\n const storeBorderLeft = cell.format.borderLeft;\r\n setProperty(cell.format, 'borderLeft', cell.format.borderRight);\r\n setProperty(cell.format, 'borderRight', storeBorderLeft);\r\n }\r\n return metadata;\r\n });\r\n });\r\n });\r\n\r\n // Apply changed borders\r\n applyTableFormat(block, undefined /* newFormat */, true /* keepCellShade*/);\r\n }\r\n }\r\n}\r\n\r\nfunction setProperty(\r\n format: MarginFormat & PaddingFormat & BorderFormat,\r\n key: keyof (MarginFormat & PaddingFormat & BorderFormat),\r\n value: string | undefined\r\n) {\r\n if (value) {\r\n format[key] = value;\r\n } else {\r\n delete format[key];\r\n }\r\n}\r\n\r\n// Designed to match browser's 'auto' detection, by scanning over the inner text until it hits a strong LTR/RTL character\r\nfunction determineTextDirection(block: ReadonlyContentModelBlock): 'ltr' | 'rtl' {\r\n if (block.blockType === 'Paragraph') {\r\n const findTextSegements: ReadonlyContentModelText[] = block.segments.filter(\r\n (seg): seg is ReadonlyContentModelText => seg.segmentType === 'Text'\r\n );\r\n let innerText =\r\n findTextSegements.length > 0\r\n ? findTextSegements.reduce((prev, seg) => prev + seg.text, '')\r\n : undefined;\r\n if (!!innerText) {\r\n // Remove links\r\n innerText = innerText.replace(URL_CHAR_REGEX, '');\r\n\r\n // Remove whitespace\r\n innerText = innerText.replace(WHITESPACE_REGEX, '');\r\n\r\n const rtlMatches = innerText.match(RTL_CHAR_REGEX);\r\n const rtlCount = rtlMatches ? rtlMatches.length : 0;\r\n\r\n const ltrCount = innerText.length - rtlCount;\r\n\r\n return rtlCount > ltrCount ? 'rtl' : 'ltr';\r\n } else {\r\n return 'ltr'; // Default to LTR if no text is found\r\n }\r\n } else {\r\n return 'ltr';\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"setModelDirection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/block/setModelDirection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,uBAAuB,GAC1B,MAAM,6BAA6B,CAAC;AAWrC,4CAA4C;AAC5C,uHAAuH;AACvH,IAAM,cAAc,GAAG,yDAAyD,CAAC;AACjF,IAAM,cAAc,GAAG,0EAA0E,CAAC;AAClG,IAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC7B,KAAmC,EACnC,SAAiC;IAEjC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAElC,IAAM,0BAA0B,GAAG,oBAAoB,CACnD,KAAK,EACL,C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E7C,OAAO,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;SAC9C;aAAM;YACH,OAAO,KAAK,CAAC,CAAC,qCAAqC;SACtD;KACJ;SAAM;QACH,OAAO,KAAK,CAAC;KAChB;AACL,CAAC","sourcesContent":["import { findListItemsInSameThread } from '../list/findListItemsInSameThread';\nimport { splitSelectedParagraphByBr } from './splitSelectedParagraphByBr';\nimport {\n applyTableFormat,\n getOperationalBlocks,\n isBlockGroupOfType,\n mutateBlock,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-dom';\nimport type {\n BorderFormat,\n ContentModelListItem,\n MarginFormat,\n PaddingFormat,\n ReadonlyContentModelBlock,\n ReadonlyContentModelDocument,\n ReadonlyContentModelText,\n} from 'roosterjs-content-model-types';\n\n// Regexes for character direction detection\n// Strongly typed RTL character ranges. Referenced unicode's DerivedBidiClass.txt, excluding things in the 2 bit range.\nconst RTL_CHAR_REGEX = /[\\u0590-\\u05FF\\u0600-\\u08FF\\uFB1D-\\uFDFF\\uFE70-\\uFEFF]/g;\nconst URL_CHAR_REGEX = /http\\S+|www\\S+|https\\S+|<a\\s+(?:[^>]*?\\s+)?href=([\"']).*?\\1.*?>.*?<\\/a>/g;\nconst WHITESPACE_REGEX = /\\s/g;\n\n/**\n * @internal\n */\nexport function setModelDirection(\n model: ReadonlyContentModelDocument,\n direction: 'ltr' | 'rtl' | 'auto'\n) {\n splitSelectedParagraphByBr(model);\n\n const paragraphOrListItemOrTable = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n ['TableCell']\n );\n\n paragraphOrListItemOrTable.forEach(({ block }) => {\n let calcDirection: 'ltr' | 'rtl';\n if (direction === 'auto') {\n calcDirection = determineTextDirection(block);\n } else {\n calcDirection = direction;\n }\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const items = findListItemsInSameThread(model, block);\n\n items.forEach(readonlyItem => {\n const item = mutateBlock(readonlyItem);\n\n item.levels.forEach(level => {\n level.format.direction = calcDirection;\n });\n\n // We already set direction on levels, no need to keep it on list item level\n delete item.format.direction;\n\n // Remove textAlign to let it be calculated based on direction change\n delete item.format.textAlign;\n\n item.blocks.forEach(block => internalSetDirection(block, calcDirection));\n });\n } else if (block) {\n internalSetDirection(block, calcDirection);\n }\n });\n\n return paragraphOrListItemOrTable.length > 0;\n}\n\nfunction internalSetDirection(block: ReadonlyContentModelBlock, direction: 'ltr' | 'rtl') {\n const wasRtl = block.format.direction == 'rtl';\n const isRtl = direction == 'rtl';\n\n if (wasRtl != isRtl) {\n const { format } = mutateBlock(block);\n format.direction = direction;\n\n // Adjust margin when change direction\n const marginLeft = format.marginLeft;\n const paddingLeft = format.paddingLeft;\n\n setProperty(format, 'marginLeft', format.marginRight);\n setProperty(format, 'marginRight', marginLeft);\n setProperty(format, 'paddingLeft', format.paddingRight);\n setProperty(format, 'paddingRight', paddingLeft);\n\n // If whole Table direction changed, flip cell side borders\n if (block && block.blockType == 'Table') {\n block.rows.forEach(row => {\n row.cells.forEach(cell => {\n // Optimise by skipping cells with unchanged borders\n updateTableCellMetadata(mutateBlock(cell), metadata => {\n if (metadata?.borderOverride) {\n const storeBorderLeft = cell.format.borderLeft;\n setProperty(cell.format, 'borderLeft', cell.format.borderRight);\n setProperty(cell.format, 'borderRight', storeBorderLeft);\n }\n return metadata;\n });\n });\n });\n\n // Apply changed borders\n applyTableFormat(block, undefined /* newFormat */, true /* keepCellShade*/);\n }\n }\n}\n\nfunction setProperty(\n format: MarginFormat & PaddingFormat & BorderFormat,\n key: keyof (MarginFormat & PaddingFormat & BorderFormat),\n value: string | undefined\n) {\n if (value) {\n format[key] = value;\n } else {\n delete format[key];\n }\n}\n\n// Designed to match browser's 'auto' detection, by scanning over the inner text until it hits a strong LTR/RTL character\nfunction determineTextDirection(block: ReadonlyContentModelBlock): 'ltr' | 'rtl' {\n if (block.blockType === 'Paragraph') {\n const findTextSegements: ReadonlyContentModelText[] = block.segments.filter(\n (seg): seg is ReadonlyContentModelText => seg.segmentType === 'Text'\n );\n let innerText =\n findTextSegements.length > 0\n ? findTextSegements.reduce((prev, seg) => prev + seg.text, '')\n : undefined;\n if (!!innerText) {\n // Remove links\n innerText = innerText.replace(URL_CHAR_REGEX, '');\n\n // Remove whitespace\n innerText = innerText.replace(WHITESPACE_REGEX, '');\n\n const rtlMatches = innerText.match(RTL_CHAR_REGEX);\n const rtlCount = rtlMatches ? rtlMatches.length : 0;\n\n const ltrCount = innerText.length - rtlCount;\n\n return rtlCount > ltrCount ? 'rtl' : 'ltr';\n } else {\n return 'ltr'; // Default to LTR if no text is found\n }\n } else {\n return 'ltr';\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { FormatContentModelContext, ReadonlyContentModelDocument } from 'roosterjs-content-model-types';
2
- /**
3
- * @param model The content model to set indentation
4
- * @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent
5
- * @param length The length of indentation in pixel, default value is 40
6
- * Set indentation for selected list items or paragraphs
7
- */
8
- export declare function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
1
+ import type { FormatContentModelContext, ReadonlyContentModelDocument } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @param model The content model to set indentation
4
+ * @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent
5
+ * @param length The length of indentation in pixel, default value is 40
6
+ * Set indentation for selected list items or paragraphs
7
+ */
8
+ export declare function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
@@ -1,155 +1,155 @@
1
- import { __read, __spreadArray } from "tslib";
2
- import { findListItemsInSameThread } from '../list/findListItemsInSameThread';
3
- import { getListAnnounceData } from '../list/getListAnnounceData';
4
- import { IndentStepInPixel } from '../common/adjustIndentation';
5
- import { splitSelectedParagraphByBr } from './splitSelectedParagraphByBr';
6
- import { createListLevel, getOperationalBlocks, isBlockGroupOfType, mutateBlock, normalizeContentModel, parseValueWithUnit, updateListMetadata, } from 'roosterjs-content-model-dom';
7
- /**
8
- * @param model The content model to set indentation
9
- * @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent
10
- * @param length The length of indentation in pixel, default value is 40
11
- * Set indentation for selected list items or paragraphs
12
- */
13
- export function setModelIndentation(model, indentation, length, context) {
14
- if (length === void 0) { length = IndentStepInPixel; }
15
- splitSelectedParagraphByBr(model);
16
- var paragraphOrListItem = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
17
- var isIndent = indentation == 'indent';
18
- var modifiedBlocks = [];
19
- paragraphOrListItem.forEach(function (_a) {
20
- var block = _a.block, parent = _a.parent, path = _a.path;
21
- if (isBlockGroupOfType(block, 'ListItem')) {
22
- var thread = findListItemsInSameThread(model, block);
23
- var firstItem = thread[0];
24
- //if the first item is selected and has only one level, we should add margin to the whole list
25
- if (isSelected(firstItem) && firstItem.levels.length == 1) {
26
- var level = block.levels[0];
27
- var format = level.format;
28
- var marginLeft = format.marginLeft, marginRight = format.marginRight;
29
- var newValue = calculateMarginValue(format, isIndent, length);
30
- var isRtl = format.direction == 'rtl';
31
- var originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);
32
- if (!isIndent && originalValue == 0) {
33
- block.levels.pop();
34
- }
35
- else if (newValue !== null) {
36
- if (isRtl) {
37
- level.format.marginRight = newValue + 'px';
38
- }
39
- else {
40
- level.format.marginLeft = newValue + 'px';
41
- }
42
- }
43
- //if block has only one level, there is not need to check if it is multilevel selection
44
- }
45
- else if (block.levels.length == 1 || !isMultilevelSelection(model, block, parent)) {
46
- if (isIndent) {
47
- var threadIdx = thread.indexOf(block);
48
- var previousItem = thread[threadIdx - 1];
49
- var nextItem = thread[threadIdx + 1];
50
- var levelLength = block.levels.length;
51
- var lastLevel = block.levels[levelLength - 1];
52
- var newLevel = createListLevel((lastLevel === null || lastLevel === void 0 ? void 0 : lastLevel.listType) || 'UL', lastLevel === null || lastLevel === void 0 ? void 0 : lastLevel.format, previousItem && previousItem.levels.length > levelLength
53
- ? previousItem.levels[levelLength].dataset
54
- : nextItem && nextItem.levels.length > levelLength
55
- ? nextItem.levels[levelLength].dataset
56
- : undefined);
57
- updateListMetadata(newLevel, function (metadata) {
58
- metadata = metadata || {};
59
- metadata.applyListStyleFromLevel = true;
60
- return metadata;
61
- });
62
- // New level is totally new, no need to have these attributes for now
63
- delete newLevel.format.startNumberOverride;
64
- block.levels.push(newLevel);
65
- }
66
- else {
67
- block.levels.pop();
68
- }
69
- if (block.levels.length > 0 && context) {
70
- context.announceData = getListAnnounceData(__spreadArray([block], __read(path), false));
71
- }
72
- }
73
- }
74
- else if (block) {
75
- var currentBlock = block;
76
- var currentParent = parent;
77
- while (currentParent && modifiedBlocks.indexOf(currentBlock) < 0) {
78
- var index = path.indexOf(currentParent);
79
- var format = mutateBlock(currentBlock).format;
80
- var newValue = calculateMarginValue(format, isIndent, length);
81
- if (newValue !== null) {
82
- var isRtl = format.direction == 'rtl';
83
- if (isRtl) {
84
- format.marginRight = newValue + 'px';
85
- }
86
- else {
87
- format.marginLeft = newValue + 'px';
88
- }
89
- modifiedBlocks.push(currentBlock);
90
- break;
91
- }
92
- else if (currentParent.blockGroupType == 'FormatContainer' && index >= 0) {
93
- mutateBlock(currentParent);
94
- currentBlock = currentParent;
95
- currentParent = path[index + 1];
96
- }
97
- else {
98
- break;
99
- }
100
- }
101
- }
102
- });
103
- if (paragraphOrListItem.length > 0) {
104
- normalizeContentModel(model);
105
- return true;
106
- }
107
- else {
108
- return false;
109
- }
110
- }
111
- function isSelected(listItem) {
112
- return listItem.blocks.some(function (block) {
113
- if (block.blockType == 'Paragraph') {
114
- return block.segments.some(function (segment) { return segment.isSelected; });
115
- }
116
- });
117
- }
118
- /*
119
- * Check if the selection has list items with different levels and the first item of the list is selected, do not create a sub list.
120
- * Otherwise, the margin of the first item will be changed, and the sub list will be created, creating a unintentional margin difference between the list items.
121
- */
122
- function isMultilevelSelection(model, listItem, parent) {
123
- var listIndex = parent.blocks.indexOf(listItem);
124
- for (var i = listIndex - 1; i >= 0; i--) {
125
- var block = parent.blocks[i];
126
- if (isBlockGroupOfType(block, 'ListItem') &&
127
- block.levels.length == 1 &&
128
- isSelected(block)) {
129
- var firstItem = findListItemsInSameThread(model, block)[0];
130
- return isSelected(firstItem);
131
- }
132
- if (!isBlockGroupOfType(block, 'ListItem')) {
133
- return false;
134
- }
135
- }
136
- return false;
137
- }
138
- function calculateMarginValue(format, isIndent, length) {
139
- if (length === void 0) { length = IndentStepInPixel; }
140
- var marginLeft = format.marginLeft, marginRight = format.marginRight, direction = format.direction;
141
- var isRtl = direction == 'rtl';
142
- var originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);
143
- var newValue = (isIndent ? Math.ceil : Math.floor)(originalValue / length) * length;
144
- if (newValue == originalValue) {
145
- newValue = Math.max(newValue + length * (isIndent ? 1 : -1), 0);
146
- }
147
- if (newValue == originalValue) {
148
- // Return null to let caller know nothing is changed
149
- return null;
150
- }
151
- else {
152
- return newValue;
153
- }
154
- }
1
+ import { __read, __spreadArray } from "tslib";
2
+ import { findListItemsInSameThread } from '../list/findListItemsInSameThread';
3
+ import { getListAnnounceData } from '../list/getListAnnounceData';
4
+ import { IndentStepInPixel } from '../common/adjustIndentation';
5
+ import { splitSelectedParagraphByBr } from './splitSelectedParagraphByBr';
6
+ import { createListLevel, getOperationalBlocks, isBlockGroupOfType, mutateBlock, normalizeContentModel, parseValueWithUnit, updateListMetadata, } from 'roosterjs-content-model-dom';
7
+ /**
8
+ * @param model The content model to set indentation
9
+ * @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent
10
+ * @param length The length of indentation in pixel, default value is 40
11
+ * Set indentation for selected list items or paragraphs
12
+ */
13
+ export function setModelIndentation(model, indentation, length, context) {
14
+ if (length === void 0) { length = IndentStepInPixel; }
15
+ splitSelectedParagraphByBr(model);
16
+ var paragraphOrListItem = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
17
+ var isIndent = indentation == 'indent';
18
+ var modifiedBlocks = [];
19
+ paragraphOrListItem.forEach(function (_a) {
20
+ var block = _a.block, parent = _a.parent, path = _a.path;
21
+ if (isBlockGroupOfType(block, 'ListItem')) {
22
+ var thread = findListItemsInSameThread(model, block);
23
+ var firstItem = thread[0];
24
+ //if the first item is selected and has only one level, we should add margin to the whole list
25
+ if (isSelected(firstItem) && firstItem.levels.length == 1) {
26
+ var level = block.levels[0];
27
+ var format = level.format;
28
+ var marginLeft = format.marginLeft, marginRight = format.marginRight;
29
+ var newValue = calculateMarginValue(format, isIndent, length);
30
+ var isRtl = format.direction == 'rtl';
31
+ var originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);
32
+ if (!isIndent && originalValue == 0) {
33
+ block.levels.pop();
34
+ }
35
+ else if (newValue !== null) {
36
+ if (isRtl) {
37
+ level.format.marginRight = newValue + 'px';
38
+ }
39
+ else {
40
+ level.format.marginLeft = newValue + 'px';
41
+ }
42
+ }
43
+ //if block has only one level, there is not need to check if it is multilevel selection
44
+ }
45
+ else if (block.levels.length == 1 || !isMultilevelSelection(model, block, parent)) {
46
+ if (isIndent) {
47
+ var threadIdx = thread.indexOf(block);
48
+ var previousItem = thread[threadIdx - 1];
49
+ var nextItem = thread[threadIdx + 1];
50
+ var levelLength = block.levels.length;
51
+ var lastLevel = block.levels[levelLength - 1];
52
+ var newLevel = createListLevel((lastLevel === null || lastLevel === void 0 ? void 0 : lastLevel.listType) || 'UL', lastLevel === null || lastLevel === void 0 ? void 0 : lastLevel.format, previousItem && previousItem.levels.length > levelLength
53
+ ? previousItem.levels[levelLength].dataset
54
+ : nextItem && nextItem.levels.length > levelLength
55
+ ? nextItem.levels[levelLength].dataset
56
+ : undefined);
57
+ updateListMetadata(newLevel, function (metadata) {
58
+ metadata = metadata || {};
59
+ metadata.applyListStyleFromLevel = true;
60
+ return metadata;
61
+ });
62
+ // New level is totally new, no need to have these attributes for now
63
+ delete newLevel.format.startNumberOverride;
64
+ block.levels.push(newLevel);
65
+ }
66
+ else {
67
+ block.levels.pop();
68
+ }
69
+ if (block.levels.length > 0 && context) {
70
+ context.announceData = getListAnnounceData(__spreadArray([block], __read(path), false));
71
+ }
72
+ }
73
+ }
74
+ else if (block) {
75
+ var currentBlock = block;
76
+ var currentParent = parent;
77
+ while (currentParent && modifiedBlocks.indexOf(currentBlock) < 0) {
78
+ var index = path.indexOf(currentParent);
79
+ var format = mutateBlock(currentBlock).format;
80
+ var newValue = calculateMarginValue(format, isIndent, length);
81
+ if (newValue !== null) {
82
+ var isRtl = format.direction == 'rtl';
83
+ if (isRtl) {
84
+ format.marginRight = newValue + 'px';
85
+ }
86
+ else {
87
+ format.marginLeft = newValue + 'px';
88
+ }
89
+ modifiedBlocks.push(currentBlock);
90
+ break;
91
+ }
92
+ else if (currentParent.blockGroupType == 'FormatContainer' && index >= 0) {
93
+ mutateBlock(currentParent);
94
+ currentBlock = currentParent;
95
+ currentParent = path[index + 1];
96
+ }
97
+ else {
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ });
103
+ if (paragraphOrListItem.length > 0) {
104
+ normalizeContentModel(model);
105
+ return true;
106
+ }
107
+ else {
108
+ return false;
109
+ }
110
+ }
111
+ function isSelected(listItem) {
112
+ return listItem.blocks.some(function (block) {
113
+ if (block.blockType == 'Paragraph') {
114
+ return block.segments.some(function (segment) { return segment.isSelected; });
115
+ }
116
+ });
117
+ }
118
+ /*
119
+ * Check if the selection has list items with different levels and the first item of the list is selected, do not create a sub list.
120
+ * Otherwise, the margin of the first item will be changed, and the sub list will be created, creating a unintentional margin difference between the list items.
121
+ */
122
+ function isMultilevelSelection(model, listItem, parent) {
123
+ var listIndex = parent.blocks.indexOf(listItem);
124
+ for (var i = listIndex - 1; i >= 0; i--) {
125
+ var block = parent.blocks[i];
126
+ if (isBlockGroupOfType(block, 'ListItem') &&
127
+ block.levels.length == 1 &&
128
+ isSelected(block)) {
129
+ var firstItem = findListItemsInSameThread(model, block)[0];
130
+ return isSelected(firstItem);
131
+ }
132
+ if (!isBlockGroupOfType(block, 'ListItem')) {
133
+ return false;
134
+ }
135
+ }
136
+ return false;
137
+ }
138
+ function calculateMarginValue(format, isIndent, length) {
139
+ if (length === void 0) { length = IndentStepInPixel; }
140
+ var marginLeft = format.marginLeft, marginRight = format.marginRight, direction = format.direction;
141
+ var isRtl = direction == 'rtl';
142
+ var originalValue = parseValueWithUnit(isRtl ? marginRight : marginLeft);
143
+ var newValue = (isIndent ? Math.ceil : Math.floor)(originalValue / length) * length;
144
+ if (newValue == originalValue) {
145
+ newValue = Math.max(newValue + length * (isIndent ? 1 : -1), 0);
146
+ }
147
+ if (newValue == originalValue) {
148
+ // Return null to let caller know nothing is changed
149
+ return null;
150
+ }
151
+ else {
152
+ return newValue;
153
+ }
154
+ }
155
155
  //# sourceMappingURL=setModelIndentation.js.map