roosterjs-content-model-plugins 0.26.4 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (479) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +11 -2
  2. package/lib/autoFormat/AutoFormatPlugin.js +24 -4
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
  4. package/lib/autoFormat/link/createLink.d.ts +5 -0
  5. package/lib/autoFormat/link/createLink.js +26 -0
  6. package/lib/autoFormat/link/createLink.js.map +1 -0
  7. package/lib/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  8. package/lib/autoFormat/link/createLinkAfterSpace.js +39 -0
  9. package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  10. package/lib/autoFormat/link/getLinkSegment.d.ts +5 -0
  11. package/lib/autoFormat/link/getLinkSegment.js +27 -0
  12. package/lib/autoFormat/link/getLinkSegment.js.map +1 -0
  13. package/lib/autoFormat/link/unlink.d.ts +5 -0
  14. package/lib/autoFormat/link/unlink.js +20 -0
  15. package/lib/autoFormat/link/unlink.js.map +1 -0
  16. package/lib/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  17. package/lib/autoFormat/list/getIndex.js.map +1 -0
  18. package/lib/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  19. package/lib/autoFormat/list/getListTypeStyle.js.map +1 -0
  20. package/lib/autoFormat/list/getNumberingListStyle.js.map +1 -0
  21. package/lib/autoFormat/list/keyboardListTrigger.d.ts +5 -0
  22. package/lib/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
  23. package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -0
  24. package/lib/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  25. package/lib/contextMenuBase/ContextMenuPluginBase.js +84 -0
  26. package/lib/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  27. package/lib/edit/EditPlugin.d.ts +3 -3
  28. package/lib/edit/EditPlugin.js +1 -1
  29. package/lib/edit/EditPlugin.js.map +1 -1
  30. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  31. package/lib/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
  32. package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  33. package/lib/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  34. package/lib/edit/deleteSteps/deleteEmptyQuote.js +60 -0
  35. package/lib/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  36. package/lib/edit/deleteSteps/deleteList.js +2 -1
  37. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  38. package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  39. package/lib/edit/handleKeyboardEventCommon.d.ts +2 -2
  40. package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
  41. package/lib/edit/inputSteps/handleEnterOnList.js +40 -10
  42. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
  43. package/lib/edit/keyboardDelete.d.ts +3 -3
  44. package/lib/edit/keyboardDelete.js +10 -2
  45. package/lib/edit/keyboardDelete.js.map +1 -1
  46. package/lib/edit/keyboardInput.d.ts +2 -2
  47. package/lib/edit/keyboardInput.js +2 -1
  48. package/lib/edit/keyboardInput.js.map +1 -1
  49. package/lib/edit/keyboardTab.d.ts +2 -2
  50. package/lib/edit/keyboardTab.js +19 -11
  51. package/lib/edit/keyboardTab.js.map +1 -1
  52. package/lib/edit/tabUtils/handleTabOnList.d.ts +7 -0
  53. package/lib/edit/tabUtils/handleTabOnList.js +34 -0
  54. package/lib/edit/tabUtils/handleTabOnList.js.map +1 -0
  55. package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
  56. package/lib/edit/tabUtils/handleTabOnParagraph.js +81 -0
  57. package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
  58. package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
  59. package/lib/index.d.ts +5 -0
  60. package/lib/index.js +22 -1
  61. package/lib/index.js.map +1 -1
  62. package/lib/paste/Excel/processPastedContentFromExcel.js +1 -1
  63. package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  64. package/lib/paste/PastePlugin.d.ts +2 -3
  65. package/lib/paste/PastePlugin.js +6 -7
  66. package/lib/paste/PastePlugin.js.map +1 -1
  67. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  68. package/lib/paste/WacComponents/constants.js.map +1 -1
  69. package/lib/paste/WacComponents/processPastedContentWacComponents.js +6 -6
  70. package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  71. package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
  72. package/lib/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  73. package/lib/paste/WordDesktop/getStyleMetadata.js +2 -1
  74. package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  75. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
  76. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  77. package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
  78. package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
  79. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  80. package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
  81. package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  82. package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  83. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  84. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  85. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  86. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  87. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  88. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  89. package/lib/paste/utils/addParser.d.ts +1 -1
  90. package/lib/paste/utils/addParser.js +2 -1
  91. package/lib/paste/utils/addParser.js.map +1 -1
  92. package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
  93. package/lib/paste/utils/getStyles.js.map +1 -1
  94. package/lib/paste/utils/linkParser.js.map +1 -1
  95. package/lib/paste/utils/setProcessor.js.map +1 -1
  96. package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  97. package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  98. package/lib/pluginUtils/CreateElement/createElement.d.ts +2 -2
  99. package/lib/pluginUtils/CreateElement/createElement.js +2 -1
  100. package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
  101. package/lib/pluginUtils/Disposable.d.ts +1 -1
  102. package/lib/pluginUtils/Disposable.js.map +1 -1
  103. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  104. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  105. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  106. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
  107. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  108. package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  109. package/lib/pluginUtils/Rect/getIntersectedRect.js +4 -3
  110. package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  111. package/lib/shortcut/ShortcutCommand.d.ts +44 -0
  112. package/lib/shortcut/ShortcutCommand.js +3 -0
  113. package/lib/shortcut/ShortcutCommand.js.map +1 -0
  114. package/lib/shortcut/ShortcutPlugin.d.ts +51 -0
  115. package/lib/shortcut/ShortcutPlugin.js +120 -0
  116. package/lib/shortcut/ShortcutPlugin.js.map +1 -0
  117. package/lib/shortcut/shortcuts.d.ts +85 -0
  118. package/lib/shortcut/shortcuts.js +211 -0
  119. package/lib/shortcut/shortcuts.js.map +1 -0
  120. package/lib/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  121. package/lib/shortcut/utils/setShortcutIndentationCommand.js +22 -0
  122. package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  123. package/lib/tableEdit/TableEditPlugin.d.ts +47 -0
  124. package/lib/tableEdit/TableEditPlugin.js +156 -0
  125. package/lib/tableEdit/TableEditPlugin.js.map +1 -0
  126. package/lib/tableEdit/editors/TableEditor.d.ts +73 -0
  127. package/lib/tableEdit/editors/TableEditor.js +294 -0
  128. package/lib/tableEdit/editors/TableEditor.js.map +1 -0
  129. package/lib/tableEdit/editors/features/CellResizer.d.ts +6 -0
  130. package/lib/tableEdit/editors/features/CellResizer.js +169 -0
  131. package/lib/tableEdit/editors/features/CellResizer.js.map +1 -0
  132. package/lib/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
  133. package/lib/tableEdit/editors/features/TableEditFeature.js +17 -0
  134. package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  135. package/lib/tableEdit/editors/features/TableInserter.d.ts +6 -0
  136. package/lib/tableEdit/editors/features/TableInserter.js +113 -0
  137. package/lib/tableEdit/editors/features/TableInserter.js.map +1 -0
  138. package/lib/tableEdit/editors/features/TableMover.d.ts +8 -0
  139. package/lib/tableEdit/editors/features/TableMover.js +83 -0
  140. package/lib/tableEdit/editors/features/TableMover.js.map +1 -0
  141. package/lib/tableEdit/editors/features/TableResizer.d.ts +6 -0
  142. package/lib/tableEdit/editors/features/TableResizer.js +166 -0
  143. package/lib/tableEdit/editors/features/TableResizer.js.map +1 -0
  144. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +11 -2
  145. package/lib-amd/autoFormat/AutoFormatPlugin.js +21 -4
  146. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
  147. package/lib-amd/autoFormat/link/createLink.d.ts +5 -0
  148. package/lib-amd/autoFormat/link/createLink.js +26 -0
  149. package/lib-amd/autoFormat/link/createLink.js.map +1 -0
  150. package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  151. package/lib-amd/autoFormat/link/createLinkAfterSpace.js +38 -0
  152. package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  153. package/lib-amd/autoFormat/link/getLinkSegment.d.ts +5 -0
  154. package/lib-amd/autoFormat/link/getLinkSegment.js +27 -0
  155. package/lib-amd/autoFormat/link/getLinkSegment.js.map +1 -0
  156. package/lib-amd/autoFormat/link/unlink.d.ts +5 -0
  157. package/lib-amd/autoFormat/link/unlink.js +21 -0
  158. package/lib-amd/autoFormat/link/unlink.js.map +1 -0
  159. package/lib-amd/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  160. package/lib-amd/autoFormat/list/getIndex.js.map +1 -0
  161. package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  162. package/lib-amd/autoFormat/list/getListTypeStyle.js.map +1 -0
  163. package/lib-amd/autoFormat/list/getNumberingListStyle.js.map +1 -0
  164. package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +5 -0
  165. package/lib-amd/autoFormat/list/keyboardListTrigger.js +46 -0
  166. package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -0
  167. package/lib-amd/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  168. package/lib-amd/contextMenuBase/ContextMenuPluginBase.js +86 -0
  169. package/lib-amd/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  170. package/lib-amd/edit/EditPlugin.d.ts +3 -3
  171. package/lib-amd/edit/EditPlugin.js +1 -1
  172. package/lib-amd/edit/EditPlugin.js.map +1 -1
  173. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  174. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +19 -1
  175. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  176. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  177. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js +60 -0
  178. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  179. package/lib-amd/edit/deleteSteps/deleteList.js +2 -1
  180. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  181. package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  182. package/lib-amd/edit/handleKeyboardEventCommon.d.ts +2 -2
  183. package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
  184. package/lib-amd/edit/inputSteps/handleEnterOnList.js +40 -10
  185. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
  186. package/lib-amd/edit/keyboardDelete.d.ts +3 -3
  187. package/lib-amd/edit/keyboardDelete.js +10 -3
  188. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  189. package/lib-amd/edit/keyboardInput.d.ts +2 -2
  190. package/lib-amd/edit/keyboardInput.js +2 -2
  191. package/lib-amd/edit/keyboardInput.js.map +1 -1
  192. package/lib-amd/edit/keyboardTab.d.ts +2 -2
  193. package/lib-amd/edit/keyboardTab.js +18 -12
  194. package/lib-amd/edit/keyboardTab.js.map +1 -1
  195. package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +7 -0
  196. package/lib-amd/edit/tabUtils/handleTabOnList.js +34 -0
  197. package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -0
  198. package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
  199. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +81 -0
  200. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
  201. package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
  202. package/lib-amd/index.d.ts +5 -0
  203. package/lib-amd/index.js +19 -2
  204. package/lib-amd/index.js.map +1 -1
  205. package/lib-amd/paste/Excel/processPastedContentFromExcel.js +1 -1
  206. package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  207. package/lib-amd/paste/PastePlugin.d.ts +2 -3
  208. package/lib-amd/paste/PastePlugin.js +6 -7
  209. package/lib-amd/paste/PastePlugin.js.map +1 -1
  210. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  211. package/lib-amd/paste/WacComponents/constants.js.map +1 -1
  212. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +6 -6
  213. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  214. package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
  215. package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  216. package/lib-amd/paste/WordDesktop/getStyleMetadata.js +2 -1
  217. package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  218. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
  219. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  220. package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
  221. package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
  222. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  223. package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
  224. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  225. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  226. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  227. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  228. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  229. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  230. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  231. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  232. package/lib-amd/paste/utils/addParser.d.ts +1 -1
  233. package/lib-amd/paste/utils/addParser.js +2 -1
  234. package/lib-amd/paste/utils/addParser.js.map +1 -1
  235. package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
  236. package/lib-amd/paste/utils/getStyles.js.map +1 -1
  237. package/lib-amd/paste/utils/linkParser.js.map +1 -1
  238. package/lib-amd/paste/utils/setProcessor.js.map +1 -1
  239. package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  240. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  241. package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +2 -2
  242. package/lib-amd/pluginUtils/CreateElement/createElement.js +2 -1
  243. package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
  244. package/lib-amd/pluginUtils/Disposable.d.ts +1 -1
  245. package/lib-amd/pluginUtils/Disposable.js.map +1 -1
  246. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  247. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  248. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  249. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
  250. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  251. package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  252. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +4 -3
  253. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  254. package/lib-amd/shortcut/ShortcutCommand.d.ts +44 -0
  255. package/lib-amd/shortcut/ShortcutCommand.js +5 -0
  256. package/lib-amd/shortcut/ShortcutCommand.js.map +1 -0
  257. package/lib-amd/shortcut/ShortcutPlugin.d.ts +51 -0
  258. package/lib-amd/shortcut/ShortcutPlugin.js +120 -0
  259. package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -0
  260. package/lib-amd/shortcut/shortcuts.d.ts +85 -0
  261. package/lib-amd/shortcut/shortcuts.js +210 -0
  262. package/lib-amd/shortcut/shortcuts.js.map +1 -0
  263. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  264. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +22 -0
  265. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  266. package/lib-amd/tableEdit/TableEditPlugin.d.ts +47 -0
  267. package/lib-amd/tableEdit/TableEditPlugin.js +156 -0
  268. package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -0
  269. package/lib-amd/tableEdit/editors/TableEditor.d.ts +73 -0
  270. package/lib-amd/tableEdit/editors/TableEditor.js +290 -0
  271. package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -0
  272. package/lib-amd/tableEdit/editors/features/CellResizer.d.ts +6 -0
  273. package/lib-amd/tableEdit/editors/features/CellResizer.js +166 -0
  274. package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -0
  275. package/lib-amd/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
  276. package/lib-amd/tableEdit/editors/features/TableEditFeature.js +19 -0
  277. package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  278. package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +6 -0
  279. package/lib-amd/tableEdit/editors/features/TableInserter.js +111 -0
  280. package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -0
  281. package/lib-amd/tableEdit/editors/features/TableMover.d.ts +8 -0
  282. package/lib-amd/tableEdit/editors/features/TableMover.js +81 -0
  283. package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -0
  284. package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +6 -0
  285. package/lib-amd/tableEdit/editors/features/TableResizer.js +164 -0
  286. package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -0
  287. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +11 -2
  288. package/lib-mjs/autoFormat/AutoFormatPlugin.js +24 -4
  289. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
  290. package/lib-mjs/autoFormat/link/createLink.d.ts +5 -0
  291. package/lib-mjs/autoFormat/link/createLink.js +22 -0
  292. package/lib-mjs/autoFormat/link/createLink.js.map +1 -0
  293. package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  294. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +35 -0
  295. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  296. package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +5 -0
  297. package/lib-mjs/autoFormat/link/getLinkSegment.js +23 -0
  298. package/lib-mjs/autoFormat/link/getLinkSegment.js.map +1 -0
  299. package/lib-mjs/autoFormat/link/unlink.d.ts +5 -0
  300. package/lib-mjs/autoFormat/link/unlink.js +16 -0
  301. package/lib-mjs/autoFormat/link/unlink.js.map +1 -0
  302. package/lib-mjs/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  303. package/lib-mjs/autoFormat/list/getIndex.js.map +1 -0
  304. package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  305. package/lib-mjs/autoFormat/list/getListTypeStyle.js.map +1 -0
  306. package/lib-mjs/autoFormat/list/getNumberingListStyle.js.map +1 -0
  307. package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +5 -0
  308. package/lib-mjs/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
  309. package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -0
  310. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  311. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js +81 -0
  312. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  313. package/lib-mjs/edit/EditPlugin.d.ts +3 -3
  314. package/lib-mjs/edit/EditPlugin.js +1 -1
  315. package/lib-mjs/edit/EditPlugin.js.map +1 -1
  316. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  317. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
  318. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  319. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  320. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js +56 -0
  321. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  322. package/lib-mjs/edit/deleteSteps/deleteList.js +2 -1
  323. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  324. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  325. package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +2 -2
  326. package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
  327. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +42 -12
  328. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
  329. package/lib-mjs/edit/keyboardDelete.d.ts +3 -3
  330. package/lib-mjs/edit/keyboardDelete.js +10 -2
  331. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  332. package/lib-mjs/edit/keyboardInput.d.ts +2 -2
  333. package/lib-mjs/edit/keyboardInput.js +2 -1
  334. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  335. package/lib-mjs/edit/keyboardTab.d.ts +2 -2
  336. package/lib-mjs/edit/keyboardTab.js +19 -11
  337. package/lib-mjs/edit/keyboardTab.js.map +1 -1
  338. package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +7 -0
  339. package/lib-mjs/edit/tabUtils/handleTabOnList.js +30 -0
  340. package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -0
  341. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
  342. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +77 -0
  343. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
  344. package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
  345. package/lib-mjs/index.d.ts +5 -0
  346. package/lib-mjs/index.js +4 -0
  347. package/lib-mjs/index.js.map +1 -1
  348. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +1 -1
  349. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  350. package/lib-mjs/paste/PastePlugin.d.ts +2 -3
  351. package/lib-mjs/paste/PastePlugin.js +1 -2
  352. package/lib-mjs/paste/PastePlugin.js.map +1 -1
  353. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  354. package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
  355. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +1 -1
  356. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  357. package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
  358. package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  359. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +1 -1
  360. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  361. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -14
  362. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  363. package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
  364. package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
  365. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  366. package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
  367. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  368. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  369. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  370. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  371. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  372. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  373. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  374. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  375. package/lib-mjs/paste/utils/addParser.d.ts +1 -1
  376. package/lib-mjs/paste/utils/addParser.js +1 -1
  377. package/lib-mjs/paste/utils/addParser.js.map +1 -1
  378. package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
  379. package/lib-mjs/paste/utils/getStyles.js.map +1 -1
  380. package/lib-mjs/paste/utils/linkParser.js.map +1 -1
  381. package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
  382. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  383. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  384. package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +2 -2
  385. package/lib-mjs/pluginUtils/CreateElement/createElement.js +1 -1
  386. package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
  387. package/lib-mjs/pluginUtils/Disposable.d.ts +1 -1
  388. package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
  389. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  390. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  391. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  392. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +1 -1
  393. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  394. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  395. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +2 -2
  396. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  397. package/lib-mjs/shortcut/ShortcutCommand.d.ts +44 -0
  398. package/lib-mjs/shortcut/ShortcutCommand.js +2 -0
  399. package/lib-mjs/shortcut/ShortcutCommand.js.map +1 -0
  400. package/lib-mjs/shortcut/ShortcutPlugin.d.ts +51 -0
  401. package/lib-mjs/shortcut/ShortcutPlugin.js +117 -0
  402. package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -0
  403. package/lib-mjs/shortcut/shortcuts.d.ts +85 -0
  404. package/lib-mjs/shortcut/shortcuts.js +208 -0
  405. package/lib-mjs/shortcut/shortcuts.js.map +1 -0
  406. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  407. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +18 -0
  408. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  409. package/lib-mjs/tableEdit/TableEditPlugin.d.ts +47 -0
  410. package/lib-mjs/tableEdit/TableEditPlugin.js +153 -0
  411. package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -0
  412. package/lib-mjs/tableEdit/editors/TableEditor.d.ts +73 -0
  413. package/lib-mjs/tableEdit/editors/TableEditor.js +291 -0
  414. package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -0
  415. package/lib-mjs/tableEdit/editors/features/CellResizer.d.ts +6 -0
  416. package/lib-mjs/tableEdit/editors/features/CellResizer.js +165 -0
  417. package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -0
  418. package/lib-mjs/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
  419. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +13 -0
  420. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  421. package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +6 -0
  422. package/lib-mjs/tableEdit/editors/features/TableInserter.js +109 -0
  423. package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -0
  424. package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +8 -0
  425. package/lib-mjs/tableEdit/editors/features/TableMover.js +79 -0
  426. package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -0
  427. package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +6 -0
  428. package/lib-mjs/tableEdit/editors/features/TableResizer.js +162 -0
  429. package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -0
  430. package/package.json +5 -5
  431. package/lib/autoFormat/keyboardListTrigger.d.ts +0 -5
  432. package/lib/autoFormat/keyboardListTrigger.js.map +0 -1
  433. package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  434. package/lib/autoFormat/utils/getIndex.js.map +0 -1
  435. package/lib/autoFormat/utils/getListTypeStyle.js.map +0 -1
  436. package/lib/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  437. package/lib/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  438. package/lib/pluginUtils/Rect/normalizeRect.js +0 -20
  439. package/lib/pluginUtils/Rect/normalizeRect.js.map +0 -1
  440. package/lib-amd/autoFormat/keyboardListTrigger.d.ts +0 -5
  441. package/lib-amd/autoFormat/keyboardListTrigger.js +0 -44
  442. package/lib-amd/autoFormat/keyboardListTrigger.js.map +0 -1
  443. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  444. package/lib-amd/autoFormat/utils/getIndex.js.map +0 -1
  445. package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +0 -1
  446. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  447. package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  448. package/lib-amd/pluginUtils/Rect/normalizeRect.js +0 -22
  449. package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +0 -1
  450. package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +0 -5
  451. package/lib-mjs/autoFormat/keyboardListTrigger.js.map +0 -1
  452. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  453. package/lib-mjs/autoFormat/utils/getIndex.js.map +0 -1
  454. package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +0 -1
  455. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  456. package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  457. package/lib-mjs/pluginUtils/Rect/normalizeRect.js +0 -17
  458. package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +0 -1
  459. /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  460. /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  461. /package/lib/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  462. /package/lib/autoFormat/{utils → list}/getIndex.js +0 -0
  463. /package/lib/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  464. /package/lib/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  465. /package/lib/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  466. /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  467. /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  468. /package/lib-amd/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  469. /package/lib-amd/autoFormat/{utils → list}/getIndex.js +0 -0
  470. /package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  471. /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  472. /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  473. /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  474. /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  475. /package/lib-mjs/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  476. /package/lib-mjs/autoFormat/{utils → list}/getIndex.js +0 -0
  477. /package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  478. /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  479. /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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 = void 0;
