roosterjs-content-model-api 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (523) 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.js.map +1 -1
  19. package/lib/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  20. package/lib/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  21. package/lib/modelApi/selection/adjustWordSelection.js.map +1 -1
  22. package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
  23. package/lib/modelApi/table/alignTable.js.map +1 -1
  24. package/lib/modelApi/table/alignTableCell.js.map +1 -1
  25. package/lib/modelApi/table/canMergeCells.js.map +1 -1
  26. package/lib/modelApi/table/clearSelectedCells.js.map +1 -1
  27. package/lib/modelApi/table/createTableStructure.js.map +1 -1
  28. package/lib/modelApi/table/deleteTable.js.map +1 -1
  29. package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
  30. package/lib/modelApi/table/deleteTableRow.js.map +1 -1
  31. package/lib/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  32. package/lib/modelApi/table/insertTableColumn.js.map +1 -1
  33. package/lib/modelApi/table/insertTableRow.js.map +1 -1
  34. package/lib/modelApi/table/mergeTableCells.js.map +1 -1
  35. package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
  36. package/lib/modelApi/table/mergeTableRow.js.map +1 -1
  37. package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  38. package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
  39. package/lib/publicApi/block/setAlignment.d.ts +1 -1
  40. package/lib/publicApi/block/setAlignment.js +2 -1
  41. package/lib/publicApi/block/setAlignment.js.map +1 -1
  42. package/lib/publicApi/block/setDirection.d.ts +1 -1
  43. package/lib/publicApi/block/setDirection.js +2 -1
  44. package/lib/publicApi/block/setDirection.js.map +1 -1
  45. package/lib/publicApi/block/setHeadingLevel.d.ts +1 -1
  46. package/lib/publicApi/block/setHeadingLevel.js +2 -1
  47. package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
  48. package/lib/publicApi/block/setIndentation.d.ts +1 -1
  49. package/lib/publicApi/block/setIndentation.js +2 -1
  50. package/lib/publicApi/block/setIndentation.js.map +1 -1
  51. package/lib/publicApi/block/setParagraphMargin.d.ts +1 -1
  52. package/lib/publicApi/block/setParagraphMargin.js +2 -1
  53. package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
  54. package/lib/publicApi/block/setSpacing.d.ts +1 -1
  55. package/lib/publicApi/block/setSpacing.js +2 -1
  56. package/lib/publicApi/block/setSpacing.js.map +1 -1
  57. package/lib/publicApi/block/toggleBlockQuote.d.ts +1 -1
  58. package/lib/publicApi/block/toggleBlockQuote.js +2 -1
  59. package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
  60. package/lib/publicApi/entity/insertEntity.d.ts +2 -2
  61. package/lib/publicApi/entity/insertEntity.js +2 -1
  62. package/lib/publicApi/entity/insertEntity.js.map +1 -1
  63. package/lib/publicApi/format/clearFormat.d.ts +1 -1
  64. package/lib/publicApi/format/clearFormat.js +2 -1
  65. package/lib/publicApi/format/clearFormat.js.map +1 -1
  66. package/lib/publicApi/format/getFormatState.d.ts +1 -1
  67. package/lib/publicApi/format/getFormatState.js +2 -1
  68. package/lib/publicApi/format/getFormatState.js.map +1 -1
  69. package/lib/publicApi/image/adjustImageSelection.d.ts +1 -1
  70. package/lib/publicApi/image/adjustImageSelection.js +2 -1
  71. package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
  72. package/lib/publicApi/image/changeImage.d.ts +1 -1
  73. package/lib/publicApi/image/changeImage.js +3 -2
  74. package/lib/publicApi/image/changeImage.js.map +1 -1
  75. package/lib/publicApi/image/insertImage.d.ts +1 -1
  76. package/lib/publicApi/image/insertImage.js +2 -1
  77. package/lib/publicApi/image/insertImage.js.map +1 -1
  78. package/lib/publicApi/image/setImageAltText.d.ts +1 -1
  79. package/lib/publicApi/image/setImageAltText.js +3 -2
  80. package/lib/publicApi/image/setImageAltText.js.map +1 -1
  81. package/lib/publicApi/image/setImageBorder.d.ts +1 -1
  82. package/lib/publicApi/image/setImageBorder.js +4 -3
  83. package/lib/publicApi/image/setImageBorder.js.map +1 -1
  84. package/lib/publicApi/image/setImageBoxShadow.d.ts +1 -1
  85. package/lib/publicApi/image/setImageBoxShadow.js +3 -2
  86. package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
  87. package/lib/publicApi/link/adjustLinkSelection.d.ts +1 -1
  88. package/lib/publicApi/link/adjustLinkSelection.js +2 -1
  89. package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
  90. package/lib/publicApi/link/insertLink.d.ts +1 -1
  91. package/lib/publicApi/link/insertLink.js +2 -1
  92. package/lib/publicApi/link/insertLink.js.map +1 -1
  93. package/lib/publicApi/link/removeLink.d.ts +1 -1
  94. package/lib/publicApi/link/removeLink.js +2 -1
  95. package/lib/publicApi/link/removeLink.js.map +1 -1
  96. package/lib/publicApi/list/setListStartNumber.d.ts +1 -1
  97. package/lib/publicApi/list/setListStartNumber.js +2 -1
  98. package/lib/publicApi/list/setListStartNumber.js.map +1 -1
  99. package/lib/publicApi/list/setListStyle.d.ts +1 -1
  100. package/lib/publicApi/list/setListStyle.js +2 -1
  101. package/lib/publicApi/list/setListStyle.js.map +1 -1
  102. package/lib/publicApi/list/toggleBullet.d.ts +1 -1
  103. package/lib/publicApi/list/toggleBullet.js +2 -1
  104. package/lib/publicApi/list/toggleBullet.js.map +1 -1
  105. package/lib/publicApi/list/toggleNumbering.d.ts +1 -1
  106. package/lib/publicApi/list/toggleNumbering.js +2 -1
  107. package/lib/publicApi/list/toggleNumbering.js.map +1 -1
  108. package/lib/publicApi/segment/applySegmentFormat.d.ts +1 -1
  109. package/lib/publicApi/segment/applySegmentFormat.js +2 -1
  110. package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
  111. package/lib/publicApi/segment/changeCapitalization.d.ts +1 -1
  112. package/lib/publicApi/segment/changeCapitalization.js +2 -1
  113. package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
  114. package/lib/publicApi/segment/changeFontSize.d.ts +1 -1
  115. package/lib/publicApi/segment/changeFontSize.js +2 -1
  116. package/lib/publicApi/segment/changeFontSize.js.map +1 -1
  117. package/lib/publicApi/segment/setBackgroundColor.d.ts +1 -1
  118. package/lib/publicApi/segment/setBackgroundColor.js +2 -1
  119. package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
  120. package/lib/publicApi/segment/setFontName.d.ts +1 -1
  121. package/lib/publicApi/segment/setFontName.js +2 -1
  122. package/lib/publicApi/segment/setFontName.js.map +1 -1
  123. package/lib/publicApi/segment/setFontSize.d.ts +1 -1
  124. package/lib/publicApi/segment/setFontSize.js +2 -2
  125. package/lib/publicApi/segment/setFontSize.js.map +1 -1
  126. package/lib/publicApi/segment/setTextColor.d.ts +1 -1
  127. package/lib/publicApi/segment/setTextColor.js +2 -1
  128. package/lib/publicApi/segment/setTextColor.js.map +1 -1
  129. package/lib/publicApi/segment/toggleBold.d.ts +1 -1
  130. package/lib/publicApi/segment/toggleBold.js +2 -1
  131. package/lib/publicApi/segment/toggleBold.js.map +1 -1
  132. package/lib/publicApi/segment/toggleCode.d.ts +1 -1
  133. package/lib/publicApi/segment/toggleCode.js +2 -1
  134. package/lib/publicApi/segment/toggleCode.js.map +1 -1
  135. package/lib/publicApi/segment/toggleItalic.d.ts +1 -1
  136. package/lib/publicApi/segment/toggleItalic.js +2 -1
  137. package/lib/publicApi/segment/toggleItalic.js.map +1 -1
  138. package/lib/publicApi/segment/toggleStrikethrough.d.ts +1 -1
  139. package/lib/publicApi/segment/toggleStrikethrough.js +2 -1
  140. package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
  141. package/lib/publicApi/segment/toggleSubscript.d.ts +1 -1
  142. package/lib/publicApi/segment/toggleSubscript.js +2 -1
  143. package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
  144. package/lib/publicApi/segment/toggleSuperscript.d.ts +1 -1
  145. package/lib/publicApi/segment/toggleSuperscript.js +2 -1
  146. package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
  147. package/lib/publicApi/segment/toggleUnderline.d.ts +1 -1
  148. package/lib/publicApi/segment/toggleUnderline.js +2 -1
  149. package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
  150. package/lib/publicApi/table/applyTableBorderFormat.d.ts +1 -1
  151. package/lib/publicApi/table/applyTableBorderFormat.js +2 -1
  152. package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
  153. package/lib/publicApi/table/editTable.d.ts +1 -1
  154. package/lib/publicApi/table/editTable.js +2 -1
  155. package/lib/publicApi/table/editTable.js.map +1 -1
  156. package/lib/publicApi/table/formatTable.d.ts +1 -1
  157. package/lib/publicApi/table/formatTable.js +2 -1
  158. package/lib/publicApi/table/formatTable.js.map +1 -1
  159. package/lib/publicApi/table/insertTable.d.ts +1 -1
  160. package/lib/publicApi/table/insertTable.js +2 -1
  161. package/lib/publicApi/table/insertTable.js.map +1 -1
  162. package/lib/publicApi/table/setTableCellShade.d.ts +1 -1
  163. package/lib/publicApi/table/setTableCellShade.js +2 -1
  164. package/lib/publicApi/table/setTableCellShade.js.map +1 -1
  165. package/lib/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
  166. package/lib/publicApi/utils/formatImageWithContentModel.js +6 -2
  167. package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  168. package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
  169. package/lib/publicApi/utils/formatParagraphWithContentModel.js +4 -1
  170. package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  171. package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
  172. package/lib/publicApi/utils/formatSegmentWithContentModel.js +7 -1
  173. package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  174. package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  175. package/lib-amd/index.d.ts +46 -42
  176. package/lib-amd/index.js +48 -44
  177. package/lib-amd/index.js.map +1 -1
  178. package/lib-amd/modelApi/block/setModelAlignment.js.map +1 -1
  179. package/lib-amd/modelApi/block/setModelDirection.js.map +1 -1
  180. package/lib-amd/modelApi/block/setModelIndentation.js.map +1 -1
  181. package/lib-amd/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  182. package/lib-amd/modelApi/common/clearModelFormat.js.map +1 -1
  183. package/lib-amd/modelApi/common/wrapBlock.js.map +1 -1
  184. package/lib-amd/modelApi/entity/insertEntityModel.js.map +1 -1
  185. package/lib-amd/modelApi/image/applyImageBorderFormat.d.ts +1 -1
  186. package/lib-amd/modelApi/image/applyImageBorderFormat.js +2 -1
  187. package/lib-amd/modelApi/image/applyImageBorderFormat.js.map +1 -1
  188. package/lib-amd/modelApi/link/matchLink.d.ts +1 -18
  189. package/lib-amd/modelApi/link/matchLink.js +0 -1
  190. package/lib-amd/modelApi/link/matchLink.js.map +1 -1
  191. package/lib-amd/modelApi/list/findListItemsInSameThread.js.map +1 -1
  192. package/lib-amd/modelApi/list/setListType.js.map +1 -1
  193. package/lib-amd/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  194. package/lib-amd/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  195. package/lib-amd/modelApi/selection/adjustWordSelection.js.map +1 -1
  196. package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
  197. package/lib-amd/modelApi/table/alignTable.js.map +1 -1
  198. package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
  199. package/lib-amd/modelApi/table/canMergeCells.js.map +1 -1
  200. package/lib-amd/modelApi/table/clearSelectedCells.js.map +1 -1
  201. package/lib-amd/modelApi/table/createTableStructure.js.map +1 -1
  202. package/lib-amd/modelApi/table/deleteTable.js.map +1 -1
  203. package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
  204. package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
  205. package/lib-amd/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  206. package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
  207. package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
  208. package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
  209. package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
  210. package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
  211. package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  212. package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
  213. package/lib-amd/publicApi/block/setAlignment.d.ts +1 -1
  214. package/lib-amd/publicApi/block/setAlignment.js +2 -1
  215. package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
  216. package/lib-amd/publicApi/block/setDirection.d.ts +1 -1
  217. package/lib-amd/publicApi/block/setDirection.js +2 -1
  218. package/lib-amd/publicApi/block/setDirection.js.map +1 -1
  219. package/lib-amd/publicApi/block/setHeadingLevel.d.ts +1 -1
  220. package/lib-amd/publicApi/block/setHeadingLevel.js +2 -1
  221. package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
  222. package/lib-amd/publicApi/block/setIndentation.d.ts +1 -1
  223. package/lib-amd/publicApi/block/setIndentation.js +2 -1
  224. package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
  225. package/lib-amd/publicApi/block/setParagraphMargin.d.ts +1 -1
  226. package/lib-amd/publicApi/block/setParagraphMargin.js +2 -1
  227. package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
  228. package/lib-amd/publicApi/block/setSpacing.d.ts +1 -1
  229. package/lib-amd/publicApi/block/setSpacing.js +2 -1
  230. package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
  231. package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +1 -1
  232. package/lib-amd/publicApi/block/toggleBlockQuote.js +2 -1
  233. package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
  234. package/lib-amd/publicApi/entity/insertEntity.d.ts +2 -2
  235. package/lib-amd/publicApi/entity/insertEntity.js +2 -1
  236. package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
  237. package/lib-amd/publicApi/format/clearFormat.d.ts +1 -1
  238. package/lib-amd/publicApi/format/clearFormat.js +2 -1
  239. package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
  240. package/lib-amd/publicApi/format/getFormatState.d.ts +1 -1
  241. package/lib-amd/publicApi/format/getFormatState.js +2 -1
  242. package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
  243. package/lib-amd/publicApi/image/adjustImageSelection.d.ts +1 -1
  244. package/lib-amd/publicApi/image/adjustImageSelection.js +2 -1
  245. package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
  246. package/lib-amd/publicApi/image/changeImage.d.ts +1 -1
  247. package/lib-amd/publicApi/image/changeImage.js +3 -2
  248. package/lib-amd/publicApi/image/changeImage.js.map +1 -1
  249. package/lib-amd/publicApi/image/insertImage.d.ts +1 -1
  250. package/lib-amd/publicApi/image/insertImage.js +2 -1
  251. package/lib-amd/publicApi/image/insertImage.js.map +1 -1
  252. package/lib-amd/publicApi/image/setImageAltText.d.ts +1 -1
  253. package/lib-amd/publicApi/image/setImageAltText.js +3 -2
  254. package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
  255. package/lib-amd/publicApi/image/setImageBorder.d.ts +1 -1
  256. package/lib-amd/publicApi/image/setImageBorder.js +4 -3
  257. package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
  258. package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +1 -1
  259. package/lib-amd/publicApi/image/setImageBoxShadow.js +3 -2
  260. package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
  261. package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +1 -1
  262. package/lib-amd/publicApi/link/adjustLinkSelection.js +2 -1
  263. package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
  264. package/lib-amd/publicApi/link/insertLink.d.ts +1 -1
  265. package/lib-amd/publicApi/link/insertLink.js +2 -1
  266. package/lib-amd/publicApi/link/insertLink.js.map +1 -1
  267. package/lib-amd/publicApi/link/removeLink.d.ts +1 -1
  268. package/lib-amd/publicApi/link/removeLink.js +2 -1
  269. package/lib-amd/publicApi/link/removeLink.js.map +1 -1
  270. package/lib-amd/publicApi/list/setListStartNumber.d.ts +1 -1
  271. package/lib-amd/publicApi/list/setListStartNumber.js +2 -1
  272. package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
  273. package/lib-amd/publicApi/list/setListStyle.d.ts +1 -1
  274. package/lib-amd/publicApi/list/setListStyle.js +2 -1
  275. package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
  276. package/lib-amd/publicApi/list/toggleBullet.d.ts +1 -1
  277. package/lib-amd/publicApi/list/toggleBullet.js +2 -1
  278. package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
  279. package/lib-amd/publicApi/list/toggleNumbering.d.ts +1 -1
  280. package/lib-amd/publicApi/list/toggleNumbering.js +2 -1
  281. package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
  282. package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +1 -1
  283. package/lib-amd/publicApi/segment/applySegmentFormat.js +2 -1
  284. package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
  285. package/lib-amd/publicApi/segment/changeCapitalization.d.ts +1 -1
  286. package/lib-amd/publicApi/segment/changeCapitalization.js +2 -1
  287. package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
  288. package/lib-amd/publicApi/segment/changeFontSize.d.ts +1 -1
  289. package/lib-amd/publicApi/segment/changeFontSize.js +2 -1
  290. package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
  291. package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +1 -1
  292. package/lib-amd/publicApi/segment/setBackgroundColor.js +2 -1
  293. package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
  294. package/lib-amd/publicApi/segment/setFontName.d.ts +1 -1
  295. package/lib-amd/publicApi/segment/setFontName.js +2 -1
  296. package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
  297. package/lib-amd/publicApi/segment/setFontSize.d.ts +1 -1
  298. package/lib-amd/publicApi/segment/setFontSize.js +2 -2
  299. package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
  300. package/lib-amd/publicApi/segment/setTextColor.d.ts +1 -1
  301. package/lib-amd/publicApi/segment/setTextColor.js +2 -1
  302. package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
  303. package/lib-amd/publicApi/segment/toggleBold.d.ts +1 -1
  304. package/lib-amd/publicApi/segment/toggleBold.js +2 -1
  305. package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
  306. package/lib-amd/publicApi/segment/toggleCode.d.ts +1 -1
  307. package/lib-amd/publicApi/segment/toggleCode.js +2 -1
  308. package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
  309. package/lib-amd/publicApi/segment/toggleItalic.d.ts +1 -1
  310. package/lib-amd/publicApi/segment/toggleItalic.js +2 -1
  311. package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
  312. package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +1 -1
  313. package/lib-amd/publicApi/segment/toggleStrikethrough.js +2 -1
  314. package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
  315. package/lib-amd/publicApi/segment/toggleSubscript.d.ts +1 -1
  316. package/lib-amd/publicApi/segment/toggleSubscript.js +2 -1
  317. package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
  318. package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +1 -1
  319. package/lib-amd/publicApi/segment/toggleSuperscript.js +2 -1
  320. package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
  321. package/lib-amd/publicApi/segment/toggleUnderline.d.ts +1 -1
  322. package/lib-amd/publicApi/segment/toggleUnderline.js +2 -1
  323. package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
  324. package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +1 -1
  325. package/lib-amd/publicApi/table/applyTableBorderFormat.js +2 -1
  326. package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
  327. package/lib-amd/publicApi/table/editTable.d.ts +1 -1
  328. package/lib-amd/publicApi/table/editTable.js +2 -1
  329. package/lib-amd/publicApi/table/editTable.js.map +1 -1
  330. package/lib-amd/publicApi/table/formatTable.d.ts +1 -1
  331. package/lib-amd/publicApi/table/formatTable.js +2 -1
  332. package/lib-amd/publicApi/table/formatTable.js.map +1 -1
  333. package/lib-amd/publicApi/table/insertTable.d.ts +1 -1
  334. package/lib-amd/publicApi/table/insertTable.js +2 -1
  335. package/lib-amd/publicApi/table/insertTable.js.map +1 -1
  336. package/lib-amd/publicApi/table/setTableCellShade.d.ts +1 -1
  337. package/lib-amd/publicApi/table/setTableCellShade.js +2 -1
  338. package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
  339. package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
  340. package/lib-amd/publicApi/utils/formatImageWithContentModel.js +6 -2
  341. package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  342. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
  343. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js +4 -1
  344. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  345. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
  346. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js +7 -1
  347. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  348. package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  349. package/lib-mjs/index.d.ts +46 -42
  350. package/lib-mjs/index.js +46 -42
  351. package/lib-mjs/index.js.map +1 -1
  352. package/lib-mjs/modelApi/block/setModelAlignment.js.map +1 -1
  353. package/lib-mjs/modelApi/block/setModelDirection.js.map +1 -1
  354. package/lib-mjs/modelApi/block/setModelIndentation.js.map +1 -1
  355. package/lib-mjs/modelApi/block/toggleModelBlockQuote.js.map +1 -1
  356. package/lib-mjs/modelApi/common/clearModelFormat.js.map +1 -1
  357. package/lib-mjs/modelApi/common/wrapBlock.js.map +1 -1
  358. package/lib-mjs/modelApi/entity/insertEntityModel.js.map +1 -1
  359. package/lib-mjs/modelApi/image/applyImageBorderFormat.d.ts +1 -1
  360. package/lib-mjs/modelApi/image/applyImageBorderFormat.js +1 -1
  361. package/lib-mjs/modelApi/image/applyImageBorderFormat.js.map +1 -1
  362. package/lib-mjs/modelApi/link/matchLink.d.ts +1 -18
  363. package/lib-mjs/modelApi/link/matchLink.js +0 -1
  364. package/lib-mjs/modelApi/link/matchLink.js.map +1 -1
  365. package/lib-mjs/modelApi/list/findListItemsInSameThread.js.map +1 -1
  366. package/lib-mjs/modelApi/list/setListType.js.map +1 -1
  367. package/lib-mjs/modelApi/selection/adjustSegmentSelection.js.map +1 -1
  368. package/lib-mjs/modelApi/selection/adjustTrailingSpaceSelection.js.map +1 -1
  369. package/lib-mjs/modelApi/selection/adjustWordSelection.js.map +1 -1
  370. package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
  371. package/lib-mjs/modelApi/table/alignTable.js.map +1 -1
  372. package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
  373. package/lib-mjs/modelApi/table/canMergeCells.js.map +1 -1
  374. package/lib-mjs/modelApi/table/clearSelectedCells.js.map +1 -1
  375. package/lib-mjs/modelApi/table/createTableStructure.js.map +1 -1
  376. package/lib-mjs/modelApi/table/deleteTable.js.map +1 -1
  377. package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
  378. package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
  379. package/lib-mjs/modelApi/table/ensureFocusableParagraphForTable.js.map +1 -1
  380. package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
  381. package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
  382. package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
  383. package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
  384. package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
  385. package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
  386. package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
  387. package/lib-mjs/publicApi/block/setAlignment.d.ts +1 -1
  388. package/lib-mjs/publicApi/block/setAlignment.js +1 -1
  389. package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
  390. package/lib-mjs/publicApi/block/setDirection.d.ts +1 -1
  391. package/lib-mjs/publicApi/block/setDirection.js +1 -1
  392. package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
  393. package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +1 -1
  394. package/lib-mjs/publicApi/block/setHeadingLevel.js +1 -1
  395. package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
  396. package/lib-mjs/publicApi/block/setIndentation.d.ts +1 -1
  397. package/lib-mjs/publicApi/block/setIndentation.js +1 -1
  398. package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
  399. package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +1 -1
  400. package/lib-mjs/publicApi/block/setParagraphMargin.js +1 -1
  401. package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
  402. package/lib-mjs/publicApi/block/setSpacing.d.ts +1 -1
  403. package/lib-mjs/publicApi/block/setSpacing.js +1 -1
  404. package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
  405. package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +1 -1
  406. package/lib-mjs/publicApi/block/toggleBlockQuote.js +1 -1
  407. package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
  408. package/lib-mjs/publicApi/entity/insertEntity.d.ts +2 -2
  409. package/lib-mjs/publicApi/entity/insertEntity.js +1 -1
  410. package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
  411. package/lib-mjs/publicApi/format/clearFormat.d.ts +1 -1
  412. package/lib-mjs/publicApi/format/clearFormat.js +1 -1
  413. package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
  414. package/lib-mjs/publicApi/format/getFormatState.d.ts +1 -1
  415. package/lib-mjs/publicApi/format/getFormatState.js +1 -1
  416. package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
  417. package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +1 -1
  418. package/lib-mjs/publicApi/image/adjustImageSelection.js +1 -1
  419. package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
  420. package/lib-mjs/publicApi/image/changeImage.d.ts +1 -1
  421. package/lib-mjs/publicApi/image/changeImage.js +2 -2
  422. package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
  423. package/lib-mjs/publicApi/image/insertImage.d.ts +1 -1
  424. package/lib-mjs/publicApi/image/insertImage.js +1 -1
  425. package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
  426. package/lib-mjs/publicApi/image/setImageAltText.d.ts +1 -1
  427. package/lib-mjs/publicApi/image/setImageAltText.js +2 -2
  428. package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
  429. package/lib-mjs/publicApi/image/setImageBorder.d.ts +1 -1
  430. package/lib-mjs/publicApi/image/setImageBorder.js +3 -3
  431. package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
  432. package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +1 -1
  433. package/lib-mjs/publicApi/image/setImageBoxShadow.js +2 -2
  434. package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
  435. package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +1 -1
  436. package/lib-mjs/publicApi/link/adjustLinkSelection.js +1 -1
  437. package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
  438. package/lib-mjs/publicApi/link/insertLink.d.ts +1 -1
  439. package/lib-mjs/publicApi/link/insertLink.js +1 -1
  440. package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
  441. package/lib-mjs/publicApi/link/removeLink.d.ts +1 -1
  442. package/lib-mjs/publicApi/link/removeLink.js +1 -1
  443. package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
  444. package/lib-mjs/publicApi/list/setListStartNumber.d.ts +1 -1
  445. package/lib-mjs/publicApi/list/setListStartNumber.js +1 -1
  446. package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
  447. package/lib-mjs/publicApi/list/setListStyle.d.ts +1 -1
  448. package/lib-mjs/publicApi/list/setListStyle.js +1 -1
  449. package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
  450. package/lib-mjs/publicApi/list/toggleBullet.d.ts +1 -1
  451. package/lib-mjs/publicApi/list/toggleBullet.js +1 -1
  452. package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
  453. package/lib-mjs/publicApi/list/toggleNumbering.d.ts +1 -1
  454. package/lib-mjs/publicApi/list/toggleNumbering.js +1 -1
  455. package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
  456. package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +1 -1
  457. package/lib-mjs/publicApi/segment/applySegmentFormat.js +1 -1
  458. package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
  459. package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +1 -1
  460. package/lib-mjs/publicApi/segment/changeCapitalization.js +1 -1
  461. package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
  462. package/lib-mjs/publicApi/segment/changeFontSize.d.ts +1 -1
  463. package/lib-mjs/publicApi/segment/changeFontSize.js +1 -1
  464. package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
  465. package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +1 -1
  466. package/lib-mjs/publicApi/segment/setBackgroundColor.js +1 -1
  467. package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
  468. package/lib-mjs/publicApi/segment/setFontName.d.ts +1 -1
  469. package/lib-mjs/publicApi/segment/setFontName.js +1 -1
  470. package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
  471. package/lib-mjs/publicApi/segment/setFontSize.d.ts +1 -1
  472. package/lib-mjs/publicApi/segment/setFontSize.js +1 -1
  473. package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
  474. package/lib-mjs/publicApi/segment/setTextColor.d.ts +1 -1
  475. package/lib-mjs/publicApi/segment/setTextColor.js +1 -1
  476. package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
  477. package/lib-mjs/publicApi/segment/toggleBold.d.ts +1 -1
  478. package/lib-mjs/publicApi/segment/toggleBold.js +1 -1
  479. package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
  480. package/lib-mjs/publicApi/segment/toggleCode.d.ts +1 -1
  481. package/lib-mjs/publicApi/segment/toggleCode.js +1 -1
  482. package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
  483. package/lib-mjs/publicApi/segment/toggleItalic.d.ts +1 -1
  484. package/lib-mjs/publicApi/segment/toggleItalic.js +1 -1
  485. package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
  486. package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +1 -1
  487. package/lib-mjs/publicApi/segment/toggleStrikethrough.js +1 -1
  488. package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
  489. package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +1 -1
  490. package/lib-mjs/publicApi/segment/toggleSubscript.js +1 -1
  491. package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
  492. package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +1 -1
  493. package/lib-mjs/publicApi/segment/toggleSuperscript.js +1 -1
  494. package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
  495. package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +1 -1
  496. package/lib-mjs/publicApi/segment/toggleUnderline.js +1 -1
  497. package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
  498. package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +1 -1
  499. package/lib-mjs/publicApi/table/applyTableBorderFormat.js +1 -1
  500. package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
  501. package/lib-mjs/publicApi/table/editTable.d.ts +1 -1
  502. package/lib-mjs/publicApi/table/editTable.js +1 -1
  503. package/lib-mjs/publicApi/table/editTable.js.map +1 -1
  504. package/lib-mjs/publicApi/table/formatTable.d.ts +1 -1
  505. package/lib-mjs/publicApi/table/formatTable.js +1 -1
  506. package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
  507. package/lib-mjs/publicApi/table/insertTable.d.ts +1 -1
  508. package/lib-mjs/publicApi/table/insertTable.js +1 -1
  509. package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
  510. package/lib-mjs/publicApi/table/setTableCellShade.d.ts +1 -1
  511. package/lib-mjs/publicApi/table/setTableCellShade.js +1 -1
  512. package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
  513. package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +5 -2
  514. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js +5 -2
  515. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  516. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +4 -1
  517. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js +4 -1
  518. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  519. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +7 -1
  520. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js +7 -1
  521. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  522. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  523. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setFontSizeInternal = void 0;
