roosterjs-content-model-api 0.26.4 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (532) hide show
  1. package/lib/index.d.ts +46 -42
  2. package/lib/index.js +52 -43
  3. package/lib/index.js.map +1 -1
  4. package/lib/modelApi/block/setModelAlignment.js.map +1 -1
  5. package/lib/modelApi/block/setModelDirection.js.map +1 -1
  6. package/lib/modelApi/block/setModelIndentation.js.map +1 -1
  7. package/lib/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  8. package/lib/modelApi/common/clearModelFormat.js.map +1 -1
  9. package/lib/modelApi/common/wrapBlock.js.map +1 -1
  10. package/lib/modelApi/entity/insertEntityModel.js.map +1 -1
  11. package/lib/modelApi/image/applyImageBorderFormat.d.ts +1 -1
  12. package/lib/modelApi/image/applyImageBorderFormat.js +2 -1
  13. package/lib/modelApi/image/applyImageBorderFormat.js.map +1 -1
  14. package/lib/modelApi/link/matchLink.d.ts +1 -18
  15. package/lib/modelApi/link/matchLink.js +0 -1
  16. package/lib/modelApi/link/matchLink.js.map +1 -1
  17. package/lib/modelApi/list/findListItemsInSameThread.js.map +1 -1
  18. package/lib/modelApi/list/setListType.d.ts +2 -1
  19. package/lib/modelApi/list/setListType.js +5 -3
  20. package/lib/modelApi/list/setListType.js.map +1 -1
  21. package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  22. package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  23. package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
  24. package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
  25. package/lib/modelApi/table/alignTable.js.map +1 -1
  26. package/lib/modelApi/table/alignTableCell.js.map +1 -1
  27. package/lib/modelApi/table/canMergeCells.js.map +1 -1
  28. package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
  29. package/lib/modelApi/table/createTableStructure.js.map +1 -1
  30. package/lib/modelApi/table/deleteTable.js.map +1 -1
  31. package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
  32. package/lib/modelApi/table/deleteTableRow.js.map +1 -1
  33. package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  34. package/lib/modelApi/table/insertTableColumn.js.map +1 -1
  35. package/lib/modelApi/table/insertTableRow.js.map +1 -1
  36. package/lib/modelApi/table/mergeTableCells.js.map +1 -1
  37. package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
  38. package/lib/modelApi/table/mergeTableRow.js.map +1 -1
  39. package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  40. package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
  41. package/lib/publicApi/block/setAlignment.d.ts +2 -2
  42. package/lib/publicApi/block/setAlignment.js +2 -1
  43. package/lib/publicApi/block/setAlignment.js.map +1 -1
  44. package/lib/publicApi/block/setDirection.d.ts +2 -2
  45. package/lib/publicApi/block/setDirection.js +2 -1
  46. package/lib/publicApi/block/setDirection.js.map +1 -1
  47. package/lib/publicApi/block/setHeadingLevel.d.ts +2 -2
  48. package/lib/publicApi/block/setHeadingLevel.js +2 -1
  49. package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
  50. package/lib/publicApi/block/setIndentation.d.ts +2 -2
  51. package/lib/publicApi/block/setIndentation.js +2 -1
  52. package/lib/publicApi/block/setIndentation.js.map +1 -1
  53. package/lib/publicApi/block/setParagraphMargin.d.ts +2 -2
  54. package/lib/publicApi/block/setParagraphMargin.js +2 -1
  55. package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
  56. package/lib/publicApi/block/setSpacing.d.ts +2 -2
  57. package/lib/publicApi/block/setSpacing.js +2 -1
  58. package/lib/publicApi/block/setSpacing.js.map +1 -1
  59. package/lib/publicApi/block/toggleBlockQuote.d.ts +2 -2
  60. package/lib/publicApi/block/toggleBlockQuote.js +2 -1
  61. package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
  62. package/lib/publicApi/entity/insertEntity.d.ts +5 -5
  63. package/lib/publicApi/entity/insertEntity.js +24 -4
  64. package/lib/publicApi/entity/insertEntity.js.map +1 -1
  65. package/lib/publicApi/format/clearFormat.d.ts +2 -2
  66. package/lib/publicApi/format/clearFormat.js +2 -1
  67. package/lib/publicApi/format/clearFormat.js.map +1 -1
  68. package/lib/publicApi/format/getFormatState.d.ts +2 -2
  69. package/lib/publicApi/format/getFormatState.js +2 -1
  70. package/lib/publicApi/format/getFormatState.js.map +1 -1
  71. package/lib/publicApi/image/adjustImageSelection.d.ts +2 -2
  72. package/lib/publicApi/image/adjustImageSelection.js +2 -1
  73. package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
  74. package/lib/publicApi/image/changeImage.d.ts +2 -2
  75. package/lib/publicApi/image/changeImage.js +3 -2
  76. package/lib/publicApi/image/changeImage.js.map +1 -1
  77. package/lib/publicApi/image/insertImage.d.ts +2 -2
  78. package/lib/publicApi/image/insertImage.js +2 -1
  79. package/lib/publicApi/image/insertImage.js.map +1 -1
  80. package/lib/publicApi/image/setImageAltText.d.ts +2 -2
  81. package/lib/publicApi/image/setImageAltText.js +3 -2
  82. package/lib/publicApi/image/setImageAltText.js.map +1 -1
  83. package/lib/publicApi/image/setImageBorder.d.ts +2 -2
  84. package/lib/publicApi/image/setImageBorder.js +4 -3
  85. package/lib/publicApi/image/setImageBorder.js.map +1 -1
  86. package/lib/publicApi/image/setImageBoxShadow.d.ts +2 -2
  87. package/lib/publicApi/image/setImageBoxShadow.js +3 -2
  88. package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
  89. package/lib/publicApi/link/adjustLinkSelection.d.ts +2 -2
  90. package/lib/publicApi/link/adjustLinkSelection.js +2 -1
  91. package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
  92. package/lib/publicApi/link/insertLink.d.ts +2 -2
  93. package/lib/publicApi/link/insertLink.js +2 -1
  94. package/lib/publicApi/link/insertLink.js.map +1 -1
  95. package/lib/publicApi/link/removeLink.d.ts +2 -2
  96. package/lib/publicApi/link/removeLink.js +2 -1
  97. package/lib/publicApi/link/removeLink.js.map +1 -1
  98. package/lib/publicApi/list/setListStartNumber.d.ts +2 -2
  99. package/lib/publicApi/list/setListStartNumber.js +2 -1
  100. package/lib/publicApi/list/setListStartNumber.js.map +1 -1
  101. package/lib/publicApi/list/setListStyle.d.ts +2 -2
  102. package/lib/publicApi/list/setListStyle.js +2 -1
  103. package/lib/publicApi/list/setListStyle.js.map +1 -1
  104. package/lib/publicApi/list/toggleBullet.d.ts +3 -2
  105. package/lib/publicApi/list/toggleBullet.js +6 -3
  106. package/lib/publicApi/list/toggleBullet.js.map +1 -1
  107. package/lib/publicApi/list/toggleNumbering.d.ts +3 -2
  108. package/lib/publicApi/list/toggleNumbering.js +6 -3
  109. package/lib/publicApi/list/toggleNumbering.js.map +1 -1
  110. package/lib/publicApi/segment/applySegmentFormat.d.ts +2 -2
  111. package/lib/publicApi/segment/applySegmentFormat.js +2 -1
  112. package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
  113. package/lib/publicApi/segment/changeCapitalization.d.ts +2 -2
  114. package/lib/publicApi/segment/changeCapitalization.js +2 -1
  115. package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
  116. package/lib/publicApi/segment/changeFontSize.d.ts +2 -2
  117. package/lib/publicApi/segment/changeFontSize.js +2 -1
  118. package/lib/publicApi/segment/changeFontSize.js.map +1 -1
  119. package/lib/publicApi/segment/setBackgroundColor.d.ts +2 -2
  120. package/lib/publicApi/segment/setBackgroundColor.js +2 -1
  121. package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
  122. package/lib/publicApi/segment/setFontName.d.ts +2 -2
  123. package/lib/publicApi/segment/setFontName.js +2 -1
  124. package/lib/publicApi/segment/setFontName.js.map +1 -1
  125. package/lib/publicApi/segment/setFontSize.d.ts +2 -2
  126. package/lib/publicApi/segment/setFontSize.js +2 -2
  127. package/lib/publicApi/segment/setFontSize.js.map +1 -1
  128. package/lib/publicApi/segment/setTextColor.d.ts +2 -2
  129. package/lib/publicApi/segment/setTextColor.js +2 -1
  130. package/lib/publicApi/segment/setTextColor.js.map +1 -1
  131. package/lib/publicApi/segment/toggleBold.d.ts +2 -2
  132. package/lib/publicApi/segment/toggleBold.js +2 -1
  133. package/lib/publicApi/segment/toggleBold.js.map +1 -1
  134. package/lib/publicApi/segment/toggleCode.d.ts +2 -2
  135. package/lib/publicApi/segment/toggleCode.js +2 -1
  136. package/lib/publicApi/segment/toggleCode.js.map +1 -1
  137. package/lib/publicApi/segment/toggleItalic.d.ts +2 -2
  138. package/lib/publicApi/segment/toggleItalic.js +2 -1
  139. package/lib/publicApi/segment/toggleItalic.js.map +1 -1
  140. package/lib/publicApi/segment/toggleStrikethrough.d.ts +2 -2
  141. package/lib/publicApi/segment/toggleStrikethrough.js +2 -1
  142. package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
  143. package/lib/publicApi/segment/toggleSubscript.d.ts +2 -2
  144. package/lib/publicApi/segment/toggleSubscript.js +2 -1
  145. package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
  146. package/lib/publicApi/segment/toggleSuperscript.d.ts +2 -2
  147. package/lib/publicApi/segment/toggleSuperscript.js +2 -1
  148. package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
  149. package/lib/publicApi/segment/toggleUnderline.d.ts +2 -2
  150. package/lib/publicApi/segment/toggleUnderline.js +2 -1
  151. package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
  152. package/lib/publicApi/table/applyTableBorderFormat.d.ts +2 -2
  153. package/lib/publicApi/table/applyTableBorderFormat.js +2 -1
  154. package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
  155. package/lib/publicApi/table/editTable.d.ts +2 -2
  156. package/lib/publicApi/table/editTable.js +2 -1
  157. package/lib/publicApi/table/editTable.js.map +1 -1
  158. package/lib/publicApi/table/formatTable.d.ts +2 -2
  159. package/lib/publicApi/table/formatTable.js +2 -1
  160. package/lib/publicApi/table/formatTable.js.map +1 -1
  161. package/lib/publicApi/table/insertTable.d.ts +2 -2
  162. package/lib/publicApi/table/insertTable.js +2 -1
  163. package/lib/publicApi/table/insertTable.js.map +1 -1
  164. package/lib/publicApi/table/setTableCellShade.d.ts +2 -2
  165. package/lib/publicApi/table/setTableCellShade.js +2 -1
  166. package/lib/publicApi/table/setTableCellShade.js.map +1 -1
  167. package/lib/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
  168. package/lib/publicApi/utils/formatImageWithContentModel.js +6 -2
  169. package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  170. package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
  171. package/lib/publicApi/utils/formatParagraphWithContentModel.js +4 -1
  172. package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  173. package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
  174. package/lib/publicApi/utils/formatSegmentWithContentModel.js +7 -1
  175. package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  176. package/lib/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
  177. package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  178. package/lib-amd/index.d.ts +46 -42
  179. package/lib-amd/index.js +48 -44
  180. package/lib-amd/index.js.map +1 -1
  181. package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
  182. package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
  183. package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
  184. package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  185. package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
  186. package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
  187. package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
  188. package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +1 -1
  189. package/lib-amd/modelApi/image/applyImageBorderFormat.js +2 -1
  190. package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
  191. package/lib-amd/modelApi/link/matchLink.d.ts +1 -18
  192. package/lib-amd/modelApi/link/matchLink.js +0 -1
  193. package/lib-amd/modelApi/link/matchLink.js.map +1 -1
  194. package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
  195. package/lib-amd/modelApi/list/setListType.d.ts +2 -1
  196. package/lib-amd/modelApi/list/setListType.js +5 -3
  197. package/lib-amd/modelApi/list/setListType.js.map +1 -1
  198. package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  199. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  200. package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
  201. package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
  202. package/lib-amd/modelApi/table/alignTable.js.map +1 -1
  203. package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
  204. package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
  205. package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
  206. package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
  207. package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
  208. package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
  209. package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
  210. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  211. package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
  212. package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
  213. package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
  214. package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
  215. package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
  216. package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  217. package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
  218. package/lib-amd/publicApi/block/setAlignment.d.ts +2 -2
  219. package/lib-amd/publicApi/block/setAlignment.js +2 -1
  220. package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
  221. package/lib-amd/publicApi/block/setDirection.d.ts +2 -2
  222. package/lib-amd/publicApi/block/setDirection.js +2 -1
  223. package/lib-amd/publicApi/block/setDirection.js.map +1 -1
  224. package/lib-amd/publicApi/block/setHeadingLevel.d.ts +2 -2
  225. package/lib-amd/publicApi/block/setHeadingLevel.js +2 -1
  226. package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
  227. package/lib-amd/publicApi/block/setIndentation.d.ts +2 -2
  228. package/lib-amd/publicApi/block/setIndentation.js +2 -1
  229. package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
  230. package/lib-amd/publicApi/block/setParagraphMargin.d.ts +2 -2
  231. package/lib-amd/publicApi/block/setParagraphMargin.js +2 -1
  232. package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
  233. package/lib-amd/publicApi/block/setSpacing.d.ts +2 -2
  234. package/lib-amd/publicApi/block/setSpacing.js +2 -1
  235. package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
  236. package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +2 -2
  237. package/lib-amd/publicApi/block/toggleBlockQuote.js +2 -1
  238. package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
  239. package/lib-amd/publicApi/entity/insertEntity.d.ts +5 -5
  240. package/lib-amd/publicApi/entity/insertEntity.js +24 -4
  241. package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
  242. package/lib-amd/publicApi/format/clearFormat.d.ts +2 -2
  243. package/lib-amd/publicApi/format/clearFormat.js +2 -1
  244. package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
  245. package/lib-amd/publicApi/format/getFormatState.d.ts +2 -2
  246. package/lib-amd/publicApi/format/getFormatState.js +2 -1
  247. package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
  248. package/lib-amd/publicApi/image/adjustImageSelection.d.ts +2 -2
  249. package/lib-amd/publicApi/image/adjustImageSelection.js +2 -1
  250. package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
  251. package/lib-amd/publicApi/image/changeImage.d.ts +2 -2
  252. package/lib-amd/publicApi/image/changeImage.js +3 -2
  253. package/lib-amd/publicApi/image/changeImage.js.map +1 -1
  254. package/lib-amd/publicApi/image/insertImage.d.ts +2 -2
  255. package/lib-amd/publicApi/image/insertImage.js +2 -1
  256. package/lib-amd/publicApi/image/insertImage.js.map +1 -1
  257. package/lib-amd/publicApi/image/setImageAltText.d.ts +2 -2
  258. package/lib-amd/publicApi/image/setImageAltText.js +3 -2
  259. package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
  260. package/lib-amd/publicApi/image/setImageBorder.d.ts +2 -2
  261. package/lib-amd/publicApi/image/setImageBorder.js +4 -3
  262. package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
  263. package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +2 -2
  264. package/lib-amd/publicApi/image/setImageBoxShadow.js +3 -2
  265. package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
  266. package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +2 -2
  267. package/lib-amd/publicApi/link/adjustLinkSelection.js +2 -1
  268. package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
  269. package/lib-amd/publicApi/link/insertLink.d.ts +2 -2
  270. package/lib-amd/publicApi/link/insertLink.js +2 -1
  271. package/lib-amd/publicApi/link/insertLink.js.map +1 -1
  272. package/lib-amd/publicApi/link/removeLink.d.ts +2 -2
  273. package/lib-amd/publicApi/link/removeLink.js +2 -1
  274. package/lib-amd/publicApi/link/removeLink.js.map +1 -1
  275. package/lib-amd/publicApi/list/setListStartNumber.d.ts +2 -2
  276. package/lib-amd/publicApi/list/setListStartNumber.js +2 -1
  277. package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
  278. package/lib-amd/publicApi/list/setListStyle.d.ts +2 -2
  279. package/lib-amd/publicApi/list/setListStyle.js +2 -1
  280. package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
  281. package/lib-amd/publicApi/list/toggleBullet.d.ts +3 -2
  282. package/lib-amd/publicApi/list/toggleBullet.js +6 -3
  283. package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
  284. package/lib-amd/publicApi/list/toggleNumbering.d.ts +3 -2
  285. package/lib-amd/publicApi/list/toggleNumbering.js +6 -3
  286. package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
  287. package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +2 -2
  288. package/lib-amd/publicApi/segment/applySegmentFormat.js +2 -1
  289. package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
  290. package/lib-amd/publicApi/segment/changeCapitalization.d.ts +2 -2
  291. package/lib-amd/publicApi/segment/changeCapitalization.js +2 -1
  292. package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
  293. package/lib-amd/publicApi/segment/changeFontSize.d.ts +2 -2
  294. package/lib-amd/publicApi/segment/changeFontSize.js +2 -1
  295. package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
  296. package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +2 -2
  297. package/lib-amd/publicApi/segment/setBackgroundColor.js +2 -1
  298. package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
  299. package/lib-amd/publicApi/segment/setFontName.d.ts +2 -2
  300. package/lib-amd/publicApi/segment/setFontName.js +2 -1
  301. package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
  302. package/lib-amd/publicApi/segment/setFontSize.d.ts +2 -2
  303. package/lib-amd/publicApi/segment/setFontSize.js +2 -2
  304. package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
  305. package/lib-amd/publicApi/segment/setTextColor.d.ts +2 -2
  306. package/lib-amd/publicApi/segment/setTextColor.js +2 -1
  307. package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
  308. package/lib-amd/publicApi/segment/toggleBold.d.ts +2 -2
  309. package/lib-amd/publicApi/segment/toggleBold.js +2 -1
  310. package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
  311. package/lib-amd/publicApi/segment/toggleCode.d.ts +2 -2
  312. package/lib-amd/publicApi/segment/toggleCode.js +2 -1
  313. package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
  314. package/lib-amd/publicApi/segment/toggleItalic.d.ts +2 -2
  315. package/lib-amd/publicApi/segment/toggleItalic.js +2 -1
  316. package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
  317. package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +2 -2
  318. package/lib-amd/publicApi/segment/toggleStrikethrough.js +2 -1
  319. package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
  320. package/lib-amd/publicApi/segment/toggleSubscript.d.ts +2 -2
  321. package/lib-amd/publicApi/segment/toggleSubscript.js +2 -1
  322. package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
  323. package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +2 -2
  324. package/lib-amd/publicApi/segment/toggleSuperscript.js +2 -1
  325. package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
  326. package/lib-amd/publicApi/segment/toggleUnderline.d.ts +2 -2
  327. package/lib-amd/publicApi/segment/toggleUnderline.js +2 -1
  328. package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
  329. package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +2 -2
  330. package/lib-amd/publicApi/table/applyTableBorderFormat.js +2 -1
  331. package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
  332. package/lib-amd/publicApi/table/editTable.d.ts +2 -2
  333. package/lib-amd/publicApi/table/editTable.js +2 -1
  334. package/lib-amd/publicApi/table/editTable.js.map +1 -1
  335. package/lib-amd/publicApi/table/formatTable.d.ts +2 -2
  336. package/lib-amd/publicApi/table/formatTable.js +2 -1
  337. package/lib-amd/publicApi/table/formatTable.js.map +1 -1
  338. package/lib-amd/publicApi/table/insertTable.d.ts +2 -2
  339. package/lib-amd/publicApi/table/insertTable.js +2 -1
  340. package/lib-amd/publicApi/table/insertTable.js.map +1 -1
  341. package/lib-amd/publicApi/table/setTableCellShade.d.ts +2 -2
  342. package/lib-amd/publicApi/table/setTableCellShade.js +2 -1
  343. package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
  344. package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
  345. package/lib-amd/publicApi/utils/formatImageWithContentModel.js +6 -2
  346. package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  347. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
  348. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +4 -1
  349. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  350. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
  351. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +7 -1
  352. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  353. package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
  354. package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  355. package/lib-mjs/index.d.ts +46 -42
  356. package/lib-mjs/index.js +46 -42
  357. package/lib-mjs/index.js.map +1 -1
  358. package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
  359. package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
  360. package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
  361. package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  362. package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
  363. package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
  364. package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
  365. package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +1 -1
  366. package/lib-mjs/modelApi/image/applyImageBorderFormat.js +1 -1
  367. package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
  368. package/lib-mjs/modelApi/link/matchLink.d.ts +1 -18
  369. package/lib-mjs/modelApi/link/matchLink.js +0 -1
  370. package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
  371. package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
  372. package/lib-mjs/modelApi/list/setListType.d.ts +2 -1
  373. package/lib-mjs/modelApi/list/setListType.js +5 -3
  374. package/lib-mjs/modelApi/list/setListType.js.map +1 -1
  375. package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  376. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  377. package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
  378. package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
  379. package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
  380. package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
  381. package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
  382. package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
  383. package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
  384. package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
  385. package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
  386. package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
  387. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  388. package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
  389. package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
  390. package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
  391. package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
  392. package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
  393. package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  394. package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
  395. package/lib-mjs/publicApi/block/setAlignment.d.ts +2 -2
  396. package/lib-mjs/publicApi/block/setAlignment.js +1 -1
  397. package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
  398. package/lib-mjs/publicApi/block/setDirection.d.ts +2 -2
  399. package/lib-mjs/publicApi/block/setDirection.js +1 -1
  400. package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
  401. package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +2 -2
  402. package/lib-mjs/publicApi/block/setHeadingLevel.js +1 -1
  403. package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
  404. package/lib-mjs/publicApi/block/setIndentation.d.ts +2 -2
  405. package/lib-mjs/publicApi/block/setIndentation.js +1 -1
  406. package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
  407. package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +2 -2
  408. package/lib-mjs/publicApi/block/setParagraphMargin.js +1 -1
  409. package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
  410. package/lib-mjs/publicApi/block/setSpacing.d.ts +2 -2
  411. package/lib-mjs/publicApi/block/setSpacing.js +1 -1
  412. package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
  413. package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +2 -2
  414. package/lib-mjs/publicApi/block/toggleBlockQuote.js +1 -1
  415. package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
  416. package/lib-mjs/publicApi/entity/insertEntity.d.ts +5 -5
  417. package/lib-mjs/publicApi/entity/insertEntity.js +23 -4
  418. package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
  419. package/lib-mjs/publicApi/format/clearFormat.d.ts +2 -2
  420. package/lib-mjs/publicApi/format/clearFormat.js +1 -1
  421. package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
  422. package/lib-mjs/publicApi/format/getFormatState.d.ts +2 -2
  423. package/lib-mjs/publicApi/format/getFormatState.js +1 -1
  424. package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
  425. package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +2 -2
  426. package/lib-mjs/publicApi/image/adjustImageSelection.js +1 -1
  427. package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
  428. package/lib-mjs/publicApi/image/changeImage.d.ts +2 -2
  429. package/lib-mjs/publicApi/image/changeImage.js +2 -2
  430. package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
  431. package/lib-mjs/publicApi/image/insertImage.d.ts +2 -2
  432. package/lib-mjs/publicApi/image/insertImage.js +1 -1
  433. package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
  434. package/lib-mjs/publicApi/image/setImageAltText.d.ts +2 -2
  435. package/lib-mjs/publicApi/image/setImageAltText.js +2 -2
  436. package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
  437. package/lib-mjs/publicApi/image/setImageBorder.d.ts +2 -2
  438. package/lib-mjs/publicApi/image/setImageBorder.js +3 -3
  439. package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
  440. package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +2 -2
  441. package/lib-mjs/publicApi/image/setImageBoxShadow.js +2 -2
  442. package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
  443. package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +2 -2
  444. package/lib-mjs/publicApi/link/adjustLinkSelection.js +1 -1
  445. package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
  446. package/lib-mjs/publicApi/link/insertLink.d.ts +2 -2
  447. package/lib-mjs/publicApi/link/insertLink.js +1 -1
  448. package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
  449. package/lib-mjs/publicApi/link/removeLink.d.ts +2 -2
  450. package/lib-mjs/publicApi/link/removeLink.js +1 -1
  451. package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
  452. package/lib-mjs/publicApi/list/setListStartNumber.d.ts +2 -2
  453. package/lib-mjs/publicApi/list/setListStartNumber.js +1 -1
  454. package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
  455. package/lib-mjs/publicApi/list/setListStyle.d.ts +2 -2
  456. package/lib-mjs/publicApi/list/setListStyle.js +1 -1
  457. package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
  458. package/lib-mjs/publicApi/list/toggleBullet.d.ts +3 -2
  459. package/lib-mjs/publicApi/list/toggleBullet.js +4 -2
  460. package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
  461. package/lib-mjs/publicApi/list/toggleNumbering.d.ts +3 -2
  462. package/lib-mjs/publicApi/list/toggleNumbering.js +4 -2
  463. package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
  464. package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +2 -2
  465. package/lib-mjs/publicApi/segment/applySegmentFormat.js +1 -1
  466. package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
  467. package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +2 -2
  468. package/lib-mjs/publicApi/segment/changeCapitalization.js +1 -1
  469. package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
  470. package/lib-mjs/publicApi/segment/changeFontSize.d.ts +2 -2
  471. package/lib-mjs/publicApi/segment/changeFontSize.js +1 -1
  472. package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
  473. package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +2 -2
  474. package/lib-mjs/publicApi/segment/setBackgroundColor.js +1 -1
  475. package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
  476. package/lib-mjs/publicApi/segment/setFontName.d.ts +2 -2
  477. package/lib-mjs/publicApi/segment/setFontName.js +1 -1
  478. package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
  479. package/lib-mjs/publicApi/segment/setFontSize.d.ts +2 -2
  480. package/lib-mjs/publicApi/segment/setFontSize.js +1 -1
  481. package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
  482. package/lib-mjs/publicApi/segment/setTextColor.d.ts +2 -2
  483. package/lib-mjs/publicApi/segment/setTextColor.js +1 -1
  484. package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
  485. package/lib-mjs/publicApi/segment/toggleBold.d.ts +2 -2
  486. package/lib-mjs/publicApi/segment/toggleBold.js +1 -1
  487. package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
  488. package/lib-mjs/publicApi/segment/toggleCode.d.ts +2 -2
  489. package/lib-mjs/publicApi/segment/toggleCode.js +1 -1
  490. package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
  491. package/lib-mjs/publicApi/segment/toggleItalic.d.ts +2 -2
  492. package/lib-mjs/publicApi/segment/toggleItalic.js +1 -1
  493. package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
  494. package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +2 -2
  495. package/lib-mjs/publicApi/segment/toggleStrikethrough.js +1 -1
  496. package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
  497. package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +2 -2
  498. package/lib-mjs/publicApi/segment/toggleSubscript.js +1 -1
  499. package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
  500. package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +2 -2
  501. package/lib-mjs/publicApi/segment/toggleSuperscript.js +1 -1
  502. package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
  503. package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +2 -2
  504. package/lib-mjs/publicApi/segment/toggleUnderline.js +1 -1
  505. package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
  506. package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +2 -2
  507. package/lib-mjs/publicApi/table/applyTableBorderFormat.js +1 -1
  508. package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
  509. package/lib-mjs/publicApi/table/editTable.d.ts +2 -2
  510. package/lib-mjs/publicApi/table/editTable.js +1 -1
  511. package/lib-mjs/publicApi/table/editTable.js.map +1 -1
  512. package/lib-mjs/publicApi/table/formatTable.d.ts +2 -2
  513. package/lib-mjs/publicApi/table/formatTable.js +1 -1
  514. package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
  515. package/lib-mjs/publicApi/table/insertTable.d.ts +2 -2
  516. package/lib-mjs/publicApi/table/insertTable.js +1 -1
  517. package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
  518. package/lib-mjs/publicApi/table/setTableCellShade.d.ts +2 -2
  519. package/lib-mjs/publicApi/table/setTableCellShade.js +1 -1
  520. package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
  521. package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +6 -3
  522. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +5 -2
  523. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  524. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +6 -3
  525. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +4 -1
  526. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  527. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +9 -3
  528. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +7 -1
  529. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  530. package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
  531. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  532. package/package.json +4 -4
