roosterjs-content-model-plugins 9.0.1 → 9.2.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 (331) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +19 -4
  2. package/lib/autoFormat/AutoFormatPlugin.js +61 -6
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
  4. package/lib/autoFormat/hyphen/transformHyphen.d.ts +5 -0
  5. package/lib/autoFormat/hyphen/transformHyphen.js +35 -0
  6. package/lib/autoFormat/hyphen/transformHyphen.js.map +1 -0
  7. package/lib/autoFormat/link/createLink.js +8 -6
  8. package/lib/autoFormat/link/createLink.js.map +1 -1
  9. package/lib/autoFormat/link/createLinkAfterSpace.d.ts +2 -2
  10. package/lib/autoFormat/link/createLinkAfterSpace.js +17 -34
  11. package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -1
  12. package/lib/autoFormat/link/unlink.js +4 -5
  13. package/lib/autoFormat/link/unlink.js.map +1 -1
  14. package/lib/autoFormat/list/keyboardListTrigger.d.ts +2 -2
  15. package/lib/autoFormat/list/keyboardListTrigger.js +9 -19
  16. package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -1
  17. package/lib/autoFormat/numbers/transformFraction.d.ts +5 -0
  18. package/lib/autoFormat/numbers/transformFraction.js +27 -0
  19. package/lib/autoFormat/numbers/transformFraction.js.map +1 -0
  20. package/lib/autoFormat/numbers/transformOrdinals.d.ts +5 -0
  21. package/lib/autoFormat/numbers/transformOrdinals.js +32 -0
  22. package/lib/autoFormat/numbers/transformOrdinals.js.map +1 -0
  23. package/lib/customReplace/CustomReplacePlugin.d.ts +61 -0
  24. package/lib/customReplace/CustomReplacePlugin.js +87 -0
  25. package/lib/customReplace/CustomReplacePlugin.js.map +1 -0
  26. package/lib/edit/EditPlugin.js +19 -1
  27. package/lib/edit/EditPlugin.js.map +1 -1
  28. package/lib/edit/deleteSteps/deleteList.js +13 -7
  29. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  30. package/lib/edit/inputSteps/handleEnterOnList.js +9 -2
  31. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
  32. package/lib/edit/keyboardDelete.js +2 -2
  33. package/lib/edit/keyboardDelete.js.map +1 -1
  34. package/lib/edit/keyboardTab.js +28 -12
  35. package/lib/edit/keyboardTab.js.map +1 -1
  36. package/lib/edit/tabUtils/handleTabOnList.d.ts +2 -2
  37. package/lib/edit/tabUtils/handleTabOnList.js +3 -3
  38. package/lib/edit/tabUtils/handleTabOnList.js.map +1 -1
  39. package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
  40. package/lib/edit/tabUtils/handleTabOnParagraph.js +2 -2
  41. package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  42. package/lib/edit/tabUtils/handleTabOnTable.d.ts +6 -0
  43. package/lib/edit/tabUtils/handleTabOnTable.js +25 -0
  44. package/lib/edit/tabUtils/handleTabOnTable.js.map +1 -0
  45. package/lib/edit/tabUtils/handleTabOnTableCell.d.ts +6 -0
  46. package/lib/edit/tabUtils/handleTabOnTableCell.js +40 -0
  47. package/lib/edit/tabUtils/handleTabOnTableCell.js.map +1 -0
  48. package/lib/hyperlink/HyperlinkPlugin.d.ts +48 -0
  49. package/lib/hyperlink/HyperlinkPlugin.js +141 -0
  50. package/lib/hyperlink/HyperlinkPlugin.js.map +1 -0
  51. package/lib/hyperlink/HyperlinkToolTip.d.ts +7 -0
  52. package/lib/hyperlink/HyperlinkToolTip.js +3 -0
  53. package/lib/hyperlink/HyperlinkToolTip.js.map +1 -0
  54. package/lib/index.d.ts +9 -1
  55. package/lib/index.js +10 -1
  56. package/lib/index.js.map +1 -1
  57. package/lib/markdown/MarkdownPlugin.d.ts +13 -4
  58. package/lib/markdown/MarkdownPlugin.js +31 -12
  59. package/lib/markdown/MarkdownPlugin.js.map +1 -1
  60. package/lib/markdown/utils/setFormat.d.ts +2 -2
  61. package/lib/markdown/utils/setFormat.js +21 -29
  62. package/lib/markdown/utils/setFormat.js.map +1 -1
  63. package/lib/picker/PickerHandler.d.ts +112 -0
  64. package/lib/picker/PickerHandler.js +3 -0
  65. package/lib/picker/PickerHandler.js.map +1 -0
  66. package/lib/picker/PickerHelper.d.ts +22 -0
  67. package/lib/picker/PickerHelper.js +3 -0
  68. package/lib/picker/PickerHelper.js.map +1 -0
  69. package/lib/picker/PickerHelperImpl.d.ts +25 -0
  70. package/lib/picker/PickerHelperImpl.js +54 -0
  71. package/lib/picker/PickerHelperImpl.js.map +1 -0
  72. package/lib/picker/PickerPlugin.d.ts +54 -0
  73. package/lib/picker/PickerPlugin.js +217 -0
  74. package/lib/picker/PickerPlugin.js.map +1 -0
  75. package/lib/picker/getQueryString.d.ts +5 -0
  76. package/lib/picker/getQueryString.js +36 -0
  77. package/lib/picker/getQueryString.js.map +1 -0
  78. package/lib/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
  79. package/lib/pluginUtils/Rect/getDOMInsertPointRect.js +57 -0
  80. package/lib/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
  81. package/lib/shortcut/ShortcutPlugin.js +1 -0
  82. package/lib/shortcut/ShortcutPlugin.js.map +1 -1
  83. package/lib/shortcut/shortcuts.d.ts +10 -3
  84. package/lib/shortcut/shortcuts.js +21 -4
  85. package/lib/shortcut/shortcuts.js.map +1 -1
  86. package/lib/shortcut/utils/setShortcutIndentationCommand.js +2 -2
  87. package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
  88. package/lib/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
  89. package/lib/tableEdit/OnTableEditorCreatedCallback.js +3 -0
  90. package/lib/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
  91. package/lib/tableEdit/TableEditPlugin.d.ts +4 -1
  92. package/lib/tableEdit/TableEditPlugin.js +5 -2
  93. package/lib/tableEdit/TableEditPlugin.js.map +1 -1
  94. package/lib/tableEdit/editors/TableEditor.d.ts +4 -1
  95. package/lib/tableEdit/editors/TableEditor.js +23 -7
  96. package/lib/tableEdit/editors/TableEditor.js.map +1 -1
  97. package/lib/tableEdit/editors/features/TableEditFeature.js +3 -3
  98. package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -1
  99. package/lib/tableEdit/editors/features/TableInserter.d.ts +2 -1
  100. package/lib/tableEdit/editors/features/TableInserter.js +7 -9
  101. package/lib/tableEdit/editors/features/TableInserter.js.map +1 -1
  102. package/lib/tableEdit/editors/features/TableMover.d.ts +2 -1
  103. package/lib/tableEdit/editors/features/TableMover.js +8 -11
  104. package/lib/tableEdit/editors/features/TableMover.js.map +1 -1
  105. package/lib/tableEdit/editors/features/TableResizer.d.ts +2 -1
  106. package/lib/tableEdit/editors/features/TableResizer.js +19 -3
  107. package/lib/tableEdit/editors/features/TableResizer.js.map +1 -1
  108. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +19 -4
  109. package/lib-amd/autoFormat/AutoFormatPlugin.js +57 -7
  110. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
  111. package/lib-amd/autoFormat/hyphen/transformHyphen.d.ts +5 -0
  112. package/lib-amd/autoFormat/hyphen/transformHyphen.js +36 -0
  113. package/lib-amd/autoFormat/hyphen/transformHyphen.js.map +1 -0
  114. package/lib-amd/autoFormat/link/createLink.js +8 -6
  115. package/lib-amd/autoFormat/link/createLink.js.map +1 -1
  116. package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +2 -2
  117. package/lib-amd/autoFormat/link/createLinkAfterSpace.js +18 -34
  118. package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -1
  119. package/lib-amd/autoFormat/link/unlink.js +4 -5
  120. package/lib-amd/autoFormat/link/unlink.js.map +1 -1
  121. package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +2 -2
  122. package/lib-amd/autoFormat/list/keyboardListTrigger.js +10 -19
  123. package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -1
  124. package/lib-amd/autoFormat/numbers/transformFraction.d.ts +5 -0
  125. package/lib-amd/autoFormat/numbers/transformFraction.js +28 -0
  126. package/lib-amd/autoFormat/numbers/transformFraction.js.map +1 -0
  127. package/lib-amd/autoFormat/numbers/transformOrdinals.d.ts +5 -0
  128. package/lib-amd/autoFormat/numbers/transformOrdinals.js +33 -0
  129. package/lib-amd/autoFormat/numbers/transformOrdinals.js.map +1 -0
  130. package/lib-amd/customReplace/CustomReplacePlugin.d.ts +61 -0
  131. package/lib-amd/customReplace/CustomReplacePlugin.js +88 -0
  132. package/lib-amd/customReplace/CustomReplacePlugin.js.map +1 -0
  133. package/lib-amd/edit/EditPlugin.js +19 -1
  134. package/lib-amd/edit/EditPlugin.js.map +1 -1
  135. package/lib-amd/edit/deleteSteps/deleteList.js +13 -7
  136. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  137. package/lib-amd/edit/inputSteps/handleEnterOnList.js +9 -3
  138. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
  139. package/lib-amd/edit/keyboardDelete.js +2 -2
  140. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  141. package/lib-amd/edit/keyboardTab.js +27 -13
  142. package/lib-amd/edit/keyboardTab.js.map +1 -1
  143. package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +2 -2
  144. package/lib-amd/edit/tabUtils/handleTabOnList.js +3 -3
  145. package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -1
  146. package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
  147. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +2 -2
  148. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  149. package/lib-amd/edit/tabUtils/handleTabOnTable.d.ts +6 -0
  150. package/lib-amd/edit/tabUtils/handleTabOnTable.js +25 -0
  151. package/lib-amd/edit/tabUtils/handleTabOnTable.js.map +1 -0
  152. package/lib-amd/edit/tabUtils/handleTabOnTableCell.d.ts +6 -0
  153. package/lib-amd/edit/tabUtils/handleTabOnTableCell.js +40 -0
  154. package/lib-amd/edit/tabUtils/handleTabOnTableCell.js.map +1 -0
  155. package/lib-amd/hyperlink/HyperlinkPlugin.d.ts +48 -0
  156. package/lib-amd/hyperlink/HyperlinkPlugin.js +142 -0
  157. package/lib-amd/hyperlink/HyperlinkPlugin.js.map +1 -0
  158. package/lib-amd/hyperlink/HyperlinkToolTip.d.ts +7 -0
  159. package/lib-amd/hyperlink/HyperlinkToolTip.js +5 -0
  160. package/lib-amd/hyperlink/HyperlinkToolTip.js.map +1 -0
  161. package/lib-amd/index.d.ts +9 -1
  162. package/lib-amd/index.js +7 -2
  163. package/lib-amd/index.js.map +1 -1
  164. package/lib-amd/markdown/MarkdownPlugin.d.ts +13 -4
  165. package/lib-amd/markdown/MarkdownPlugin.js +31 -12
  166. package/lib-amd/markdown/MarkdownPlugin.js.map +1 -1
  167. package/lib-amd/markdown/utils/setFormat.d.ts +2 -2
  168. package/lib-amd/markdown/utils/setFormat.js +21 -29
  169. package/lib-amd/markdown/utils/setFormat.js.map +1 -1
  170. package/lib-amd/picker/PickerHandler.d.ts +112 -0
  171. package/lib-amd/picker/PickerHandler.js +5 -0
  172. package/lib-amd/picker/PickerHandler.js.map +1 -0
  173. package/lib-amd/picker/PickerHelper.d.ts +22 -0
  174. package/lib-amd/picker/PickerHelper.js +5 -0
  175. package/lib-amd/picker/PickerHelper.js.map +1 -0
  176. package/lib-amd/picker/PickerHelperImpl.d.ts +25 -0
  177. package/lib-amd/picker/PickerHelperImpl.js +53 -0
  178. package/lib-amd/picker/PickerHelperImpl.js.map +1 -0
  179. package/lib-amd/picker/PickerPlugin.d.ts +54 -0
  180. package/lib-amd/picker/PickerPlugin.js +215 -0
  181. package/lib-amd/picker/PickerPlugin.js.map +1 -0
  182. package/lib-amd/picker/getQueryString.d.ts +5 -0
  183. package/lib-amd/picker/getQueryString.js +37 -0
  184. package/lib-amd/picker/getQueryString.js.map +1 -0
  185. package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
  186. package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.js +58 -0
  187. package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
  188. package/lib-amd/shortcut/ShortcutPlugin.js +1 -0
  189. package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -1
  190. package/lib-amd/shortcut/shortcuts.d.ts +10 -3
  191. package/lib-amd/shortcut/shortcuts.js +21 -4
  192. package/lib-amd/shortcut/shortcuts.js.map +1 -1
  193. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +2 -2
  194. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
  195. package/lib-amd/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
  196. package/lib-amd/tableEdit/OnTableEditorCreatedCallback.js +5 -0
  197. package/lib-amd/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
  198. package/lib-amd/tableEdit/TableEditPlugin.d.ts +4 -1
  199. package/lib-amd/tableEdit/TableEditPlugin.js +5 -2
  200. package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -1
  201. package/lib-amd/tableEdit/editors/TableEditor.d.ts +4 -1
  202. package/lib-amd/tableEdit/editors/TableEditor.js +23 -7
  203. package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -1
  204. package/lib-amd/tableEdit/editors/features/TableEditFeature.js +3 -3
  205. package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -1
  206. package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +2 -1
  207. package/lib-amd/tableEdit/editors/features/TableInserter.js +7 -9
  208. package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -1
  209. package/lib-amd/tableEdit/editors/features/TableMover.d.ts +2 -1
  210. package/lib-amd/tableEdit/editors/features/TableMover.js +8 -11
  211. package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -1
  212. package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +2 -1
  213. package/lib-amd/tableEdit/editors/features/TableResizer.js +19 -4
  214. package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -1
  215. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +19 -4
  216. package/lib-mjs/autoFormat/AutoFormatPlugin.js +61 -6
  217. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
  218. package/lib-mjs/autoFormat/hyphen/transformHyphen.d.ts +5 -0
  219. package/lib-mjs/autoFormat/hyphen/transformHyphen.js +31 -0
  220. package/lib-mjs/autoFormat/hyphen/transformHyphen.js.map +1 -0
  221. package/lib-mjs/autoFormat/link/createLink.js +9 -7
  222. package/lib-mjs/autoFormat/link/createLink.js.map +1 -1
  223. package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +2 -2
  224. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +17 -34
  225. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -1
  226. package/lib-mjs/autoFormat/link/unlink.js +4 -5
  227. package/lib-mjs/autoFormat/link/unlink.js.map +1 -1
  228. package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +2 -2
  229. package/lib-mjs/autoFormat/list/keyboardListTrigger.js +9 -19
  230. package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -1
  231. package/lib-mjs/autoFormat/numbers/transformFraction.d.ts +5 -0
  232. package/lib-mjs/autoFormat/numbers/transformFraction.js +23 -0
  233. package/lib-mjs/autoFormat/numbers/transformFraction.js.map +1 -0
  234. package/lib-mjs/autoFormat/numbers/transformOrdinals.d.ts +5 -0
  235. package/lib-mjs/autoFormat/numbers/transformOrdinals.js +28 -0
  236. package/lib-mjs/autoFormat/numbers/transformOrdinals.js.map +1 -0
  237. package/lib-mjs/customReplace/CustomReplacePlugin.d.ts +61 -0
  238. package/lib-mjs/customReplace/CustomReplacePlugin.js +84 -0
  239. package/lib-mjs/customReplace/CustomReplacePlugin.js.map +1 -0
  240. package/lib-mjs/edit/EditPlugin.js +19 -1
  241. package/lib-mjs/edit/EditPlugin.js.map +1 -1
  242. package/lib-mjs/edit/deleteSteps/deleteList.js +13 -7
  243. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  244. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +9 -2
  245. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
  246. package/lib-mjs/edit/keyboardDelete.js +2 -2
  247. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  248. package/lib-mjs/edit/keyboardTab.js +28 -12
  249. package/lib-mjs/edit/keyboardTab.js.map +1 -1
  250. package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +2 -2
  251. package/lib-mjs/edit/tabUtils/handleTabOnList.js +3 -3
  252. package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -1
  253. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
  254. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +2 -2
  255. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  256. package/lib-mjs/edit/tabUtils/handleTabOnTable.d.ts +6 -0
  257. package/lib-mjs/edit/tabUtils/handleTabOnTable.js +21 -0
  258. package/lib-mjs/edit/tabUtils/handleTabOnTable.js.map +1 -0
  259. package/lib-mjs/edit/tabUtils/handleTabOnTableCell.d.ts +6 -0
  260. package/lib-mjs/edit/tabUtils/handleTabOnTableCell.js +36 -0
  261. package/lib-mjs/edit/tabUtils/handleTabOnTableCell.js.map +1 -0
  262. package/lib-mjs/hyperlink/HyperlinkPlugin.d.ts +48 -0
  263. package/lib-mjs/hyperlink/HyperlinkPlugin.js +138 -0
  264. package/lib-mjs/hyperlink/HyperlinkPlugin.js.map +1 -0
  265. package/lib-mjs/hyperlink/HyperlinkToolTip.d.ts +7 -0
  266. package/lib-mjs/hyperlink/HyperlinkToolTip.js +2 -0
  267. package/lib-mjs/hyperlink/HyperlinkToolTip.js.map +1 -0
  268. package/lib-mjs/index.d.ts +9 -1
  269. package/lib-mjs/index.js +5 -1
  270. package/lib-mjs/index.js.map +1 -1
  271. package/lib-mjs/markdown/MarkdownPlugin.d.ts +13 -4
  272. package/lib-mjs/markdown/MarkdownPlugin.js +31 -12
  273. package/lib-mjs/markdown/MarkdownPlugin.js.map +1 -1
  274. package/lib-mjs/markdown/utils/setFormat.d.ts +2 -2
  275. package/lib-mjs/markdown/utils/setFormat.js +21 -29
  276. package/lib-mjs/markdown/utils/setFormat.js.map +1 -1
  277. package/lib-mjs/picker/PickerHandler.d.ts +112 -0
  278. package/lib-mjs/picker/PickerHandler.js +2 -0
  279. package/lib-mjs/picker/PickerHandler.js.map +1 -0
  280. package/lib-mjs/picker/PickerHelper.d.ts +22 -0
  281. package/lib-mjs/picker/PickerHelper.js +2 -0
  282. package/lib-mjs/picker/PickerHelper.js.map +1 -0
  283. package/lib-mjs/picker/PickerHelperImpl.d.ts +25 -0
  284. package/lib-mjs/picker/PickerHelperImpl.js +51 -0
  285. package/lib-mjs/picker/PickerHelperImpl.js.map +1 -0
  286. package/lib-mjs/picker/PickerPlugin.d.ts +54 -0
  287. package/lib-mjs/picker/PickerPlugin.js +214 -0
  288. package/lib-mjs/picker/PickerPlugin.js.map +1 -0
  289. package/lib-mjs/picker/getQueryString.d.ts +5 -0
  290. package/lib-mjs/picker/getQueryString.js +32 -0
  291. package/lib-mjs/picker/getQueryString.js.map +1 -0
  292. package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
  293. package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.js +53 -0
  294. package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
  295. package/lib-mjs/shortcut/ShortcutPlugin.js +2 -1
  296. package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -1
  297. package/lib-mjs/shortcut/shortcuts.d.ts +10 -3
  298. package/lib-mjs/shortcut/shortcuts.js +20 -3
  299. package/lib-mjs/shortcut/shortcuts.js.map +1 -1
  300. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +2 -2
  301. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
  302. package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
  303. package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.js +2 -0
  304. package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
  305. package/lib-mjs/tableEdit/TableEditPlugin.d.ts +4 -1
  306. package/lib-mjs/tableEdit/TableEditPlugin.js +5 -2
  307. package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -1
  308. package/lib-mjs/tableEdit/editors/TableEditor.d.ts +4 -1
  309. package/lib-mjs/tableEdit/editors/TableEditor.js +24 -8
  310. package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -1
  311. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +3 -3
  312. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -1
  313. package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +2 -1
  314. package/lib-mjs/tableEdit/editors/features/TableInserter.js +7 -9
  315. package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -1
  316. package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +2 -1
  317. package/lib-mjs/tableEdit/editors/features/TableMover.js +8 -11
  318. package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -1
  319. package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +2 -1
  320. package/lib-mjs/tableEdit/editors/features/TableResizer.js +19 -3
  321. package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -1
  322. package/package.json +5 -5
  323. package/lib/autoFormat/link/getLinkSegment.d.ts +0 -5
  324. package/lib/autoFormat/link/getLinkSegment.js +0 -27
  325. package/lib/autoFormat/link/getLinkSegment.js.map +0 -1
  326. package/lib-amd/autoFormat/link/getLinkSegment.d.ts +0 -5
  327. package/lib-amd/autoFormat/link/getLinkSegment.js +0 -27
  328. package/lib-amd/autoFormat/link/getLinkSegment.js.map +0 -1
  329. package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +0 -5
  330. package/lib-mjs/autoFormat/link/getLinkSegment.js +0 -23
  331. package/lib-mjs/autoFormat/link/getLinkSegment.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardTab.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardTab.ts"],"names":[],"mappings":";;;;IAUA;;OAEG;IACH,SAAgB,WAAW,CAAC,MAAe,EAAE,QAAuB;QAChE,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAE3C,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,OAAO,EAAE;YAC5B,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;gBACD,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACtC,CAAC,EACD;gBACI,OAAO,EAAE,cAAc;aAC1B,CACJ,CAAC;YAEF,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAfD,kCAeC;IAED;;;OAGG;IACH,SAAS,SAAS,CAAC,KAA2B,EAAE,QAAuB;QACnE,IAAM,MAAM,GAAG,IAAA,kDAAoB,EAAuB,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;QAC9F,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,IAAA,iDAAmB,EAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;aAAM,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,WAAW,EAAE;YACzC,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;SACvD;aAAM,IAAI,IAAA,gDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;YACpE,OAAO,IAAA,iCAAe,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;SAClD;QACD,OAAO,KAAK,CAAC;IACjB,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-dom';\nimport { handleTabOnList } from './tabUtils/handleTabOnList';\nimport { handleTabOnParagraph } from './tabUtils/handleTabOnParagraph';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardTab(editor: IEditor, rawEvent: KeyboardEvent) {\n const selection = editor.getDOMSelection();\n\n if (selection?.type == 'range') {\n editor.formatContentModel(\n model => {\n return handleTab(model, rawEvent);\n },\n {\n apiName: 'handleTabKey',\n }\n );\n\n return true;\n }\n}\n\n/**\n * If multiple blocks are selected, indent or outdent the selected blocks with setModelIndentation.\n * If only one block is selected, call handleTabOnParagraph or handleTabOnList to handle the tab key.\n */\nfunction handleTab(model: ContentModelDocument, rawEvent: KeyboardEvent) {\n const blocks = getOperationalBlocks<ContentModelListItem>(model, ['ListItem'], ['TableCell']);\n const block = blocks.length > 0 ? blocks[0].block : undefined;\n if (blocks.length > 1) {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n } else if (block?.blockType === 'Paragraph') {\n return handleTabOnParagraph(model, block, rawEvent);\n } else if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n return handleTabOnList(model, block, rawEvent);\n }\n return false;\n}\n"]}