3
+ exports.setFontSizeInternal = exports.setFontSize = void 0;
4
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
5
5
  /**
6
6
  * Set font size
@@ -11,7 +11,7 @@ function setFontSize(editor, fontSize) {
11
11
  editor.focus();
12
12
  (0, formatSegmentWithContentModel_1.formatSegmentWithContentModel)(editor, 'setFontSize', function (format, _, __, paragraph) { return setFontSizeInternal(fontSize, format, paragraph); }, undefined /* segmentHasStyleCallback*/, true /*includingFormatHandler*/);
13
13
  }
14
- exports.default = setFontSize;
14
+ exports.setFontSize = setFontSize;
15
15
  /**
16
16
  * @internal
17
17
  * Internal set font function shared by setFontSize and changeFontSize
@@ -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,wFAAuF;AAOvF;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAe,EAAE,QAAgB;IACjE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAVD,8BAUC;AAED;;;GAGG;AACH,SAAgB,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;AAnBD,kDAmBC","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 default 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
+ {"version":3,"file":"setFontSize.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/setFontSize.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AAOvF;;;;GAIG;AACH,SAAgB,WAAW,CAAC,MAAe,EAAE,QAAgB;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAVD,kCAUC;AAED;;;GAGG;AACH,SAAgB,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;AAnBD,kDAmBC","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"]}
@@ -4,4 +4,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
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: IEditor, textColor: string | null): void;
7
+ export declare function setTextColor(editor: IEditor, textColor: string | null): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setTextColor = void 0;
3
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
4
5
  /**
5
6
  * Set text color
@@ -22,5 +23,5 @@ function setTextColor(editor, textColor) {
22
23
  }
23
24
  }, undefined /* segmentHasStyleCallback*/, true /*includingFormatHandler*/);
