roosterjs-content-model-api 0.26.3 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/lib/modelApi/list/setListType.d.ts +2 -1
  2. package/lib/modelApi/list/setListType.js +5 -3
  3. package/lib/modelApi/list/setListType.js.map +1 -1
  4. package/lib/publicApi/block/setAlignment.d.ts +2 -2
  5. package/lib/publicApi/block/setAlignment.js.map +1 -1
  6. package/lib/publicApi/block/setDirection.d.ts +2 -2
  7. package/lib/publicApi/block/setDirection.js.map +1 -1
  8. package/lib/publicApi/block/setHeadingLevel.d.ts +2 -2
  9. package/lib/publicApi/block/setHeadingLevel.js.map +1 -1
  10. package/lib/publicApi/block/setIndentation.d.ts +2 -2
  11. package/lib/publicApi/block/setIndentation.js.map +1 -1
  12. package/lib/publicApi/block/setParagraphMargin.d.ts +2 -2
  13. package/lib/publicApi/block/setParagraphMargin.js.map +1 -1
  14. package/lib/publicApi/block/setSpacing.d.ts +2 -2
  15. package/lib/publicApi/block/setSpacing.js.map +1 -1
  16. package/lib/publicApi/block/toggleBlockQuote.d.ts +2 -2
  17. package/lib/publicApi/block/toggleBlockQuote.js.map +1 -1
  18. package/lib/publicApi/entity/insertEntity.d.ts +5 -5
  19. package/lib/publicApi/entity/insertEntity.js +22 -3
  20. package/lib/publicApi/entity/insertEntity.js.map +1 -1
  21. package/lib/publicApi/format/clearFormat.d.ts +2 -2
  22. package/lib/publicApi/format/clearFormat.js.map +1 -1
  23. package/lib/publicApi/format/getFormatState.d.ts +2 -2
  24. package/lib/publicApi/format/getFormatState.js.map +1 -1
  25. package/lib/publicApi/image/adjustImageSelection.d.ts +2 -2
  26. package/lib/publicApi/image/adjustImageSelection.js.map +1 -1
  27. package/lib/publicApi/image/changeImage.d.ts +2 -2
  28. package/lib/publicApi/image/changeImage.js.map +1 -1
  29. package/lib/publicApi/image/insertImage.d.ts +2 -2
  30. package/lib/publicApi/image/insertImage.js.map +1 -1
  31. package/lib/publicApi/image/setImageAltText.d.ts +2 -2
  32. package/lib/publicApi/image/setImageAltText.js.map +1 -1
  33. package/lib/publicApi/image/setImageBorder.d.ts +2 -2
  34. package/lib/publicApi/image/setImageBorder.js.map +1 -1
  35. package/lib/publicApi/image/setImageBoxShadow.d.ts +2 -2
  36. package/lib/publicApi/image/setImageBoxShadow.js.map +1 -1
  37. package/lib/publicApi/link/adjustLinkSelection.d.ts +2 -2
  38. package/lib/publicApi/link/adjustLinkSelection.js.map +1 -1
  39. package/lib/publicApi/link/insertLink.d.ts +2 -2
  40. package/lib/publicApi/link/insertLink.js.map +1 -1
  41. package/lib/publicApi/link/removeLink.d.ts +2 -2
  42. package/lib/publicApi/link/removeLink.js.map +1 -1
  43. package/lib/publicApi/list/setListStartNumber.d.ts +2 -2
  44. package/lib/publicApi/list/setListStartNumber.js.map +1 -1
  45. package/lib/publicApi/list/setListStyle.d.ts +2 -2
  46. package/lib/publicApi/list/setListStyle.js.map +1 -1
  47. package/lib/publicApi/list/toggleBullet.d.ts +3 -2
  48. package/lib/publicApi/list/toggleBullet.js +4 -2
  49. package/lib/publicApi/list/toggleBullet.js.map +1 -1
  50. package/lib/publicApi/list/toggleNumbering.d.ts +3 -2
  51. package/lib/publicApi/list/toggleNumbering.js +4 -2
  52. package/lib/publicApi/list/toggleNumbering.js.map +1 -1
  53. package/lib/publicApi/segment/applySegmentFormat.d.ts +2 -2
  54. package/lib/publicApi/segment/applySegmentFormat.js.map +1 -1
  55. package/lib/publicApi/segment/changeCapitalization.d.ts +2 -2
  56. package/lib/publicApi/segment/changeCapitalization.js.map +1 -1
  57. package/lib/publicApi/segment/changeFontSize.d.ts +2 -2
  58. package/lib/publicApi/segment/changeFontSize.js.map +1 -1
  59. package/lib/publicApi/segment/setBackgroundColor.d.ts +2 -2
  60. package/lib/publicApi/segment/setBackgroundColor.js.map +1 -1
  61. package/lib/publicApi/segment/setFontName.d.ts +2 -2
  62. package/lib/publicApi/segment/setFontName.js.map +1 -1
  63. package/lib/publicApi/segment/setFontSize.d.ts +2 -2
  64. package/lib/publicApi/segment/setFontSize.js.map +1 -1
  65. package/lib/publicApi/segment/setTextColor.d.ts +2 -2
  66. package/lib/publicApi/segment/setTextColor.js.map +1 -1
  67. package/lib/publicApi/segment/toggleBold.d.ts +2 -2
  68. package/lib/publicApi/segment/toggleBold.js.map +1 -1
  69. package/lib/publicApi/segment/toggleCode.d.ts +2 -2
  70. package/lib/publicApi/segment/toggleCode.js.map +1 -1
  71. package/lib/publicApi/segment/toggleItalic.d.ts +2 -2
  72. package/lib/publicApi/segment/toggleItalic.js.map +1 -1
  73. package/lib/publicApi/segment/toggleStrikethrough.d.ts +2 -2
  74. package/lib/publicApi/segment/toggleStrikethrough.js.map +1 -1
  75. package/lib/publicApi/segment/toggleSubscript.d.ts +2 -2
  76. package/lib/publicApi/segment/toggleSubscript.js.map +1 -1
  77. package/lib/publicApi/segment/toggleSuperscript.d.ts +2 -2
  78. package/lib/publicApi/segment/toggleSuperscript.js.map +1 -1
  79. package/lib/publicApi/segment/toggleUnderline.d.ts +2 -2
  80. package/lib/publicApi/segment/toggleUnderline.js.map +1 -1
  81. package/lib/publicApi/table/applyTableBorderFormat.d.ts +2 -2
  82. package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
  83. package/lib/publicApi/table/editTable.d.ts +2 -2
  84. package/lib/publicApi/table/editTable.js.map +1 -1
  85. package/lib/publicApi/table/formatTable.d.ts +2 -2
  86. package/lib/publicApi/table/formatTable.js.map +1 -1
  87. package/lib/publicApi/table/insertTable.d.ts +2 -2
  88. package/lib/publicApi/table/insertTable.js.map +1 -1
  89. package/lib/publicApi/table/setTableCellShade.d.ts +2 -2
  90. package/lib/publicApi/table/setTableCellShade.js.map +1 -1
  91. package/lib/publicApi/utils/formatImageWithContentModel.d.ts +2 -2
  92. package/lib/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  93. package/lib/publicApi/utils/formatParagraphWithContentModel.d.ts +2 -2
  94. package/lib/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  95. package/lib/publicApi/utils/formatSegmentWithContentModel.d.ts +2 -2
  96. package/lib/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  97. package/lib/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
  98. package/lib/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  99. package/lib-amd/modelApi/list/setListType.d.ts +2 -1
  100. package/lib-amd/modelApi/list/setListType.js +5 -3
  101. package/lib-amd/modelApi/list/setListType.js.map +1 -1
  102. package/lib-amd/publicApi/block/setAlignment.d.ts +2 -2
  103. package/lib-amd/publicApi/block/setAlignment.js.map +1 -1
  104. package/lib-amd/publicApi/block/setDirection.d.ts +2 -2
  105. package/lib-amd/publicApi/block/setDirection.js.map +1 -1
  106. package/lib-amd/publicApi/block/setHeadingLevel.d.ts +2 -2
  107. package/lib-amd/publicApi/block/setHeadingLevel.js.map +1 -1
  108. package/lib-amd/publicApi/block/setIndentation.d.ts +2 -2
  109. package/lib-amd/publicApi/block/setIndentation.js.map +1 -1
  110. package/lib-amd/publicApi/block/setParagraphMargin.d.ts +2 -2
  111. package/lib-amd/publicApi/block/setParagraphMargin.js.map +1 -1
  112. package/lib-amd/publicApi/block/setSpacing.d.ts +2 -2
  113. package/lib-amd/publicApi/block/setSpacing.js.map +1 -1
  114. package/lib-amd/publicApi/block/toggleBlockQuote.d.ts +2 -2
  115. package/lib-amd/publicApi/block/toggleBlockQuote.js.map +1 -1
  116. package/lib-amd/publicApi/entity/insertEntity.d.ts +5 -5
  117. package/lib-amd/publicApi/entity/insertEntity.js +22 -3
  118. package/lib-amd/publicApi/entity/insertEntity.js.map +1 -1
  119. package/lib-amd/publicApi/format/clearFormat.d.ts +2 -2
  120. package/lib-amd/publicApi/format/clearFormat.js.map +1 -1
  121. package/lib-amd/publicApi/format/getFormatState.d.ts +2 -2
  122. package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
  123. package/lib-amd/publicApi/image/adjustImageSelection.d.ts +2 -2
  124. package/lib-amd/publicApi/image/adjustImageSelection.js.map +1 -1
  125. package/lib-amd/publicApi/image/changeImage.d.ts +2 -2
  126. package/lib-amd/publicApi/image/changeImage.js.map +1 -1
  127. package/lib-amd/publicApi/image/insertImage.d.ts +2 -2
  128. package/lib-amd/publicApi/image/insertImage.js.map +1 -1
  129. package/lib-amd/publicApi/image/setImageAltText.d.ts +2 -2
  130. package/lib-amd/publicApi/image/setImageAltText.js.map +1 -1
  131. package/lib-amd/publicApi/image/setImageBorder.d.ts +2 -2
  132. package/lib-amd/publicApi/image/setImageBorder.js.map +1 -1
  133. package/lib-amd/publicApi/image/setImageBoxShadow.d.ts +2 -2
  134. package/lib-amd/publicApi/image/setImageBoxShadow.js.map +1 -1
  135. package/lib-amd/publicApi/link/adjustLinkSelection.d.ts +2 -2
  136. package/lib-amd/publicApi/link/adjustLinkSelection.js.map +1 -1
  137. package/lib-amd/publicApi/link/insertLink.d.ts +2 -2
  138. package/lib-amd/publicApi/link/insertLink.js.map +1 -1
  139. package/lib-amd/publicApi/link/removeLink.d.ts +2 -2
  140. package/lib-amd/publicApi/link/removeLink.js.map +1 -1
  141. package/lib-amd/publicApi/list/setListStartNumber.d.ts +2 -2
  142. package/lib-amd/publicApi/list/setListStartNumber.js.map +1 -1
  143. package/lib-amd/publicApi/list/setListStyle.d.ts +2 -2
  144. package/lib-amd/publicApi/list/setListStyle.js.map +1 -1
  145. package/lib-amd/publicApi/list/toggleBullet.d.ts +3 -2
  146. package/lib-amd/publicApi/list/toggleBullet.js +4 -2
  147. package/lib-amd/publicApi/list/toggleBullet.js.map +1 -1
  148. package/lib-amd/publicApi/list/toggleNumbering.d.ts +3 -2
  149. package/lib-amd/publicApi/list/toggleNumbering.js +4 -2
  150. package/lib-amd/publicApi/list/toggleNumbering.js.map +1 -1
  151. package/lib-amd/publicApi/segment/applySegmentFormat.d.ts +2 -2
  152. package/lib-amd/publicApi/segment/applySegmentFormat.js.map +1 -1
  153. package/lib-amd/publicApi/segment/changeCapitalization.d.ts +2 -2
  154. package/lib-amd/publicApi/segment/changeCapitalization.js.map +1 -1
  155. package/lib-amd/publicApi/segment/changeFontSize.d.ts +2 -2
  156. package/lib-amd/publicApi/segment/changeFontSize.js.map +1 -1
  157. package/lib-amd/publicApi/segment/setBackgroundColor.d.ts +2 -2
  158. package/lib-amd/publicApi/segment/setBackgroundColor.js.map +1 -1
  159. package/lib-amd/publicApi/segment/setFontName.d.ts +2 -2
  160. package/lib-amd/publicApi/segment/setFontName.js.map +1 -1
  161. package/lib-amd/publicApi/segment/setFontSize.d.ts +2 -2
  162. package/lib-amd/publicApi/segment/setFontSize.js.map +1 -1
  163. package/lib-amd/publicApi/segment/setTextColor.d.ts +2 -2
  164. package/lib-amd/publicApi/segment/setTextColor.js.map +1 -1
  165. package/lib-amd/publicApi/segment/toggleBold.d.ts +2 -2
  166. package/lib-amd/publicApi/segment/toggleBold.js.map +1 -1
  167. package/lib-amd/publicApi/segment/toggleCode.d.ts +2 -2
  168. package/lib-amd/publicApi/segment/toggleCode.js.map +1 -1
  169. package/lib-amd/publicApi/segment/toggleItalic.d.ts +2 -2
  170. package/lib-amd/publicApi/segment/toggleItalic.js.map +1 -1
  171. package/lib-amd/publicApi/segment/toggleStrikethrough.d.ts +2 -2
  172. package/lib-amd/publicApi/segment/toggleStrikethrough.js.map +1 -1
  173. package/lib-amd/publicApi/segment/toggleSubscript.d.ts +2 -2
  174. package/lib-amd/publicApi/segment/toggleSubscript.js.map +1 -1
  175. package/lib-amd/publicApi/segment/toggleSuperscript.d.ts +2 -2
  176. package/lib-amd/publicApi/segment/toggleSuperscript.js.map +1 -1
  177. package/lib-amd/publicApi/segment/toggleUnderline.d.ts +2 -2
  178. package/lib-amd/publicApi/segment/toggleUnderline.js.map +1 -1
  179. package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +2 -2
  180. package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
  181. package/lib-amd/publicApi/table/editTable.d.ts +2 -2
  182. package/lib-amd/publicApi/table/editTable.js.map +1 -1
  183. package/lib-amd/publicApi/table/formatTable.d.ts +2 -2
  184. package/lib-amd/publicApi/table/formatTable.js.map +1 -1
  185. package/lib-amd/publicApi/table/insertTable.d.ts +2 -2
  186. package/lib-amd/publicApi/table/insertTable.js.map +1 -1
  187. package/lib-amd/publicApi/table/setTableCellShade.d.ts +2 -2
  188. package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
  189. package/lib-amd/publicApi/utils/formatImageWithContentModel.d.ts +2 -2
  190. package/lib-amd/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  191. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.d.ts +2 -2
  192. package/lib-amd/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  193. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.d.ts +2 -2
  194. package/lib-amd/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  195. package/lib-amd/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
  196. package/lib-amd/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  197. package/lib-mjs/modelApi/list/setListType.d.ts +2 -1
  198. package/lib-mjs/modelApi/list/setListType.js +5 -3
  199. package/lib-mjs/modelApi/list/setListType.js.map +1 -1
  200. package/lib-mjs/publicApi/block/setAlignment.d.ts +2 -2
  201. package/lib-mjs/publicApi/block/setAlignment.js.map +1 -1
  202. package/lib-mjs/publicApi/block/setDirection.d.ts +2 -2
  203. package/lib-mjs/publicApi/block/setDirection.js.map +1 -1
  204. package/lib-mjs/publicApi/block/setHeadingLevel.d.ts +2 -2
  205. package/lib-mjs/publicApi/block/setHeadingLevel.js.map +1 -1
  206. package/lib-mjs/publicApi/block/setIndentation.d.ts +2 -2
  207. package/lib-mjs/publicApi/block/setIndentation.js.map +1 -1
  208. package/lib-mjs/publicApi/block/setParagraphMargin.d.ts +2 -2
  209. package/lib-mjs/publicApi/block/setParagraphMargin.js.map +1 -1
  210. package/lib-mjs/publicApi/block/setSpacing.d.ts +2 -2
  211. package/lib-mjs/publicApi/block/setSpacing.js.map +1 -1
  212. package/lib-mjs/publicApi/block/toggleBlockQuote.d.ts +2 -2
  213. package/lib-mjs/publicApi/block/toggleBlockQuote.js.map +1 -1
  214. package/lib-mjs/publicApi/entity/insertEntity.d.ts +5 -5
  215. package/lib-mjs/publicApi/entity/insertEntity.js +22 -3
  216. package/lib-mjs/publicApi/entity/insertEntity.js.map +1 -1
  217. package/lib-mjs/publicApi/format/clearFormat.d.ts +2 -2
  218. package/lib-mjs/publicApi/format/clearFormat.js.map +1 -1
  219. package/lib-mjs/publicApi/format/getFormatState.d.ts +2 -2
  220. package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
  221. package/lib-mjs/publicApi/image/adjustImageSelection.d.ts +2 -2
  222. package/lib-mjs/publicApi/image/adjustImageSelection.js.map +1 -1
  223. package/lib-mjs/publicApi/image/changeImage.d.ts +2 -2
  224. package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
  225. package/lib-mjs/publicApi/image/insertImage.d.ts +2 -2
  226. package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
  227. package/lib-mjs/publicApi/image/setImageAltText.d.ts +2 -2
  228. package/lib-mjs/publicApi/image/setImageAltText.js.map +1 -1
  229. package/lib-mjs/publicApi/image/setImageBorder.d.ts +2 -2
  230. package/lib-mjs/publicApi/image/setImageBorder.js.map +1 -1
  231. package/lib-mjs/publicApi/image/setImageBoxShadow.d.ts +2 -2
  232. package/lib-mjs/publicApi/image/setImageBoxShadow.js.map +1 -1
  233. package/lib-mjs/publicApi/link/adjustLinkSelection.d.ts +2 -2
  234. package/lib-mjs/publicApi/link/adjustLinkSelection.js.map +1 -1
  235. package/lib-mjs/publicApi/link/insertLink.d.ts +2 -2
  236. package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
  237. package/lib-mjs/publicApi/link/removeLink.d.ts +2 -2
  238. package/lib-mjs/publicApi/link/removeLink.js.map +1 -1
  239. package/lib-mjs/publicApi/list/setListStartNumber.d.ts +2 -2
  240. package/lib-mjs/publicApi/list/setListStartNumber.js.map +1 -1
  241. package/lib-mjs/publicApi/list/setListStyle.d.ts +2 -2
  242. package/lib-mjs/publicApi/list/setListStyle.js.map +1 -1
  243. package/lib-mjs/publicApi/list/toggleBullet.d.ts +3 -2
  244. package/lib-mjs/publicApi/list/toggleBullet.js +4 -2
  245. package/lib-mjs/publicApi/list/toggleBullet.js.map +1 -1
  246. package/lib-mjs/publicApi/list/toggleNumbering.d.ts +3 -2
  247. package/lib-mjs/publicApi/list/toggleNumbering.js +4 -2
  248. package/lib-mjs/publicApi/list/toggleNumbering.js.map +1 -1
  249. package/lib-mjs/publicApi/segment/applySegmentFormat.d.ts +2 -2
  250. package/lib-mjs/publicApi/segment/applySegmentFormat.js.map +1 -1
  251. package/lib-mjs/publicApi/segment/changeCapitalization.d.ts +2 -2
  252. package/lib-mjs/publicApi/segment/changeCapitalization.js.map +1 -1
  253. package/lib-mjs/publicApi/segment/changeFontSize.d.ts +2 -2
  254. package/lib-mjs/publicApi/segment/changeFontSize.js.map +1 -1
  255. package/lib-mjs/publicApi/segment/setBackgroundColor.d.ts +2 -2
  256. package/lib-mjs/publicApi/segment/setBackgroundColor.js.map +1 -1
  257. package/lib-mjs/publicApi/segment/setFontName.d.ts +2 -2
  258. package/lib-mjs/publicApi/segment/setFontName.js.map +1 -1
  259. package/lib-mjs/publicApi/segment/setFontSize.d.ts +2 -2
  260. package/lib-mjs/publicApi/segment/setFontSize.js.map +1 -1
  261. package/lib-mjs/publicApi/segment/setTextColor.d.ts +2 -2
  262. package/lib-mjs/publicApi/segment/setTextColor.js.map +1 -1
  263. package/lib-mjs/publicApi/segment/toggleBold.d.ts +2 -2
  264. package/lib-mjs/publicApi/segment/toggleBold.js.map +1 -1
  265. package/lib-mjs/publicApi/segment/toggleCode.d.ts +2 -2
  266. package/lib-mjs/publicApi/segment/toggleCode.js.map +1 -1
  267. package/lib-mjs/publicApi/segment/toggleItalic.d.ts +2 -2
  268. package/lib-mjs/publicApi/segment/toggleItalic.js.map +1 -1
  269. package/lib-mjs/publicApi/segment/toggleStrikethrough.d.ts +2 -2
  270. package/lib-mjs/publicApi/segment/toggleStrikethrough.js.map +1 -1
  271. package/lib-mjs/publicApi/segment/toggleSubscript.d.ts +2 -2
  272. package/lib-mjs/publicApi/segment/toggleSubscript.js.map +1 -1
  273. package/lib-mjs/publicApi/segment/toggleSuperscript.d.ts +2 -2
  274. package/lib-mjs/publicApi/segment/toggleSuperscript.js.map +1 -1
  275. package/lib-mjs/publicApi/segment/toggleUnderline.d.ts +2 -2
  276. package/lib-mjs/publicApi/segment/toggleUnderline.js.map +1 -1
  277. package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +2 -2
  278. package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
  279. package/lib-mjs/publicApi/table/editTable.d.ts +2 -2
  280. package/lib-mjs/publicApi/table/editTable.js.map +1 -1
  281. package/lib-mjs/publicApi/table/formatTable.d.ts +2 -2
  282. package/lib-mjs/publicApi/table/formatTable.js.map +1 -1
  283. package/lib-mjs/publicApi/table/insertTable.d.ts +2 -2
  284. package/lib-mjs/publicApi/table/insertTable.js.map +1 -1
  285. package/lib-mjs/publicApi/table/setTableCellShade.d.ts +2 -2
  286. package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
  287. package/lib-mjs/publicApi/utils/formatImageWithContentModel.d.ts +2 -2
  288. package/lib-mjs/publicApi/utils/formatImageWithContentModel.js.map +1 -1
  289. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.d.ts +2 -2
  290. package/lib-mjs/publicApi/utils/formatParagraphWithContentModel.js.map +1 -1
  291. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.d.ts +2 -2
  292. package/lib-mjs/publicApi/utils/formatSegmentWithContentModel.js.map +1 -1
  293. package/lib-mjs/publicApi/utils/formatTableWithContentModel.d.ts +2 -2
  294. package/lib-mjs/publicApi/utils/formatTableWithContentModel.js.map +1 -1
  295. package/package.json +4 -4