4
+ var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
+ var setShortcutIndentationCommand_1 = require("./utils/setShortcutIndentationCommand");
6
+ var roosterjs_content_model_api_1 = require("roosterjs-content-model-api");
7
+ var Keys;
8
+ (function (Keys) {
9
+ Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
10
+ Keys[Keys["SPACE"] = 32] = "SPACE";
11
+ Keys[Keys["B"] = 66] = "B";
12
+ Keys[Keys["I"] = 73] = "I";
13
+ Keys[Keys["U"] = 85] = "U";
14
+ Keys[Keys["Y"] = 89] = "Y";
15
+ Keys[Keys["Z"] = 90] = "Z";
16
+ Keys[Keys["COMMA"] = 188] = "COMMA";
17
+ Keys[Keys["PERIOD"] = 190] = "PERIOD";
18
+ Keys[Keys["FORWARD_SLASH"] = 191] = "FORWARD_SLASH";
19
+ Keys[Keys["ArrowRight"] = 39] = "ArrowRight";
20
+ Keys[Keys["ArrowLeft"] = 37] = "ArrowLeft";
21
+ })(Keys || (Keys = {}));
22
+ /**
23
+ * Shortcut command for Bold
24
+ * Windows: Ctrl + B
25
+ * MacOS: Meta + B
26
+ */
27
+ exports.ShortcutBold = {
28
+ shortcutKey: {
29
+ modifierKey: 'ctrl',
30
+ shiftKey: false,
31
+ which: 66 /* B */,
32
+ },
33
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleBold)(editor); },
34
+ };
35
+ /**
36
+ * Shortcut command for Italic
37
+ * Windows: Ctrl + I
38
+ * MacOS: Meta + I
39
+ */
40
+ exports.ShortcutItalic = {
41
+ shortcutKey: {
42
+ modifierKey: 'ctrl',
43
+ shiftKey: false,
44
+ which: 73 /* I */,
45
+ },
46
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleItalic)(editor); },
47
+ };
48
+ /**
49
+ * Shortcut command for Underline
50
+ * Windows: Ctrl + U
51
+ * MacOS: Meta + U
52
+ */
53
+ exports.ShortcutUnderline = {
54
+ shortcutKey: {
55
+ modifierKey: 'ctrl',
56
+ shiftKey: false,
57
+ which: 85 /* U */,
58
+ },
59
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleUnderline)(editor); },
60
+ };
61
+ /**
62
+ * Shortcut command for Clear Format
63
+ * Windows: Ctrl + Space
64
+ * MacOS: Meta + Space
65
+ */
66
+ exports.ShortcutClearFormat = {
67
+ shortcutKey: {
68
+ modifierKey: 'ctrl',
69
+ shiftKey: false,
70
+ which: 32 /* SPACE */,
71
+ },
72
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.clearFormat)(editor); },
73
+ };
74
+ /**
75
+ * Shortcut command for Undo 1
76
+ * Windows: Ctrl + Z
77
+ * MacOS: Meta + Z
78
+ */
79
+ exports.ShortcutUndo = {
80
+ shortcutKey: {
81
+ modifierKey: 'ctrl',
82
+ shiftKey: false,
83
+ which: 90 /* Z */,
84
+ },
85
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.undo)(editor); },
86
+ };
87
+ /**
88
+ * Shortcut command for Undo 2
89
+ * Windows: Alt + Backspace
90
+ * MacOS: N/A
91
+ */
92
+ exports.ShortcutUndo2 = {
93
+ shortcutKey: {
94
+ modifierKey: 'alt',
95
+ shiftKey: false,
96
+ which: 8 /* BACKSPACE */,
97
+ },
98
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.undo)(editor); },
99
+ environment: 'nonMac',
100
+ };
101
+ /**
102
+ * Shortcut command for Redo 1
103
+ * Windows: Ctrl + Y
104
+ * MacOS: N/A
105
+ */
106
+ exports.ShortcutRedo = {
107
+ shortcutKey: {
108
+ modifierKey: 'ctrl',
109
+ shiftKey: false,
110
+ which: 89 /* Y */,
111
+ },
112
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.redo)(editor); },
113
+ environment: 'nonMac',
114
+ };
115
+ /**
116
+ * Shortcut command for Redo 2
117
+ * Windows: N/A
118
+ * MacOS: Meta + Shift + Z
119
+ */
120
+ exports.ShortcutRedoMacOS = {
121
+ shortcutKey: {
122
+ modifierKey: 'ctrl',
123
+ shiftKey: true,
124
+ which: 90 /* Z */,
125
+ },
126
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.redo)(editor); },
127
+ environment: 'mac',
128
+ };
129
+ /**
130
+ * Shortcut command for Bullet List
131
+ * Windows: Ctrl + . (Period)
132
+ * MacOS: Meta + . (Period)
133
+ */
134
+ exports.ShortcutBullet = {
135
+ shortcutKey: {
136
+ modifierKey: 'ctrl',
137
+ shiftKey: false,
138
+ which: 190 /* PERIOD */,
139
+ },
140
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleBullet)(editor); },
141
+ };
142
+ /**
143
+ * Shortcut command for Numbering List
144
+ * Windows: Ctrl + / (Forward slash)
145
+ * MacOS: Meta + / (Forward slash)
146
+ */
147
+ exports.ShortcutNumbering = {
148
+ shortcutKey: {
149
+ modifierKey: 'ctrl',
150
+ shiftKey: false,
151
+ which: 191 /* FORWARD_SLASH */,
152
+ },
153
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleNumbering)(editor); },
154
+ };
155
+ /**
156
+ * Shortcut command for Increase Font
157
+ * Windows: Ctrl + Shift + . (Period)
158
+ * MacOS: Meta + Shift + . (Period)
159
+ */
160
+ exports.ShortcutIncreaseFont = {
161
+ shortcutKey: {
162
+ modifierKey: 'ctrl',
163
+ shiftKey: true,
164
+ which: 190 /* PERIOD */,
165
+ },
166
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.changeFontSize)(editor, 'increase'); },
167
+ };
168
+ /**
169
+ * Shortcut command for Decrease Font
170
+ * Windows: Ctrl + Shift + , (Comma)
171
+ * MacOS: Meta + Shift + , (Comma)
172
+ */
173
+ exports.ShortcutDecreaseFont = {
174
+ shortcutKey: {
175
+ modifierKey: 'ctrl',
176
+ shiftKey: true,
177
+ which: 188 /* COMMA */,
178
+ },
179
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.changeFontSize)(editor, 'decrease'); },
180
+ };
181
+ /**
182
+ * Shortcut command for Intent list
183
+ * Windows: Alt + Shift + Arrow Right
184
+ * MacOS: Option + Shift+ Arrow Right
185
+ */
186
+ exports.ShortcutIndentList = {
187
+ shortcutKey: {
188
+ modifierKey: 'alt',
189
+ shiftKey: true,
190
+ which: 39 /* ArrowRight */,
191
+ },
192
+ onClick: function (editor) {
193
+ (0, setShortcutIndentationCommand_1.setShortcutIndentationCommand)(editor, 'indent');
194
+ },
195
+ };
196
+ /**
197
+ * Shortcut command for Outdent list
198
+ * Windows: Alt + Shift + Arrow Left
199
+ * MacOS: Option + Shift+ Arrow Left
200
+ */
201
+ exports.ShortcutOutdentList = {
202
+ shortcutKey: {
203
+ modifierKey: 'alt',
204
+ shiftKey: true,
205
+ which: 37 /* ArrowLeft */,
206
+ },
207
+ onClick: function (editor) {
208
+ (0, setShortcutIndentationCommand_1.setShortcutIndentationCommand)(editor, 'outdent');
209
+ },
210
+ };
211
+ //# sourceMappingURL=shortcuts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/shortcuts.ts"],"names":[],"mappings":";;;AAAA,6EAA0D;AAC1D,uFAAsF;AACtF,2EAQqC;AAGrC,IAAW,IAaV;AAbD,WAAW,IAAI;IACX,yCAAa,CAAA;IACb,kCAAU,CAAA;IACV,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,0BAAM,CAAA;IACN,mCAAW,CAAA;IACX,qCAAY,CAAA;IACZ,mDAAmB,CAAA;IACnB,4C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IG;AACU,QAAA,oBAAoB,GAAoB;IACjD,WAAW,EAAE;QACT,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,IAAI;QACd,KAAK,kBAAa;KACrB;IACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,4CAAc,EAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;CACxD,CAAC;AAEF;;;;GAIG;AACU,QAAA,oBAAoB,GAAoB;IACjD,WAAW,EAAE;QACT,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,IAAI;QACd,KAAK,iBAAY;KACpB;IACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,4CAAc,EAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;CACxD,CAAC;AAEF;;;;GAIG;AACU,QAAA,kBAAkB,GAAoB;IAC/C,WAAW,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,KAAK,qBAAiB;KACzB;IACD,OAAO,EAAE,UAAA,MAAM;QACX,IAAA,6DAA6B,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;CACJ,CAAC;AAEF;;;;GAIG;AACU,QAAA,mBAAmB,GAAoB;IAChD,WAAW,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,KAAK,oBAAgB;KACxB;IACD,OAAO,EAAE,UAAA,MAAM;QACX,IAAA,6DAA6B,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC;CACJ,CAAC","sourcesContent":["import { redo, undo } from 'roosterjs-content-model-core';\nimport { setShortcutIndentationCommand } from './utils/setShortcutIndentationCommand';\nimport {\n changeFontSize,\n clearFormat,\n toggleBold,\n toggleBullet,\n toggleItalic,\n toggleNumbering,\n toggleUnderline,\n} from 'roosterjs-content-model-api';\nimport type { ShortcutCommand } from './ShortcutCommand';\n\nconst enum Keys {\n BACKSPACE = 8,\n SPACE = 32,\n B = 66,\n I = 73,\n U = 85,\n Y = 89,\n Z = 90,\n COMMA = 188,\n PERIOD = 190,\n FORWARD_SLASH = 191,\n ArrowRight = 39,\n ArrowLeft = 37,\n}\n\n/**\n * Shortcut command for Bold\n * Windows: Ctrl + B\n * MacOS: Meta + B\n */\nexport const ShortcutBold: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.B,\n },\n onClick: editor => toggleBold(editor),\n};\n\n/**\n * Shortcut command for Italic\n * Windows: Ctrl + I\n * MacOS: Meta + I\n */\nexport const ShortcutItalic: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.I,\n },\n onClick: editor => toggleItalic(editor),\n};\n\n/**\n * Shortcut command for Underline\n * Windows: Ctrl + U\n * MacOS: Meta + U\n */\nexport const ShortcutUnderline: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.U,\n },\n onClick: editor => toggleUnderline(editor),\n};\n\n/**\n * Shortcut command for Clear Format\n * Windows: Ctrl + Space\n * MacOS: Meta + Space\n */\nexport const ShortcutClearFormat: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.SPACE,\n },\n onClick: editor => clearFormat(editor),\n};\n\n/**\n * Shortcut command for Undo 1\n * Windows: Ctrl + Z\n * MacOS: Meta + Z\n */\nexport const ShortcutUndo: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.Z,\n },\n onClick: editor => undo(editor),\n};\n\n/**\n * Shortcut command for Undo 2\n * Windows: Alt + Backspace\n * MacOS: N/A\n */\nexport const ShortcutUndo2: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'alt',\n shiftKey: false,\n which: Keys.BACKSPACE,\n },\n onClick: editor => undo(editor),\n environment: 'nonMac',\n};\n\n/**\n * Shortcut command for Redo 1\n * Windows: Ctrl + Y\n * MacOS: N/A\n */\nexport const ShortcutRedo: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.Y,\n },\n onClick: editor => redo(editor),\n environment: 'nonMac',\n};\n\n/**\n * Shortcut command for Redo 2\n * Windows: N/A\n * MacOS: Meta + Shift + Z\n */\nexport const ShortcutRedoMacOS: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: true,\n which: Keys.Z,\n },\n onClick: editor => redo(editor),\n environment: 'mac',\n};\n\n/**\n * Shortcut command for Bullet List\n * Windows: Ctrl + . (Period)\n * MacOS: Meta + . (Period)\n */\nexport const ShortcutBullet: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.PERIOD,\n },\n onClick: editor => toggleBullet(editor),\n};\n\n/**\n * Shortcut command for Numbering List\n * Windows: Ctrl + / (Forward slash)\n * MacOS: Meta + / (Forward slash)\n */\nexport const ShortcutNumbering: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: false,\n which: Keys.FORWARD_SLASH,\n },\n onClick: editor => toggleNumbering(editor),\n};\n\n/**\n * Shortcut command for Increase Font\n * Windows: Ctrl + Shift + . (Period)\n * MacOS: Meta + Shift + . (Period)\n */\nexport const ShortcutIncreaseFont: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: true,\n which: Keys.PERIOD,\n },\n onClick: editor => changeFontSize(editor, 'increase'),\n};\n\n/**\n * Shortcut command for Decrease Font\n * Windows: Ctrl + Shift + , (Comma)\n * MacOS: Meta + Shift + , (Comma)\n */\nexport const ShortcutDecreaseFont: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'ctrl',\n shiftKey: true,\n which: Keys.COMMA,\n },\n onClick: editor => changeFontSize(editor, 'decrease'),\n};\n\n/**\n * Shortcut command for Intent list\n * Windows: Alt + Shift + Arrow Right\n * MacOS: Option + Shift+ Arrow Right\n */\nexport const ShortcutIndentList: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'alt',\n shiftKey: true,\n which: Keys.ArrowRight,\n },\n onClick: editor => {\n setShortcutIndentationCommand(editor, 'indent');\n },\n};\n\n/**\n * Shortcut command for Outdent list\n * Windows: Alt + Shift + Arrow Left\n * MacOS: Option + Shift+ Arrow Left\n */\nexport const ShortcutOutdentList: ShortcutCommand = {\n shortcutKey: {\n modifierKey: 'alt',\n shiftKey: true,\n which: Keys.ArrowLeft,\n },\n onClick: editor => {\n setShortcutIndentationCommand(editor, 'outdent');\n },\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function setShortcutIndentationCommand(editor: IEditor, operation: 'indent' | 'outdent'): void;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setShortcutIndentationCommand = void 0;
4
+ var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
+ var roosterjs_content_model_api_1 = require("roosterjs-content-model-api");
6
+ /**
7
+ * @internal
8
+ */
9
+ function setShortcutIndentationCommand(editor, operation) {
10
+ editor.formatContentModel(function (model) {
11
+ var listItem = (0, roosterjs_content_model_core_1.getFirstSelectedListItem)(model);
12
+ if (listItem &&
13
+ listItem.blocks[0].blockType == 'Paragraph' &&
14
+ listItem.blocks[0].segments[0].segmentType == 'SelectionMarker') {
15
+ (0, roosterjs_content_model_api_1.setModelIndentation)(model, operation);
16
+ return true;
17
+ }
18
+ return false;
19
+ });
20
+ }
21
+ exports.setShortcutIndentationCommand = setShortcutIndentationCommand;
22
+ //# sourceMappingURL=setShortcutIndentationCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setShortcutIndentationCommand.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/shortcut/utils/setShortcutIndentationCommand.ts"],"names":[],"mappings":";;;AAAA,6EAAwE;AACxE,2EAAkE;AAGlE;;GAEG;AACH,SAAgB,6BAA6B,CAAC,MAAe,EAAE,SAA+B;IAC1F,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK;QAC3B,IAAM,QAAQ,GAAG,IAAA,uDAAwB,EAAC,KAAK,CAAC,CAAC;QAEjD,IACI,QAAQ;YACR,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,EACjE;YACE,IAAA,iDAAmB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAdD,sEAcC","sourcesContent":["import { getFirstSelectedListItem } from 'roosterjs-content-model-core';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function setShortcutIndentationCommand(editor: IEditor, operation: 'indent' | 'outdent') {\n editor.formatContentModel(model => {\n const listItem = getFirstSelectedListItem(model);\n\n if (\n listItem &&\n listItem.blocks[0].blockType == 'Paragraph' &&\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\n ) {\n setModelIndentation(model, operation);\n return true;\n }\n return false;\n });\n}\n"]}
@@ -0,0 +1,47 @@
1
+ import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
2
+ /**
3
+ * TableEdit plugin, provides the ability to resize a table by drag-and-drop
4
+ */
5
+ export declare class TableEditPlugin implements EditorPlugin {
6
+ private anchorContainerSelector?;
7
+ private editor;
8
+ private onMouseMoveDisposer;
9
+ private tableRectMap;
10
+ private tableEditor;
11
+ /**
12
+ * Construct a new instance of TableResize plugin
13
+ * @param anchorContainerSelector An optional selector string to specify the container to host the plugin.
14
+ * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.
15
+ * If not specified, the plugin will be inserted in document.body
16
+ */
17
+ constructor(anchorContainerSelector?: string | undefined);
18
+ /**
19
+ * Get a friendly name of this plugin
20
+ */
21
+ getName(): string;
22
+ /**
23
+ * Initialize this plugin. This should only be called from Editor
24
+ * @param editor Editor instance
25
+ */
26
+ initialize(editor: IEditor): void;
27
+ private onMouseOut;
28
+ /**
29
+ * Dispose this plugin
30
+ */
31
+ dispose(): void;
32
+ /**
33
+ * Handle events triggered from editor
34
+ * @param event PluginEvent object
35
+ */
36
+ onPluginEvent(e: PluginEvent): void;
37
+ private onMouseMove;
38
+ /**
39
+ * @internal Public only for unit test
40
+ * @param table Table to use when setting the Editors
41
+ * @param event (Optional) Mouse event
42
+ */
43
+ setTableEditor(table: HTMLTableElement | null, event?: MouseEvent): void;
44
+ private invalidateTableRects;
45
+ private disposeTableEditor;
46
+ private ensureTableRects;
47
+ }
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableEditPlugin = void 0;
4
+ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
5
+ var TableEditor_1 = require("./editors/TableEditor");
6
+ var TABLE_RESIZER_LENGTH = 12;
7
+ /**
8
+ * TableEdit plugin, provides the ability to resize a table by drag-and-drop
9
+ */
10
+ var TableEditPlugin = /** @class */ (function () {
11
+ /**
12
+ * Construct a new instance of TableResize plugin
13
+ * @param anchorContainerSelector An optional selector string to specify the container to host the plugin.
14
+ * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.
15
+ * If not specified, the plugin will be inserted in document.body
16
+ */
17
+ function TableEditPlugin(anchorContainerSelector) {
18
+ var _this = this;
19
+ this.anchorContainerSelector = anchorContainerSelector;
20
+ this.editor = null;
21
+ this.onMouseMoveDisposer = null;
22
+ this.tableRectMap = null;
23
+ this.tableEditor = null;
24
+ this.onMouseOut = function (_a) {
25
+ var relatedTarget = _a.relatedTarget, currentTarget = _a.currentTarget;
26
+ var relatedTargetNode = relatedTarget;
27
+ var currentTargetNode = currentTarget;
28
+ if ((0, roosterjs_content_model_dom_1.isNodeOfType)(relatedTargetNode, 'ELEMENT_NODE') &&
29
+ (0, roosterjs_content_model_dom_1.isNodeOfType)(currentTargetNode, 'ELEMENT_NODE') &&
30
+ _this.tableEditor &&
31
+ !_this.tableEditor.isOwnedElement(relatedTargetNode) &&
32
+ !currentTargetNode.contains(relatedTargetNode)) {
33
+ _this.setTableEditor(null);
34
+ }
35
+ };
36
+ this.onMouseMove = function (event) {
37
+ var _a;
38
+ var e = event;
39
+ if (e.buttons > 0 || !_this.editor) {
40
+ return;
41
+ }
42
+ _this.ensureTableRects();
43
+ var editorWindow = _this.editor.getDocument().defaultView || window;
44
+ var x = e.pageX - editorWindow.scrollX;
45
+ var y = e.pageY - editorWindow.scrollY;
46
+ var currentTable = null;
47
+ //Find table in range of mouse
48
+ if (_this.tableRectMap) {
49
+ for (var i = _this.tableRectMap.length - 1; i >= 0; i--) {
50
+ var _b = _this.tableRectMap[i], table = _b.table, rect = _b.rect;
51
+ if (x >= rect.left - TABLE_RESIZER_LENGTH &&
52
+ x <= rect.right + TABLE_RESIZER_LENGTH &&
53
+ y >= rect.top - TABLE_RESIZER_LENGTH &&
54
+ y <= rect.bottom + TABLE_RESIZER_LENGTH) {
55
+ currentTable = table;
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ _this.setTableEditor(currentTable, e);
61
+ (_a = _this.tableEditor) === null || _a === void 0 ? void 0 : _a.onMouseMove(x, y);
62
+ };
63
+ this.invalidateTableRects = function () {
64
+ _this.tableRectMap = null;
65
+ };
66
+ }
67
+ /**
68
+ * Get a friendly name of this plugin
69
+ */
70
+ TableEditPlugin.prototype.getName = function () {
71
+ return 'TableEdit';
72
+ };
73
+ /**
74
+ * Initialize this plugin. This should only be called from Editor
75
+ * @param editor Editor instance
76
+ */
77
+ TableEditPlugin.prototype.initialize = function (editor) {
78
+ this.editor = editor;
79
+ this.onMouseMoveDisposer = this.editor.attachDomEvent({
80
+ mousemove: { beforeDispatch: this.onMouseMove },
81
+ });
82
+ var scrollContainer = this.editor.getScrollContainer();
83
+ scrollContainer.addEventListener('mouseout', this.onMouseOut);
84
+ };
85
+ /**
86
+ * Dispose this plugin
87
+ */
88
+ TableEditPlugin.prototype.dispose = function () {
89
+ var _a, _b;
90
+ var scrollContainer = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getScrollContainer();
91
+ scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.removeEventListener('mouseout', this.onMouseOut);
92
+ (_b = this.onMouseMoveDisposer) === null || _b === void 0 ? void 0 : _b.call(this);
93
+ this.invalidateTableRects();
94
+ this.disposeTableEditor();
95
+ this.editor = null;
96
+ this.onMouseMoveDisposer = null;
97
+ };
98
+ /**
99
+ * Handle events triggered from editor
100
+ * @param event PluginEvent object
101
+ */
102
+ TableEditPlugin.prototype.onPluginEvent = function (e) {
103
+ switch (e.eventType) {
104
+ case 'input':
105
+ case 'contentChanged':
106
+ case 'scroll':
107
+ case 'zoomChanged':
108
+ this.setTableEditor(null);
109
+ this.invalidateTableRects();
110
+ break;
111
+ }
112
+ };
113
+ /**
114
+ * @internal Public only for unit test
115
+ * @param table Table to use when setting the Editors
116
+ * @param event (Optional) Mouse event
117
+ */
118
+ TableEditPlugin.prototype.setTableEditor = function (table, event) {
119
+ if (this.tableEditor && !this.tableEditor.isEditing() && table != this.tableEditor.table) {
120
+ this.disposeTableEditor();
121
+ }
122
+ if (!this.tableEditor && table && this.editor && table.rows.length > 0) {
123
+ // anchorContainerSelector is used to specify the container to host the plugin, which can be outside of the editor's div
124
+ var container = this.anchorContainerSelector
125
+ ? this.editor.getDocument().querySelector(this.anchorContainerSelector)
126
+ : undefined;
127
+ this.tableEditor = new TableEditor_1.TableEditor(this.editor, table, this.invalidateTableRects, (0, roosterjs_content_model_dom_1.isNodeOfType)(container, 'ELEMENT_NODE') ? container : undefined, event === null || event === void 0 ? void 0 : event.currentTarget);
128
+ }
129
+ };
130
+ TableEditPlugin.prototype.disposeTableEditor = function () {
131
+ var _a;
132
+ (_a = this.tableEditor) === null || _a === void 0 ? void 0 : _a.dispose();
133
+ this.tableEditor = null;
134
+ };
135
+ TableEditPlugin.prototype.ensureTableRects = function () {
136
+ var _this = this;
137
+ if (!this.tableRectMap && this.editor) {
138
+ this.tableRectMap = [];
139
+ var tables = this.editor.getDOMHelper().queryElements('table');
140
+ tables.forEach(function (table) {
141
+ if (table.isContentEditable) {
142
+ var rect = (0, roosterjs_content_model_dom_1.normalizeRect)(table.getBoundingClientRect());
143
+ if (rect && _this.tableRectMap) {
144
+ _this.tableRectMap.push({
145
+ table: table,
146
+ rect: rect,
147
+ });
148
+ }
149
+ }
150
+ });
151
+ }
152
+ };
153
+ return TableEditPlugin;
154
+ }());
155
+ exports.TableEditPlugin = TableEditPlugin;
156
+ //# sourceMappingURL=TableEditPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableEditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/tableEdit/TableEditPlugin.ts"],"names":[],"mappings":";;;AAAA,2EAA0E;AAC1E,qDAAoD;AAGpD,IAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;GAEG;AACH;IAMI;;;;;OAKG;IACH,yBAAoB,uBAAgC;QAApD,iBAAwD;QAApC,4BAAuB,GAAvB,uBAAuB,CAAS;QAX5C,WAAM,GAAmB,IAAI,CAAC;QAC9B,wBAAmB,GAAwB,IAAI,CAAC;QAChD,iBAAY,GAAqD,IAAI,CAAC;QACtE,gBAAW,GAAuB,IAAI,CAAC;QA8BvC,eAAU,GAAG,UAAC,EAA4C;gBAA1C,aAAa,mBAAA,EAAE,aAAa,mBAAA;YAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;YAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;YAChD,IACI,IAAA,0CAAY,EAAC,iBAAiB,EAAE,cAAc,CAAC;gBAC/C,IAAA,0CAAY,EAAC,iBAAiB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AC;IAEO,0CAAgB,GAAxB;QAAA,iBAiBC;QAhBG,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,EAAE;YACnC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;YAEvB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACjE,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;gBAChB,IAAI,KAAK,CAAC,iBAAiB,EAAE;oBACzB,IAAM,IAAI,GAAG,IAAA,2CAAa,EAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC;oBAC1D,IAAI,IAAI,IAAI,KAAI,CAAC,YAAY,EAAE;wBAC3B,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC;4BACnB,KAAK,OAAA;4BACL,IAAI,MAAA;yBACP,CAAC,CAAC;qBACN;iBACJ;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AArKD,IAqKC;AArKY,0CAAe","sourcesContent":["import { isNodeOfType, normalizeRect } from 'roosterjs-content-model-dom';\nimport { TableEditor } from './editors/TableEditor';\nimport type { EditorPlugin, IEditor, PluginEvent, Rect } from 'roosterjs-content-model-types';\n\nconst TABLE_RESIZER_LENGTH = 12;\n\n/**\n * TableEdit plugin, provides the ability to resize a table by drag-and-drop\n */\nexport class TableEditPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private onMouseMoveDisposer: (() => void) | null = null;\n private tableRectMap: { table: HTMLTableElement; rect: Rect }[] | null = null;\n private tableEditor: TableEditor | null = null;\n\n /**\n * Construct a new instance of TableResize plugin\n * @param anchorContainerSelector An optional selector string to specify the container to host the plugin.\n * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.\n * If not specified, the plugin will be inserted in document.body\n */\n constructor(private anchorContainerSelector?: string) {}\n\n /**\n * Get a friendly name of this plugin\n */\n getName() {\n return 'TableEdit';\n }\n\n /**\n * Initialize this plugin. This should only be called from Editor\n * @param editor Editor instance\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.onMouseMoveDisposer = this.editor.attachDomEvent({\n mousemove: { beforeDispatch: this.onMouseMove },\n });\n const scrollContainer = this.editor.getScrollContainer();\n scrollContainer.addEventListener('mouseout', this.onMouseOut);\n }\n\n private onMouseOut = ({ relatedTarget, currentTarget }: MouseEvent) => {\n const relatedTargetNode = relatedTarget as Node;\n const currentTargetNode = currentTarget as Node;\n if (\n isNodeOfType(relatedTargetNode, 'ELEMENT_NODE') &&\n isNodeOfType(currentTargetNode, 'ELEMENT_NODE') &&\n this.tableEditor &&\n !this.tableEditor.isOwnedElement(relatedTargetNode) &&\n !currentTargetNode.contains(relatedTargetNode)\n ) {\n this.setTableEditor(null);\n }\n };\n\n /**\n * Dispose this plugin\n */\n dispose() {\n const scrollContainer = this.editor?.getScrollContainer();\n scrollContainer?.removeEventListener('mouseout', this.onMouseOut);\n this.onMouseMoveDisposer?.();\n this.invalidateTableRects();\n this.disposeTableEditor();\n this.editor = null;\n this.onMouseMoveDisposer = null;\n }\n\n /**\n * Handle events triggered from editor\n * @param event PluginEvent object\n */\n onPluginEvent(e: PluginEvent) {\n switch (e.eventType) {\n case 'input':\n case 'contentChanged':\n case 'scroll':\n case 'zoomChanged':\n this.setTableEditor(null);\n this.invalidateTableRects();\n break;\n }\n }\n\n private onMouseMove = (event: Event) => {\n const e = event as MouseEvent;\n\n if (e.buttons > 0 || !this.editor) {\n return;\n }\n\n this.ensureTableRects();\n\n const editorWindow = this.editor.getDocument().defaultView || window;\n const x = e.pageX - editorWindow.scrollX;\n const y = e.pageY - editorWindow.scrollY;\n let currentTable: HTMLTableElement | null = null;\n\n //Find table in range of mouse\n if (this.tableRectMap) {\n for (let i = this.tableRectMap.length - 1; i >= 0; i--) {\n const { table, rect } = this.tableRectMap[i];\n\n if (\n x >= rect.left - TABLE_RESIZER_LENGTH &&\n x <= rect.right + TABLE_RESIZER_LENGTH &&\n y >= rect.top - TABLE_RESIZER_LENGTH &&\n y <= rect.bottom + TABLE_RESIZER_LENGTH\n ) {\n currentTable = table;\n break;\n }\n }\n }\n\n this.setTableEditor(currentTable, e);\n this.tableEditor?.onMouseMove(x, y);\n };\n\n /**\n * @internal Public only for unit test\n * @param table Table to use when setting the Editors\n * @param event (Optional) Mouse event\n */\n public setTableEditor(table: HTMLTableElement | null, event?: MouseEvent) {\n if (this.tableEditor && !this.tableEditor.isEditing() && table != this.tableEditor.table) {\n this.disposeTableEditor();\n }\n\n if (!this.tableEditor && table && this.editor && table.rows.length > 0) {\n // anchorContainerSelector is used to specify the container to host the plugin, which can be outside of the editor's div\n const container = this.anchorContainerSelector\n ? this.editor.getDocument().querySelector(this.anchorContainerSelector)\n : undefined;\n\n this.tableEditor = new TableEditor(\n this.editor,\n table,\n this.invalidateTableRects,\n isNodeOfType(container, 'ELEMENT_NODE') ? container : undefined,\n event?.currentTarget\n );\n }\n }\n\n private invalidateTableRects = () => {\n this.tableRectMap = null;\n };\n\n private disposeTableEditor() {\n this.tableEditor?.dispose();\n this.tableEditor = null;\n }\n\n private ensureTableRects() {\n if (!this.tableRectMap && this.editor) {\n this.tableRectMap = [];\n\n const tables = this.editor.getDOMHelper().queryElements('table');\n tables.forEach(table => {\n if (table.isContentEditable) {\n const rect = normalizeRect(table.getBoundingClientRect());\n if (rect && this.tableRectMap) {\n this.tableRectMap.push({\n table,\n rect,\n });\n }\n }\n });\n }\n }\n}\n"]}
@@ -0,0 +1,73 @@
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ *
5
+ * A table has 6 hot areas to be resized/edited (take LTR example):
6
+ *
7
+ * [6] [ ]
8
+ * +[ 1 ]+--------------------+
9
+ * |[ ]| |
10
+ * [ ] [ ] |
11
+ * [ ] [ ] |
12
+ * [2] [3] |
13
+ * [ ] [ ] |
14
+ * [ ][ 4 ]| |
15
+ * +------------------+--------------------+
16
+ * | | |
17
+ * | | |
18
+ * | | |
19
+ * +------------------+--------------------+
20
+ * [5]
21
+ *
22
+ * 1 - Hover area to show insert column button
23
+ * 2 - Hover area to show insert row button
24
+ * 3 - Hover area to show vertical resizing bar
25
+ * 4 - Hover area to show horizontal resizing bar
26
+ * 5 - Hover area to show whole table resize handle
27
+ * 6 - Hover area to show whole table mover handle
28
+ *
29
+ * When set a different current table or change current TD, we need to update these areas
30
+ */
31
+ export declare class TableEditor {
32
+ private editor;
33
+ readonly table: HTMLTableElement;
34
+ private onChanged;
35
+ private anchorContainer?;
36
+ private contentDiv?;
37
+ private horizontalInserter;
38
+ private verticalInserter;
39
+ private horizontalResizer;
40
+ private verticalResizer;
41
+ private tableResizer;
42
+ private tableMover;
43
+ private isRTL;
44
+ private range;
45
+ private isCurrentlyEditing;
46
+ constructor(editor: IEditor, table: HTMLTableElement, onChanged: () => void, anchorContainer?: HTMLElement | undefined, contentDiv?: EventTarget | null | undefined);
47
+ dispose(): void;
48
+ isEditing(): boolean;
49
+ isOwnedElement(node: Node): boolean;
50
+ onMouseMove(x: number, y: number): void;
51
+ private setEditorFeatures;
52
+ private setResizingTd;
53
+ /**
54
+ * create or remove TableInserter
55
+ * @param td td to attach to, set this to null to remove inserters (both horizontal and vertical)
56
+ */
57
+ private setInserterTd;
58
+ private disposeTableResizer;
59
+ private disposeTableInserter;
60
+ private disposeCellResizers;
61
+ private disposeTableMover;
62
+ private onFinishEditing;
63
+ private onStartTableResize;
64
+ private onStartCellResize;
65
+ private onStartResize;
66
+ private onInserted;
67
+ /**
68
+ * Public only for testing purposes
69
+ * @param table the table to select
70
+ */
71
+ onSelect: (table: HTMLTableElement) => void;
72
+ private getOnMouseOut;
73
+ }