24
25
  }
25
- exports.default = setTextColor;
26
+ exports.setTextColor = setTextColor;
26
27
  //# sourceMappingURL=setTextColor.js.map
@@ -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,wFAAuF;AAGvF;;;;GAIG;AACH,SAAwB,YAAY,CAAC,MAAe,EAAE,SAAwB;IAC1E,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAxBD,+BAwBC","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 default 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
+ {"version":3,"file":"setTextColor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/setTextColor.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AAGvF;;;;GAIG;AACH,SAAgB,YAAY,CAAC,MAAe,EAAE,SAAwB;IAClE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAxBD,oCAwBC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle bold style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleBold(editor: IEditor): void;
6
+ export declare function toggleBold(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleBold = void 0;
3
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
4
5
  var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
6
  /**
@@ -17,5 +18,5 @@ function toggleBold(editor) {
17
18
  : format.fontWeight);
18
19
  });
19
20
  }
20
- exports.default = toggleBold;
21
+ exports.toggleBold = toggleBold;
21
22
  //# sourceMappingURL=toggleBold.js.map
@@ -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,wFAAuF;AACvF,6EAAsD;AAGtD;;;GAGG;AACH,SAAwB,UAAU,CAAC,MAAe;IAC9C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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,IAAA,qCAAM,EACF,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;AAhBD,6BAgBC","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 default 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
+ {"version":3,"file":"toggleBold.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleBold.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AACvF,6EAAsD;AAGtD;;;GAGG;AACH,SAAgB,UAAU,CAAC,MAAe;IACtC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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,IAAA,qCAAM,EACF,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;AAhBD,gCAgBC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle italic style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleCode(editor: IEditor): void;
6
+ export declare function toggleCode(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleCode = void 0;
3
4
  var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
4
5
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
5
6
  var DefaultCode = {
@@ -24,5 +25,5 @@ function toggleCode(editor) {
24
25
  }
25
26
  }, function (_, segment) { return !!(segment === null || segment === void 0 ? void 0 : segment.code); });
26
27
  }
27
- exports.default = toggleCode;
28
+ exports.toggleCode = toggleCode;
28
29
  //# sourceMappingURL=toggleCode.js.map
@@ -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,2EAAsD;AACtD,wFAAuF;AAGvF,IAAM,WAAW,GAAqB;IAClC,MAAM,EAAE;QACJ,UAAU,EAAE,WAAW;KAC1B;CACJ,CAAC;AAEF;;;GAGG;AACH,SAAwB,UAAU,CAAC,MAAe;IAC9C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,MAAM,EACN,YAAY,EACZ,UAAC,CAAC,EAAE,WAAW,EAAE,OAAO;QACpB,IAAI,OAAO,EAAE;YACT,IAAI,WAAW,EAAE;gBACb,IAAA,qCAAO,EAAC,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;AAjBD,6BAiBC","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 default 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
+ {"version":3,"file":"toggleCode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleCode.ts"],"names":[],"mappings":";;;AAAA,2EAAsD;AACtD,wFAAuF;AAGvF,IAAM,WAAW,GAAqB;IAClC,MAAM,EAAE;QACJ,UAAU,EAAE,WAAW;KAC1B;CACJ,CAAC;AAEF;;;GAGG;AACH,SAAgB,UAAU,CAAC,MAAe;IACtC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,MAAM,EACN,YAAY,EACZ,UAAC,CAAC,EAAE,WAAW,EAAE,OAAO;QACpB,IAAI,OAAO,EAAE;YACT,IAAI,WAAW,EAAE;gBACb,IAAA,qCAAO,EAAC,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;AAjBD,gCAiBC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle italic style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleItalic(editor: IEditor): void;
6
+ export declare function toggleItalic(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleItalic = void 0;
3
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
4
5
  /**
5
6
  * Toggle italic style
@@ -11,5 +12,5 @@ function toggleItalic(editor) {
11
12
  format.italic = !!isTurningOn;
12
13
  }, function (format) { return !!format.italic; });
13
14
  }
14
- exports.default = toggleItalic;
15
+ exports.toggleItalic = toggleItalic;
15
16
  //# sourceMappingURL=toggleItalic.js.map
@@ -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,wFAAuF;AAGvF;;;GAGG;AACH,SAAwB,YAAY,CAAC,MAAe;IAChD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,+BAWC","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 default 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
+ {"version":3,"file":"toggleItalic.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleItalic.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AAGvF;;;GAGG;AACH,SAAgB,YAAY,CAAC,MAAe;IACxC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,oCAWC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle strikethrough style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleStrikethrough(editor: IEditor): void;
6
+ export declare function toggleStrikethrough(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleStrikethrough = void 0;
3
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
4
5
  /**
5
6
  * Toggle strikethrough style
@@ -11,5 +12,5 @@ function toggleStrikethrough(editor) {
11
12
  format.strikethrough = !!isTurningOn;
12
13
  }, function (format) { return !!format.strikethrough; });
13
14
  }
14
- exports.default = toggleStrikethrough;
15
+ exports.toggleStrikethrough = toggleStrikethrough;
15
16
  //# sourceMappingURL=toggleStrikethrough.js.map
@@ -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,wFAAuF;AAGvF;;;GAGG;AACH,SAAwB,mBAAmB,CAAC,MAAe;IACvD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,sCAWC","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 default 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
+ {"version":3,"file":"toggleStrikethrough.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleStrikethrough.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AAGvF;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAe;IAC/C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,kDAWC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle subscript style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleSubscript(editor: IEditor): void;
6
+ export declare function toggleSubscript(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleSubscript = void 0;
3
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
4
5
  /**
5
6
  * Toggle subscript style
@@ -11,5 +12,5 @@ function toggleSubscript(editor) {
11
12
  format.superOrSubScriptSequence = isTurningOn ? 'sub' : '';
12
13
  }, function (format) { var _a; return ((_a = format.superOrSubScriptSequence) === null || _a === void 0 ? void 0 : _a.split(' ').pop()) == 'sub'; });
13
14
  }
14
- exports.default = toggleSubscript;
15
+ exports.toggleSubscript = toggleSubscript;
15
16
  //# sourceMappingURL=toggleSubscript.js.map
@@ -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,wFAAuF;AAGvF;;;GAGG;AACH,SAAwB,eAAe,CAAC,MAAe;IACnD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,kCAWC","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 default 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
+ {"version":3,"file":"toggleSubscript.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleSubscript.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AAGvF;;;GAGG;AACH,SAAgB,eAAe,CAAC,MAAe;IAC3C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,0CAWC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle superscript style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleSuperscript(editor: IEditor): void;
6
+ export declare function toggleSuperscript(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleSuperscript = void 0;
3
4
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
4
5
  /**
5
6
  * Toggle superscript style
@@ -11,5 +12,5 @@ function toggleSuperscript(editor) {
11
12
  format.superOrSubScriptSequence = isTurningOn ? 'super' : '';
12
13
  }, function (format) { var _a; return ((_a = format.superOrSubScriptSequence) === null || _a === void 0 ? void 0 : _a.split(' ').pop()) == 'super'; });
13
14
  }
14
- exports.default = toggleSuperscript;
15
+ exports.toggleSuperscript = toggleSuperscript;
15
16
  //# sourceMappingURL=toggleSuperscript.js.map
@@ -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,wFAAuF;AAGvF;;;GAGG;AACH,SAAwB,iBAAiB,CAAC,MAAe;IACrD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,oCAWC","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 default 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
+ {"version":3,"file":"toggleSuperscript.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleSuperscript.ts"],"names":[],"mappings":";;;AAAA,wFAAuF;AAGvF;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,MAAe;IAC7C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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;AAXD,8CAWC","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"]}
@@ -3,4 +3,4 @@ import type { IEditor } from 'roosterjs-content-model-types';
3
3
  * Toggle underline style
4
4
  * @param editor The editor to operate on
5
5
  */
6
- export default function toggleUnderline(editor: IEditor): void;
6
+ export declare function toggleUnderline(editor: IEditor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleUnderline = void 0;
3
4
  var adjustTrailingSpaceSelection_1 = require("../../modelApi/selection/adjustTrailingSpaceSelection");
4
5
  var formatSegmentWithContentModel_1 = require("../utils/formatSegmentWithContentModel");
5
6
  /**
@@ -15,5 +16,5 @@ function toggleUnderline(editor) {
15
16
  }
16
17
  }, function (format, segment) { var _a, _b; return !!format.underline || !!((_b = (_a = segment === null || segment === void 0 ? void 0 : segment.link) === null || _a === void 0 ? void 0 : _a.format) === null || _b === void 0 ? void 0 : _b.underline); }, false /*includingFormatHolder*/, adjustTrailingSpaceSelection_1.adjustTrailingSpaceSelection);
17
18
  }
18
- exports.default = toggleUnderline;
19
+ exports.toggleUnderline = toggleUnderline;
19
20
  //# sourceMappingURL=toggleUnderline.js.map
@@ -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,sGAAqG;AACrG,wFAAuF;AAGvF;;;GAGG;AACH,SAAwB,eAAe,CAAC,MAAe;IACnD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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,2DAA4B,CAC/B,CAAC;AACN,CAAC;AAjBD,kCAiBC","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 default 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
+ {"version":3,"file":"toggleUnderline.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/segment/toggleUnderline.ts"],"names":[],"mappings":";;;AAAA,sGAAqG;AACrG,wFAAuF;AAGvF;;;GAGG;AACH,SAAgB,eAAe,CAAC,MAAe;IAC3C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,6DAA6B,EACzB,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,2DAA4B,CAC/B,CAAC;AACN,CAAC;AAjBD,0CAiBC","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"]}
@@ -5,4 +5,4 @@ import type { IEditor, Border, BorderOperations } from 'roosterjs-content-model-
5
5
  * @param border The border to apply