@@ -3,5 +3,6 @@ import type { ContentModelDocument } from 'roosterjs-content-model-types';
3
3
  * Set a list type to content model
4
4
  * @param model the model document
5
5
  * @param listType the list type OL | UL
6
+ * @param removeMargins true to remove margins, false to keep margins @default false
6
7
  */
7
- export declare function setListType(model: ContentModelDocument, listType: 'OL' | 'UL'): boolean;
8
+ export declare function setListType(model: ContentModelDocument, listType: 'OL' | 'UL', removeMargins?: boolean): boolean;
@@ -7,8 +7,10 @@ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
7
7
  * Set a list type to content model
8
8
  * @param model the model document
9
9
  * @param listType the list type OL | UL
10
+ * @param removeMargins true to remove margins, false to keep margins @default false
10
11
  */
11
- function setListType(model, listType) {
12
+ function setListType(model, listType, removeMargins) {
13
+ if (removeMargins === void 0) { removeMargins = false; }
12
14
  var paragraphOrListItems = (0, roosterjs_content_model_core_1.getOperationalBlocks)(model, ['ListItem'], [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any
13
15
  );
14
16
  var alreadyInExpectedType = paragraphOrListItems.every(function (_a) {
@@ -62,8 +64,8 @@ function setListType(model, listType) {
62
64
  : 1,
63
65
  direction: block.format.direction,
64
66
  textAlign: block.format.textAlign,
65
- marginTop: '0px',
66
- marginBottom: '0px',
67
+ marginBottom: removeMargins ? '0px' : undefined,
68
+ marginTop: removeMargins ? '0px' : undefined,
67
69
  }),
68
70
  ],
69
71
  // For list bullet, we only want to carry over these formats from segments:
@@ -1 +1 @@
1
- {"version":3,"file":"setListType.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/list/setListType.ts"],"names":[],"mappings":";;;AAAA,6EAAwF;AACxF,2EAKqC;AAOrC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,KAA2B,EAAE,QAAqB;IAC1E,IAAM,oBAAoB,GAAG,IAAA,mDAAoB,EAC7C,KAAK,EACL,CAAC,UAAU,CAAC,E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,CAAC,CAAC;IAEH,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;IAE7B,OAAO,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3C,CAAC;AAxGD,kCAwGC;AAED,SAAS,iBAAiB,CAAC,KAAwB;IAC/C,QAAQ,KAAK,CAAC,SAAS,EAAE;QACrB,KAAK,OAAO;YACR,OAAO,KAAK,CAAC;QACjB,KAAK,WAAW;YACZ,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CACvB,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,WAAW,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,iBAAiB,EAA3D,CAA2D,CACnE,CAAC;QACN;YACI,OAAO,IAAI,CAAC;KACnB;AACL,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';\nimport {\n createListItem,\n createListLevel,\n normalizeContentModel,\n setParagraphNotImplicit,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelDocument,\n ContentModelListItem,\n} from 'roosterjs-content-model-types';\n\n/**\n * Set a list type to content model\n * @param model the model document\n * @param listType the list type OL | UL\n */\nexport function setListType(model: ContentModelDocument, listType: 'OL' | 'UL') {\n const paragraphOrListItems = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any\n );\n const alreadyInExpectedType = paragraphOrListItems.every(({ block }) =>\n isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')\n ? block.levels[block.levels.length - 1]?.listType == listType\n : shouldIgnoreBlock(block)\n );\n let existingListItems: ContentModelListItem[] = [];\n\n paragraphOrListItems.forEach(({ block, parent }, itemIndex) => {\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const level = block.levels.pop();\n\n if (!alreadyInExpectedType && level) {\n level.listType = listType;\n block.levels.push(level);\n } else if (block.blocks.length == 1) {\n setParagraphNotImplicit(block.blocks[0]);\n }\n\n if (alreadyInExpectedType) {\n //if the list item has margins or textAlign, we need to apply them to the block to preserve the indention and alignment\n block.blocks.forEach(x => {\n if (block.format.marginLeft) {\n x.format.marginLeft = block.format.marginLeft;\n }\n\n if (block.format.marginRight) {\n x.format.marginRight = block.format.marginRight;\n }\n\n if (block.format.textAlign) {\n x.format.textAlign = block.format.textAlign;\n }\n });\n }\n } else {\n const index = parent.blocks.indexOf(block);\n\n if (index >= 0) {\n if (paragraphOrListItems.length == 1 || !shouldIgnoreBlock(block)) {\n const prevBlock = parent.blocks[index - 1];\n const segmentFormat =\n (block.blockType == 'Paragraph' && block.segments[0]?.format) || {};\n const newListItem = createListItem(\n [\n createListLevel(listType, {\n startNumberOverride:\n itemIndex > 0 ||\n (prevBlock?.blockType == 'BlockGroup' &&\n prevBlock.blockGroupType == 'ListItem' &&\n prevBlock.levels[0]?.listType == 'OL')\n ? undefined\n : 1,\n direction: block.format.direction,\n textAlign: block.format.textAlign,\n marginTop: '0px',\n marginBottom: '0px',\n }),\n ],\n // For list bullet, we only want to carry over these formats from segments:\n {\n fontFamily: segmentFormat.fontFamily,\n fontSize: segmentFormat.fontSize,\n textColor: segmentFormat.textColor,\n }\n );\n\n if (block.blockType == 'Paragraph') {\n setParagraphNotImplicit(block);\n }\n\n newListItem.blocks.push(block);\n\n if (block.format.marginRight) {\n newListItem.format.marginRight = block.format.marginRight;\n block.format.marginRight = undefined;\n }\n if (block.format.marginLeft) {\n newListItem.format.marginLeft = block.format.marginLeft;\n block.format.marginLeft = undefined;\n }\n\n if (block.format.textAlign) {\n newListItem.format.textAlign = block.format.textAlign;\n }\n\n parent.blocks.splice(index, 1, newListItem);\n existingListItems.push(newListItem);\n } else {\n existingListItems.forEach(x => (x.levels[0].format.marginBottom = '0px'));\n existingListItems = [];\n }\n }\n }\n });\n\n normalizeContentModel(model);\n\n return paragraphOrListItems.length > 0;\n}\n\nfunction shouldIgnoreBlock(block: ContentModelBlock) {\n switch (block.blockType) {\n case 'Table':\n return false;\n case 'Paragraph':\n return block.segments.every(\n x => x.segmentType == 'Br' || x.segmentType == 'SelectionMarker'\n );\n default:\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"setListType.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/list/setListType.ts"],"names":[],"mappings":";;;AAAA,6EAAwF;AACxF,2EAKqC;AAOrC;;;;;GAKG;AACH,SAAgB,WAAW,CACvB,KAA2B,EAC3B,QAAqB,EACrB,aAA8B;IAA9B,8BAAA,EAAA,qBAA8B;IAE9B,IAAM,oBAAoB,GAAG,IAAA,mDAAoB,EAC7C,KAAK,EACL,CAAC,UAAU,CAAC,EACZ,EAAE,CAAC,8IAA8I;KACpJ,CAAC;IACF,IAAM,qBAAqB,GAAG,oBAAoB,CAAC,KAAK,CAAC,UAAC,EAAS;;YAAP,KAAK,WAAA;QAC7D,OAAA,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC;YACvD,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,QAAQ,KAAI,QAAQ;YAC7D,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;KAAA,CACjC,CAAC;IACF,IAAI,iBAAiB,GAA2B,EAAE,CAAC;IAEnD,oBAAoB,CAAC,OAAO,CAAC,UAAC,EAAiB,EAAE,SAAS;;YAA1B,KAAK,WAAA,EAAE,MAAM,YAAA;QACzC,IAAI,IAAA,iDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;YAC7D,IAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;YAEjC,IAAI,CAAC,qBAAqB,IAAI,KAAK,EAAE;gBACjC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC1B,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CA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,CAAC;qBACvC;oBAED,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;wBACxB,WAAW,CAAC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;qBACzD;oBAED,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;oBAC5C,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBACvC;qBAAM;oBACH,iBAAiB,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,EAAzC,CAAyC,CAAC,CAAC;oBAC1E,iBAAiB,GAAG,EAAE,CAAC;iBAC1B;aACJ;SACJ;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;IAE7B,OAAO,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3C,CAAC;AA7GD,kCA6GC;AAED,SAAS,iBAAiB,CAAC,KAAwB;IAC/C,QAAQ,KAAK,CAAC,SAAS,EAAE;QACrB,KAAK,OAAO;YACR,OAAO,KAAK,CAAC;QACjB,KAAK,WAAW;YACZ,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CACvB,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,WAAW,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,iBAAiB,EAA3D,CAA2D,CACnE,CAAC;QACN;YACI,OAAO,IAAI,CAAC;KACnB;AACL,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-core';\nimport {\n createListItem,\n createListLevel,\n normalizeContentModel,\n setParagraphNotImplicit,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlock,\n ContentModelDocument,\n ContentModelListItem,\n} from 'roosterjs-content-model-types';\n\n/**\n * Set a list type to content model\n * @param model the model document\n * @param listType the list type OL | UL\n * @param removeMargins true to remove margins, false to keep margins @default false\n */\nexport function setListType(\n model: ContentModelDocument,\n listType: 'OL' | 'UL',\n removeMargins: boolean = false\n) {\n const paragraphOrListItems = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any\n );\n const alreadyInExpectedType = paragraphOrListItems.every(({ block }) =>\n isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')\n ? block.levels[block.levels.length - 1]?.listType == listType\n : shouldIgnoreBlock(block)\n );\n let existingListItems: ContentModelListItem[] = [];\n\n paragraphOrListItems.forEach(({ block, parent }, itemIndex) => {\n if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n const level = block.levels.pop();\n\n if (!alreadyInExpectedType && level) {\n level.listType = listType;\n block.levels.push(level);\n } else if (block.blocks.length == 1) {\n setParagraphNotImplicit(block.blocks[0]);\n }\n\n if (alreadyInExpectedType) {\n //if the list item has margins or textAlign, we need to apply them to the block to preserve the indention and alignment\n block.blocks.forEach(x => {\n if (block.format.marginLeft) {\n x.format.marginLeft = block.format.marginLeft;\n }\n\n if (block.format.marginRight) {\n x.format.marginRight = block.format.marginRight;\n }\n\n if (block.format.textAlign) {\n x.format.textAlign = block.format.textAlign;\n }\n });\n }\n } else {\n const index = parent.blocks.indexOf(block);\n\n if (index >= 0) {\n if (paragraphOrListItems.length == 1 || !shouldIgnoreBlock(block)) {\n const prevBlock = parent.blocks[index - 1];\n const segmentFormat =\n (block.blockType == 'Paragraph' && block.segments[0]?.format) || {};\n const newListItem = createListItem(\n [\n createListLevel(listType, {\n startNumberOverride:\n itemIndex > 0 ||\n (prevBlock?.blockType == 'BlockGroup' &&\n prevBlock.blockGroupType == 'ListItem' &&\n prevBlock.levels[0]?.listType == 'OL')\n ? undefined\n : 1,\n direction: block.format.direction,\n textAlign: block.format.textAlign,\n marginBottom: removeMargins ? '0px' : undefined,\n marginTop: removeMargins ? '0px' : undefined,\n }),\n ],\n // For list bullet, we only want to carry over these formats from segments:\n {\n fontFamily: segmentFormat.fontFamily,\n fontSize: segmentFormat.fontSize,\n textColor: segmentFormat.textColor,\n }\n );\n\n if (block.blockType == 'Paragraph') {\n setParagraphNotImplicit(block);\n }\n\n newListItem.blocks.push(block);\n\n if (block.format.marginRight) {\n newListItem.format.marginRight = block.format.marginRight;\n block.format.marginRight = undefined;\n }\n\n if (block.format.marginLeft) {\n newListItem.format.marginLeft = block.format.marginLeft;\n block.format.marginLeft = undefined;\n }\n\n if (block.format.textAlign) {\n newListItem.format.textAlign = block.format.textAlign;\n }\n\n parent.blocks.splice(index, 1, newListItem);\n existingListItems.push(newListItem);\n } else {\n existingListItems.forEach(x => (x.levels[0].format.marginBottom = '0px'));\n existingListItems = [];\n }\n }\n }\n });\n\n normalizeContentModel(model);\n\n return paragraphOrListItems.length > 0;\n}\n\nfunction shouldIgnoreBlock(block: ContentModelBlock) {\n switch (block.blockType) {\n case 'Table':\n return false;\n case 'Paragraph':\n return block.segments.every(\n x => x.segmentType == 'Br' || x.segmentType == 'SelectionMarker'\n );\n default:\n return true;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set text alignment of selected paragraphs
4
4
  * @param editor The editor to set alignment
5
5
  * @param alignment Alignment value: left, center or right
6
6
  */
7
- export default function setAlignment(editor: IStandaloneEditor, alignment: 'left' | 'center' | 'right' | 'justify'): void;
7
+ export default function setAlignment(editor: IEditor, alignment: 'left' | 'center' | 'right' | 'justify'): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setAlignment.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setAlignment.ts"],"names":[],"mappings":";;AAAA,4EAA2E;AAG3E;;;;GAIG;AACH,SAAwB,YAAY,CAChC,MAAyB,EACzB,SAAkD;IAElD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK,IAAI,OAAA,IAAA,qCAAiB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAnC,CAAmC,EAAE;QACpE,OAAO,EAAE,cAAc;KAC1B,CAAC,CAAC;AACP,CAAC;AATD,+BASC","sourcesContent":["import { setModelAlignment } from '../../modelApi/block/setModelAlignment';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text alignment of selected paragraphs\n * @param editor The editor to set alignment\n * @param alignment Alignment value: left, center or right\n */\nexport default function setAlignment(\n editor: IStandaloneEditor,\n alignment: 'left' | 'center' | 'right' | 'justify'\n) {\n editor.focus();\n\n editor.formatContentModel(model => setModelAlignment(model, alignment), {\n apiName: 'setAlignment',\n });\n}\n"]}
1
+ {"version":3,"file":"setAlignment.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setAlignment.ts"],"names":[],"mappings":";;AAAA,4EAA2E;AAG3E;;;;GAIG;AACH,SAAwB,YAAY,CAChC,MAAe,EACf,SAAkD;IAElD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK,IAAI,OAAA,IAAA,qCAAiB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAnC,CAAmC,EAAE;QACpE,OAAO,EAAE,cAAc;KAC1B,CAAC,CAAC;AACP,CAAC;AATD,+BASC","sourcesContent":["import { setModelAlignment } from '../../modelApi/block/setModelAlignment';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text alignment of selected paragraphs\n * @param editor The editor to set alignment\n * @param alignment Alignment value: left, center or right\n */\nexport default function setAlignment(\n editor: IEditor,\n alignment: 'left' | 'center' | 'right' | 'justify'\n) {\n editor.focus();\n\n editor.formatContentModel(model => setModelAlignment(model, alignment), {\n apiName: 'setAlignment',\n });\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set text direction of selected paragraphs (Left to right or Right to left)
4
4
  * @param editor The editor to set alignment
5
5
  * @param direction Direction value: ltr (Left to right) or rtl (Right to left)
6
6
  */
7
- export default function setDirection(editor: IStandaloneEditor, direction: 'ltr' | 'rtl'): void;
7
+ export default function setDirection(editor: IEditor, direction: 'ltr' | 'rtl'): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setDirection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setDirection.ts"],"names":[],"mappings":";;AAAA,4EAA2E;AAG3E;;;;GAIG;AACH,SAAwB,YAAY,CAAC,MAAyB,EAAE,SAAwB;IACpF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK,IAAI,OAAA,IAAA,qCAAiB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAnC,CAAmC,EAAE;QACpE,OAAO,EAAE,cAAc;KAC1B,CAAC,CAAC;AACP,CAAC;AAND,+BAMC","sourcesContent":["import { setModelDirection } from '../../modelApi/block/setModelDirection';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text direction of selected paragraphs (Left to right or Right to left)\n * @param editor The editor to set alignment\n * @param direction Direction value: ltr (Left to right) or rtl (Right to left)\n */\nexport default function setDirection(editor: IStandaloneEditor, direction: 'ltr' | 'rtl') {\n editor.focus();\n\n editor.formatContentModel(model => setModelDirection(model, direction), {\n apiName: 'setDirection',\n });\n}\n"]}
1
+ {"version":3,"file":"setDirection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setDirection.ts"],"names":[],"mappings":";;AAAA,4EAA2E;AAG3E;;;;GAIG;AACH,SAAwB,YAAY,CAAC,MAAe,EAAE,SAAwB;IAC1E,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK,IAAI,OAAA,IAAA,qCAAiB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAnC,CAAmC,EAAE;QACpE,OAAO,EAAE,cAAc;KAC1B,CAAC,CAAC;AACP,CAAC;AAND,+BAMC","sourcesContent":["import { setModelDirection } from '../../modelApi/block/setModelDirection';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set text direction of selected paragraphs (Left to right or Right to left)\n * @param editor The editor to set alignment\n * @param direction Direction value: ltr (Left to right) or rtl (Right to left)\n */\nexport default function setDirection(editor: IEditor, direction: 'ltr' | 'rtl') {\n editor.focus();\n\n editor.formatContentModel(model => setModelDirection(model, direction), {\n apiName: 'setDirection',\n });\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set heading level of selected paragraphs
4
4
  * @param editor The editor to set heading level to
5
5
  * @param headingLevel Level of heading, from 1 to 6. Set to 0 means set it back to a regular paragraph
6
6
  */
7
- export default function setHeadingLevel(editor: IStandaloneEditor, headingLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6): void;
7
+ export default function setHeadingLevel(editor: IEditor, headingLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setHeadingLevel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setHeadingLevel.ts"],"names":[],"mappings":";;AAAA,4FAA2F;AAQ3F,IAAM,eAAe,GAAqC;IACtD,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;CACf,CAAC;AAEF;;;;GAIG;AACH,SAAwB,eAAe,CACnC,MAAyB,EACzB,YAAuC;IAEvC,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAA,IAAI;QAC3D,IAAM,OAAO,GACT,YAAY,GAAG,CAAC;YACZ,CAAC,CAAE,CAAC,GAAG,GAAG,YAAY,CAA6B;YACnD,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,YAAY,GAAG,CAAC,EAAE;YAClB,IAAI,CAAC,SAAS,GAAG;gBACb,OAAO,EAAE,OAAQ;gBACjB,MAAM,EAAE,OAAO;oBACX,CAAC,CAAC;wBACI,UAAU,EAAE,MAAM;wBAClB,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC;qBACrC;oBACH,CAAC,CAAC,EAAE;aACX,CAAC;YAEF,uEAAuE;YACvE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;gBACzB,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;YACrC,CAAC,CAAC,CAAC;SACN;aAAM,IAAI,OAAO,EAAE;YAChB,OAAO,IAAI,CAAC,SAAS,CAAC;SACzB;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAhCD,kCAgCC;AAED,SAAS,qBAAqB,CAC1B,SAA0C;IAE1C,IAAM,GAAG,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,KAAI,EAAE,CAAC;IACrC,IAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzC,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAE,GAAwB,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC","sourcesContent":["import { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type {\n ContentModelParagraphDecorator,\n IStandaloneEditor,\n} from 'roosterjs-content-model-types';\n\ntype HeadingLevelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nconst HeaderFontSizes: Record<HeadingLevelTags, string> = {\n h1: '2em',\n h2: '1.5em',\n h3: '1.17em',\n h4: '1em',\n h5: '0.83em',\n h6: '0.67em',\n};\n\n/**\n * Set heading level of selected paragraphs\n * @param editor The editor to set heading level to\n * @param headingLevel Level of heading, from 1 to 6. Set to 0 means set it back to a regular paragraph\n */\nexport default function setHeadingLevel(\n editor: IStandaloneEditor,\n headingLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6\n) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setHeadingLevel', para => {\n const tagName =\n headingLevel > 0\n ? (('h' + headingLevel) as HeadingLevelTags | null)\n : getExistingHeadingTag(para.decorator);\n\n if (headingLevel > 0) {\n para.decorator = {\n tagName: tagName!,\n format: tagName\n ? {\n fontWeight: 'bold',\n fontSize: HeaderFontSizes[tagName],\n }\n : {},\n };\n\n // Remove existing formats since tags have default font size and weight\n para.segments.forEach(segment => {\n delete segment.format.fontSize;\n delete segment.format.fontWeight;\n });\n } else if (tagName) {\n delete para.decorator;\n }\n });\n}\n\nfunction getExistingHeadingTag(\n decorator?: ContentModelParagraphDecorator\n): HeadingLevelTags | null {\n const tag = decorator?.tagName || '';\n const level = parseInt(tag.substring(1));\n\n return level >= 1 && level <= 6 ? (tag as HeadingLevelTags) : null;\n}\n"]}
1
+ {"version":3,"file":"setHeadingLevel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setHeadingLevel.ts"],"names":[],"mappings":";;AAAA,4FAA2F;AAK3F,IAAM,eAAe,GAAqC;IACtD,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;CACf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atParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { ContentModelParagraphDecorator, IEditor } from 'roosterjs-content-model-types';\n\ntype HeadingLevelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nconst HeaderFontSizes: Record<HeadingLevelTags, string> = {\n h1: '2em',\n h2: '1.5em',\n h3: '1.17em',\n h4: '1em',\n h5: '0.83em',\n h6: '0.67em',\n};\n\n/**\n * Set heading level of selected paragraphs\n * @param editor The editor to set heading level to\n * @param headingLevel Level of heading, from 1 to 6. Set to 0 means set it back to a regular paragraph\n */\nexport default function setHeadingLevel(editor: IEditor, headingLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setHeadingLevel', para => {\n const tagName =\n headingLevel > 0\n ? (('h' + headingLevel) as HeadingLevelTags | null)\n : getExistingHeadingTag(para.decorator);\n\n if (headingLevel > 0) {\n para.decorator = {\n tagName: tagName!,\n format: tagName\n ? {\n fontWeight: 'bold',\n fontSize: HeaderFontSizes[tagName],\n }\n : {},\n };\n\n // Remove existing formats since tags have default font size and weight\n para.segments.forEach(segment => {\n delete segment.format.fontSize;\n delete segment.format.fontWeight;\n });\n } else if (tagName) {\n delete para.decorator;\n }\n });\n}\n\nfunction getExistingHeadingTag(\n decorator?: ContentModelParagraphDecorator\n): HeadingLevelTags | null {\n const tag = decorator?.tagName || '';\n const level = parseInt(tag.substring(1));\n\n return level >= 1 && level <= 6 ? (tag as HeadingLevelTags) : null;\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Indent or outdent to selected paragraphs
4
4
  * @param editor The editor to operate on
5
5
  * @param indentation Whether indent or outdent
6
6
  * @param length The length of pixel to indent/outdent @default 40
7
7
  */
8
- export default function setIndentation(editor: IStandaloneEditor, indentation: 'indent' | 'outdent', length?: number): void;
8
+ export default function setIndentation(editor: IEditor, indentation: 'indent' | 'outdent', length?: number): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setIndentation.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setIndentation.ts"],"names":[],"mappings":";;AAAA,2EAAoE;AACpE,gFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,cAAc,CAClC,MAAyB,EACzB,WAAiC,EACjC,MAAe;IAEf,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,IAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAE/D,IAAI,MAAM,EAAE;YACR,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;SAChC;QAED,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAEtC,OAAO,MAAM,CAAC;IAClB,CAAC,EACD;QACI,OAAO,EAAE,gBAAgB;KAC5B,CACJ,CAAC;AACN,CAAC;AAvBD,iCAuBC","sourcesContent":["import { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from '../../modelApi/block/setModelIndentation';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Indent or outdent to selected paragraphs\n * @param editor The editor to operate on\n * @param indentation Whether indent or outdent\n * @param length The length of pixel to indent/outdent @default 40\n */\nexport default function setIndentation(\n editor: IStandaloneEditor,\n indentation: 'indent' | 'outdent',\n length?: number\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const result = setModelIndentation(model, indentation, length);\n\n if (result) {\n normalizeContentModel(model);\n }\n\n context.newPendingFormat = 'preserve';\n\n return result;\n },\n {\n apiName: 'setIndentation',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"setIndentation.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setIndentation.ts"],"names":[],"mappings":";;AAAA,2EAAoE;AACpE,gFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,cAAc,CAClC,MAAe,EACf,WAAiC,EACjC,MAAe;IAEf,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,IAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAE/D,IAAI,MAAM,EAAE;YACR,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;SAChC;QAED,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAEtC,OAAO,MAAM,CAAC;IAClB,CAAC,EACD;QACI,OAAO,EAAE,gBAAgB;KAC5B,CACJ,CAAC;AACN,CAAC;AAvBD,iCAuBC","sourcesContent":["import { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from '../../modelApi/block/setModelIndentation';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Indent or outdent to selected paragraphs\n * @param editor The editor to operate on\n * @param indentation Whether indent or outdent\n * @param length The length of pixel to indent/outdent @default 40\n */\nexport default function setIndentation(\n editor: IEditor,\n indentation: 'indent' | 'outdent',\n length?: number\n) {\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n const result = setModelIndentation(model, indentation, length);\n\n if (result) {\n normalizeContentModel(model);\n }\n\n context.newPendingFormat = 'preserve';\n\n return result;\n },\n {\n apiName: 'setIndentation',\n }\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggles the current block(s) margin properties.
4
4
  * null deletes any existing value, undefined is ignored
@@ -6,4 +6,4 @@ import type { IStandaloneEditor } from 'roosterjs-content-model-types';
6
6
  * @param marginTop value for top margin
7
7
  * @param marginBottom value for bottom margin
8
8
  */
9
- export default function setParagraphMargin(editor: IStandaloneEditor, marginTop?: string | null, marginBottom?: string | null): void;
9
+ export default function setParagraphMargin(editor: IEditor, marginTop?: string | null, marginBottom?: string | null): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setParagraphMargin.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setParagraphMargin.ts"],"names":[],"mappings":";;AAAA,2EAAuE;AACvE,4FAA2F;AAG3F;;;;;;GAMG;AACH,SAAwB,kBAAkB,CACtC,MAAyB,EACzB,SAAyB,EACzB,YAA4B;IAE5B,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,oBAAoB,EAAE,UAAA,IAAI;QAC9D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAA,sDAAwB,EAAC,GAAG,CAAC,CAAC;SAClD;QAED,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;SACrC;aAAM,IAAI,SAAS,KAAK,IAAI,EAAE;YAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;SAChC;QAED,IAAI,YAAY,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;SAC3C;aAAM,IAAI,YAAY,KAAK,IAAI,EAAE;YAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;SACnC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAxBD,qCAwBC","sourcesContent":["import { createParagraphDecorator } from 'roosterjs-content-model-dom';\nimport { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggles the current block(s) margin properties.\n * null deletes any existing value, undefined is ignored\n * @param editor The editor to operate on\n * @param marginTop value for top margin\n * @param marginBottom value for bottom margin\n */\nexport default function setParagraphMargin(\n editor: IStandaloneEditor,\n marginTop?: string | null,\n marginBottom?: string | null\n) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setParagraphMargin', para => {\n if (!para.decorator) {\n para.decorator = createParagraphDecorator('p');\n }\n\n if (marginTop) {\n para.format.marginTop = marginTop;\n } else if (marginTop === null) {\n delete para.format.marginTop;\n }\n\n if (marginBottom) {\n para.format.marginBottom = marginBottom;\n } else if (marginBottom === null) {\n delete para.format.marginBottom;\n }\n });\n}\n"]}
1
+ {"version":3,"file":"setParagraphMargin.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setParagraphMargin.ts"],"names":[],"mappings":";;AAAA,2EAAuE;AACvE,4FAA2F;AAG3F;;;;;;GAMG;AACH,SAAwB,kBAAkB,CACtC,MAAe,EACf,SAAyB,EACzB,YAA4B;IAE5B,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,oBAAoB,EAAE,UAAA,IAAI;QAC9D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAA,sDAAwB,EAAC,GAAG,CAAC,CAAC;SAClD;QAED,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;SACrC;aAAM,IAAI,SAAS,KAAK,IAAI,EAAE;YAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;SAChC;QAED,IAAI,YAAY,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;SAC3C;aAAM,IAAI,YAAY,KAAK,IAAI,EAAE;YAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;SACnC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAxBD,qCAwBC","sourcesContent":["import { createParagraphDecorator } from 'roosterjs-content-model-dom';\nimport { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Toggles the current block(s) margin properties.\n * null deletes any existing value, undefined is ignored\n * @param editor The editor to operate on\n * @param marginTop value for top margin\n * @param marginBottom value for bottom margin\n */\nexport default function setParagraphMargin(\n editor: IEditor,\n marginTop?: string | null,\n marginBottom?: string | null\n) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setParagraphMargin', para => {\n if (!para.decorator) {\n para.decorator = createParagraphDecorator('p');\n }\n\n if (marginTop) {\n para.format.marginTop = marginTop;\n } else if (marginTop === null) {\n delete para.format.marginTop;\n }\n\n if (marginBottom) {\n para.format.marginBottom = marginBottom;\n } else if (marginBottom === null) {\n delete para.format.marginBottom;\n }\n });\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Sets current selected block(s) line-height property and wipes such property from child segments
4
4
  * @param editor The editor to operate on
5
5
  * @param spacing Unitless/px value to set line height
6
6
  */
7
- export default function setSpacing(editor: IStandaloneEditor, spacing: number | string): void;
7
+ export default function setSpacing(editor: IEditor, spacing: number | string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setSpacing.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setSpacing.ts"],"names":[],"mappings":";;AAAA,4FAA2F;AAG3F;;;;GAIG;AACH,SAAwB,UAAU,CAAC,MAAyB,EAAE,OAAwB;IAClF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,YAAY,EAAE,UAAA,SAAS;QAC3D,SAAS,CAAC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACjD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;YAC9B,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;gBAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;aACpC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAXD,6BAWC","sourcesContent":["import { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Sets current selected block(s) line-height property and wipes such property from child segments\n * @param editor The editor to operate on\n * @param spacing Unitless/px value to set line height\n */\nexport default function setSpacing(editor: IStandaloneEditor, spacing: number | string) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setSpacing', paragraph => {\n paragraph.format.lineHeight = spacing.toString();\n paragraph.segments.forEach(segment => {\n if (segment.format.lineHeight) {\n delete segment.format.lineHeight;\n }\n });\n });\n}\n"]}
1
+ {"version":3,"file":"setSpacing.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/setSpacing.ts"],"names":[],"mappings":";;AAAA,4FAA2F;AAG3F;;;;GAIG;AACH,SAAwB,UAAU,CAAC,MAAe,EAAE,OAAwB;IACxE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,iEAA+B,EAAC,MAAM,EAAE,YAAY,EAAE,UAAA,SAAS;QAC3D,SAAS,CAAC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACjD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,OAAO;YAC9B,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;gBAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;aACpC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAXD,6BAWC","sourcesContent":["import { formatParagraphWithContentModel } from '../utils/formatParagraphWithContentModel';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Sets current selected block(s) line-height property and wipes such property from child segments\n * @param editor The editor to operate on\n * @param spacing Unitless/px value to set line height\n */\nexport default function setSpacing(editor: IEditor, spacing: number | string) {\n editor.focus();\n\n formatParagraphWithContentModel(editor, 'setSpacing', paragraph => {\n paragraph.format.lineHeight = spacing.toString();\n paragraph.segments.forEach(segment => {\n if (segment.format.lineHeight) {\n delete segment.format.lineHeight;\n }\n });\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { ContentModelFormatContainerFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { ContentModelFormatContainerFormat, IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Toggle BLOCKQUOTE state of selected paragraphs.
4
4
  * If any selected paragraph is not under a BLOCKQUOTE, wrap them into a BLOCKQUOTE.
@@ -6,4 +6,4 @@ import type { ContentModelFormatContainerFormat, IStandaloneEditor } from 'roost
6
6
  * @param editor The editor object to toggle BLOCKQUOTE onto
7
7
  * @param quoteFormat @optional Block format for the new quote object
8
8
  */
9
- export default function toggleBlockQuote(editor: IStandaloneEditor, quoteFormat?: ContentModelFormatContainerFormat, quoteFormatRtl?: ContentModelFormatContainerFormat): void;
9
+ export default function toggleBlockQuote(editor: IEditor, quoteFormat?: ContentModelFormatContainerFormat, quoteFormatRtl?: ContentModelFormatContainerFormat): void;
@@ -1 +1 @@
1
- {"version":3,"file":"toggleBlockQuote.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/toggleBlockQuote.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AAMnF,IAAM,qBAAqB,GAAsC;IAC7D,UAAU,EAAE,8BAA8B;IAC1C,SAAS,EAAE,oBAAoB;CAClC,CAAC;AACF,IAAM,qBAAqB,GAAsC;IAC7D,WAAW,EAAE,8BAA8B;IAC3C,SAAS,EAAE,oBAAoB;CAClC,CAAC;AACF,IAAM,kBAAkB,GAAsC;IAC1D,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,MAAM;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,SAAwB,gBAAgB,CACpC,MAAyB,EACzB,WAA+C,EAC/C,cAAkD;;IAElD,IAAM,kBAAkB,yEACjB,kBAAkB,KACrB,WAAW,EAAE,MAAM,KAChB,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,qBAAqB,CAAC,CAC5C,CAAC;IACF,IAAM,kBAAkB,yEACjB,kBAAkB,KACrB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,KAAK,KACb,CAAC,MAAA,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,WAAW,mCAAI,qBAAqB,CAAC,CAC9D,CAAC;IAEF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAEtC,OAAO,IAAA,6CAAqB,EAAC,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;IAChF,CAAC,EACD;QACI,OAAO,EAAE,kBAAkB;KAC9B,CACJ,CAAC;AACN,CAAC;AA7BD,mCA6BC","sourcesContent":["import { toggleModelBlockQuote } from '../../modelApi/block/toggleModelBlockQuote';\nimport type {\n ContentModelFormatContainerFormat,\n IStandaloneEditor,\n} from 'roosterjs-content-model-types';\n\nconst DefaultQuoteFormatLtr: ContentModelFormatContainerFormat = {\n borderLeft: '3px solid rgb(200, 200, 200)',\n textColor: 'rgb(102, 102, 102)',\n};\nconst DefaultQuoteFormatRtl: ContentModelFormatContainerFormat = {\n borderRight: '3px solid rgb(200, 200, 200)',\n textColor: 'rgb(102, 102, 102)',\n};\nconst BuildInQuoteFormat: ContentModelFormatContainerFormat = {\n marginTop: '1em',\n marginBottom: '1em',\n marginLeft: '40px',\n marginRight: '40px',\n};\n\n/**\n * Toggle BLOCKQUOTE state of selected paragraphs.\n * If any selected paragraph is not under a BLOCKQUOTE, wrap them into a BLOCKQUOTE.\n * Otherwise, unwrap all related BLOCKQUOTEs.\n * @param editor The editor object to toggle BLOCKQUOTE onto\n * @param quoteFormat @optional Block format for the new quote object\n */\nexport default function toggleBlockQuote(\n editor: IStandaloneEditor,\n quoteFormat?: ContentModelFormatContainerFormat,\n quoteFormatRtl?: ContentModelFormatContainerFormat\n) {\n const fullQuoteFormatLtr: ContentModelFormatContainerFormat = {\n ...BuildInQuoteFormat,\n paddingLeft: '10px',\n ...(quoteFormat ?? DefaultQuoteFormatLtr),\n };\n const fullQuoteFormatRtl: ContentModelFormatContainerFormat = {\n ...BuildInQuoteFormat,\n paddingRight: '10px',\n direction: 'rtl',\n ...(quoteFormatRtl ?? quoteFormat ?? DefaultQuoteFormatRtl),\n };\n\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n context.newPendingFormat = 'preserve';\n\n return toggleModelBlockQuote(model, fullQuoteFormatLtr, fullQuoteFormatRtl);\n },\n {\n apiName: 'toggleBlockQuote',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"toggleBlockQuote.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/block/toggleBlockQuote.ts"],"names":[],"mappings":";;;AAAA,oFAAmF;AAGnF,IAAM,qBAAqB,GAAsC;IAC7D,UAAU,EAAE,8BAA8B;IAC1C,SAAS,EAAE,oBAAoB;CAClC,CAAC;AACF,IAAM,qBAAqB,GAAsC;IAC7D,WAAW,EAAE,8BAA8B;IAC3C,SAAS,EAAE,oBAAoB;CAClC,CAAC;AACF,IAAM,kBAAkB,GAAsC;IAC1D,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,MAAM;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,SAAwB,gBAAgB,CACpC,MAAe,EACf,WAA+C,EAC/C,cAAkD;;IAElD,IAAM,kBAAkB,yEACjB,kBAAkB,KACrB,WAAW,EAAE,MAAM,KAChB,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,qBAAqB,CAAC,CAC5C,CAAC;IACF,IAAM,kBAAkB,yEACjB,kBAAkB,KACrB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,KAAK,KACb,CAAC,MAAA,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,WAAW,mCAAI,qBAAqB,CAAC,CAC9D,CAAC;IAEF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAEtC,OAAO,IAAA,6CAAqB,EAAC,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;IAChF,CAAC,EACD;QACI,OAAO,EAAE,kBAAkB;KAC9B,CACJ,CAAC;AACN,CAAC;AA7BD,mCA6BC","sourcesContent":["import { toggleModelBlockQuote } from '../../modelApi/block/toggleModelBlockQuote';\nimport type { ContentModelFormatContainerFormat, IEditor } from 'roosterjs-content-model-types';\n\nconst DefaultQuoteFormatLtr: ContentModelFormatContainerFormat = {\n borderLeft: '3px solid rgb(200, 200, 200)',\n textColor: 'rgb(102, 102, 102)',\n};\nconst DefaultQuoteFormatRtl: ContentModelFormatContainerFormat = {\n borderRight: '3px solid rgb(200, 200, 200)',\n textColor: 'rgb(102, 102, 102)',\n};\nconst BuildInQuoteFormat: ContentModelFormatContainerFormat = {\n marginTop: '1em',\n marginBottom: '1em',\n marginLeft: '40px',\n marginRight: '40px',\n};\n\n/**\n * Toggle BLOCKQUOTE state of selected paragraphs.\n * If any selected paragraph is not under a BLOCKQUOTE, wrap them into a BLOCKQUOTE.\n * Otherwise, unwrap all related BLOCKQUOTEs.\n * @param editor The editor object to toggle BLOCKQUOTE onto\n * @param quoteFormat @optional Block format for the new quote object\n */\nexport default function toggleBlockQuote(\n editor: IEditor,\n quoteFormat?: ContentModelFormatContainerFormat,\n quoteFormatRtl?: ContentModelFormatContainerFormat\n) {\n const fullQuoteFormatLtr: ContentModelFormatContainerFormat = {\n ...BuildInQuoteFormat,\n paddingLeft: '10px',\n ...(quoteFormat ?? DefaultQuoteFormatLtr),\n };\n const fullQuoteFormatRtl: ContentModelFormatContainerFormat = {\n ...BuildInQuoteFormat,\n paddingRight: '10px',\n direction: 'rtl',\n ...(quoteFormatRtl ?? quoteFormat ?? DefaultQuoteFormatRtl),\n };\n\n editor.focus();\n\n editor.formatContentModel(\n (model, context) => {\n context.newPendingFormat = 'preserve';\n\n return toggleModelBlockQuote(model, fullQuoteFormatLtr, fullQuoteFormatRtl);\n },\n {\n apiName: 'toggleBlockQuote',\n }\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { ContentModelEntity, DOMSelection, InsertEntityPosition, InsertEntityOptions, IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { ContentModelEntity, DOMSelection, InsertEntityPosition, InsertEntityOptions, IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Insert an entity into editor
4
- * @param editor The Content Model editor
4
+ * @param editor The editor object
5
5
  * @param type Type of entity
6
6
  * @param isBlock True to insert a block entity, false to insert an inline entity
7
7
  * @param position Position of the entity to insert. It can be
@@ -10,10 +10,10 @@ import type { ContentModelEntity, DOMSelection, InsertEntityPosition, InsertEnti
10
10
  * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)
11
11
  * @param options Move options to insert. See InsertEntityOptions
12
12
  */
13
- export default function insertEntity(editor: IStandaloneEditor, type: string, isBlock: boolean, position: 'focus' | 'begin' | 'end' | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
13
+ export default function insertEntity(editor: IEditor, type: string, isBlock: boolean, position: 'focus' | 'begin' | 'end' | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
14
14
  /**
15
15
  * Insert a block entity into editor
16
- * @param editor The Content Model editor
16
+ * @param editor The editor object
17
17
  * @param type Type of entity
18
18
  * @param isBlock Must be true for a block entity
19
19
  * @param position Position of the entity to insert. It can be
@@ -22,4 +22,4 @@ export default function insertEntity(editor: IStandaloneEditor, type: string, is
22
22
  * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)
23
23
  * @param options Move options to insert. See InsertEntityOptions
24
24
  */
25
- export default function insertEntity(editor: IStandaloneEditor, type: string, isBlock: true, position: InsertEntityPosition | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
25
+ export default function insertEntity(editor: IEditor, type: string, isBlock: true, position: InsertEntityPosition | DOMSelection, options?: InsertEntityOptions): ContentModelEntity | null;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
4
- var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
5
4
  var insertEntityModel_1 = require("../../modelApi/entity/insertEntityModel");
5
+ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
6
6
  var BlockEntityTag = 'div';
7
7
  var InlineEntityTag = 'span';
8
8
  function insertEntity(editor, type, isBlock, position, options) {
9
- var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot;
9
+ var _a = options || {}, contentNode = _a.contentNode, focusAfterEntity = _a.focusAfterEntity, wrapperDisplay = _a.wrapperDisplay, skipUndoSnapshot = _a.skipUndoSnapshot, initialEntityState = _a.initialEntityState;
10
10
  var document = editor.getDocument();
11
11
  var wrapper = document.createElement(isBlock ? BlockEntityTag : InlineEntityTag);
12
12
  var display = wrapperDisplay !== null && wrapperDisplay !== void 0 ? wrapperDisplay : (isBlock ? undefined : 'inline-block');
@@ -19,10 +19,13 @@ function insertEntity(editor, type, isBlock, position, options) {
19
19
  wrapper.appendChild(contentNode);
20
20
  }
21
21
  var entityModel = (0, roosterjs_content_model_dom_1.createEntity)(wrapper, true /* isReadonly */, undefined /*format*/, type);
22
+ if (!skipUndoSnapshot) {
23
+ editor.takeSnapshot();
24
+ }
22
25
  editor.formatContentModel(function (model, context) {
23
26
  (0, insertEntityModel_1.insertEntityModel)(model, entityModel, typeof position == 'string' ? position : 'focus', isBlock, focusAfterEntity, context);
24
27
  (0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
25
- context.skipUndoSnapshot = skipUndoSnapshot;
28
+ context.skipUndoSnapshot = true;
26
29
  context.newEntities.push(entityModel);
27
30
  return true;
28
31
  }, {
@@ -36,6 +39,22 @@ function insertEntity(editor, type, isBlock, position, options) {
36
39
  }); },
37
40
  apiName: 'insertEntity',
38
41
  });
42
+ if (!skipUndoSnapshot) {
43
+ var entityState = void 0;
44
+ if (initialEntityState) {
45
+ var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(wrapper);
46
+ var id = format.id, entityType = format.entityType;
47
+ entityState =
48
+ id && entityType
49
+ ? {
50
+ id: id,
51
+ type: entityType,
52
+ state: initialEntityState,
53
+ }
54
+ : undefined;
55
+ }
56
+ editor.takeSnapshot(entityState);
57
+ }
39
58
  return entityModel;
40
59
  }
41
60
  exports.default = insertEntity;
@@ -1 +1 @@
1
- {"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/entity/insertEntity.ts"],"names":[],"mappings":";;AAAA,6EAA4D;AAC5D,2EAAkF;AAClF,6EAA4E;AAS5E,IAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,IAAM,eAAe,GAAG,MAAM,CAAC;AAwC/B,SAAwB,YAAY,CAChC,MAAyB,EACzB,IAAY,EACZ,OAAgB,EAChB,QAA8C,EAC9C,OAA6B;IAEvB,IAAA,KAAsE,OAAO,IAAI,EAAE,EAAjF,WAAW,iBAAA,EAAE,gBAAgB,sBAAA,EAAE,cAAc,oBAAA,EAAE,gBAAgB,sBAAkB,CAAC;IAC1F,IAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACtC,IAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,O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YAAY;QACvC,aAAa,EAAE,cAAM,OAAA,CAAC;YAClB,OAAO,SAAA;YACP,IAAI,MAAA;YACJ,EAAE,EAAE,EAAE;YACN,UAAU,EAAE,IAAI;SACnB,CAAC,EALmB,CAKnB;QACF,OAAO,EAAE,cAAc;KAC1B,CACJ,CAAC;IAEF,OAAO,WAAW,CAAC;AACvB,CAAC;AAzDD,+BAyDC","sourcesContent":["import { ChangeSource } from 'roosterjs-content-model-core';\nimport { createEntity, normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { insertEntityModel } from '../../modelApi/entity/insertEntityModel';\nimport type {\n ContentModelEntity,\n DOMSelection,\n InsertEntityPosition,\n InsertEntityOptions,\n IStandaloneEditor,\n} from 'roosterjs-content-model-types';\n\nconst BlockEntityTag = 'div';\nconst InlineEntityTag = 'span';\n\n/**\n * Insert an entity into editor\n * @param editor The Content Model editor\n * @param type Type of entity\n * @param isBlock True to insert a block entity, false to insert an inline entity\n * @param position Position of the entity to insert. It can be\n * Value of InsertEntityPosition: see InsertEntityPosition\n * selectionRangeEx: Use this range instead of current focus position to insert. After insert, focus will be moved to\n * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)\n * @param options Move options to insert. See InsertEntityOptions\n */\nexport default function insertEntity(\n editor: IStandaloneEditor,\n type: string,\n isBlock: boolean,\n position: 'focus' | 'begin' | 'end' | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\n/**\n * Insert a block entity into editor\n * @param editor The Content Model editor\n * @param type Type of entity\n * @param isBlock Must be true for a block entity\n * @param position Position of the entity to insert. It can be\n * Value of InsertEntityPosition: see InsertEntityPosition\n * selectionRangeEx: Use this range instead of current focus position to insert. After insert, focus will be moved to\n * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)\n * @param options Move options to insert. See InsertEntityOptions\n */\nexport default function insertEntity(\n editor: IStandaloneEditor,\n type: string,\n isBlock: true,\n position: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\nexport default function insertEntity(\n editor: IStandaloneEditor,\n type: string,\n isBlock: boolean,\n position?: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null {\n const { contentNode, focusAfterEntity, wrapperDisplay, skipUndoSnapshot } = options || {};\n const document = editor.getDocument();\n const wrapper = document.createElement(isBlock ? BlockEntityTag : InlineEntityTag);\n const display = wrapperDisplay ?? (isBlock ? undefined : 'inline-block');\n\n wrapper.style.setProperty('display', display || null);\n\n if (display == undefined && isBlock) {\n wrapper.style.setProperty('width', '100%');\n wrapper.style.setProperty('display', 'inline-block');\n }\n\n if (contentNode) {\n wrapper.appendChild(contentNode);\n }\n\n const entityModel = createEntity(wrapper, true /* isReadonly */, undefined /*format*/, type);\n\n editor.formatContentModel(\n (model, context) => {\n insertEntityModel(\n model,\n entityModel,\n typeof position == 'string' ? position : 'focus',\n isBlock,\n focusAfterEntity,\n context\n );\n\n normalizeContentModel(model);\n\n context.skipUndoSnapshot = skipUndoSnapshot;\n context.newEntities.push(entityModel);\n\n return true;\n },\n {\n selectionOverride: typeof position === 'object' ? position : undefined,\n changeSource: ChangeSource.InsertEntity,\n getChangeData: () => ({\n wrapper,\n type,\n id: '',\n isReadonly: true,\n }),\n apiName: 'insertEntity',\n }\n );\n\n return entityModel;\n}\n"]}
1
+ {"version":3,"file":"insertEntity.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/entity/insertEntity.ts"],"names":[],"mappings":";;AAAA,6EAA4D;AAC5D,6EAA4E;AAC5E,2EAIqC;AAUrC,IAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,IAAM,eAAe,GAAG,MAAM,CAAC;AAwC/B,SAAwB,YAAY,CAChC,MAAe,EACf,IAAY,EACZ,OAAgB,EAChB,QAA8C,EAC9C,OAA6B;IAEvB,IAAA,KACF,OAAO,IAAI,EAAE,EADT,WAAW,iBAAA,EAAE,gBAAgB,sBA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B,GAAG,IAAI,CAAC;QAChC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IAChB,CAAC,EACD;QACI,iBAAiB,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACtE,YAAY,EAAE,2CAAY,CAAC,YAAY;QACvC,aAAa,EAAE,cAAM,OAAA,CAAC;YAClB,OAAO,SAAA;YACP,IAAI,MAAA;YACJ,EAAE,EAAE,EAAE;YACN,UAAU,EAAE,IAAI;SACnB,CAAC,EALmB,CAKnB;QACF,OAAO,EAAE,cAAc;KAC1B,CACJ,CAAC;IAEF,IAAI,CAAC,gBAAgB,EAAE;QACnB,IAAI,WAAW,SAAyB,CAAC;QAEzC,IAAI,kBAAkB,EAAE;YACpB,IAAM,MAAM,GAAG,IAAA,+CAAiB,EAAC,OAAO,CAAC,CAAC;YAClC,IAAA,EAAE,GAAiB,MAAM,GAAvB,EAAE,UAAU,GAAK,MAAM,WAAX,CAAY;YAElC,WAAW;gBACP,EAAE,IAAI,UAAU;oBACZ,CAAC,CAAC;wBACI,EAAE,EAAE,EAAE;wBACN,IAAI,EAAE,UAAU;wBAChB,KAAK,EAAE,kBAAkB;qBAC5B;oBACH,CAAC,CAAC,SAAS,CAAC;SACvB;QAED,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;KACpC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC;AAlFD,+BAkFC","sourcesContent":["import { ChangeSource } from 'roosterjs-content-model-core';\nimport { insertEntityModel } from '../../modelApi/entity/insertEntityModel';\nimport {\n createEntity,\n normalizeContentModel,\n parseEntityFormat,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelEntity,\n DOMSelection,\n InsertEntityPosition,\n InsertEntityOptions,\n IEditor,\n EntityState,\n} from 'roosterjs-content-model-types';\n\nconst BlockEntityTag = 'div';\nconst InlineEntityTag = 'span';\n\n/**\n * Insert an entity into editor\n * @param editor The editor object\n * @param type Type of entity\n * @param isBlock True to insert a block entity, false to insert an inline entity\n * @param position Position of the entity to insert. It can be\n * Value of InsertEntityPosition: see InsertEntityPosition\n * selectionRangeEx: Use this range instead of current focus position to insert. After insert, focus will be moved to\n * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)\n * @param options Move options to insert. See InsertEntityOptions\n */\nexport default function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: boolean,\n position: 'focus' | 'begin' | 'end' | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\n/**\n * Insert a block entity into editor\n * @param editor The editor object\n * @param type Type of entity\n * @param isBlock Must be true for a block entity\n * @param position Position of the entity to insert. It can be\n * Value of InsertEntityPosition: see InsertEntityPosition\n * selectionRangeEx: Use this range instead of current focus position to insert. After insert, focus will be moved to\n * the beginning of this range (when focusAfterEntity is not set to true) or after the new entity (when focusAfterEntity is set to true)\n * @param options Move options to insert. See InsertEntityOptions\n */\nexport default function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: true,\n position: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null;\n\nexport default function insertEntity(\n editor: IEditor,\n type: string,\n isBlock: boolean,\n position?: InsertEntityPosition | DOMSelection,\n options?: InsertEntityOptions\n): ContentModelEntity | null {\n const { contentNode, focusAfterEntity, wrapperDisplay, skipUndoSnapshot, initialEntityState } =\n options || {};\n const document = editor.getDocument();\n const wrapper = document.createElement(isBlock ? BlockEntityTag : InlineEntityTag);\n const display = wrapperDisplay ?? (isBlock ? undefined : 'inline-block');\n\n wrapper.style.setProperty('display', display || null);\n\n if (display == undefined && isBlock) {\n wrapper.style.setProperty('width', '100%');\n wrapper.style.setProperty('display', 'inline-block');\n }\n\n if (contentNode) {\n wrapper.appendChild(contentNode);\n }\n\n const entityModel = createEntity(wrapper, true /* isReadonly */, undefined /*format*/, type);\n\n if (!skipUndoSnapshot) {\n editor.takeSnapshot();\n }\n\n editor.formatContentModel(\n (model, context) => {\n insertEntityModel(\n model,\n entityModel,\n typeof position == 'string' ? position : 'focus',\n isBlock,\n focusAfterEntity,\n context\n );\n\n normalizeContentModel(model);\n\n context.skipUndoSnapshot = true;\n context.newEntities.push(entityModel);\n\n return true;\n },\n {\n selectionOverride: typeof position === 'object' ? position : undefined,\n changeSource: ChangeSource.InsertEntity,\n getChangeData: () => ({\n wrapper,\n type,\n id: '',\n isReadonly: true,\n }),\n apiName: 'insertEntity',\n }\n );\n\n if (!skipUndoSnapshot) {\n let entityState: EntityState | undefined;\n\n if (initialEntityState) {\n const format = parseEntityFormat(wrapper);\n const { id, entityType } = format;\n\n entityState =\n id && entityType\n ? {\n id: id,\n type: entityType,\n state: initialEntityState,\n }\n : undefined;\n }\n\n editor.takeSnapshot(entityState);\n }\n\n return entityModel;\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Clear format of selection
4
4
  * @param editor The editor to clear format from
5
5
  */
6
- export default function clearFormat(editor: IStandaloneEditor): void;
6
+ export default function clearFormat(editor: IEditor): void;
@@ -1 +1 @@
1
- {"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/clearFormat.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAC1E,2EAAoE;AASpE;;;GAGG;AACH,SAAwB,WAAW,CAAC,MAAyB;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,IAAM,aAAa,GAAoD,EAAE,CAAC;QAC1E,IAAM,eAAe,GAA0B,EAAE,CAAC;QAClD,IAAM,aAAa,GAAmC,EAAE,CAAC;QAEzD,IAAA,mCAAgB,EAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;QAEvE,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,CACH,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CACrF,CAAC;IACN,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC;AArBD,8BAqBC","sourcesContent":["import { clearModelFormat } from '../../modelApi/common/clearModelFormat';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport type {\n IStandaloneEditor,\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelSegment,\n ContentModelTable,\n} from 'roosterjs-content-model-types';\n\n/**\n * Clear format of selection\n * @param editor The editor to clear format from\n */\nexport default function clearFormat(editor: IStandaloneEditor) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const blocksToClear: [ContentModelBlockGroup[], ContentModelBlock][] = [];\n const segmentsToClear: ContentModelSegment[] = [];\n const tablesToClear: [ContentModelTable, boolean][] = [];\n\n clearModelFormat(model, blocksToClear, segmentsToClear, tablesToClear);\n\n normalizeContentModel(model);\n\n return (\n blocksToClear.length > 0 || segmentsToClear.length > 0 || tablesToClear.length > 0\n );\n },\n {\n apiName: 'clearFormat',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"clearFormat.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/clearFormat.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAC1E,2EAAoE;AASpE;;;GAGG;AACH,SAAwB,WAAW,CAAC,MAAe;IAC/C,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,IAAM,aAAa,GAAoD,EAAE,CAAC;QAC1E,IAAM,eAAe,GAA0B,EAAE,CAAC;QAClD,IAAM,aAAa,GAAmC,EAAE,CAAC;QAEzD,IAAA,mCAAgB,EAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;QAEvE,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,CACH,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CACrF,CAAC;IACN,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC;AArBD,8BAqBC","sourcesContent":["import { clearModelFormat } from '../../modelApi/common/clearModelFormat';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport type {\n IEditor,\n ContentModelBlock,\n ContentModelBlockGroup,\n ContentModelSegment,\n ContentModelTable,\n} from 'roosterjs-content-model-types';\n\n/**\n * Clear format of selection\n * @param editor The editor to clear format from\n */\nexport default function clearFormat(editor: IEditor) {\n editor.focus();\n\n editor.formatContentModel(\n model => {\n const blocksToClear: [ContentModelBlockGroup[], ContentModelBlock][] = [];\n const segmentsToClear: ContentModelSegment[] = [];\n const tablesToClear: [ContentModelTable, boolean][] = [];\n\n clearModelFormat(model, blocksToClear, segmentsToClear, tablesToClear);\n\n normalizeContentModel(model);\n\n return (\n blocksToClear.length > 0 || segmentsToClear.length > 0 || tablesToClear.length > 0\n );\n },\n {\n apiName: 'clearFormat',\n }\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor, ContentModelFormatState } from 'roosterjs-content-model-types';
1
+ import type { IEditor, ContentModelFormatState } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Get current format state
4
4
  * @param editor The editor to get format from
5
5
  */
6
- export default function getFormatState(editor: IStandaloneEditor): ContentModelFormatState;
6
+ export default function getFormatState(editor: IEditor): ContentModelFormatState;
@@ -1 +1 @@
1
- {"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts"],"names":[],"mappings":";;AAAA,6EAAwE;AAGxE;;;GAGG;AACH,SAAwB,cAAc,CAAC,MAAyB;IAC5D,IAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAChD,IAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACpD,IAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC7C,IAAM,MAAM,GAA4B;QACpC,OAAO,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;KAClC,CAAC;IAEF,IAAA,uDAAwB,EAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAClB,CAAC;AAbD,iCAaC","sourcesContent":["import { retrieveModelFormatState } from 'roosterjs-content-model-core';\nimport type { IStandaloneEditor, ContentModelFormatState } from 'roosterjs-content-model-types';\n\n/**\n * Get current format state\n * @param editor The editor to get format from\n */\nexport default function getFormatState(editor: IStandaloneEditor): ContentModelFormatState {\n const pendingFormat = editor.getPendingFormat();\n const model = editor.getContentModelCopy('reduced');\n const manager = editor.getSnapshotsManager();\n const result: ContentModelFormatState = {\n canUndo: manager.hasNewContent || manager.canMove(-1),\n canRedo: manager.canMove(1),\n isDarkMode: editor.isDarkMode(),\n };\n\n retrieveModelFormatState(model, pendingFormat, result);\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"getFormatState.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts"],"names":[],"mappings":";;AAAA,6EAAwE;AAGxE;;;GAGG;AACH,SAAwB,cAAc,CAAC,MAAe;IAClD,IAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAChD,IAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACpD,IAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC7C,IAAM,MAAM,GAA4B;QACpC,OAAO,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;KAClC,CAAC;IAEF,IAAA,uDAAwB,EAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAClB,CAAC;AAbD,iCAaC","sourcesContent":["import { retrieveModelFormatState } from 'roosterjs-content-model-core';\nimport type { IEditor, ContentModelFormatState } from 'roosterjs-content-model-types';\n\n/**\n * Get current format state\n * @param editor The editor to get format from\n */\nexport default function getFormatState(editor: IEditor): ContentModelFormatState {\n const pendingFormat = editor.getPendingFormat();\n const model = editor.getContentModelCopy('reduced');\n const manager = editor.getSnapshotsManager();\n const result: ContentModelFormatState = {\n canUndo: manager.hasNewContent || manager.canMove(-1),\n canRedo: manager.canMove(1),\n isDarkMode: editor.isDarkMode(),\n };\n\n retrieveModelFormatState(model, pendingFormat, result);\n\n return result;\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Adjust selection to make sure select an image if any
4
4
  * @return Content Model Image object if an image is select, or null
5
5
  */
6
- export default function adjustImageSelection(editor: IStandaloneEditor): ContentModelImage | null;
6
+ export default function adjustImageSelection(editor: IEditor): ContentModelImage | null;
@@ -1 +1 @@
1
- {"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/adjustImageSelection.ts"],"names":[],"mappings":";;AAAA,0FAAyF;AAGzF;;;GAGG;AACH,SAAwB,oBAAoB,CAAC,MAAyB;IAClE,IAAI,KAAK,GAA6B,IAAI,CAAC;IAE3C,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,OAAA,IAAA,+CAAsB,EAClB,KAAK,EACL,UAAA,MAAM;YACF,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,WAAW,IAAI,OAAO,EAAE;gBACpD,KAAK,GAAG,MAAM,CAAC;gBACf,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,MAAM,IAAI,GAAG,EAAb,CAAa,CACjC;IAXD,CAWC,EACL;QACI,OAAO,EAAE,sBAAsB;KAClC,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC;AACjB,CAAC;AAvBD,uCAuBC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Adjust selection to make sure select an image if any\n * @return Content Model Image object if an image is select, or null\n */\nexport default function adjustImageSelection(editor: IStandaloneEditor): ContentModelImage | null {\n let image: ContentModelImage | null = null;\n\n editor.formatContentModel(\n model =>\n adjustSegmentSelection(\n model,\n target => {\n if (target.isSelected && target.segmentType == 'Image') {\n image = target;\n return true;\n } else {\n return false;\n }\n },\n (target, ref) => target == ref\n ),\n {\n apiName: 'adjustImageSelection',\n }\n );\n\n return image;\n}\n"]}
1
+ {"version":3,"file":"adjustImageSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/adjustImageSelection.ts"],"names":[],"mappings":";;AAAA,0FAAyF;AAGzF;;;GAGG;AACH,SAAwB,oBAAoB,CAAC,MAAe;IACxD,IAAI,KAAK,GAA6B,IAAI,CAAC;IAE3C,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;QACD,OAAA,IAAA,+CAAsB,EAClB,KAAK,EACL,UAAA,MAAM;YACF,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,WAAW,IAAI,OAAO,EAAE;gBACpD,KAAK,GAAG,MAAM,CAAC;gBACf,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,EACD,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,MAAM,IAAI,GAAG,EAAb,CAAa,CACjC;IAXD,CAWC,EACL;QACI,OAAO,EAAE,sBAAsB;KAClC,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC;AACjB,CAAC;AAvBD,uCAuBC","sourcesContent":["import { adjustSegmentSelection } from '../../modelApi/selection/adjustSegmentSelection';\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Adjust selection to make sure select an image if any\n * @return Content Model Image object if an image is select, or null\n */\nexport default function adjustImageSelection(editor: IEditor): ContentModelImage | null {\n let image: ContentModelImage | null = null;\n\n editor.formatContentModel(\n model =>\n adjustSegmentSelection(\n model,\n target => {\n if (target.isSelected && target.segmentType == 'Image') {\n image = target;\n return true;\n } else {\n return false;\n }\n },\n (target, ref) => target == ref\n ),\n {\n apiName: 'adjustImageSelection',\n }\n );\n\n return image;\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Change the selected image src
4
4
  * @param editor The editor instance
5
5
  * @param file The image file
6
6
  */
7
- export default function changeImage(editor: IStandaloneEditor, file: File): void;
7
+ export default function changeImage(editor: IEditor, file: File): void;
@@ -1 +1 @@
1
- {"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAC/E,6EAA6E;AAG7E;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAyB,EAAE,IAAU;IACrE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3C,IAAA,uCAAQ,EAAC,IAAI,EAAE,UAAA,OAAO;QAClB,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,OAAO,EAAE;YAChE,IAAA,qCAA2B,EAAC,MAAM,EAAE,aAAa,EAAE,UAAC,KAAwB;;gBACxE,IAAM,WAAW,GAAG,MAAA,MAAA,IAAA,kDAAmB,EAAC,KAAK,CAAC,0CAAE,GAAG,mCAAI,EAAE,CAAC;gBAC1D,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC;gBAE9B,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;gBACpB,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;gBACnB,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;gBACxB,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;gBACzB,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;gBAEf,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE;oBAC7B,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,WAAW,aAAA;oBACX,MAAM,EAAE,OAAO;oBACf,WAAW,aAAA;iBACd,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAzBD,8BAyBC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport { readFile, updateImageMetadata } from 'roosterjs-content-model-core';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Change the selected image src\n * @param editor The editor instance\n * @param file The image file\n */\nexport default function changeImage(editor: IStandaloneEditor, file: File) {\n editor.focus();\n\n const selection = editor.getDOMSelection();\n readFile(file, dataUrl => {\n if (dataUrl && !editor.isDisposed() && selection?.type === 'image') {\n formatImageWithContentModel(editor, 'changeImage', (image: ContentModelImage) => {\n const originalSrc = updateImageMetadata(image)?.src ?? '';\n const previousSrc = image.src;\n\n image.src = dataUrl;\n image.dataset = {};\n image.format.width = '';\n image.format.height = '';\n image.alt = '';\n\n editor.triggerEvent('editImage', {\n image: selection.image,\n previousSrc,\n newSrc: dataUrl,\n originalSrc,\n });\n });\n }\n });\n}\n"]}
1
+ {"version":3,"file":"changeImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAC/E,6EAA6E;AAG7E;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAe,EAAE,IAAU;IAC3D,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3C,IAAA,uCAAQ,EAAC,IAAI,EAAE,UAAA,OAAO;QAClB,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,OAAO,EAAE;YAChE,IAAA,qCAA2B,EAAC,MAAM,EAAE,aAAa,EAAE,UAAC,KAAwB;;gBACxE,IAAM,WAAW,GAAG,MAAA,MAAA,IAAA,kDAAmB,EAAC,KAAK,CAAC,0CAAE,GAAG,mCAAI,EAAE,CAAC;gBAC1D,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC;gBAE9B,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;gBACpB,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;gBACnB,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;gBACxB,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;gBACzB,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;gBAEf,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE;oBAC7B,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,WAAW,aAAA;oBACX,MAAM,EAAE,OAAO;oBACf,WAAW,aAAA;iBACd,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAzBD,8BAyBC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport { readFile, updateImageMetadata } from 'roosterjs-content-model-core';\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Change the selected image src\n * @param editor The editor instance\n * @param file The image file\n */\nexport default function changeImage(editor: IEditor, file: File) {\n editor.focus();\n\n const selection = editor.getDOMSelection();\n readFile(file, dataUrl => {\n if (dataUrl && !editor.isDisposed() && selection?.type === 'image') {\n formatImageWithContentModel(editor, 'changeImage', (image: ContentModelImage) => {\n const originalSrc = updateImageMetadata(image)?.src ?? '';\n const previousSrc = image.src;\n\n image.src = dataUrl;\n image.dataset = {};\n image.format.width = '';\n image.format.height = '';\n image.alt = '';\n\n editor.triggerEvent('editImage', {\n image: selection.image,\n previousSrc,\n newSrc: dataUrl,\n originalSrc,\n });\n });\n }\n });\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Insert an image into current selected position
4
4
  * @param editor The editor to operate on
5
5
  * @param file Image Blob file or source string
6
6
  */
7
- export default function insertImage(editor: IStandaloneEditor, imageFileOrSrc: File | string): void;
7
+ export default function insertImage(editor: IEditor, imageFileOrSrc: File | string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/insertImage.ts"],"names":[],"mappings":";;AAAA,2EAAkG;AAClG,6EAAoE;AAGpE;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAyB,EAAE,cAA6B;IACxF,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAI,OAAO,cAAc,IAAI,QAAQ,EAAE;QACnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;KAC9C;SAAM;QACH,IAAA,uCAAQ,EAAC,cAAc,EAAE,UAAA,OAAO;YAC5B,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE;gBACjC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;aACvC;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC;AAZD,8BAYC;AAED,SAAS,kBAAkB,CAAC,MAAyB,EAAE,GAAW;IAC9D,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,IAAM,KAAK,GAAG,IAAA,yCAAW,EAAC,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,IAAM,GAAG,GAAG,IAAA,wDAA0B,GAAE,CAAC;QAEzC,IAAA,wCAAU,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,IAAA,yCAAU,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;YAC5B,WAAW,EAAE,UAAU;SAC1B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import { addSegment, createContentModelDocument, createImage } from 'roosterjs-content-model-dom';\nimport { mergeModel, readFile } from 'roosterjs-content-model-core';\nimport type { IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Insert an image into current selected position\n * @param editor The editor to operate on\n * @param file Image Blob file or source string\n */\nexport default function insertImage(editor: IStandaloneEditor, imageFileOrSrc: File | string) {\n editor.focus();\n\n if (typeof imageFileOrSrc == 'string') {\n insertImageWithSrc(editor, imageFileOrSrc);\n } else {\n readFile(imageFileOrSrc, dataUrl => {\n if (dataUrl && !editor.isDisposed()) {\n insertImageWithSrc(editor, dataUrl);\n }\n });\n }\n}\n\nfunction insertImageWithSrc(editor: IStandaloneEditor, src: string) {\n editor.formatContentModel(\n (model, context) => {\n const image = createImage(src, { backgroundColor: '' });\n const doc = createContentModelDocument();\n\n addSegment(doc, image);\n mergeModel(model, doc, context, {\n mergeFormat: 'mergeAll',\n });\n\n return true;\n },\n {\n apiName: 'insertImage',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"insertImage.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/insertImage.ts"],"names":[],"mappings":";;AAAA,2EAAkG;AAClG,6EAAoE;AAGpE;;;;GAIG;AACH,SAAwB,WAAW,CAAC,MAAe,EAAE,cAA6B;IAC9E,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAI,OAAO,cAAc,IAAI,QAAQ,EAAE;QACnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;KAC9C;SAAM;QACH,IAAA,uCAAQ,EAAC,cAAc,EAAE,UAAA,OAAO;YAC5B,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE;gBACjC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;aACvC;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC;AAZD,8BAYC;AAED,SAAS,kBAAkB,CAAC,MAAe,EAAE,GAAW;IACpD,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;QACX,IAAM,KAAK,GAAG,IAAA,yCAAW,EAAC,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,IAAM,GAAG,GAAG,IAAA,wDAA0B,GAAE,CAAC;QAEzC,IAAA,wCAAU,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,IAAA,yCAAU,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;YAC5B,WAAW,EAAE,UAAU;SAC1B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC,EACD;QACI,OAAO,EAAE,aAAa;KACzB,CACJ,CAAC;AACN,CAAC","sourcesContent":["import { addSegment, createContentModelDocument, createImage } from 'roosterjs-content-model-dom';\nimport { mergeModel, readFile } from 'roosterjs-content-model-core';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Insert an image into current selected position\n * @param editor The editor to operate on\n * @param file Image Blob file or source string\n */\nexport default function insertImage(editor: IEditor, imageFileOrSrc: File | string) {\n editor.focus();\n\n if (typeof imageFileOrSrc == 'string') {\n insertImageWithSrc(editor, imageFileOrSrc);\n } else {\n readFile(imageFileOrSrc, dataUrl => {\n if (dataUrl && !editor.isDisposed()) {\n insertImageWithSrc(editor, dataUrl);\n }\n });\n }\n}\n\nfunction insertImageWithSrc(editor: IEditor, src: string) {\n editor.formatContentModel(\n (model, context) => {\n const image = createImage(src, { backgroundColor: '' });\n const doc = createContentModelDocument();\n\n addSegment(doc, image);\n mergeModel(model, doc, context, {\n mergeFormat: 'mergeAll',\n });\n\n return true;\n },\n {\n apiName: 'insertImage',\n }\n );\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set image alt text for all selected images at selection. If no images is contained
4
4
  * in selection, do nothing.
5
5
  * @param editor The editor instance
6
6
  * @param altText The image alt text
7
7
  */
8
- export default function setImageAltText(editor: IStandaloneEditor, altText: string): void;
8
+ export default function setImageAltText(editor: IEditor, altText: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageAltText.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,eAAe,CAAC,MAAyB,EAAE,OAAe;IAC9E,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAC,KAAwB;QAC5E,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC;AAND,kCAMC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image alt text for all selected images at selection. If no images is contained\n * in selection, do nothing.\n * @param editor The editor instance\n * @param altText The image alt text\n */\nexport default function setImageAltText(editor: IStandaloneEditor, altText: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageAltText', (image: ContentModelImage) => {\n image.alt = altText;\n });\n}\n"]}
1
+ {"version":3,"file":"setImageAltText.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageAltText.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,eAAe,CAAC,MAAe,EAAE,OAAe;IACpE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAC,KAAwB;QAC5E,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC;AAND,kCAMC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image alt text for all selected images at selection. If no images is contained\n * in selection, do nothing.\n * @param editor The editor instance\n * @param altText The image alt text\n */\nexport default function setImageAltText(editor: IEditor, altText: string) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageAltText', (image: ContentModelImage) => {\n image.alt = altText;\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { Border, IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { Border, IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set image border style for all selected images at selection.
4
4
  * @param editor The editor instance
@@ -6,4 +6,4 @@ import type { Border, IStandaloneEditor } from 'roosterjs-content-model-types';
6
6
  * its value will not be changed. Passing null instead of an object will remove the border
7
7
  * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value
8
8
  */
9
- export default function setImageBorder(editor: IStandaloneEditor, border: Border | null, borderRadius?: string): void;
9
+ export default function setImageBorder(editor: IEditor, border: Border | null, borderRadius?: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;AAAA,sFAAiF;AACjF,oFAA+E;AAG/E;;;;;;GAMG;AACH,SAAwB,cAAc,CAClC,MAAyB,EACzB,MAAqB,EACrB,YAAqB;IAErB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;QAC3E,IAAA,gCAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAVD,iCAUC","sourcesContent":["import applyImageBorderFormat from '../../modelApi/image/applyImageBorderFormat';\nimport formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { Border, ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image border style for all selected images at selection.\n * @param editor The editor instance\n * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined\n * its value will not be changed. Passing null instead of an object will remove the border\n * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value\n */\nexport default function setImageBorder(\n editor: IStandaloneEditor,\n border: Border | null,\n borderRadius?: string\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\n applyImageBorderFormat(image, border, borderRadius);\n });\n}\n"]}
1
+ {"version":3,"file":"setImageBorder.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBorder.ts"],"names":[],"mappings":";;AAAA,sFAAiF;AACjF,oFAA+E;AAG/E;;;;;;GAMG;AACH,SAAwB,cAAc,CAClC,MAAe,EACf,MAAqB,EACrB,YAAqB;IAErB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAC,KAAwB;QAC3E,IAAA,gCAAsB,EAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAVD,iCAUC","sourcesContent":["import applyImageBorderFormat from '../../modelApi/image/applyImageBorderFormat';\nimport formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { Border, ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image border style for all selected images at selection.\n * @param editor The editor instance\n * @param border the border format object. Ex: { color: 'red', width: '10px', style: 'solid'}, if one of the value in object is undefined\n * its value will not be changed. Passing null instead of an object will remove the border\n * @param borderRadius the border radius value, if undefined, the border radius will keep the actual value\n */\nexport default function setImageBorder(\n editor: IEditor,\n border: Border | null,\n borderRadius?: string\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBorder', (image: ContentModelImage) => {\n applyImageBorderFormat(image, border, borderRadius);\n });\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Set image box shadow for all selected images at selection.
4
4
  * @param editor The editor instance
5
5
  * @param boxShadow The image box boxShadow
6
6
  * @param margin The image margin for all sides (eg. "4px"), null to remove margin
7
7
  */
8
- export default function setImageBoxShadow(editor: IStandaloneEditor, boxShadow: string, margin?: string | null): void;
8
+ export default function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,iBAAiB,CACrC,MAAyB,EACzB,SAAiB,EACjB,MAAsB;IAEtB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,mBAAmB,EAAE,UAAC,KAAwB;QAC9E,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;YACnC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;YAClC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;SACnC;aAAM,IAAI,MAAM,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;YAChC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AArBD,oCAqBC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image box shadow for all selected images at selection.\n * @param editor The editor instance\n * @param boxShadow The image box boxShadow\n * @param margin The image margin for all sides (eg. \"4px\"), null to remove margin\n */\nexport default function setImageBoxShadow(\n editor: IStandaloneEditor,\n boxShadow: string,\n margin?: string | null\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBoxShadow', (image: ContentModelImage) => {\n image.format.boxShadow = boxShadow;\n if (margin) {\n image.format.marginBottom = margin;\n image.format.marginLeft = margin;\n image.format.marginRight = margin;\n image.format.marginTop = margin;\n } else if (margin === null) {\n delete image.format.marginBottom;\n delete image.format.marginLeft;\n delete image.format.marginRight;\n delete image.format.marginTop;\n }\n });\n}\n"]}
1
+ {"version":3,"file":"setImageBoxShadow.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts"],"names":[],"mappings":";;AAAA,oFAA+E;AAG/E;;;;;GAKG;AACH,SAAwB,iBAAiB,CACrC,MAAe,EACf,SAAiB,EACjB,MAAsB;IAEtB,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,IAAA,qCAA2B,EAAC,MAAM,EAAE,mBAAmB,EAAE,UAAC,KAAwB;QAC9E,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;YACnC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;YAClC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;SACnC;aAAM,IAAI,MAAM,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;YAChC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AArBD,oCAqBC","sourcesContent":["import formatImageWithContentModel from '../utils/formatImageWithContentModel';\nimport type { ContentModelImage, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Set image box shadow for all selected images at selection.\n * @param editor The editor instance\n * @param boxShadow The image box boxShadow\n * @param margin The image margin for all sides (eg. \"4px\"), null to remove margin\n */\nexport default function setImageBoxShadow(\n editor: IEditor,\n boxShadow: string,\n margin?: string | null\n) {\n editor.focus();\n\n formatImageWithContentModel(editor, 'setImageBoxShadow', (image: ContentModelImage) => {\n image.format.boxShadow = boxShadow;\n if (margin) {\n image.format.marginBottom = margin;\n image.format.marginLeft = margin;\n image.format.marginRight = margin;\n image.format.marginTop = margin;\n } else if (margin === null) {\n delete image.format.marginBottom;\n delete image.format.marginLeft;\n delete image.format.marginRight;\n delete image.format.marginTop;\n }\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { IStandaloneEditor } from 'roosterjs-content-model-types';
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * Adjust selection to make sure select a hyperlink if any, or a word if original selection is collapsed
4
4
  * @return A combination of existing link display text and url if any. If there is no existing link, return selected text and null
5
5
  */
6
- export default function adjustLinkSelection(editor: IStandaloneEditor): [string, string | null];
6
+ export default function adjustLinkSelection(editor: IEditor): [string, string | null];