1
+ {"version":3,"file":"keyboardTab.js","sourceRoot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cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;aAAM,IAAI,IAAA,gDAAkB,EAAwB,KAAK,EAAE,WAAW,CAAC,EAAE;YACtE,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;SACvD;aAAM,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,WAAW,EAAE;YACzC,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAChE;aAAM,IAAI,IAAA,gDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;YACpE,OAAO,IAAA,iCAAe,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC3D;QACD,OAAO,KAAK,CAAC;IACjB,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-dom';\nimport { handleTabOnList } from './tabUtils/handleTabOnList';\nimport { handleTabOnParagraph } from './tabUtils/handleTabOnParagraph';\nimport { handleTabOnTable } from './tabUtils/handleTabOnTable';\nimport { handleTabOnTableCell } from './tabUtils/handleTabOnTableCell';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n ContentModelTableCell,\n FormatContentModelContext,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardTab(editor: IEditor, rawEvent: KeyboardEvent) {\n const selection = editor.getDOMSelection();\n\n switch (selection?.type) {\n case 'range':\n editor.formatContentModel(\n (model, context) => {\n return handleTab(model, rawEvent, context);\n },\n {\n apiName: 'handleTabKey',\n }\n );\n\n return true;\n case 'table':\n editor.formatContentModel(\n model => {\n return handleTabOnTable(model, rawEvent);\n },\n {\n apiName: 'handleTabKey',\n }\n );\n return true;\n }\n}\n\n/**\n * If multiple blocks are selected, indent or outdent the selected blocks with setModelIndentation.\n * If only one block is selected:\n * - If it is a table cell, call handleTabOnTableCell to handle the tab key.\n * - If it is a paragraph, call handleTabOnParagraph to handle the tab key.\n * - If it is a list item, call handleTabOnList to handle the tab key.\n */\nfunction handleTab(\n model: ContentModelDocument,\n rawEvent: KeyboardEvent,\n context: FormatContentModelContext\n) {\n const blocks = getOperationalBlocks<ContentModelListItem | ContentModelTableCell>(\n model,\n ['ListItem', 'TableCell'],\n []\n );\n const block = blocks.length > 0 ? blocks[0].block : undefined;\n\n if (blocks.length > 1) {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n } else if (isBlockGroupOfType<ContentModelTableCell>(block, 'TableCell')) {\n return handleTabOnTableCell(model, block, rawEvent);\n } else if (block?.blockType === 'Paragraph') {\n return handleTabOnParagraph(model, block, rawEvent, context);\n } else if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n return handleTabOnList(model, block, rawEvent, context);\n }\n return false;\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { ContentModelDocument, ContentModelListItem } from 'roosterjs-content-model-types';
1
+ import type { ContentModelDocument, ContentModelListItem, FormatContentModelContext } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.
4
4
  * 2. Otherwise call handleTabOnParagraph.
5
5
  * @internal
6
6
  */
7
- export declare function handleTabOnList(model: ContentModelDocument, listItem: ContentModelListItem, rawEvent: KeyboardEvent): boolean;
7
+ export declare function handleTabOnList(model: ContentModelDocument, listItem: ContentModelListItem, rawEvent: KeyboardEvent, context?: FormatContentModelContext): boolean;
@@ -7,15 +7,15 @@ define(["require", "exports", "./handleTabOnParagraph", "roosterjs-content-model
7
7
  * 2. Otherwise call handleTabOnParagraph.
8
8
  * @internal
9
9
  */
10
- function handleTabOnList(model, listItem, rawEvent) {
10
+ function handleTabOnList(model, listItem, rawEvent, context) {
11
11
  var selectedParagraph = findSelectedParagraph(listItem);
12
12
  if (!isMarkerAtStartOfBlock(listItem) &&
13
13
  selectedParagraph.length == 1 &&
14
14
  selectedParagraph[0].blockType === 'Paragraph') {
15
- return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, selectedParagraph[0], rawEvent);
15
+ return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, selectedParagraph[0], rawEvent, context);
16
16
  }
17
17
  else {
18
- (0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
18
+ (0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent', undefined /*length*/, context);
19
19
  rawEvent.preventDefault();
20
20
  return true;
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handleTabOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnList.ts"],"names":[],"mappings":";;;;IAIA;;;;OAIG;IACH,SAAgB,eAAe,CAC3B,KAA2B,EAC3B,QAA8B,EAC9B,QAAuB;QAEvB,IAAM,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC1D,IACI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;YACjC,iBAAiB,CAAC,MAAM,IAAI,CAAC;YAC7B,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,EAChD;YACE,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;SACtE;aAAM;YACH,IAAA,iDAAmB,EAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAjBD,0CAiBC;IAED,SAAS,sBAAsB,CAAC,QAA8B;QAC1D,OAAO,CACH,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;YAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAClE,CAAC;IACN,CAAC;IAED,SAAS,qBAAqB,CAAC,QAA8B;QACzD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CACzB,UAAA,KAAK;YACD,OAAA,KAAK,CAAC,SAAS,IAAI,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC;QAApF,CAAoF,CAC3F,CAAC;IACN,CAAC","sourcesContent":["import { handleTabOnParagraph } from './handleTabOnParagraph';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, ContentModelListItem } from 'roosterjs-content-model-types';\n\n/**\n * 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.\n * 2. Otherwise call handleTabOnParagraph.\n * @internal\n */\nexport function handleTabOnList(\n model: ContentModelDocument,\n listItem: ContentModelListItem,\n rawEvent: KeyboardEvent\n) {\n const selectedParagraph = findSelectedParagraph(listItem);\n if (\n !isMarkerAtStartOfBlock(listItem) &&\n selectedParagraph.length == 1 &&\n selectedParagraph[0].blockType === 'Paragraph'\n ) {\n return handleTabOnParagraph(model, selectedParagraph[0], rawEvent);\n } else {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n }\n}\n\nfunction isMarkerAtStartOfBlock(listItem: ContentModelListItem) {\n return (\n listItem.blocks[0].blockType == 'Paragraph' &&\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\n );\n}\n\nfunction findSelectedParagraph(listItem: ContentModelListItem) {\n return listItem.blocks.filter(\n block =>\n block.blockType == 'Paragraph' && block.segments.some(segment => segment.isSelected)\n );\n}\n"]}
1
+ {"version":3,"file":"handleTabOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnList.ts"],"names":[],"mappings":";;;;IAQA;;;;OAIG;IACH,SAAgB,eAAe,CAC3B,KAA2B,EAC3B,QAA8B,EAC9B,QAAuB,EACvB,OAAmC;QAEnC,IAAM,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC1D,IACI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;YACjC,iBAAiB,CAAC,MAAM,IAAI,CAAC;YAC7B,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,EAChD;YACE,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC/E;aAAM;YACH,IAAA,iDAAmB,EACf,KAAK,EACL,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACxC,SAAS,CAAC,UAAU,EACpB,OAAO,CACV,CAAC;YACF,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAvBD,0CAuBC;IAED,SAAS,sBAAsB,CAAC,QAA8B;QAC1D,OAAO,CACH,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;YAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAClE,CAAC;IACN,CAAC;IAED,SAAS,qBAAqB,CAAC,QAA8B;QACzD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CACzB,UAAA,KAAK;YACD,OAAA,KAAK,CAAC,SAAS,IAAI,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC;QAApF,CAAoF,CAC3F,CAAC;IACN,CAAC","sourcesContent":["import { handleTabOnParagraph } from './handleTabOnParagraph';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.\n * 2. Otherwise call handleTabOnParagraph.\n * @internal\n */\nexport function handleTabOnList(\n model: ContentModelDocument,\n listItem: ContentModelListItem,\n rawEvent: KeyboardEvent,\n context?: FormatContentModelContext\n) {\n const selectedParagraph = findSelectedParagraph(listItem);\n if (\n !isMarkerAtStartOfBlock(listItem) &&\n selectedParagraph.length == 1 &&\n selectedParagraph[0].blockType === 'Paragraph'\n ) {\n return handleTabOnParagraph(model, selectedParagraph[0], rawEvent, context);\n } else {\n setModelIndentation(\n model,\n rawEvent.shiftKey ? 'outdent' : 'indent',\n undefined /*length*/,\n context\n );\n rawEvent.preventDefault();\n return true;\n }\n}\n\nfunction isMarkerAtStartOfBlock(listItem: ContentModelListItem) {\n return (\n listItem.blocks[0].blockType == 'Paragraph' &&\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\n );\n}\n\nfunction findSelectedParagraph(listItem: ContentModelListItem) {\n return listItem.blocks.filter(\n block =>\n block.blockType == 'Paragraph' && block.segments.some(segment => segment.isSelected)\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-content-model-types';
1
+ import type { ContentModelDocument, ContentModelParagraph, FormatContentModelContext } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * @internal
4
4
  The handleTabOnParagraph function will handle the tab key in following scenarios:
@@ -14,4 +14,4 @@ import type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-cont
14
14
  * 4. When the selection is not collapsed, replace the selected range with a 4 space.
15
15
  * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph
16
16
  */
17
- export declare function handleTabOnParagraph(model: ContentModelDocument, paragraph: ContentModelParagraph, rawEvent: KeyboardEvent): boolean;
17
+ export declare function handleTabOnParagraph(model: ContentModelDocument, paragraph: ContentModelParagraph, rawEvent: KeyboardEvent, context?: FormatContentModelContext): boolean;
@@ -19,7 +19,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-
19
19
  * 4. When the selection is not collapsed, replace the selected range with a 4 space.
20
20
  * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph
21
21
  */
22
- function handleTabOnParagraph(model, paragraph, rawEvent) {
22
+ function handleTabOnParagraph(model, paragraph, rawEvent, context) {
23
23
  var selectedSegments = paragraph.segments.filter(function (segment) { return segment.isSelected; });
24
24
  var isCollapsed = selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';
25
25
  var isAllSelected = paragraph.segments.every(function (segment) { return segment.isSelected; });
@@ -31,7 +31,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-
31
31
  (isRtl && (!marginRight || marginRight == '0px')))) {
32
32
  return false;
33
33
  }
34
- (0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
34
+ (0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent', undefined /*length*/, context);
35
35
  }
36
36
  else {
37
37
  if (!isCollapsed) {
@@ -1 +1 @@
1
- {"version":3,"file":"handleTabOnParagraph.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnParagraph.ts"],"names":[],"mappings":";;;;IAIA,IAAM,SAAS,GAAG,MAAM,CAAC;IACzB,IAAM,KAAK,GAAG,GAAG,CAAC;IAElB;;;;;;;;;;;;;;OAcG;IACH,SAAgB,oBAAoB,CAChC,KAA2B,EAC3B,SAAgC,EAChC,QAAuB;QAEvB,IAAM,gBAAgB,GAAG,SAAS,CAAC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IAAI,OAAO,CAAC,WAAW,IAAI,MAAM,EAAE;wBAC/B,IAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;wBACjE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;4BAC5B,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;yBACjD;6BAAM,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE;4BACjE,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;yBAChE;6BAAM;4BACH,OAAO,KAAK,CAAC;yBAChB;qBACJ;iBACJ;aACJ;SACJ;QACD,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IA3ED,oDA2EC","sourcesContent":["import { createSelectionMarker, createText } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-content-model-types';\n\nconst tabSpaces = '    ';\nconst space = ' ';\n\n/**\n * @internal\n The handleTabOnParagraph function will handle the tab key in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, add 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to indent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, add 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a single space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to indent the whole paragraph\n The handleTabOnParagraph function will handle the shift + tab key in a indented paragraph in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, remove 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to outdent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, remove 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a 4 space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph\n */\nexport function handleTabOnParagraph(\n model: ContentModelDocument,\n paragraph: ContentModelParagraph,\n rawEvent: KeyboardEvent\n) {\n const selectedSegments = paragraph.segments.filter(segment => segment.isSelected);\n const isCollapsed =\n selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';\n const isAllSelected = paragraph.segments.every(segment => segment.isSelected);\n if ((paragraph.segments[0].segmentType === 'SelectionMarker' && isCollapsed) || isAllSelected) {\n const { marginLeft, marginRight, direction } = paragraph.format;\n const isRtl = direction === 'rtl';\n if (\n rawEvent.shiftKey &&\n ((!isRtl && (!marginLeft || marginLeft == '0px')) ||\n (isRtl && (!marginRight || marginRight == '0px')))\n ) {\n return false;\n }\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n } else {\n if (!isCollapsed) {\n let firstSelectedSegmentIndex: number | undefined = undefined;\n let lastSelectedSegmentIndex: number | undefined = undefined;\n\n paragraph.segments.forEach((segment, index) => {\n if (segment.isSelected) {\n if (!firstSelectedSegmentIndex) {\n firstSelectedSegmentIndex = index;\n }\n lastSelectedSegmentIndex = index;\n }\n });\n if (firstSelectedSegmentIndex && lastSelectedSegmentIndex) {\n const firstSelectedSegment = paragraph.segments[firstSelectedSegmentIndex];\n const spaceText = createText(\n rawEvent.shiftKey ? tabSpaces : space,\n firstSelectedSegment.format\n );\n const marker = createSelectionMarker(firstSelectedSegment.format);\n paragraph.segments.splice(\n firstSelectedSegmentIndex,\n lastSelectedSegmentIndex - firstSelectedSegmentIndex + 1,\n spaceText,\n marker\n );\n } else {\n return false;\n }\n } else {\n const markerIndex = paragraph.segments.findIndex(\n segment => segment.segmentType === 'SelectionMarker'\n );\n if (!rawEvent.shiftKey) {\n const markerFormat = paragraph.segments[markerIndex].format;\n const tabText = createText(tabSpaces, markerFormat);\n paragraph.segments.splice(markerIndex, 0, tabText);\n } else {\n const tabText = paragraph.segments[markerIndex - 1];\n const tabSpacesLength = tabSpaces.length;\n if (tabText.segmentType == 'Text') {\n const tabSpaceTextLength = tabText.text.length - tabSpacesLength;\n if (tabText.text === tabSpaces) {\n paragraph.segments.splice(markerIndex - 1, 1);\n } else if (tabText.text.substring(tabSpaceTextLength) === tabSpaces) {\n tabText.text = tabText.text.substring(0, tabSpaceTextLength);\n } else {\n return false;\n }\n }\n }\n }\n }\n rawEvent.preventDefault();\n return true;\n}\n"]}
1
+ {"version":3,"file":"handleTabOnParagraph.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnParagraph.ts"],"names":[],"mappings":";;;;IAQA,IAAM,SAAS,GAAG,MAAM,CAAC;IACzB,IAAM,KAAK,GAAG,GAAG,CAAC;IAElB;;;;;;;;;;;;;;OAcG;IACH,SAAgB,oBAAoB,CAChC,KAA2B,EAC3B,SAAgC,EAChC,QAAuB,EACvB,OAAmC;QAEnC,IAAM,gBAAgB,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;QAClF,IAAM,WAAW,GACb,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,iBAAiB,CAAC;QAC3F,IAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;QAC9E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,iBAAiB,IAAI,WAAW,CAAC,IAAI,aAAa,EAAE;YACrF,IAAA,KAAyC,SAAS,CAAC,MAAM,EAAvD,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,SAAS,e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AQ,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAjFD,oDAiFC","sourcesContent":["import { createSelectionMarker, createText } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\nconst tabSpaces = '    ';\nconst space = ' ';\n\n/**\n * @internal\n The handleTabOnParagraph function will handle the tab key in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, add 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to indent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, add 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a single space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to indent the whole paragraph\n The handleTabOnParagraph function will handle the shift + tab key in a indented paragraph in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, remove 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to outdent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, remove 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a 4 space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph\n */\nexport function handleTabOnParagraph(\n model: ContentModelDocument,\n paragraph: ContentModelParagraph,\n rawEvent: KeyboardEvent,\n context?: FormatContentModelContext\n) {\n const selectedSegments = paragraph.segments.filter(segment => segment.isSelected);\n const isCollapsed =\n selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';\n const isAllSelected = paragraph.segments.every(segment => segment.isSelected);\n if ((paragraph.segments[0].segmentType === 'SelectionMarker' && isCollapsed) || isAllSelected) {\n const { marginLeft, marginRight, direction } = paragraph.format;\n const isRtl = direction === 'rtl';\n if (\n rawEvent.shiftKey &&\n ((!isRtl && (!marginLeft || marginLeft == '0px')) ||\n (isRtl && (!marginRight || marginRight == '0px')))\n ) {\n return false;\n }\n setModelIndentation(\n model,\n rawEvent.shiftKey ? 'outdent' : 'indent',\n undefined /*length*/,\n context\n );\n } else {\n if (!isCollapsed) {\n let firstSelectedSegmentIndex: number | undefined = undefined;\n let lastSelectedSegmentIndex: number | undefined = undefined;\n\n paragraph.segments.forEach((segment, index) => {\n if (segment.isSelected) {\n if (!firstSelectedSegmentIndex) {\n firstSelectedSegmentIndex = index;\n }\n lastSelectedSegmentIndex = index;\n }\n });\n if (firstSelectedSegmentIndex && lastSelectedSegmentIndex) {\n const firstSelectedSegment = paragraph.segments[firstSelectedSegmentIndex];\n const spaceText = createText(\n rawEvent.shiftKey ? tabSpaces : space,\n firstSelectedSegment.format\n );\n const marker = createSelectionMarker(firstSelectedSegment.format);\n paragraph.segments.splice(\n firstSelectedSegmentIndex,\n lastSelectedSegmentIndex - firstSelectedSegmentIndex + 1,\n spaceText,\n marker\n );\n } else {\n return false;\n }\n } else {\n const markerIndex = paragraph.segments.findIndex(\n segment => segment.segmentType === 'SelectionMarker'\n );\n if (!rawEvent.shiftKey) {\n const markerFormat = paragraph.segments[markerIndex].format;\n const tabText = createText(tabSpaces, markerFormat);\n paragraph.segments.splice(markerIndex, 0, tabText);\n } else {\n const tabText = paragraph.segments[markerIndex - 1];\n const tabSpacesLength = tabSpaces.length;\n if (tabText.segmentType == 'Text') {\n const tabSpaceTextLength = tabText.text.length - tabSpacesLength;\n if (tabText.text === tabSpaces) {\n paragraph.segments.splice(markerIndex - 1, 1);\n } else if (tabText.text.substring(tabSpaceTextLength) === tabSpaces) {\n tabText.text = tabText.text.substring(0, tabSpaceTextLength);\n } else {\n return false;\n }\n }\n }\n }\n }\n rawEvent.preventDefault();\n return true;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { ContentModelDocument } from 'roosterjs-content-model-types';
2
+ /**
3
+ * When the whole table is selected, indent or outdent the whole table with setModelIndentation.
4
+ * @internal
5
+ */
6
+ export declare function handleTabOnTable(model: ContentModelDocument, rawEvent: KeyboardEvent): boolean;
@@ -0,0 +1,25 @@
1
+ define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_dom_1, roosterjs_content_model_api_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.handleTabOnTable = void 0;
5
+ /**
6
+ * When the whole table is selected, indent or outdent the whole table with setModelIndentation.
7
+ * @internal
8
+ */
9
+ function handleTabOnTable(model, rawEvent) {
10
+ var tableModel = (0, roosterjs_content_model_dom_1.getFirstSelectedTable)(model)[0];
11
+ if (tableModel && isWholeTableSelected(tableModel)) {
12
+ (0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
13
+ rawEvent.preventDefault();
14
+ return true;
15
+ }
16
+ return false;
17
+ }
18
+ exports.handleTabOnTable = handleTabOnTable;
19
+ function isWholeTableSelected(tableModel) {
20
+ var _a, _b, _c, _d;
21
+ return (((_b = (_a = tableModel.rows[0]) === null || _a === void 0 ? void 0 : _a.cells[0]) === null || _b === void 0 ? void 0 : _b.isSelected) &&
22
+ ((_d = (_c = tableModel.rows[tableModel.rows.length - 1]) === null || _c === void 0 ? void 0 : _c.cells[tableModel.widths.length - 1]) === null || _d === void 0 ? void 0 : _d.isSelected));
23
+ }
24
+ });
25
+ //# sourceMappingURL=handleTabOnTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleTabOnTable.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnTable.ts"],"names":[],"mappings":";;;;IAIA;;;OAGG;IACH,SAAgB,gBAAgB,CAAC,KAA2B,EAAE,QAAuB;QACjF,IAAM,UAAU,GAAG,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,IAAI,UAAU,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE;YAChD,IAAA,iDAAmB,EAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IARD,4CAQC;IAED,SAAS,oBAAoB,CAAC,UAA6B;;QACvD,OAAO,CACH,CAAA,MAAA,MAAA,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC,CAAC,0CAAE,UAAU;aACxC,MAAA,MAAA,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,UAAU,CAAA,CAC/F,CAAC;IACN,CAAC","sourcesContent":["import { getFirstSelectedTable } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * When the whole table is selected, indent or outdent the whole table with setModelIndentation.\n * @internal\n */\nexport function handleTabOnTable(model: ContentModelDocument, rawEvent: KeyboardEvent) {\n const tableModel = getFirstSelectedTable(model)[0];\n if (tableModel && isWholeTableSelected(tableModel)) {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n }\n return false;\n}\n\nfunction isWholeTableSelected(tableModel: ContentModelTable) {\n return (\n tableModel.rows[0]?.cells[0]?.isSelected &&\n tableModel.rows[tableModel.rows.length - 1]?.cells[tableModel.widths.length - 1]?.isSelected\n );\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { ContentModelDocument, ContentModelTableCell } from 'roosterjs-content-model-types';
2
+ /**
3
+ * When the cursor is on the last cell of a table, add new row and focus first new cell.
4
+ * @internal
5
+ */
6
+ export declare function handleTabOnTableCell(model: ContentModelDocument, cell: ContentModelTableCell, rawEvent: KeyboardEvent): boolean;
@@ -0,0 +1,40 @@
1
+ define(["require", "exports", "roosterjs-content-model-api", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_api_1, roosterjs_content_model_dom_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.handleTabOnTableCell = void 0;
5
+ /**
6
+ * When the cursor is on the last cell of a table, add new row and focus first new cell.
7
+ * @internal
8
+ */
9
+ function handleTabOnTableCell(model, cell, rawEvent) {
10
+ var _a, _b, _c;
11
+ var tableModel = (0, roosterjs_content_model_dom_1.getFirstSelectedTable)(model)[0];
12
+ // Check if cursor is on last cell of the table
13
+ if (!rawEvent.shiftKey &&
14
+ tableModel &&
15
+ ((_a = tableModel.rows[tableModel.rows.length - 1]) === null || _a === void 0 ? void 0 : _a.cells[tableModel.widths.length - 1]) === cell) {
16
+ (0, roosterjs_content_model_api_1.insertTableRow)(tableModel, 'insertBelow');
17
+ // Clear Table selection
18
+ (0, roosterjs_content_model_api_1.clearSelectedCells)(tableModel, {
19
+ firstRow: tableModel.rows.length - 1,
20
+ firstColumn: 0,
21
+ lastRow: tableModel.rows.length - 1,
22
+ lastColumn: tableModel.widths.length - 1,
23
+ });
24
+ (0, roosterjs_content_model_dom_1.normalizeTable)(tableModel, model.format);
25
+ // Add selection marker to the first cell of the new row
26
+ var markerParagraph = (_c = (_b = tableModel.rows[tableModel.rows.length - 1]) === null || _b === void 0 ? void 0 : _b.cells[0]) === null || _c === void 0 ? void 0 : _c.blocks[0];
27
+ if (markerParagraph.blockType == 'Paragraph') {
28
+ var marker = (0, roosterjs_content_model_dom_1.createSelectionMarker)(model.format);
29
+ markerParagraph.segments.unshift(marker);
30
+ (0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(markerParagraph);
31
+ (0, roosterjs_content_model_dom_1.setSelection)(tableModel.rows[tableModel.rows.length - 1].cells[0], marker);
32
+ }
33
+ rawEvent.preventDefault();
34
+ return true;
35
+ }
36
+ return false;
37
+ }
38
+ exports.handleTabOnTableCell = handleTabOnTableCell;
39
+ });
40
+ //# sourceMappingURL=handleTabOnTableCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleTabOnTableCell.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnTableCell.ts"],"names":[],"mappings":";;;;IAUA;;;OAGG;IACH,SAAgB,oBAAoB,CAChC,KAA2B,EAC3B,IAA2B,EAC3B,QAAuB;;QAEvB,IAAM,UAAU,GAAG,IAAA,mDAAqB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,+CAA+C;QAC/C,IACI,CAAC,QAAQ,CAAC,QAAQ;YAClB,UAAU;YACV,CAAA,MAAA,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,MAAK,IAAI,EAC3F;YACE,IAAA,4CAAc,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;YAE1C,wBAAwB;YACxB,IAAA,gDAAkB,EAAC,UAAU,EAAE;gBAC3B,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;gBACpC,WAAW,EAAE,CAAC;gBACd,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;gBACnC,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;aAC3C,CAAC,CAAC;YACH,IAAA,4CAAc,EAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAEzC,wDAAwD;YACxD,IAAM,eAAe,GAAG,MAAA,MAAA,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YACzF,IAAI,eAAe,CAAC,SAAS,IAAI,WAAW,EAAE;gBAC1C,IAAM,MAAM,GAAG,IAAA,mDAAqB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAEnD,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACzC,IAAA,qDAAuB,EAAC,eAAe,CAAC,CAAC;gBACzC,IAAA,0CAAY,EAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;aAC9E;YAED,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAtCD,oDAsCC","sourcesContent":["import { clearSelectedCells, insertTableRow } from 'roosterjs-content-model-api';\nimport {\n createSelectionMarker,\n getFirstSelectedTable,\n normalizeTable,\n setParagraphNotImplicit,\n setSelection,\n} from 'roosterjs-content-model-dom';\nimport type { ContentModelDocument, ContentModelTableCell } from 'roosterjs-content-model-types';\n\n/**\n * When the cursor is on the last cell of a table, add new row and focus first new cell.\n * @internal\n */\nexport function handleTabOnTableCell(\n model: ContentModelDocument,\n cell: ContentModelTableCell,\n rawEvent: KeyboardEvent\n) {\n const tableModel = getFirstSelectedTable(model)[0];\n // Check if cursor is on last cell of the table\n if (\n !rawEvent.shiftKey &&\n tableModel &&\n tableModel.rows[tableModel.rows.length - 1]?.cells[tableModel.widths.length - 1] === cell\n ) {\n insertTableRow(tableModel, 'insertBelow');\n\n // Clear Table selection\n clearSelectedCells(tableModel, {\n firstRow: tableModel.rows.length - 1,\n firstColumn: 0,\n lastRow: tableModel.rows.length - 1,\n lastColumn: tableModel.widths.length - 1,\n });\n normalizeTable(tableModel, model.format);\n\n // Add selection marker to the first cell of the new row\n const markerParagraph = tableModel.rows[tableModel.rows.length - 1]?.cells[0]?.blocks[0];\n if (markerParagraph.blockType == 'Paragraph') {\n const marker = createSelectionMarker(model.format);\n\n markerParagraph.segments.unshift(marker);\n setParagraphNotImplicit(markerParagraph);\n setSelection(tableModel.rows[tableModel.rows.length - 1].cells[0], marker);\n }\n\n rawEvent.preventDefault();\n return true;\n }\n\n return false;\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import type { HyperlinkToolTip } from './HyperlinkToolTip';
2
+ import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
3
+ /**
4
+ * Hyperlink plugin does the following jobs for a hyperlink in editor:
5
+ * 1. When hover on a link, show a tool tip
6
+ * 2. When Ctrl+Click on a link, open a new window with the link
7
+ * 3. When type directly on a link whose text matches its link url, update the link url with the link text
8
+ */
9
+ export declare class HyperlinkPlugin implements EditorPlugin {
10
+ private tooltip;
11
+ private target?;
12
+ private onLinkClick?;
13
+ private editor;
14
+ private domHelper;
15
+ private isMac;
16
+ private disposer;
17
+ private currentNode;
18
+ private currentLink;
19
+ /**
20
+ * Create a new instance of HyperLink class
21
+ * @param tooltip Tooltip to show when mouse hover over a link
22
+ * Default value is to return the href itself. If null, there will be no tooltip text.
23
+ * @param target (Optional) Target window name for hyperlink. If null, will use "_blank"
24
+ * @param onLinkClick (Optional) Open link callback (return false to use default behavior)
25
+ */
26
+ constructor(tooltip?: HyperlinkToolTip, target?: string | undefined, onLinkClick?: ((anchor: HTMLAnchorElement, mouseEvent: MouseEvent) => boolean | void) | undefined);
27
+ /**
28
+ * Get a friendly name of this plugin
29
+ */
30
+ getName(): string;
31
+ /**
32
+ * Initialize this plugin
33
+ * @param editor The editor instance
34
+ */
35
+ initialize(editor: IEditor): void;
36
+ /**
37
+ * Dispose this plugin
38
+ */
39
+ dispose(): void;
40
+ /**
41
+ * Handle events triggered from editor
42
+ * @param event PluginEvent object
43
+ */
44
+ onPluginEvent(event: PluginEvent): void;
45
+ protected onMouse: (e: Event) => void;
46
+ private runWithHyperlink;
47
+ private isCtrlOrMetaPressed;
48
+ }
@@ -0,0 +1,142 @@
1
+ define(["require", "exports", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_api_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HyperlinkPlugin = void 0;
5
+ var defaultToolTipCallback = function (url) { return url; };
6
+ /**
7
+ * Hyperlink plugin does the following jobs for a hyperlink in editor:
8
+ * 1. When hover on a link, show a tool tip
9
+ * 2. When Ctrl+Click on a link, open a new window with the link
10
+ * 3. When type directly on a link whose text matches its link url, update the link url with the link text
11
+ */
12
+ var HyperlinkPlugin = /** @class */ (function () {
13
+ /**
14
+ * Create a new instance of HyperLink class
15
+ * @param tooltip Tooltip to show when mouse hover over a link
16
+ * Default value is to return the href itself. If null, there will be no tooltip text.
17
+ * @param target (Optional) Target window name for hyperlink. If null, will use "_blank"
18
+ * @param onLinkClick (Optional) Open link callback (return false to use default behavior)
19
+ */
20
+ function HyperlinkPlugin(tooltip, target, onLinkClick) {
21
+ var _this = this;
22
+ if (tooltip === void 0) { tooltip = defaultToolTipCallback; }
23
+ this.tooltip = tooltip;
24
+ this.target = target;
25
+ this.onLinkClick = onLinkClick;
26
+ this.editor = null;
27
+ this.domHelper = null;
28
+ this.isMac = false;
29
+ this.disposer = null;
30
+ this.currentNode = null;
31
+ this.currentLink = null;
32
+ this.onMouse = function (e) {
33
+ _this.runWithHyperlink(e.target, function (href, a) {
34
+ var _a;
35
+ var tooltip = e.type == 'mouseover'
36
+ ? typeof _this.tooltip == 'function'
37
+ ? _this.tooltip(href, a)
38
+ : _this.tooltip
39
+ : null;
40
+ (_a = _this.domHelper) === null || _a === void 0 ? void 0 : _a.setDomAttribute('title', tooltip);
41
+ });
42
+ };
43
+ }
44
+ /**
45
+ * Get a friendly name of this plugin
46
+ */
47
+ HyperlinkPlugin.prototype.getName = function () {
48
+ return 'Hyperlink';
49
+ };
50
+ /**
51
+ * Initialize this plugin
52
+ * @param editor The editor instance
53
+ */
54
+ HyperlinkPlugin.prototype.initialize = function (editor) {
55
+ this.editor = editor;
56
+ this.domHelper = editor.getDOMHelper();
57
+ this.isMac = !!editor.getEnvironment().isMac;
58
+ this.disposer = editor.attachDomEvent({
59
+ mouseover: { beforeDispatch: this.onMouse },
60
+ mouseout: { beforeDispatch: this.onMouse },
61
+ });
62
+ };
63
+ /**
64
+ * Dispose this plugin
65
+ */
66
+ HyperlinkPlugin.prototype.dispose = function () {
67
+ if (this.disposer) {
68
+ this.disposer();
69
+ this.disposer = null;
70
+ }
71
+ this.currentNode = null;
72
+ this.currentLink = null;
73
+ this.editor = null;
74
+ };
75
+ /**
76
+ * Handle events triggered from editor
77
+ * @param event PluginEvent object
78
+ */
79
+ HyperlinkPlugin.prototype.onPluginEvent = function (event) {
80
+ var _this = this;
81
+ var _a, _b;
82
+ var matchedLink;
83
+ if (event.eventType == 'keyDown') {
84
+ var selection = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getDOMSelection();
85
+ var node_1 = (selection === null || selection === void 0 ? void 0 : selection.type) == 'range' ? selection.range.commonAncestorContainer : null;
86
+ if (node_1 && node_1 != this.currentNode) {
87
+ this.currentNode = node_1;
88
+ this.currentLink = null;
89
+ this.runWithHyperlink(node_1, function (href, a) {
90
+ if (node_1.textContent &&
91
+ (matchedLink = (0, roosterjs_content_model_api_1.matchLink)(node_1.textContent)) &&
92
+ matchedLink.normalizedUrl == href) {
93
+ _this.currentLink = a;
94
+ }
95
+ });
96
+ }
97
+ }
98
+ else if (event.eventType == 'keyUp') {
99
+ var selection = (_b = this.editor) === null || _b === void 0 ? void 0 : _b.getDOMSelection();
100
+ var node = (selection === null || selection === void 0 ? void 0 : selection.type) == 'range' ? selection.range.commonAncestorContainer : null;
101
+ if (node &&
102
+ node == this.currentNode &&
103
+ this.currentLink &&
104
+ this.currentLink.contains(node) &&
105
+ node.textContent &&
106
+ (matchedLink = (0, roosterjs_content_model_api_1.matchLink)(node.textContent))) {
107
+ this.currentLink.setAttribute('href', matchedLink.normalizedUrl);
108
+ }
109
+ }
110
+ else if (event.eventType == 'mouseUp' && event.isClicking) {
111
+ this.runWithHyperlink(event.rawEvent.target, function (href, anchor) {
112
+ var _a, _b;
113
+ if (!((_a = _this.onLinkClick) === null || _a === void 0 ? void 0 : _a.call(_this, anchor, event.rawEvent)) &&
114
+ _this.isCtrlOrMetaPressed(event.rawEvent) &&
115
+ event.rawEvent.button === 0) {
116
+ event.rawEvent.preventDefault();
117
+ var target = _this.target || '_blank';
118
+ var window_1 = (_b = _this.editor) === null || _b === void 0 ? void 0 : _b.getDocument().defaultView;
119
+ try {
120
+ window_1 === null || window_1 === void 0 ? void 0 : window_1.open(href, target);
121
+ }
122
+ catch (_c) { }
123
+ }
124
+ });
125
+ }
126
+ };
127
+ HyperlinkPlugin.prototype.runWithHyperlink = function (node, callback) {
128
+ var _a;
129
+ var a = (_a = this.domHelper) === null || _a === void 0 ? void 0 : _a.findClosestElementAncestor(node, 'a[href]');
130
+ var href = a === null || a === void 0 ? void 0 : a.getAttribute('href');
131
+ if (href && a) {
132
+ callback(href, a);
133
+ }
134
+ };
135
+ HyperlinkPlugin.prototype.isCtrlOrMetaPressed = function (event) {
136
+ return this.isMac ? event.metaKey : event.ctrlKey;
137
+ };
138
+ return HyperlinkPlugin;
139
+ }());
140
+ exports.HyperlinkPlugin = HyperlinkPlugin;
141
+ });
142
+ //# sourceMappingURL=HyperlinkPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperlinkPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/hyperlink/HyperlinkPlugin.ts"],"names":[],"mappings":";;;;IAUA,IAAM,sBAAsB,GAAqB,UAAC,GAAW,IAAK,OAAA,GAAG,EAAH,CAAG,CAAC;IAEtE;;;;;OAKG;IACH;QASI;;;;;;WAMG;QACH,yBACY,OAAkD,EAClD,MAAe,EACf,WAAmF;YAH/F,iBAII;YAHQ,wBAAA,EAAA,gC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,uBAAN,QAAM,CAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;yBAC9B;wBAAC,WAAM,GAAE;qBACb;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC;QAcO,0CAAgB,GAAxB,UAAyB,IAAU,EAAE,QAAsD;;YACvF,IAAM,CAAC,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,0BAA0B,CAChD,IAAI,EACJ,SAAS,CACgB,CAAC;YAC9B,IAAM,IAAI,GAAG,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,YAAY,CAAC,MAAM,CAAC,CAAC;YAErC,IAAI,IAAI,IAAI,CAAC,EAAE;gBACX,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aACrB;QACL,CAAC;QAEO,6CAAmB,GAA3B,UAA4B,KAAiC;YACzD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACtD,CAAC;QACL,sBAAC;IAAD,CAAC,AAjJD,IAiJC;IAjJY,0CAAe","sourcesContent":["import { matchLink } from 'roosterjs-content-model-api';\nimport type { HyperlinkToolTip } from './HyperlinkToolTip';\nimport type {\n DOMHelper,\n EditorPlugin,\n IEditor,\n PluginEvent,\n LinkData,\n} from 'roosterjs-content-model-types';\n\nconst defaultToolTipCallback: HyperlinkToolTip = (url: string) => url;\n\n/**\n * Hyperlink plugin does the following jobs for a hyperlink in editor:\n * 1. When hover on a link, show a tool tip\n * 2. When Ctrl+Click on a link, open a new window with the link\n * 3. When type directly on a link whose text matches its link url, update the link url with the link text\n */\nexport class HyperlinkPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private domHelper: DOMHelper | null = null;\n private isMac: boolean = false;\n private disposer: (() => void) | null = null;\n\n private currentNode: Node | null = null;\n private currentLink: HTMLAnchorElement | null = null;\n\n /**\n * Create a new instance of HyperLink class\n * @param tooltip Tooltip to show when mouse hover over a link\n * Default value is to return the href itself. If null, there will be no tooltip text.\n * @param target (Optional) Target window name for hyperlink. If null, will use \"_blank\"\n * @param onLinkClick (Optional) Open link callback (return false to use default behavior)\n */\n constructor(\n private tooltip: HyperlinkToolTip = defaultToolTipCallback,\n private target?: string,\n private onLinkClick?: (anchor: HTMLAnchorElement, mouseEvent: MouseEvent) => boolean | void\n ) {}\n\n /**\n * Get a friendly name of this plugin\n */\n getName() {\n return 'Hyperlink';\n }\n\n /**\n * Initialize this plugin\n * @param editor The editor instance\n */\n public initialize(editor: IEditor): void {\n this.editor = editor;\n this.domHelper = editor.getDOMHelper();\n this.isMac = !!editor.getEnvironment().isMac;\n this.disposer = editor.attachDomEvent({\n mouseover: { beforeDispatch: this.onMouse },\n mouseout: { beforeDispatch: this.onMouse },\n });\n }\n\n /**\n * Dispose this plugin\n */\n public dispose(): void {\n if (this.disposer) {\n this.disposer();\n this.disposer = null;\n }\n\n this.currentNode = null;\n this.currentLink = null;\n this.editor = null;\n }\n\n /**\n * Handle events triggered from editor\n * @param event PluginEvent object\n */\n public onPluginEvent(event: PluginEvent): void {\n let matchedLink: LinkData | null;\n\n if (event.eventType == 'keyDown') {\n const selection = this.editor?.getDOMSelection();\n const node =\n selection?.type == 'range' ? selection.range.commonAncestorContainer : null;\n\n if (node && node != this.currentNode) {\n this.currentNode = node;\n this.currentLink = null;\n\n this.runWithHyperlink(node, (href, a) => {\n if (\n node.textContent &&\n (matchedLink = matchLink(node.textContent)) &&\n matchedLink.normalizedUrl == href\n ) {\n this.currentLink = a;\n }\n });\n }\n } else if (event.eventType == 'keyUp') {\n const selection = this.editor?.getDOMSelection();\n const node =\n selection?.type == 'range' ? selection.range.commonAncestorContainer : null;\n\n if (\n node &&\n node == this.currentNode &&\n this.currentLink &&\n this.currentLink.contains(node) &&\n node.textContent &&\n (matchedLink = matchLink(node.textContent))\n ) {\n this.currentLink.setAttribute('href', matchedLink.normalizedUrl);\n }\n } else if (event.eventType == 'mouseUp' && event.isClicking) {\n this.runWithHyperlink(event.rawEvent.target as Node, (href, anchor) => {\n if (\n !this.onLinkClick?.(anchor, event.rawEvent) &&\n this.isCtrlOrMetaPressed(event.rawEvent) &&\n event.rawEvent.button === 0\n ) {\n event.rawEvent.preventDefault();\n\n const target = this.target || '_blank';\n const window = this.editor?.getDocument().defaultView;\n\n try {\n window?.open(href, target);\n } catch {}\n }\n });\n }\n }\n\n protected onMouse = (e: Event) => {\n this.runWithHyperlink(e.target as Node, (href, a) => {\n const tooltip =\n e.type == 'mouseover'\n ? typeof this.tooltip == 'function'\n ? this.tooltip(href, a)\n : this.tooltip\n : null;\n this.domHelper?.setDomAttribute('title', tooltip);\n });\n };\n\n private runWithHyperlink(node: Node, callback: (href: string, a: HTMLAnchorElement) => void) {\n const a = this.domHelper?.findClosestElementAncestor(\n node,\n 'a[href]'\n ) as HTMLAnchorElement | null;\n const href = a?.getAttribute('href');\n\n if (href && a) {\n callback(href, a);\n }\n }\n\n private isCtrlOrMetaPressed(event: KeyboardEvent | MouseEvent): boolean {\n return this.isMac ? event.metaKey : event.ctrlKey;\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A type to specify how to get a tool tip of hyperlink in editor
3
+ * string: Use this string as tooltip
4
+ * null: No tooltip
5
+ * function: Call this function to get a tooltip
6
+ */
7
+ export declare type HyperlinkToolTip = string | null | ((url: string, anchor: HTMLAnchorElement) => string);
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=HyperlinkToolTip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperlinkToolTip.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/hyperlink/HyperlinkToolTip.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A type to specify how to get a tool tip of hyperlink in editor\n * string: Use this string as tooltip\n * null: No tooltip\n * function: Call this function to get a tooltip\n */\nexport type HyperlinkToolTip = string | null | ((url: string, anchor: HTMLAnchorElement) => string);\n"]}
@@ -1,11 +1,19 @@
1
1
  export { TableEditPlugin } from './tableEdit/TableEditPlugin';
2
+ export { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';
2
3
  export { PastePlugin } from './paste/PastePlugin';
3
4
  export { EditPlugin } from './edit/EditPlugin';
4
5
  export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
5
- export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
6
+ export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoAlt, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
6
7
  export { ShortcutPlugin } from './shortcut/ShortcutPlugin';
7
8
  export { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';
8
9
  export { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';
9
10
  export { WatermarkPlugin } from './watermark/WatermarkPlugin';
10
11
  export { WatermarkFormat } from './watermark/WatermarkFormat';
11
12
  export { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';
13
+ export { HyperlinkPlugin } from './hyperlink/HyperlinkPlugin';
14
+ export { HyperlinkToolTip } from './hyperlink/HyperlinkToolTip';
15
+ export { PickerPlugin } from './picker/PickerPlugin';
16
+ export { PickerHelper } from './picker/PickerHelper';
17
+ export { PickerSelectionChangMode, PickerDirection, PickerHandler } from './picker/PickerHandler';
18
+ export { CustomReplacePlugin, CustomReplace } from './customReplace/CustomReplacePlugin';
19
+ export { getDOMInsertPointRect } from './pluginUtils/Rect/getDOMInsertPointRect';
package/lib-amd/index.js CHANGED
@@ -1,7 +1,7 @@
1
- define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugin", "./edit/EditPlugin", "./autoFormat/AutoFormatPlugin", "./shortcut/shortcuts", "./shortcut/ShortcutPlugin", "./contextMenuBase/ContextMenuPluginBase", "./watermark/WatermarkPlugin", "./markdown/MarkdownPlugin"], function (require, exports, TableEditPlugin_1, PastePlugin_1, EditPlugin_1, AutoFormatPlugin_1, shortcuts_1, ShortcutPlugin_1, ContextMenuPluginBase_1, WatermarkPlugin_1, MarkdownPlugin_1) {
1
+ define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugin", "./edit/EditPlugin", "./autoFormat/AutoFormatPlugin", "./shortcut/shortcuts", "./shortcut/ShortcutPlugin", "./contextMenuBase/ContextMenuPluginBase", "./watermark/WatermarkPlugin", "./markdown/MarkdownPlugin", "./hyperlink/HyperlinkPlugin", "./picker/PickerPlugin", "./customReplace/CustomReplacePlugin", "./pluginUtils/Rect/getDOMInsertPointRect"], function (require, exports, TableEditPlugin_1, PastePlugin_1, EditPlugin_1, AutoFormatPlugin_1, shortcuts_1, ShortcutPlugin_1, ContextMenuPluginBase_1, WatermarkPlugin_1, MarkdownPlugin_1, HyperlinkPlugin_1, PickerPlugin_1, CustomReplacePlugin_1, getDOMInsertPointRect_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.MarkdownPlugin = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = exports.TableEditPlugin = void 0;
4
+ exports.getDOMInsertPointRect = exports.CustomReplacePlugin = exports.PickerPlugin = exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedoAlt = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = exports.TableEditPlugin = void 0;
5
5
  Object.defineProperty(exports, "TableEditPlugin", { enumerable: true, get: function () { return TableEditPlugin_1.TableEditPlugin; } });
6
6
  Object.defineProperty(exports, "PastePlugin", { enumerable: true, get: function () { return PastePlugin_1.PastePlugin; } });
7
7
  Object.defineProperty(exports, "EditPlugin", { enumerable: true, get: function () { return EditPlugin_1.EditPlugin; } });
@@ -13,6 +13,7 @@ define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugi
13
13
  Object.defineProperty(exports, "ShortcutUndo", { enumerable: true, get: function () { return shortcuts_1.ShortcutUndo; } });
14
14
  Object.defineProperty(exports, "ShortcutUndo2", { enumerable: true, get: function () { return shortcuts_1.ShortcutUndo2; } });
15
15
  Object.defineProperty(exports, "ShortcutRedo", { enumerable: true, get: function () { return shortcuts_1.ShortcutRedo; } });
16
+ Object.defineProperty(exports, "ShortcutRedoAlt", { enumerable: true, get: function () { return shortcuts_1.ShortcutRedoAlt; } });
16
17
  Object.defineProperty(exports, "ShortcutRedoMacOS", { enumerable: true, get: function () { return shortcuts_1.ShortcutRedoMacOS; } });
17
18
  Object.defineProperty(exports, "ShortcutBullet", { enumerable: true, get: function () { return shortcuts_1.ShortcutBullet; } });
18
19
  Object.defineProperty(exports, "ShortcutNumbering", { enumerable: true, get: function () { return shortcuts_1.ShortcutNumbering; } });
@@ -24,5 +25,9 @@ define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugi
24
25
  Object.defineProperty(exports, "ContextMenuPluginBase", { enumerable: true, get: function () { return ContextMenuPluginBase_1.ContextMenuPluginBase; } });
25
26
  Object.defineProperty(exports, "WatermarkPlugin", { enumerable: true, get: function () { return WatermarkPlugin_1.WatermarkPlugin; } });
26
27
  Object.defineProperty(exports, "MarkdownPlugin", { enumerable: true, get: function () { return MarkdownPlugin_1.MarkdownPlugin; } });
28
+ Object.defineProperty(exports, "HyperlinkPlugin", { enumerable: true, get: function () { return HyperlinkPlugin_1.HyperlinkPlugin; } });
29
+ Object.defineProperty(exports, "PickerPlugin", { enumerable: true, get: function () { return PickerPlugin_1.PickerPlugin; } });
30
+ Object.defineProperty(exports, "CustomReplacePlugin", { enumerable: true, get: function () { return CustomReplacePlugin_1.CustomReplacePlugin; } });
31
+ Object.defineProperty(exports, "getDOMInsertPointRect", { enumerable: true, get: function () { return getDOMInsertPointRect_1.getDOMInsertPointRect; } });
27
32
  });
28
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":";;;;IAAS,kHAAA,eAAe,OAAA;IACf,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,oHAAA,gBAAgB,OAAA;IAGrB,yGAAA,YAAY,OAAA;IACZ,2GAAA,cAAc,OAAA;IACd,8GAAA,iBAAiB,OAAA;IACjB,gHAAA,mBAAmB,OAAA;IACnB,yGAAA,YAAY,OAAA;IACZ,0GAAA,aAAa,OAAA;IACb,yGAAA,YAAY,OAAA;IACZ,8GAAA,iBAAiB,OAAA;IACjB,2GAAA,cAAc,OAAA;IACd,8GAAA,iBAAiB,OAAA;IACjB,iHAAA,oBAAoB,OAAA;IACpB,iHAAA,oBAAoB,OAAA;IACpB,+GAAA,kBAAkB,OAAA;IAClB,gHAAA,mBAAmB,OAAA;IAEd,gHAAA,cAAc,OAAA;IAEd,8HAAA,qBAAqB,OAAA;IACrB,kHAAA,eAAe,OAAA;IAEf,gHAAA,cAAc,OAAA","sourcesContent":["export { TableEditPlugin } from './tableEdit/TableEditPlugin';\nexport { PastePlugin } from './paste/PastePlugin';\nexport { EditPlugin } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n\nexport {\n ShortcutBold,\n ShortcutItalic,\n ShortcutUnderline,\n ShortcutClearFormat,\n ShortcutUndo,\n ShortcutUndo2,\n ShortcutRedo,\n ShortcutRedoMacOS,\n ShortcutBullet,\n ShortcutNumbering,\n ShortcutIncreaseFont,\n ShortcutDecreaseFont,\n ShortcutIndentList,\n ShortcutOutdentList,\n} from './shortcut/shortcuts';\nexport { ShortcutPlugin } from './shortcut/ShortcutPlugin';\nexport { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';\nexport { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';\nexport { WatermarkPlugin } from './watermark/WatermarkPlugin';\nexport { WatermarkFormat } from './watermark/WatermarkFormat';\nexport { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":";;;;IAAS,kHAAA,eAAe,OAAA;IAEf,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,oHAAA,gBAAgB,OAAA;IAGrB,yGAAA,YAAY,OAAA;IACZ,2GAAA,cAAc,OAAA;IACd,8GAAA,iBAAiB,OAAA;IACjB,gHAAA,mBAAmB,OAAA;IACnB,yGAAA,YAAY,OAAA;IACZ,0GAAA,aAAa,OAAA;IACb,yGAAA,YAAY,OAAA;IACZ,4GAAA,eAAe,OAAA;IACf,8GAAA,iBAAiB,OAAA;IACjB,2GAAA,cAAc,OAAA;IACd,8GAAA,iBAAiB,OAAA;IACjB,iHAAA,oBAAoB,OAAA;IACpB,iHAAA,oBAAoB,OAAA;IACpB,+GAAA,kBAAkB,OAAA;IAClB,gHAAA,mBAAmB,OAAA;IAEd,gHAAA,cAAc,OAAA;IAEd,8HAAA,qBAAqB,OAAA;IACrB,kHAAA,eAAe,OAAA;IAEf,gHAAA,cAAc,OAAA;IACd,kHAAA,eAAe,OAAA;IAEf,4GAAA,YAAY,OAAA;IAGZ,0HAAA,mBAAmB,OAAA;IAEnB,8HAAA,qBAAqB,OAAA","sourcesContent":["export { TableEditPlugin } from './tableEdit/TableEditPlugin';\nexport { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';\nexport { PastePlugin } from './paste/PastePlugin';\nexport { EditPlugin } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n\nexport {\n ShortcutBold,\n ShortcutItalic,\n ShortcutUnderline,\n ShortcutClearFormat,\n ShortcutUndo,\n ShortcutUndo2,\n ShortcutRedo,\n ShortcutRedoAlt,\n ShortcutRedoMacOS,\n ShortcutBullet,\n ShortcutNumbering,\n ShortcutIncreaseFont,\n ShortcutDecreaseFont,\n ShortcutIndentList,\n ShortcutOutdentList,\n} from './shortcut/shortcuts';\nexport { ShortcutPlugin } from './shortcut/ShortcutPlugin';\nexport { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';\nexport { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';\nexport { WatermarkPlugin } from './watermark/WatermarkPlugin';\nexport { WatermarkFormat } from './watermark/WatermarkFormat';\nexport { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';\nexport { HyperlinkPlugin } from './hyperlink/HyperlinkPlugin';\nexport { HyperlinkToolTip } from './hyperlink/HyperlinkToolTip';\nexport { PickerPlugin } from './picker/PickerPlugin';\nexport { PickerHelper } from './picker/PickerHelper';\nexport { PickerSelectionChangMode, PickerDirection, PickerHandler } from './picker/PickerHandler';\nexport { CustomReplacePlugin, CustomReplace } from './customReplace/CustomReplacePlugin';\n\nexport { getDOMInsertPointRect } from './pluginUtils/Rect/getDOMInsertPointRect';\n"]}
@@ -1,11 +1,17 @@
1
- import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
1
+ import type { ContentModelCodeFormat, EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
2
2
  /**
3
+ *
3
4
  * Options for Markdown plugin
5
+ * - strikethrough: If true text between ~ will receive strikethrough format.
6
+ * - bold: If true text between * will receive bold format.
7
+ * - italic: If true text between _ will receive italic format.
8
+ * - codeFormat: If provided, text between ` will receive code format. If equal to {}, it will set the default code format.
4
9
  */
5
10
  export interface MarkdownOptions {
6
11
  strikethrough?: boolean;
7
12
  bold?: boolean;
8
13
  italic?: boolean;
14
+ codeFormat?: ContentModelCodeFormat;
9
15
  }
10
16
  /**
11
17
  * Markdown plugin handles markdown formatting, such as transforming * characters into bold text.
@@ -16,12 +22,14 @@ export declare class MarkdownPlugin implements EditorPlugin {
16
22
  private shouldBold;
17
23
  private shouldItalic;
18
24
  private shouldStrikethrough;
25
+ private shouldCode;
19
26
  private lastKeyTyped;
20
27
  /**
21
28
  * @param options An optional parameter that takes in an object of type MarkdownOptions, which includes the following properties:
22
- * - strikethrough: If true text between ~ will receive strikethrough format. Defaults to true.
23
- * - bold: If true text between * will receive bold format. Defaults to true.
24
- * - italic: If true text between _ will receive italic format. Defaults to true.
29
+ * - strikethrough: If true text between ~ will receive strikethrough format. Defaults to false.
30
+ * - bold: If true text between * will receive bold format. Defaults to false.
31
+ * - italic: If true text between _ will receive italic format. Defaults to false.
32
+ * - codeFormat: If provided, text between ` will receive code format. Defaults to undefined.
25
33
  */
26
34
  constructor(options?: MarkdownOptions);
27
35
  /**
@@ -52,4 +60,5 @@ export declare class MarkdownPlugin implements EditorPlugin {
52
60
  private handleKeyDownEvent;
53
61
  private handleBackspaceEvent;
54
62
  private handleContentChangedEvent;
63
+ private disableAllFeatures;
55
64
  }