6
6
  * @param operation The operation to apply
7
7
  */
8
- export default function applyTableBorderFormat(editor: IEditor, border: Border, operation: BorderOperations): void;
8
+ export declare function applyTableBorderFormat(editor: IEditor, border: Border, operation: BorderOperations): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyTableBorderFormat = void 0;
3
4
  var tslib_1 = require("tslib");
4
5
  var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
5
6
  var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
@@ -232,7 +233,7 @@ function applyTableBorderFormat(editor, border, operation) {
232
233
  apiName: 'tableBorder',
233
234
  });
234
235
  }
235
- exports.default = applyTableBorderFormat;
236
+ exports.applyTableBorderFormat = applyTableBorderFormat;
236
237
  /**
237
238
  * @internal
238
239
  * Apply border format to a cell
@@ -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,2EAAiE;AACjE,6EAKsC;AA4BtC;;;;;GAKG;AACH,SAAwB,sBAAsB,CAC1C,MAAe,EACf,MAAc,EACd,SAA2B;IAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA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AAW,GAAG,CAAC,IAAI,CAAC,EAAE;QAC5C,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,WAAW,GAAG,CAAC,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 default 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
+ {"version":3,"file":"applyTableBorderFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/applyTableBorderFormat.ts"],"names":[],"mappings":";;;;AAAA,2EAAiE;AACjE,6EAKsC;AA4BtC;;;;;GAKG;AACH,SAAgB,sBAAsB,CAClC,MAAe,EACf,MAAc,EACd,SAA2B;IAE3B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,oBAAe,IAAA,oDAAqB,EAAC,KAAK,CAAC,IAAA,EAA1C,UAAU,QAAgC,CAAC;QAElD,IAAI,UAAU,EAAE;YACZ,IAAM,GAAG,GAAG,IAAA,+CAAgB,EAAC,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,IAAA,kDAAmB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC9D,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;YAC1C,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;YAC1C,IAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;YAE1C,IAAI,KAAK,EAAE;gBACP,YAAY,GAAG,IAAA,gDAAkB,EAAC,KAAK,CAAC,GAAG,IAAI,CAAC;aACnD;iBAAM,IAAI,WAAW,EAAE;gBACpB,YAAY,GAAG,WAAW,CAAC;aAC9B;iBAAM;gBACH,YAAY,GAAG,KAAK,CAAC;aACxB;YAED,IAAI,KAAK,EAAE;gBACP,YAAY,GAAM,YAAY,SA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-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"]}
@@ -4,4 +4,4 @@ import type { TableOperation, IEditor } from 'roosterjs-content-model-types';
4
4
  * @param editor The editor instance
5
5
  * @param operation The table operation to apply
6
6
  */