@@ -1,10 +1,10 @@
1
- import type { ContentModelParagraph, ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { ContentModelParagraph, ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set font size
4
4
  * @param editor The editor to operate on
5
5
  * @param fontSize The font size to set
6
6
  */
7
- export default function setFontSize(editor: IStandaloneEditor, fontSize: string): void;
7
+ export declare function setFontSize(editor: IEditor, fontSize: string): void;
8
8
  /**
9
9
  * @internal
10
10
  * Internal set font function shared by setFontSize and changeFontSize
@@ -4,7 +4,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
4
4
  * @param editor The editor to operate on
5
5
  * @param fontSize The font size to set
6
6
  */
7
- export default function setFontSize(editor, fontSize) {
7
+ export function setFontSize(editor, fontSize) {
8
8
  editor.focus();
9
9
  formatSegmentWithContentModel(editor, 'setFontSize', function (format, _, __, paragraph) { return setFontSizeInternal(fontSize, format, paragraph); }, undefined /* segmentHasStyleCallback*/, true /*includingFormatHandler*/);
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setFontSize.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/setFontSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAOvF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAyB,EAAE,QAAgB;IAC3E,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,aAAa,EACb,UAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,IAAK,OAAA,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAhD,CAAgD,EAC9E,SAAS,CAAC,4BAA4B,EACtC,IAAI,CAAC,0BAA0B,CAClC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAC/B,QAAgB,EAChB,MAAiC,EACjC,SAAuC;;IAEvC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE3B,iIAAiI;IACjI,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,aAAa,0CAAE,QAAQ,EAAE;QACpC,IAAM,MAAI,GAAG,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;QAE9C,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;YAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAI,CAAC;aAClC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;KAC3C;AACL,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type {\n ContentModelParagraph,\n ContentModelSegmentFormat,\n IStandaloneEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * Set font size\n * @param editor The editor to operate on\n * @param fontSize The font size to set\n */\nexport default function setFontSize(editor: IStandaloneEditor, fontSize: string) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'setFontSize',\n (format, _, __, paragraph) => setFontSizeInternal(fontSize, format, paragraph),\n undefined /* segmentHasStyleCallback*/,\n true /*includingFormatHandler*/\n );\n}\n\n/**\n * @internal\n * Internal set font function shared by setFontSize and changeFontSize\n */\nexport function setFontSizeInternal(\n fontSize: string,\n format: ContentModelSegmentFormat,\n paragraph: ContentModelParagraph | null\n) {\n format.fontSize = fontSize;\n\n // Since we have set font size to segment, it can be smaller than the one in paragraph format, so delete font size from paragraph\n if (paragraph?.segmentFormat?.fontSize) {\n const size = paragraph.segmentFormat.fontSize;\n\n paragraph.segments.forEach(segment => {\n if (!segment.format.fontSize) {\n segment.format.fontSize = size;\n }\n });\n\n delete paragraph.segmentFormat.fontSize;\n }\n}\n"]}
1
+ {"version":3,"file":"setFontSize.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/setFontSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAOvF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,QAAgB;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,aAAa,EACb,UAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,IAAK,OAAA,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAhD,CAAgD,EAC9E,SAAS,CAAC,4BAA4B,EACtC,IAAI,CAAC,0BAA0B,CAClC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAC/B,QAAgB,EAChB,MAAiC,EACjC,SAAuC;;IAEvC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE3B,iIAAiI;IACjI,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,aAAa,0CAAE,QAAQ,EAAE;QACpC,IAAM,MAAI,GAAG,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;QAE9C,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;YAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAI,CAAC;aAClC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;KAC3C;AACL,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type {\n ContentModelParagraph,\n ContentModelSegmentFormat,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * Set font size\n * @param editor The editor to operate on\n * @param fontSize The font size to set\n */\nexport function setFontSize(editor: IEditor, fontSize: string) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'setFontSize',\n (format, _, __, paragraph) => setFontSizeInternal(fontSize, format, paragraph),\n undefined /* segmentHasStyleCallback*/,\n true /*includingFormatHandler*/\n );\n}\n\n/**\n * @internal\n * Internal set font function shared by setFontSize and changeFontSize\n */\nexport function setFontSizeInternal(\n fontSize: string,\n format: ContentModelSegmentFormat,\n paragraph: ContentModelParagraph | null\n) {\n format.fontSize = fontSize;\n\n // Since we have set font size to segment, it can be smaller than the one in paragraph format, so delete font size from paragraph\n if (paragraph?.segmentFormat?.fontSize) {\n const size = paragraph.segmentFormat.fontSize;\n\n paragraph.segments.forEach(segment => {\n if (!segment.format.fontSize) {\n segment.format.fontSize = size;\n }\n });\n\n delete paragraph.segmentFormat.fontSize;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set text color
4
4
  * @param editor The editor to operate on
5
5
  * @param textColor The text color to set. Pass null to remove existing color.
6
6
  */
7
- export default function setTextColor(editor: IStandaloneEditor, textColor: string | null): void;
7
+ export declare function setTextColor(editor: IEditor, textColor: string | null): void;
@@ -4,7 +4,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
4
4
  * @param editor The editor to operate on
5
5
  * @param textColor The text color to set. Pass null to remove existing color.
6
6
  */
7
- export default function setTextColor(editor, textColor) {
7
+ export function setTextColor(editor, textColor) {
8
8
  editor.focus();
9
9
  formatSegmentWithContentModel(editor, 'setTextColor', textColor === null
10
10
  ? function (format, _, segment) {
@@ -1 +1 @@
1
- {"version":3,"file":"setTextColor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/setTextColor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAyB,EAAE,SAAwB;IACpF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,cAAc,EACd,SAAS,KAAK,IAAI;QACd,CAAC,CAAC,UAAC,MAAM,EAAE,CAAC,EAAE,OAAO;YACf,OAAO,MAAM,CAAC,SAAS,CAAC;YAExB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;aACxC;QACL,CAAC;QACH,CAAC,CAAC,UAAC,MAAM,EAAE,CAAC,EAAE,OAAO;YACf,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;YAE7B,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;aAC7C;QACL,CAAC,EACP,SAAS,CAAC,4BAA4B,EACtC,IAAI,CAAC,0BAA0B,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text color\n * @param editor The editor to operate on\n * @param textColor The text color to set. Pass null to remove existing color.\n */\nexport default function setTextColor(editor: IStandaloneEditor, textColor: string | null) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'setTextColor',\n textColor === null\n ? (format, _, segment) => {\n delete format.textColor;\n\n if (segment?.link) {\n delete segment.link.format.textColor;\n }\n }\n : (format, _, segment) => {\n format.textColor = textColor;\n\n if (segment?.link) {\n segment.link.format.textColor = textColor;\n }\n },\n undefined /* segmentHasStyleCallback*/,\n true /*includingFormatHandler*/\n );\n}\n"]}
1
+ {"version":3,"file":"setTextColor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/setTextColor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe,EAAE,SAAwB;IAClE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,cAAc,EACd,SAAS,KAAK,IAAI;QACd,CAAC,CAAC,UAAC,MAAM,EAAE,CAAC,EAAE,OAAO;YACf,OAAO,MAAM,CAAC,SAAS,CAAC;YAExB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;aACxC;QACL,CAAC;QACH,CAAC,CAAC,UAAC,MAAM,EAAE,CAAC,EAAE,OAAO;YACf,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;YAE7B,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;aAC7C;QACL,CAAC,EACP,SAAS,CAAC,4BAA4B,EACtC,IAAI,CAAC,0BAA0B,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text color\n * @param editor The editor to operate on\n * @param textColor The text color to set. Pass null to remove existing color.\n */\nexport function setTextColor(editor: IEditor, textColor: string | null) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'setTextColor',\n textColor === null\n ? (format, _, segment) => {\n delete format.textColor;\n\n if (segment?.link) {\n delete segment.link.format.textColor;\n }\n }\n : (format, _, segment) => {\n format.textColor = textColor;\n\n if (segment?.link) {\n segment.link.format.textColor = textColor;\n }\n },\n undefined /* segmentHasStyleCallback*/,\n true /*includingFormatHandler*/\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle bold style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleBold(editor: IStandaloneEditor): void;
6
+ export declare function toggleBold(editor: IEditor): void;
@@ -4,7 +4,7 @@ import { isBold } from 'roosterjs-content-model-core';
4
4
  * Toggle bold style
5
5
  * @param editor The editor to operate on
6
6
  */
7
- export default function toggleBold(editor) {
7
+ export function toggleBold(editor) {
8
8
  editor.focus();
9
9
  formatSegmentWithContentModel(editor, 'toggleBold', function (format, isTurningOn) {
10
10
  format.fontWeight = isTurningOn ? 'bold' : 'normal';
@@ -1 +1 @@
1
- {"version":3,"file":"toggleBold.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleBold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,MAAyB;IACxD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,YAAY,EACZ,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxD,CAAC,EACD,UAAC,MAAM,EAAE,CAAC,EAAE,SAAS;;QACjB,OAAA,MAAM,CACF,OAAO,MAAM,CAAC,UAAU,IAAI,WAAW;YACnC,CAAC,CAAC,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,0CAAE,MAAM,CAAC,UAAU;YACzC,CAAC,CAAC,MAAM,CAAC,UAAU,CAC1B,CAAA;KAAA,CACR,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport { isBold } from 'roosterjs-content-model-core';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle bold style\n * @param editor The editor to operate on\n */\nexport default function toggleBold(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleBold',\n (format, isTurningOn) => {\n format.fontWeight = isTurningOn ? 'bold' : 'normal';\n },\n (format, _, paragraph) =>\n isBold(\n typeof format.fontWeight == 'undefined'\n ? paragraph?.decorator?.format.fontWeight\n : format.fontWeight\n )\n );\n}\n"]}
1
+ {"version":3,"file":"toggleBold.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleBold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe;IACtC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,YAAY,EACZ,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxD,CAAC,EACD,UAAC,MAAM,EAAE,CAAC,EAAE,SAAS;;QACjB,OAAA,MAAM,CACF,OAAO,MAAM,CAAC,UAAU,IAAI,WAAW;YACnC,CAAC,CAAC,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,0CAAE,MAAM,CAAC,UAAU;YACzC,CAAC,CAAC,MAAM,CAAC,UAAU,CAC1B,CAAA;KAAA,CACR,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport { isBold } from 'roosterjs-content-model-core';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle bold style\n * @param editor The editor to operate on\n */\nexport function toggleBold(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleBold',\n (format, isTurningOn) => {\n format.fontWeight = isTurningOn ? 'bold' : 'normal';\n },\n (format, _, paragraph) =>\n isBold(\n typeof format.fontWeight == 'undefined'\n ? paragraph?.decorator?.format.fontWeight\n : format.fontWeight\n )\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle italic style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleCode(editor: IStandaloneEditor): void;
6
+ export declare function toggleCode(editor: IEditor): void;
@@ -9,7 +9,7 @@ var DefaultCode = {
9
9
  * Toggle italic style
10
10
  * @param editor The editor to operate on
11
11
  */
12
- export default function toggleCode(editor) {
12
+ export function toggleCode(editor) {
13
13
  editor.focus();
14
14
  formatSegmentWithContentModel(editor, 'toggleCode', function (_, isTurningOn, segment) {
15
15
  if (segment) {
@@ -1 +1 @@
1
- {"version":3,"file":"toggleCode.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF,IAAM,WAAW,GAAqB;IAClC,MAAM,EAAE;QACJ,UAAU,EAAE,WAAW;KAC1B;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,MAAyB;IACxD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,YAAY,EACZ,UAAC,CAAC,EAAE,WAAW,EAAE,OAAO;QACpB,IAAI,OAAO,EAAE;YACT,IAAI,WAAW,EAAE;gBACb,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;aACjC;iBAAM;gBACH,OAAO,OAAO,CAAC,IAAI,CAAC;aACvB;SACJ;IACL,CAAC,EACD,UAAC,CAAC,EAAE,OAAO,IAAK,OAAA,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAA,EAAf,CAAe,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { addCode } from 'roosterjs-content-model-dom';\nimport { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { ContentModelCode, IStandaloneEditor } from 'roosterjs-content-model-types';\n\nconst DefaultCode: ContentModelCode = {\n format: {\n fontFamily: 'monospace',\n },\n};\n\n/**\n * Toggle italic style\n * @param editor The editor to operate on\n */\nexport default function toggleCode(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleCode',\n (_, isTurningOn, segment) => {\n if (segment) {\n if (isTurningOn) {\n addCode(segment, DefaultCode);\n } else {\n delete segment.code;\n }\n }\n },\n (_, segment) => !!segment?.code\n );\n}\n"]}
1
+ {"version":3,"file":"toggleCode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF,IAAM,WAAW,GAAqB;IAClC,MAAM,EAAE;QACJ,UAAU,EAAE,WAAW;KAC1B;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe;IACtC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,YAAY,EACZ,UAAC,CAAC,EAAE,WAAW,EAAE,OAAO;QACpB,IAAI,OAAO,EAAE;YACT,IAAI,WAAW,EAAE;gBACb,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;aACjC;iBAAM;gBACH,OAAO,OAAO,CAAC,IAAI,CAAC;aACvB;SACJ;IACL,CAAC,EACD,UAAC,CAAC,EAAE,OAAO,IAAK,OAAA,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAA,EAAf,CAAe,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { addCode } from 'roosterjs-content-model-dom';\nimport { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { ContentModelCode, IEditor } from 'roosterjs-content-model-types';\n\nconst DefaultCode: ContentModelCode = {\n format: {\n fontFamily: 'monospace',\n },\n};\n\n/**\n * Toggle italic style\n * @param editor The editor to operate on\n */\nexport function toggleCode(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleCode',\n (_, isTurningOn, segment) => {\n if (segment) {\n if (isTurningOn) {\n addCode(segment, DefaultCode);\n } else {\n delete segment.code;\n }\n }\n },\n (_, segment) => !!segment?.code\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle italic style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleItalic(editor: IStandaloneEditor): void;
6
+ export declare function toggleItalic(editor: IEditor): void;
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
3
3
  * Toggle italic style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleItalic(editor) {
6
+ export function toggleItalic(editor) {
7
7
  editor.focus();
8
8
  formatSegmentWithContentModel(editor, 'toggleItalic', function (format, isTurningOn) {
9
9
  format.italic = !!isTurningOn;
@@ -1 +1 @@
1
- {"version":3,"file":"toggleItalic.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleItalic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAyB;IAC1D,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,cAAc,EACd,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;IAClC,CAAC,EACD,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,MAAM,EAAf,CAAe,CAC5B,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle italic style\n * @param editor The editor to operate on\n */\nexport default function toggleItalic(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleItalic',\n (format, isTurningOn) => {\n format.italic = !!isTurningOn;\n },\n format => !!format.italic\n );\n}\n"]}
1
+ {"version":3,"file":"toggleItalic.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleItalic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe;IACxC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,cAAc,EACd,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;IAClC,CAAC,EACD,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,MAAM,EAAf,CAAe,CAC5B,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle italic style\n * @param editor The editor to operate on\n */\nexport function toggleItalic(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleItalic',\n (format, isTurningOn) => {\n format.italic = !!isTurningOn;\n },\n format => !!format.italic\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle strikethrough style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleStrikethrough(editor: IStandaloneEditor): void;
6
+ export declare function toggleStrikethrough(editor: IEditor): void;
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
3
3
  * Toggle strikethrough style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleStrikethrough(editor) {
6
+ export function toggleStrikethrough(editor) {
7
7
  editor.focus();
8
8
  formatSegmentWithContentModel(editor, 'toggleStrikethrough', function (format, isTurningOn) {
9
9
  format.strikethrough = !!isTurningOn;
@@ -1 +1 @@
1
- {"version":3,"file":"toggleStrikethrough.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleStrikethrough.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,MAAyB;IACjE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,qBAAqB,EACrB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC;IACzC,CAAC,EACD,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,aAAa,EAAtB,CAAsB,CACnC,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle strikethrough style\n * @param editor The editor to operate on\n */\nexport default function toggleStrikethrough(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleStrikethrough',\n (format, isTurningOn) => {\n format.strikethrough = !!isTurningOn;\n },\n format => !!format.strikethrough\n );\n}\n"]}
1
+ {"version":3,"file":"toggleStrikethrough.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleStrikethrough.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAe;IAC/C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,qBAAqB,EACrB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC;IACzC,CAAC,EACD,UAAA,MAAM,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,aAAa,EAAtB,CAAsB,CACnC,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle strikethrough style\n * @param editor The editor to operate on\n */\nexport function toggleStrikethrough(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleStrikethrough',\n (format, isTurningOn) => {\n format.strikethrough = !!isTurningOn;\n },\n format => !!format.strikethrough\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle subscript style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleSubscript(editor: IStandaloneEditor): void;
6
+ export declare function toggleSubscript(editor: IEditor): void;
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
3
3
  * Toggle subscript style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleSubscript(editor) {
6
+ export function toggleSubscript(editor) {
7
7
  editor.focus();
8
8
  formatSegmentWithContentModel(editor, 'toggleSubscript', function (format, isTurningOn) {
9
9
  format.superOrSubScriptSequence = isTurningOn ? 'sub' : '';
@@ -1 +1 @@
1
- {"version":3,"file":"toggleSubscript.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleSubscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAAyB;IAC7D,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,iBAAiB,EACjB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,CAAC,EACD,UAAA,MAAM,YAAI,OAAA,CAAA,MAAA,MAAM,CAAC,wBAAwB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAI,KAAK,CAAA,EAAA,CACvE,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle subscript style\n * @param editor The editor to operate on\n */\nexport default function toggleSubscript(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleSubscript',\n (format, isTurningOn) => {\n format.superOrSubScriptSequence = isTurningOn ? 'sub' : '';\n },\n format => format.superOrSubScriptSequence?.split(' ').pop() == 'sub'\n );\n}\n"]}
1
+ {"version":3,"file":"toggleSubscript.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleSubscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe;IAC3C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,iBAAiB,EACjB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,CAAC,EACD,UAAA,MAAM,YAAI,OAAA,CAAA,MAAA,MAAM,CAAC,wBAAwB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAI,KAAK,CAAA,EAAA,CACvE,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle subscript style\n * @param editor The editor to operate on\n */\nexport function toggleSubscript(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleSubscript',\n (format, isTurningOn) => {\n format.superOrSubScriptSequence = isTurningOn ? 'sub' : '';\n },\n format => format.superOrSubScriptSequence?.split(' ').pop() == 'sub'\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle superscript style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleSuperscript(editor: IStandaloneEditor): void;
6
+ export declare function toggleSuperscript(editor: IEditor): void;
@@ -3,7 +3,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
3
3
  * Toggle superscript style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleSuperscript(editor) {
6
+ export function toggleSuperscript(editor) {
7
7
  editor.focus();
8
8
  formatSegmentWithContentModel(editor, 'toggleSuperscript', function (format, isTurningOn) {
9
9
  format.superOrSubScriptSequence = isTurningOn ? 'super' : '';
@@ -1 +1 @@
1
- {"version":3,"file":"toggleSuperscript.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleSuperscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,MAAyB;IAC/D,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,mBAAmB,EACnB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC,EACD,UAAA,MAAM,YAAI,OAAA,CAAA,MAAA,MAAM,CAAC,wBAAwB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAI,OAAO,CAAA,EAAA,CACzE,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle superscript style\n * @param editor The editor to operate on\n */\nexport default function toggleSuperscript(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleSuperscript',\n (format, isTurningOn) => {\n format.superOrSubScriptSequence = isTurningOn ? 'super' : '';\n },\n format => format.superOrSubScriptSequence?.split(' ').pop() == 'super'\n );\n}\n"]}
1
+ {"version":3,"file":"toggleSuperscript.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleSuperscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC7C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,mBAAmB,EACnB,UAAC,MAAM,EAAE,WAAW;QAChB,MAAM,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC,EACD,UAAA,MAAM,YAAI,OAAA,CAAA,MAAA,MAAM,CAAC,wBAAwB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAI,OAAO,CAAA,EAAA,CACzE,CAAC;AACN,CAAC","sourcesContent":["import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle superscript style\n * @param editor The editor to operate on\n */\nexport function toggleSuperscript(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleSuperscript',\n (format, isTurningOn) => {\n format.superOrSubScriptSequence = isTurningOn ? 'super' : '';\n },\n format => format.superOrSubScriptSequence?.split(' ').pop() == 'super'\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle underline style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleUnderline(editor: IStandaloneEditor): void;
6
+ export declare function toggleUnderline(editor: IEditor): void;
@@ -4,7 +4,7 @@ import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContent
4
4
  * Toggle underline style
5
5
  * @param editor The editor to operate on
6
6
  */
7
- export default function toggleUnderline(editor) {
7
+ export function toggleUnderline(editor) {
8
8
  editor.focus();
9
9
  formatSegmentWithContentModel(editor, 'toggleUnderline', function (format, isTurningOn, segment) {
10
10
  format.underline = !!isTurningOn;
@@ -1 +1 @@
1
- {"version":3,"file":"toggleUnderline.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/segment/toggleUnderline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAAyB;IAC7D,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,iBAAiB,EACjB,UAAC,MAAM,EAAE,WAAW,EAAE,OAAO;QACzB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC;QAEjC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC;SACjD;IACL,CAAC,EACD,UAAC,MAAM,EAAE,OAAO,gBAAK,OAAA,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,CAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,MAAM,0CAAE,SAAS,CAAA,CAAA,EAAA,EAC7E,KAAK,CAAC,yBAAyB,EAC/B,4BAA4B,CAC/B,CAAC;AACN,CAAC","sourcesContent":["import { adjustTrailingSpaceSelection } from '../../modelApi/selection/adjustTrailingSpaceSelection';\nimport { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle underline style\n * @param editor The editor to operate on\n */\nexport default function toggleUnderline(editor: IStandaloneEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleUnderline',\n (format, isTurningOn, segment) => {\n format.underline = !!isTurningOn;\n\n if (segment?.link) {\n segment.link.format.underline = !!isTurningOn;\n }\n },\n (format, segment) => !!format.underline || !!segment?.link?.format?.underline,\n false /*includingFormatHolder*/,\n adjustTrailingSpaceSelection\n );\n}\n"]}
1
+ {"version":3,"file":"toggleUnderline.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleUnderline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAGvF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe;IAC3C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,6BAA6B,CACzB,MAAM,EACN,iBAAiB,EACjB,UAAC,MAAM,EAAE,WAAW,EAAE,OAAO;QACzB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC;QAEjC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC;SACjD;IACL,CAAC,EACD,UAAC,MAAM,EAAE,OAAO,gBAAK,OAAA,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,CAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,MAAM,0CAAE,SAAS,CAAA,CAAA,EAAA,EAC7E,KAAK,CAAC,yBAAyB,EAC/B,4BAA4B,CAC/B,CAAC;AACN,CAAC","sourcesContent":["import { adjustTrailingSpaceSelection } from '../../modelApi/selection/adjustTrailingSpaceSelection';\nimport { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggle underline style\n * @param editor The editor to operate on\n */\nexport function toggleUnderline(editor: IEditor) {\n editor.focus();\n\n formatSegmentWithContentModel(\n editor,\n 'toggleUnderline',\n (format, isTurningOn, segment) => {\n format.underline = !!isTurningOn;\n\n if (segment?.link) {\n segment.link.format.underline = !!isTurningOn;\n }\n },\n (format, segment) => !!format.underline || !!segment?.link?.format?.underline,\n false /*includingFormatHolder*/,\n adjustTrailingSpaceSelection\n );\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { IStandaloneEditor, Border, BorderOperations } from 'roosterjs-content-model-types';
1
+ import type { IEditor, Border, BorderOperations } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Operations to apply border
4
4
  * @param editor The editor instance
5
5
  * @param border The border to apply
6
6
  * @param operation The operation to apply
7
7
  */
8
- export default function applyTableBorderFormat(editor: IStandaloneEditor, border: Border, operation: BorderOperations): void;
8
+ export declare function applyTableBorderFormat(editor: IEditor, border: Border, operation: BorderOperations): void;
@@ -7,7 +7,7 @@ import { extractBorderValues, getFirstSelectedTable, getSelectedCells, updateTab
7
7
  * @param border The border to apply
8
8
  * @param operation The operation to apply
9
9
  */
10
- export default function applyTableBorderFormat(editor, border, operation) {
10
+ export function applyTableBorderFormat(editor, border, operation) {
11
11
  editor.formatContentModel(function (model) {
12
12
  var _a = __read(getFirstSelectedTable(model), 1), tableModel = _a[0];
13
13
  if (tableModel) {
@@ -1 +1 @@
1
- {"version":3,"file":"applyTableBorderFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/applyTableBorderFormat.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GAC1B,MAAM,8BAA8B,CAAC;AA4BtC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC1C,MAAyB,EACzB,MAAc,EACd,SAA2B;IAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,OAAe,qBAAqB,CAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,IAAM,GAAG,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACzC,IAAM,SAAS,GAAc;gBACzB,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;aACf,CAAC;YAEF,mDAAmD;YACnD,IAAI,YAAY,GAAG,EAAE,CAAC;YACtB,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YACzB,IAAA,KAAK,GAAmB,MAAM,MAAzB,EAAE,KAAK,GAAY,MAAM,MAAlB,EAAE,KAAK,GAAK,MAAM,MAAX,CAAY;YACvC,IAAM,eAAe,GAAG,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC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C,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;YACnE,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YACjE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;SACjF;KACJ;AACL,CAAC","sourcesContent":["import { parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport {\n extractBorderValues,\n getFirstSelectedTable,\n getSelectedCells,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\nimport type {\n IStandaloneEditor,\n Border,\n ContentModelTable,\n ContentModelTableCell,\n BorderOperations,\n TableSelectionCoordinates,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Border positions\n */\ntype BorderPositions = 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight';\n\n/**\n * @internal\n * Perimeter of the table selection\n * Used to determine where to apply border to the cells adjacent to the selection.\n */\ntype Perimeter = {\n Top: boolean;\n Bottom: boolean;\n Left: boolean;\n Right: boolean;\n};\n\n/**\n * Operations to apply border\n * @param editor The editor instance\n * @param border The border to apply\n * @param operation The operation to apply\n */\nexport default function applyTableBorderFormat(\n editor: IStandaloneEditor,\n border: Border,\n operation: BorderOperations\n) {\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n const sel = getSelectedCells(tableModel);\n const perimeter: Perimeter = {\n Top: false,\n Bottom: false,\n Left: false,\n Right: false,\n };\n\n // Create border format with table format as backup\n let borderFormat = '';\n const format = tableModel.format;\n const { width, style, color } = border;\n const extractedBorder = extractBorderValues(format.borderTop);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n\n if (width) {\n borderFormat = parseValueWithUnit(width) + 'px';\n } else if (borderWidth) {\n borderFormat = borderWidth;\n } else {\n borderFormat = '1px';\n }\n\n if (style) {\n borderFormat = `${borderFormat} ${style}`;\n } else if (borderStyle) {\n borderFormat = `${borderFormat} ${borderStyle}`;\n } else {\n borderFormat = `${borderFormat} solid`;\n }\n\n if (color) {\n borderFormat = `${borderFormat} ${color}`;\n } else if (borderColor) {\n borderFormat = `${borderFormat} ${borderColor}`;\n }\n\n // undefined is treated as Left to Right\n const isRtl = tableModel.format.direction == 'rtl';\n\n if (sel) {\n const operations: BorderOperations[] = [operation];\n while (operations.length) {\n switch (operations.pop()) {\n case 'noBorders':\n // Do All borders but with empty border format\n borderFormat = '';\n operations.push('allBorders');\n break;\n case 'allBorders':\n const allBorders: BorderPositions[] = [\n 'borderTop',\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[colIndex];\n // Format cells - All borders\n applyBorderFormat(cell, borderFormat, allBorders);\n }\n }\n\n // Format perimeter\n perimeter.Top = true;\n perimeter.Bottom = true;\n perimeter.Left = true;\n perimeter.Right = true;\n break;\n case 'leftBorders':\n const leftBorder: BorderPositions[] = ['borderLeft'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ];\n // Format cells - Left border\n applyBorderFormat(cell, borderFormat, leftBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Right = true) : (perimeter.Left = true);\n break;\n case 'rightBorders':\n const rightBorder: BorderPositions[] = ['borderRight'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ];\n // Format cells - Right border\n applyBorderFormat(cell, borderFormat, rightBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Left = true) : (perimeter.Right = true);\n break;\n case 'topBorders':\n const topBorder: BorderPositions[] = ['borderTop'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n // Format cells - Top border\n applyBorderFormat(cell, borderFormat, topBorder);\n }\n\n // Format perimeter\n perimeter.Top = true;\n break;\n case 'bottomBorders':\n const bottomBorder: BorderPositions[] = ['borderBottom'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n // Format cells - Bottom border\n applyBorderFormat(cell, borderFormat, bottomBorder);\n }\n\n // Format perimeter\n perimeter.Bottom = true;\n break;\n case 'insideBorders':\n // Format cells - Inside borders\n const singleCol = sel.lastColumn == sel.firstColumn;\n const singleRow = sel.lastRow == sel.firstRow;\n // Single cell selection\n if (singleCol && singleRow) {\n break;\n }\n // Single column selection\n if (singleCol) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[sel.firstColumn],\n borderFormat,\n ['borderBottom']\n );\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex <= sel.lastRow - 1;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[sel.firstColumn],\n borderFormat,\n ['borderTop']\n );\n break;\n }\n // Single row selection\n if (singleRow) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderRight']\n );\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex <= sel.lastColumn - 1;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderLeft',\n 'borderRight',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderLeft']\n );\n break;\n }\n\n // For multiple rows and columns selections\n // Top left cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderBottom', 'borderRight']\n );\n // Top right cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderBottom', 'borderLeft']\n );\n // Bottom left cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderTop', 'borderRight']\n );\n // Bottom right cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderTop', 'borderLeft']\n );\n // First row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // Last row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // First column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderLeft' : 'borderRight',\n ]);\n }\n // Last column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderRight' : 'borderLeft',\n ]);\n }\n // Inner cells\n sel.firstColumn++;\n sel.firstRow++;\n sel.lastColumn--;\n sel.lastRow--;\n operations.push('allBorders');\n break;\n case 'outsideBorders':\n // Format cells - Outside borders\n operations.push('topBorders');\n operations.push('bottomBorders');\n operations.push('leftBorders');\n operations.push('rightBorders');\n break;\n default:\n break;\n }\n }\n\n //Format perimeter if necessary or possible\n modifyPerimeter(tableModel, sel, borderFormat, perimeter, isRtl);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'tableBorder',\n }\n );\n}\n\n/**\n * @internal\n * Apply border format to a cell\n * @param cell The cell to apply border format\n * @param borderFormat The border format to apply\n * @param positions The positions to apply\n */\nfunction applyBorderFormat(\n cell: ContentModelTableCell,\n borderFormat: string,\n positions: BorderPositions[]\n) {\n positions.forEach(pos => {\n cell.format[pos] = borderFormat;\n });\n\n updateTableCellMetadata(cell, metadata => {\n metadata = metadata || {};\n metadata.borderOverride = true;\n return metadata;\n });\n\n // Cell was modified, so delete cached element\n delete cell.cachedElement;\n}\n\n/**\n * @internal\n * Modify the perimeter of the table selection\n * @param tableModel The table model\n * @param sel The table selection\n * @param borderFormat The border format to apply\n * If borderFormat is empty, the border will be removed\n * @param perimeter Where in the perimeter to apply\n */\nfunction modifyPerimeter(\n tableModel: ContentModelTable,\n sel: TableSelectionCoordinates,\n borderFormat: string,\n perimeter: Perimeter,\n isRtl: boolean\n) {\n // Top of selection\n if (perimeter.Top && sel.firstRow - 1 >= 0) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.firstRow - 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderBottom']);\n }\n }\n // Bottom of selection\n if (perimeter.Bottom && sel.lastRow + 1 < tableModel.rows.length) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.lastRow + 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderTop']);\n }\n }\n // Left of selection\n if (perimeter.Left && sel.firstColumn - 1 >= 0) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn - 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderLeft' : 'borderRight']);\n }\n }\n // Right of selection\n if (perimeter.Right && sel.lastColumn + 1 < tableModel.rows[0].cells.length) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn + 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderRight' : 'borderLeft']);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"applyTableBorderFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/applyTableBorderFormat.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GAC1B,MAAM,8BAA8B,CAAC;AA4BtC;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAClC,MAAe,EACf,MAAc,EACd,SAA2B;IAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,OAAe,qBAAqB,CAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,IAAM,GAAG,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACzC,IAAM,SAAS,GAAc;gBACzB,GAAG,EAAE,KAAK;gBACV,MAAM,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AC,CAAC,CAAC;YAClE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;SACjF;KACJ;IACD,qBAAqB;IACrB,IAAI,SAAS,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;QACzE,KAAK,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;YACnE,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YACjE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;SACjF;KACJ;AACL,CAAC","sourcesContent":["import { parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport {\n extractBorderValues,\n getFirstSelectedTable,\n getSelectedCells,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\nimport type {\n IEditor,\n Border,\n ContentModelTable,\n ContentModelTableCell,\n BorderOperations,\n TableSelectionCoordinates,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Border positions\n */\ntype BorderPositions = 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight';\n\n/**\n * @internal\n * Perimeter of the table selection\n * Used to determine where to apply border to the cells adjacent to the selection.\n */\ntype Perimeter = {\n Top: boolean;\n Bottom: boolean;\n Left: boolean;\n Right: boolean;\n};\n\n/**\n * Operations to apply border\n * @param editor The editor instance\n * @param border The border to apply\n * @param operation The operation to apply\n */\nexport function applyTableBorderFormat(\n editor: IEditor,\n border: Border,\n operation: BorderOperations\n) {\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n const sel = getSelectedCells(tableModel);\n const perimeter: Perimeter = {\n Top: false,\n Bottom: false,\n Left: false,\n Right: false,\n };\n\n // Create border format with table format as backup\n let borderFormat = '';\n const format = tableModel.format;\n const { width, style, color } = border;\n const extractedBorder = extractBorderValues(format.borderTop);\n const borderColor = extractedBorder.color;\n const borderWidth = extractedBorder.width;\n const borderStyle = extractedBorder.style;\n\n if (width) {\n borderFormat = parseValueWithUnit(width) + 'px';\n } else if (borderWidth) {\n borderFormat = borderWidth;\n } else {\n borderFormat = '1px';\n }\n\n if (style) {\n borderFormat = `${borderFormat} ${style}`;\n } else if (borderStyle) {\n borderFormat = `${borderFormat} ${borderStyle}`;\n } else {\n borderFormat = `${borderFormat} solid`;\n }\n\n if (color) {\n borderFormat = `${borderFormat} ${color}`;\n } else if (borderColor) {\n borderFormat = `${borderFormat} ${borderColor}`;\n }\n\n // undefined is treated as Left to Right\n const isRtl = tableModel.format.direction == 'rtl';\n\n if (sel) {\n const operations: BorderOperations[] = [operation];\n while (operations.length) {\n switch (operations.pop()) {\n case 'noBorders':\n // Do All borders but with empty border format\n borderFormat = '';\n operations.push('allBorders');\n break;\n case 'allBorders':\n const allBorders: BorderPositions[] = [\n 'borderTop',\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[colIndex];\n // Format cells - All borders\n applyBorderFormat(cell, borderFormat, allBorders);\n }\n }\n\n // Format perimeter\n perimeter.Top = true;\n perimeter.Bottom = true;\n perimeter.Left = true;\n perimeter.Right = true;\n break;\n case 'leftBorders':\n const leftBorder: BorderPositions[] = ['borderLeft'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ];\n // Format cells - Left border\n applyBorderFormat(cell, borderFormat, leftBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Right = true) : (perimeter.Left = true);\n break;\n case 'rightBorders':\n const rightBorder: BorderPositions[] = ['borderRight'];\n for (\n let rowIndex = sel.firstRow;\n rowIndex <= sel.lastRow;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ];\n // Format cells - Right border\n applyBorderFormat(cell, borderFormat, rightBorder);\n }\n\n // Format perimeter\n isRtl ? (perimeter.Left = true) : (perimeter.Right = true);\n break;\n case 'topBorders':\n const topBorder: BorderPositions[] = ['borderTop'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n // Format cells - Top border\n applyBorderFormat(cell, borderFormat, topBorder);\n }\n\n // Format perimeter\n perimeter.Top = true;\n break;\n case 'bottomBorders':\n const bottomBorder: BorderPositions[] = ['borderBottom'];\n for (\n let colIndex = sel.firstColumn;\n colIndex <= sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n // Format cells - Bottom border\n applyBorderFormat(cell, borderFormat, bottomBorder);\n }\n\n // Format perimeter\n perimeter.Bottom = true;\n break;\n case 'insideBorders':\n // Format cells - Inside borders\n const singleCol = sel.lastColumn == sel.firstColumn;\n const singleRow = sel.lastRow == sel.firstRow;\n // Single cell selection\n if (singleCol && singleRow) {\n break;\n }\n // Single column selection\n if (singleCol) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[sel.firstColumn],\n borderFormat,\n ['borderBottom']\n );\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex <= sel.lastRow - 1;\n rowIndex++\n ) {\n const cell =\n tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[sel.firstColumn],\n borderFormat,\n ['borderTop']\n );\n break;\n }\n // Single row selection\n if (singleRow) {\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderRight']\n );\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex <= sel.lastColumn - 1;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderLeft',\n 'borderRight',\n ]);\n }\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderLeft']\n );\n break;\n }\n\n // For multiple rows and columns selections\n // Top left cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderBottom', 'borderRight']\n );\n // Top right cell\n applyBorderFormat(\n tableModel.rows[sel.firstRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderBottom', 'borderLeft']\n );\n // Bottom left cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.lastColumn : sel.firstColumn\n ],\n borderFormat,\n ['borderTop', 'borderRight']\n );\n // Bottom right cell\n applyBorderFormat(\n tableModel.rows[sel.lastRow].cells[\n isRtl ? sel.firstColumn : sel.lastColumn\n ],\n borderFormat,\n ['borderTop', 'borderLeft']\n );\n // First row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.firstRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderBottom',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // Last row\n for (\n let colIndex = sel.firstColumn + 1;\n colIndex < sel.lastColumn;\n colIndex++\n ) {\n const cell = tableModel.rows[sel.lastRow].cells[colIndex];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderLeft',\n 'borderRight',\n ]);\n }\n // First column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderLeft' : 'borderRight',\n ]);\n }\n // Last column\n for (\n let rowIndex = sel.firstRow + 1;\n rowIndex < sel.lastRow;\n rowIndex++\n ) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn];\n applyBorderFormat(cell, borderFormat, [\n 'borderTop',\n 'borderBottom',\n isRtl ? 'borderRight' : 'borderLeft',\n ]);\n }\n // Inner cells\n sel.firstColumn++;\n sel.firstRow++;\n sel.lastColumn--;\n sel.lastRow--;\n operations.push('allBorders');\n break;\n case 'outsideBorders':\n // Format cells - Outside borders\n operations.push('topBorders');\n operations.push('bottomBorders');\n operations.push('leftBorders');\n operations.push('rightBorders');\n break;\n default:\n break;\n }\n }\n\n //Format perimeter if necessary or possible\n modifyPerimeter(tableModel, sel, borderFormat, perimeter, isRtl);\n }\n\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'tableBorder',\n }\n );\n}\n\n/**\n * @internal\n * Apply border format to a cell\n * @param cell The cell to apply border format\n * @param borderFormat The border format to apply\n * @param positions The positions to apply\n */\nfunction applyBorderFormat(\n cell: ContentModelTableCell,\n borderFormat: string,\n positions: BorderPositions[]\n) {\n positions.forEach(pos => {\n cell.format[pos] = borderFormat;\n });\n\n updateTableCellMetadata(cell, metadata => {\n metadata = metadata || {};\n metadata.borderOverride = true;\n return metadata;\n });\n\n // Cell was modified, so delete cached element\n delete cell.cachedElement;\n}\n\n/**\n * @internal\n * Modify the perimeter of the table selection\n * @param tableModel The table model\n * @param sel The table selection\n * @param borderFormat The border format to apply\n * If borderFormat is empty, the border will be removed\n * @param perimeter Where in the perimeter to apply\n */\nfunction modifyPerimeter(\n tableModel: ContentModelTable,\n sel: TableSelectionCoordinates,\n borderFormat: string,\n perimeter: Perimeter,\n isRtl: boolean\n) {\n // Top of selection\n if (perimeter.Top && sel.firstRow - 1 >= 0) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.firstRow - 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderBottom']);\n }\n }\n // Bottom of selection\n if (perimeter.Bottom && sel.lastRow + 1 < tableModel.rows.length) {\n for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) {\n const cell = tableModel.rows[sel.lastRow + 1].cells[colIndex];\n applyBorderFormat(cell, borderFormat, ['borderTop']);\n }\n }\n // Left of selection\n if (perimeter.Left && sel.firstColumn - 1 >= 0) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.firstColumn - 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderLeft' : 'borderRight']);\n }\n }\n // Right of selection\n if (perimeter.Right && sel.lastColumn + 1 < tableModel.rows[0].cells.length) {\n for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) {\n const cell = tableModel.rows[rowIndex].cells[sel.lastColumn + 1];\n applyBorderFormat(cell, borderFormat, [isRtl ? 'borderRight' : 'borderLeft']);\n }\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { TableOperation, IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { TableOperation, IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Format current focused table with the given format
4
4
  * @param editor The editor instance
5
5
  * @param operation The table operation to apply
6
6
  */
7
- export default function editTable(editor: IStandaloneEditor, operation: TableOperation): void;
7
+ export declare function editTable(editor: IEditor, operation: TableOperation): void;
@@ -16,7 +16,7 @@ import { alignTableCellHorizontally, alignTableCellVertically, } from '../../mod
16
16
  * @param editor The editor instance
17
17
  * @param operation The table operation to apply
18
18
  */
19
- export default function editTable(editor, operation) {
19
+ export function editTable(editor, operation) {
20
20
  editor.focus();
21
21
  formatTableWithContentModel(editor, 'editTable', function (tableModel) {
22
22
  switch (operation) {
@@ -1 +1 @@
1
- {"version":3,"file":"editTable.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/editTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAEzF,OAAO,EACH,0BAA0B,EAC1B,wBAAwB,GAC3B,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,MAAyB,EAAE,SAAyB;IAClF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,2BAA2B,CAAC,MAAM,EAAE,WAAW,EAAE,UAAA,UAAU;QACvD,QAAQ,SAAS,EAAE;YACf,KAAK,eAAe,CA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C,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { alignTable } from '../../modelApi/table/alignTable';\nimport { deleteTable } from '../../modelApi/table/deleteTable';\nimport { deleteTableColumn } from '../../modelApi/table/deleteTableColumn';\nimport { deleteTableRow } from '../../modelApi/table/deleteTableRow';\nimport { formatTableWithContentModel } from '../utils/formatTableWithContentModel';\nimport { insertTableColumn } from '../../modelApi/table/insertTableColumn';\nimport { insertTableRow } from '../../modelApi/table/insertTableRow';\nimport { mergeTableCells } from '../../modelApi/table/mergeTableCells';\nimport { mergeTableColumn } from '../../modelApi/table/mergeTableColumn';\nimport { mergeTableRow } from '../../modelApi/table/mergeTableRow';\nimport { splitTableCellHorizontally } from '../../modelApi/table/splitTableCellHorizontally';\nimport { splitTableCellVertically } from '../../modelApi/table/splitTableCellVertically';\nimport type { TableOperation, IStandaloneEditor } from 'roosterjs-content-model-types';\nimport {\n alignTableCellHorizontally,\n alignTableCellVertically,\n} from '../../modelApi/table/alignTableCell';\n\n/**\n * Format current focused table with the given format\n * @param editor The editor instance\n * @param operation The table operation to apply\n */\nexport default function editTable(editor: IStandaloneEditor, operation: TableOperation) {\n editor.focus();\n\n formatTableWithContentModel(editor, 'editTable', tableModel => {\n switch (operation) {\n case 'alignCellLeft':\n case 'alignCellCenter':\n case 'alignCellRight':\n alignTableCellHorizontally(tableModel, operation);\n break;\n case 'alignCellTop':\n case 'alignCellMiddle':\n case 'alignCellBottom':\n alignTableCellVertically(tableModel, operation);\n break;\n case 'alignCenter':\n case 'alignLeft':\n case 'alignRight':\n alignTable(tableModel, operation);\n break;\n\n case 'deleteColumn':\n deleteTableColumn(tableModel);\n break;\n\n case 'deleteRow':\n deleteTableRow(tableModel);\n break;\n\n case 'deleteTable':\n deleteTable(tableModel);\n break;\n\n case 'insertAbove':\n case 'insertBelow':\n insertTableRow(tableModel, operation);\n break;\n\n case 'insertLeft':\n case 'insertRight':\n insertTableColumn(tableModel, operation);\n break;\n\n case 'mergeAbove':\n case 'mergeBelow':\n mergeTableRow(tableModel, operation);\n break;\n\n case 'mergeCells':\n mergeTableCells(tableModel);\n break;\n\n case 'mergeLeft':\n case 'mergeRight':\n mergeTableColumn(tableModel, operation);\n break;\n\n case 'splitHorizontally':\n splitTableCellHorizontally(tableModel);\n break;\n\n case 'splitVertically':\n splitTableCellVertically(tableModel);\n break;\n }\n });\n}\n"]}
1
+ {"version":3,"file":"editTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/editTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAEzF,OAAO,EACH,0BAA0B,EAC1B,wBAAwB,GAC3B,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,MAAe,EAAE,SAAyB;IAChE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,2BAA2B,CAAC,MAAM,EAAE,WAAW,EAAE,UAAA,UAAU;QACvD,QAAQ,SAAS,EAAE;YACf,KAAK,eAAe,CAAC;YACrB,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AAC;AACP,CAAC","sourcesContent":["import { alignTable } from '../../modelApi/table/alignTable';\nimport { deleteTable } from '../../modelApi/table/deleteTable';\nimport { deleteTableColumn } from '../../modelApi/table/deleteTableColumn';\nimport { deleteTableRow } from '../../modelApi/table/deleteTableRow';\nimport { formatTableWithContentModel } from '../utils/formatTableWithContentModel';\nimport { insertTableColumn } from '../../modelApi/table/insertTableColumn';\nimport { insertTableRow } from '../../modelApi/table/insertTableRow';\nimport { mergeTableCells } from '../../modelApi/table/mergeTableCells';\nimport { mergeTableColumn } from '../../modelApi/table/mergeTableColumn';\nimport { mergeTableRow } from '../../modelApi/table/mergeTableRow';\nimport { splitTableCellHorizontally } from '../../modelApi/table/splitTableCellHorizontally';\nimport { splitTableCellVertically } from '../../modelApi/table/splitTableCellVertically';\nimport type { TableOperation, IEditor } from 'roosterjs-content-model-types';\nimport {\n alignTableCellHorizontally,\n alignTableCellVertically,\n} from '../../modelApi/table/alignTableCell';\n\n/**\n * Format current focused table with the given format\n * @param editor The editor instance\n * @param operation The table operation to apply\n */\nexport function editTable(editor: IEditor, operation: TableOperation) {\n editor.focus();\n\n formatTableWithContentModel(editor, 'editTable', tableModel => {\n switch (operation) {\n case 'alignCellLeft':\n case 'alignCellCenter':\n case 'alignCellRight':\n alignTableCellHorizontally(tableModel, operation);\n break;\n case 'alignCellTop':\n case 'alignCellMiddle':\n case 'alignCellBottom':\n alignTableCellVertically(tableModel, operation);\n break;\n case 'alignCenter':\n case 'alignLeft':\n case 'alignRight':\n alignTable(tableModel, operation);\n break;\n\n case 'deleteColumn':\n deleteTableColumn(tableModel);\n break;\n\n case 'deleteRow':\n deleteTableRow(tableModel);\n break;\n\n case 'deleteTable':\n deleteTable(tableModel);\n break;\n\n case 'insertAbove':\n case 'insertBelow':\n insertTableRow(tableModel, operation);\n break;\n\n case 'insertLeft':\n case 'insertRight':\n insertTableColumn(tableModel, operation);\n break;\n\n case 'mergeAbove':\n case 'mergeBelow':\n mergeTableRow(tableModel, operation);\n break;\n\n case 'mergeCells':\n mergeTableCells(tableModel);\n break;\n\n case 'mergeLeft':\n case 'mergeRight':\n mergeTableColumn(tableModel, operation);\n break;\n\n case 'splitHorizontally':\n splitTableCellHorizontally(tableModel);\n break;\n\n case 'splitVertically':\n splitTableCellVertically(tableModel);\n break;\n }\n });\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { IStandaloneEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
1
+ import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Format current focused table with the given format
4
4
  * @param editor The editor instance
5
5
  * @param format The table format to apply
6
6
  * @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color
7
7
  */
8
- export default function formatTable(editor: IStandaloneEditor, format: TableMetadataFormat, keepCellShade?: boolean): void;
8
+ export declare function formatTable(editor: IEditor, format: TableMetadataFormat, keepCellShade?: boolean): void;
@@ -6,7 +6,7 @@ import { applyTableFormat, getFirstSelectedTable, updateTableCellMetadata, } fro
6
6
  * @param format The table format to apply
7
7
  * @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color
8
8
  */
9
- export default function formatTable(editor, format, keepCellShade) {
9
+ export function formatTable(editor, format, keepCellShade) {
10
10
  editor.focus();
11
11
  editor.formatContentModel(function (model) {
12
12
  var _a = __read(getFirstSelectedTable(model), 1), tableModel = _a[0];
@@ -1 +1 @@
1
- {"version":3,"file":"formatTable.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/table/formatTable.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,GAC1B,MAAM,8BAA8B,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAC/B,MAAyB,EACzB,MAA2B,EAC3B,aAAuB;IAEvB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,OAAe,qBAAqB,CAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,uBAAuB;YACvB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;gBACvB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;oBAClB,uBAAuB,CAAC,IAAI,EAAE,UAAA,QAAQ;wBAClC,IAAI,QAAQ,EAAE;4BACV,OAAO,QAAQ,CAAC,cAAc,CAAC;yBAClC;wBACD,OAAO,QAAQ,CAAC;oBACpB,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import {\n applyTableFormat,\n getFirstSelectedTable,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\nimport type { IStandaloneEditor, TableMetadataFormat } from 'roosterjs-content-model-types';\n\n/**\n * Format current focused table with the given format\n * @param editor The editor instance\n * @param format The table format to apply\n * @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color\n */\nexport default function formatTable(\n editor: IStandaloneEditor,\n format: TableMetadataFormat,\n keepCellShade?: boolean\n) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n // Wipe border metadata\n tableModel.rows.forEach(row => {\n row.cells.forEach(cell => {\n updateTableCellMetadata(cell, metadata => {\n if (metadata) {\n delete metadata.borderOverride;\n }\n return metadata;\n });\n });\n });\n applyTableFormat(tableModel, format, keepCellShade);\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'formatTable',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"formatTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/formatTable.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,GAC1B,MAAM,8BAA8B,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE,MAA2B,EAAE,aAAuB;IAC7F,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,OAAe,qBAAqB,CAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,uBAAuB;YACvB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;gBACvB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;oBAClB,uBAAuB,CAAC,IAAI,EAAE,UAAA,QAAQ;wBAClC,IAAI,QAAQ,EAAE;4BACV,OAAO,QAAQ,CAAC,cAAc,CAAC;yBAClC;wBACD,OAAO,QAAQ,CAAC;oBACpB,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import {\n applyTableFormat,\n getFirstSelectedTable,\n updateTableCellMetadata,\n} from 'roosterjs-content-model-core';\nimport type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';\n\n/**\n * Format current focused table with the given format\n * @param editor The editor instance\n * @param format The table format to apply\n * @param keepCellShade Whether keep existing shade color when apply format if there is a manually set shade color\n */\nexport function formatTable(editor: IEditor, format: TableMetadataFormat, keepCellShade?: boolean) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const [tableModel] = getFirstSelectedTable(model);\n\n if (tableModel) {\n // Wipe border metadata\n tableModel.rows.forEach(row => {\n row.cells.forEach(cell => {\n updateTableCellMetadata(cell, metadata => {\n if (metadata) {\n delete metadata.borderOverride;\n }\n return metadata;\n });\n });\n });\n applyTableFormat(tableModel, format, keepCellShade);\n return true;\n } else {\n return false;\n }\n },\n {\n apiName: 'formatTable',\n }\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IStandaloneEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
1
+ import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Insert table into editor at current selection
4
4
  * @param editor The editor instance
@@ -8,4 +8,4 @@ import type { IStandaloneEditor, TableMetadataFormat } from 'roosterjs-content-m
8
8
  * @param format (Optional) The table format. If not passed, the default format will be applied:
9
9
  * background color: #FFF; border color: #ABABAB
10
10
  */
11
- export default function insertTable(editor: IStandaloneEditor, columns: number, rows: number, format?: Partial<TableMetadataFormat>): void;
11
+ export declare function insertTable(editor: IEditor, columns: number, rows: number, format?: Partial<TableMetadataFormat>): void;
@@ -10,7 +10,7 @@ import { applyTableFormat, deleteSelection, mergeModel, normalizeTable, setSelec
10
10
  * @param format (Optional) The table format. If not passed, the default format will be applied:
11
11
  * background color: #FFF; border color: #ABABAB
12
12
  */
13
- export default function insertTable(editor, columns, rows, format) {
13
+ export function insertTable(editor, columns, rows, format) {
14
14
  editor.focus();
15
15
  editor.formatContentModel(function (model, context) {
16
16
  var _a, _b, _c;