7
- export default function editTable(editor: IEditor, operation: TableOperation): void;
7
+ export declare function editTable(editor: IEditor, operation: TableOperation): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.editTable = void 0;
3
4
  var alignTable_1 = require("../../modelApi/table/alignTable");
4
5
  var deleteTable_1 = require("../../modelApi/table/deleteTable");
5
6
  var deleteTableColumn_1 = require("../../modelApi/table/deleteTableColumn");
@@ -74,5 +75,5 @@ function editTable(editor, operation) {
74
75
  }
75
76
  });
76
77
  }
77
- exports.default = editTable;
78
+ exports.editTable = editTable;
78
79
  //# sourceMappingURL=editTable.js.map
@@ -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,8DAA6D;AAC7D,gEAA+D;AAC/D,4EAA2E;AAC3E,sEAAqE;AACrE,oFAAmF;AACnF,4EAA2E;AAC3E,sEAAqE;AACrE,wEAAuE;AACvE,0EAAyE;AACzE,oEAAmE;AACnE,8FAA6F;AAC7F,0FAAyF;AAEzF,sEAG6C;AAE7C;;;;GAIG;AACH,SAAwB,SAAS,CAAC,MAAe,EAAE,SAAyB;IACxE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,WAAW,EAAE,UAAA,UAAU;QACvD,QAAQ,SAAS,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AAC;gBACvC,MAAM;YAEV,KAAK,iBAAiB;gBAClB,IAAA,mDAAwB,EAAC,UAAU,CAAC,CAAC;gBACrC,MAAM;SACb;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAlED,4BAkEC","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 default 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
+ {"version":3,"file":"editTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/table/editTable.ts"],"names":[],"mappings":";;;AAAA,8DAA6D;AAC7D,gEAA+D;AAC/D,4EAA2E;AAC3E,sEAAqE;AACrE,oFAAmF;AACnF,4EAA2E;AAC3E,sEAAqE;AACrE,wEAAuE;AACvE,0EAAyE;AACzE,oEAAmE;AACnE,8FAA6F;AAC7F,0FAAyF;AAEzF,sEAG6C;AAE7C;;;;GAIG;AACH,SAAgB,SAAS,CAAC,MAAe,EAAE,SAAyB;IAChE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,yDAA2B,EAAC,MAAM,EAAE,WAAW,EAAE,UAAA,UAAU;QACvD,QAAQ,SAAS,EAAE;YACf,KAAK,eAAe,CAAC;YACrB,KAAK,iBAAiB,CAAC;YACvB,KAAK,gBAAgB;gBACjB,IAAA,2CAA0B,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBAClD,MAAM;YACV,KAAK,cAAc,CAAC;YACpB,KAAK,iBAAiB,CAAC;YACvB,KAAK,iBAAiB;gBAClB,IAAA,yCAAwB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBAChD,MAAM;YACV,KAAK,aAAa,CAAC;YACnB,KAAK,WAAW,CAAC;YACjB,KAAK,YAAY;gBACb,IAAA,uBAAU,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBAClC,MAAM;YAEV,KAAK,cAAc;gBACf,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;gBAC9B,MAAM;YAEV,KAAK,WAAW;gBACZ,IAAA,+BAAc,EAAC,UAAU,CAAC,CAAC;gBAC3B,MAAM;YAEV,KAAK,aAAa;gBACd,IAAA,yBAAW,EAAC,UAAU,CAAC,CAAC;gBACxB,MAAM;YAEV,KAAK,aAAa,CAAC;YACnB,KAAK,aAAa;gBACd,IAAA,+BAAc,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACtC,MAAM;YAEV,KAAK,YAAY,CAAC;YAClB,KAAK,aAAa;gBACd,IAAA,qCAAiB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACzC,MAAM;YAEV,KAAK,YAAY,CAAC;YAClB,KAAK,YAAY;gBACb,IAAA,6BAAa,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACrC,MAAM;YAEV,KAAK,YAAY;gBACb,IAAA,iCAAe,EAAC,UAAU,CAAC,CAAC;gBAC5B,MAAM;YAEV,KAAK,WAAW,CAAC;YACjB,KAAK,YAAY;gBACb,IAAA,mCAAgB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACxC,MAAM;YAEV,KAAK,mBAAmB;gBACpB,IAAA,uDAA0B,EAAC,UAAU,CAAC,CAAC;gBACvC,MAAM;YAEV,KAAK,iBAAiB;gBAClB,IAAA,mDAAwB,EAAC,UAAU,CAAC,CAAC;gBACrC,MAAM;SACb;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAlED,8BAkEC","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"]}
@@ -5,4 +5,4 @@ import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types
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: IEditor, format: TableMetadataFormat, keepCellShade?: boolean): void;
8
+ export declare function formatTable(editor: IEditor, format: TableMetadataFormat, keepCellShade?: boolean): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatTable = void 0;
3
4
  var tslib_1 = require("tslib");
4
5
  var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
6
  /**
@@ -34,5 +35,5 @@ function formatTable(editor, format, keepCellShade) {
34
35
  apiName: 'formatTable',
35
36
  });
36
37
  }
37
- exports.default = formatTable;
38
+ exports.formatTable = formatTable;
38
39
  //# sourceMappingURL=formatTable.js.map
@@ -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,6EAIsC;AAGtC;;;;;GAKG;AACH,SAAwB,WAAW,CAC/B,MAAe,EACf,MAA2B,EAC3B,aAAuB;IAEvB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,oBAAe,IAAA,oDAAqB,EAAC,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,IAAA,sDAAuB,EAAC,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,IAAA,+CAAgB,EAAC,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;AAjCD,8BAiCC","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 default function formatTable(\n editor: IEditor,\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,6EAIsC;AAGtC;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,MAAe,EAAE,MAA2B,EAAE,aAAuB;IAC7F,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACK,IAAA,KAAA,oBAAe,IAAA,oDAAqB,EAAC,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,IAAA,sDAAuB,EAAC,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,IAAA,+CAAgB,EAAC,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;AA7BD,kCA6BC","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"]}
@@ -8,4 +8,4 @@ import type { IEditor, TableMetadataFormat } from 'roosterjs-content-model-types
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: IEditor, columns: number, rows: number, format?: Partial<TableMetadataFormat>): void;
11
+ export declare function insertTable(editor: IEditor, columns: number, rows: number, format?: Partial<TableMetadataFormat>): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertTable = void 0;
3
4
  var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
4
5
  var createTableStructure_1 = require("../../modelApi/table/createTableStructure");
5
6
  var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
@@ -43,5 +44,5 @@ function insertTable(editor, columns, rows, format) {
43
44
  apiName: 'insertTable',
44
45
  });
45
46
  }
46
- exports.default = insertTable;
47
+ exports.insertTable = insertTable;
47
48
  //# sourceMappingURL=insertTable.js.map