roosterjs-content-model-plugins 0.27.0 → 0.28.1

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 (431) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +9 -0
  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/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
  22. package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -0
  23. package/lib/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  24. package/lib/contextMenuBase/ContextMenuPluginBase.js +84 -0
  25. package/lib/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  26. package/lib/edit/EditPlugin.js.map +1 -1
  27. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  28. package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  29. package/lib/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  30. package/lib/edit/deleteSteps/deleteEmptyQuote.js +60 -0
  31. package/lib/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  32. package/lib/edit/deleteSteps/deleteList.js +2 -1
  33. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  34. package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  35. package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
  36. package/lib/edit/inputSteps/handleEnterOnList.js +1 -1
  37. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
  38. package/lib/edit/keyboardDelete.js +9 -1
  39. package/lib/edit/keyboardDelete.js.map +1 -1
  40. package/lib/edit/keyboardInput.js +2 -1
  41. package/lib/edit/keyboardInput.js.map +1 -1
  42. package/lib/edit/keyboardTab.js.map +1 -1
  43. package/lib/edit/tabUtils/handleTabOnList.js.map +1 -1
  44. package/lib/edit/tabUtils/handleTabOnParagraph.js +7 -0
  45. package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  46. package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
  47. package/lib/index.d.ts +2 -1
  48. package/lib/index.js +5 -1
  49. package/lib/index.js.map +1 -1
  50. package/lib/paste/Excel/processPastedContentFromExcel.js +1 -1
  51. package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  52. package/lib/paste/PastePlugin.js +6 -6
  53. package/lib/paste/PastePlugin.js.map +1 -1
  54. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  55. package/lib/paste/WacComponents/constants.js.map +1 -1
  56. package/lib/paste/WacComponents/processPastedContentWacComponents.js +6 -6
  57. package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  58. package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
  59. package/lib/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  60. package/lib/paste/WordDesktop/getStyleMetadata.js +2 -1
  61. package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  62. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
  63. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  64. package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
  65. package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
  66. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  67. package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
  68. package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  69. package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  70. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  71. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  72. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  73. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  74. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  75. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  76. package/lib/paste/utils/addParser.d.ts +1 -1
  77. package/lib/paste/utils/addParser.js +2 -1
  78. package/lib/paste/utils/addParser.js.map +1 -1
  79. package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
  80. package/lib/paste/utils/getStyles.js.map +1 -1
  81. package/lib/paste/utils/linkParser.js.map +1 -1
  82. package/lib/paste/utils/setProcessor.js.map +1 -1
  83. package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  84. package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  85. package/lib/pluginUtils/CreateElement/createElement.d.ts +2 -2
  86. package/lib/pluginUtils/CreateElement/createElement.js +2 -1
  87. package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
  88. package/lib/pluginUtils/Disposable.d.ts +1 -1
  89. package/lib/pluginUtils/Disposable.js.map +1 -1
  90. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  91. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  92. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  93. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
  94. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  95. package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  96. package/lib/pluginUtils/Rect/getIntersectedRect.js +4 -3
  97. package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  98. package/lib/shortcut/ShortcutCommand.js.map +1 -1
  99. package/lib/shortcut/ShortcutPlugin.js +2 -0
  100. package/lib/shortcut/ShortcutPlugin.js.map +1 -1
  101. package/lib/shortcut/shortcuts.d.ts +12 -0
  102. package/lib/shortcut/shortcuts.js +34 -1
  103. package/lib/shortcut/shortcuts.js.map +1 -1
  104. package/lib/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  105. package/lib/shortcut/utils/setShortcutIndentationCommand.js +22 -0
  106. package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  107. package/lib/tableEdit/TableEditPlugin.js +5 -5
  108. package/lib/tableEdit/TableEditPlugin.js.map +1 -1
  109. package/lib/tableEdit/editors/TableEditor.d.ts +1 -1
  110. package/lib/tableEdit/editors/TableEditor.js +17 -17
  111. package/lib/tableEdit/editors/TableEditor.js.map +1 -1
  112. package/lib/tableEdit/editors/features/CellResizer.d.ts +2 -2
  113. package/lib/tableEdit/editors/features/CellResizer.js +7 -7
  114. package/lib/tableEdit/editors/features/CellResizer.js.map +1 -1
  115. package/{lib-mjs/tableEdit/editors/features/TableEditorFeature.d.ts → lib/tableEdit/editors/features/TableEditFeature.d.ts} +2 -2
  116. package/lib/tableEdit/editors/features/{TableEditorFeature.js → TableEditFeature.js} +1 -1
  117. package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  118. package/lib/tableEdit/editors/features/TableInserter.d.ts +2 -2
  119. package/lib/tableEdit/editors/features/TableInserter.js +5 -5
  120. package/lib/tableEdit/editors/features/TableInserter.js.map +1 -1
  121. package/lib/tableEdit/editors/features/TableMover.d.ts +2 -2
  122. package/lib/tableEdit/editors/features/TableMover.js +6 -6
  123. package/lib/tableEdit/editors/features/TableMover.js.map +1 -1
  124. package/lib/tableEdit/editors/features/TableResizer.d.ts +2 -2
  125. package/lib/tableEdit/editors/features/TableResizer.js +11 -8
  126. package/lib/tableEdit/editors/features/TableResizer.js.map +1 -1
  127. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +9 -0
  128. package/lib-amd/autoFormat/AutoFormatPlugin.js +21 -4
  129. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
  130. package/lib-amd/autoFormat/link/createLink.d.ts +5 -0
  131. package/lib-amd/autoFormat/link/createLink.js +26 -0
  132. package/lib-amd/autoFormat/link/createLink.js.map +1 -0
  133. package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  134. package/lib-amd/autoFormat/link/createLinkAfterSpace.js +38 -0
  135. package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  136. package/lib-amd/autoFormat/link/getLinkSegment.d.ts +5 -0
  137. package/lib-amd/autoFormat/link/getLinkSegment.js +27 -0
  138. package/lib-amd/autoFormat/link/getLinkSegment.js.map +1 -0
  139. package/lib-amd/autoFormat/link/unlink.d.ts +5 -0
  140. package/lib-amd/autoFormat/link/unlink.js +21 -0
  141. package/lib-amd/autoFormat/link/unlink.js.map +1 -0
  142. package/lib-amd/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  143. package/lib-amd/autoFormat/list/getIndex.js.map +1 -0
  144. package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  145. package/lib-amd/autoFormat/list/getListTypeStyle.js.map +1 -0
  146. package/lib-amd/autoFormat/list/getNumberingListStyle.js.map +1 -0
  147. package/lib-amd/autoFormat/list/keyboardListTrigger.js +46 -0
  148. package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -0
  149. package/lib-amd/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  150. package/lib-amd/contextMenuBase/ContextMenuPluginBase.js +86 -0
  151. package/lib-amd/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  152. package/lib-amd/edit/EditPlugin.js.map +1 -1
  153. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  154. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  155. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  156. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js +60 -0
  157. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  158. package/lib-amd/edit/deleteSteps/deleteList.js +2 -1
  159. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  160. package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  161. package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
  162. package/lib-amd/edit/inputSteps/handleEnterOnList.js +1 -1
  163. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
  164. package/lib-amd/edit/keyboardDelete.js +9 -2
  165. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  166. package/lib-amd/edit/keyboardInput.js +2 -2
  167. package/lib-amd/edit/keyboardInput.js.map +1 -1
  168. package/lib-amd/edit/keyboardTab.js.map +1 -1
  169. package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -1
  170. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +7 -0
  171. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  172. package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
  173. package/lib-amd/index.d.ts +2 -1
  174. package/lib-amd/index.js +5 -2
  175. package/lib-amd/index.js.map +1 -1
  176. package/lib-amd/paste/Excel/processPastedContentFromExcel.js +1 -1
  177. package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  178. package/lib-amd/paste/PastePlugin.js +6 -6
  179. package/lib-amd/paste/PastePlugin.js.map +1 -1
  180. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  181. package/lib-amd/paste/WacComponents/constants.js.map +1 -1
  182. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +6 -6
  183. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  184. package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
  185. package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  186. package/lib-amd/paste/WordDesktop/getStyleMetadata.js +2 -1
  187. package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  188. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
  189. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  190. package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
  191. package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
  192. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  193. package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
  194. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  195. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  196. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  197. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  198. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  199. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  200. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  201. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  202. package/lib-amd/paste/utils/addParser.d.ts +1 -1
  203. package/lib-amd/paste/utils/addParser.js +2 -1
  204. package/lib-amd/paste/utils/addParser.js.map +1 -1
  205. package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
  206. package/lib-amd/paste/utils/getStyles.js.map +1 -1
  207. package/lib-amd/paste/utils/linkParser.js.map +1 -1
  208. package/lib-amd/paste/utils/setProcessor.js.map +1 -1
  209. package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  210. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  211. package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +2 -2
  212. package/lib-amd/pluginUtils/CreateElement/createElement.js +2 -1
  213. package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
  214. package/lib-amd/pluginUtils/Disposable.d.ts +1 -1
  215. package/lib-amd/pluginUtils/Disposable.js.map +1 -1
  216. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  217. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  218. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  219. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
  220. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  221. package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  222. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +4 -3
  223. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  224. package/lib-amd/shortcut/ShortcutCommand.js.map +1 -1
  225. package/lib-amd/shortcut/ShortcutPlugin.js +2 -0
  226. package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -1
  227. package/lib-amd/shortcut/shortcuts.d.ts +12 -0
  228. package/lib-amd/shortcut/shortcuts.js +34 -2
  229. package/lib-amd/shortcut/shortcuts.js.map +1 -1
  230. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  231. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +22 -0
  232. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  233. package/lib-amd/tableEdit/TableEditPlugin.js +5 -4
  234. package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -1
  235. package/lib-amd/tableEdit/editors/TableEditor.d.ts +1 -1
  236. package/lib-amd/tableEdit/editors/TableEditor.js +17 -16
  237. package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -1
  238. package/lib-amd/tableEdit/editors/features/CellResizer.d.ts +2 -2
  239. package/lib-amd/tableEdit/editors/features/CellResizer.js +8 -7
  240. package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -1
  241. package/lib-amd/tableEdit/editors/features/{TableEditorFeature.d.ts → TableEditFeature.d.ts} +2 -2
  242. package/lib-amd/tableEdit/editors/features/{TableEditorFeature.js → TableEditFeature.js} +1 -1
  243. package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  244. package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +2 -2
  245. package/lib-amd/tableEdit/editors/features/TableInserter.js +6 -5
  246. package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -1
  247. package/lib-amd/tableEdit/editors/features/TableMover.d.ts +2 -2
  248. package/lib-amd/tableEdit/editors/features/TableMover.js +7 -6
  249. package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -1
  250. package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +2 -2
  251. package/lib-amd/tableEdit/editors/features/TableResizer.js +12 -8
  252. package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -1
  253. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +9 -0
  254. package/lib-mjs/autoFormat/AutoFormatPlugin.js +24 -4
  255. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
  256. package/lib-mjs/autoFormat/link/createLink.d.ts +5 -0
  257. package/lib-mjs/autoFormat/link/createLink.js +22 -0
  258. package/lib-mjs/autoFormat/link/createLink.js.map +1 -0
  259. package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  260. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +35 -0
  261. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  262. package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +5 -0
  263. package/lib-mjs/autoFormat/link/getLinkSegment.js +23 -0
  264. package/lib-mjs/autoFormat/link/getLinkSegment.js.map +1 -0
  265. package/lib-mjs/autoFormat/link/unlink.d.ts +5 -0
  266. package/lib-mjs/autoFormat/link/unlink.js +16 -0
  267. package/lib-mjs/autoFormat/link/unlink.js.map +1 -0
  268. package/lib-mjs/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  269. package/lib-mjs/autoFormat/list/getIndex.js.map +1 -0
  270. package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  271. package/lib-mjs/autoFormat/list/getListTypeStyle.js.map +1 -0
  272. package/lib-mjs/autoFormat/list/getNumberingListStyle.js.map +1 -0
  273. package/lib-mjs/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
  274. package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -0
  275. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  276. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js +81 -0
  277. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  278. package/lib-mjs/edit/EditPlugin.js.map +1 -1
  279. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  280. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  281. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  282. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js +56 -0
  283. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  284. package/lib-mjs/edit/deleteSteps/deleteList.js +2 -1
  285. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  286. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  287. package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
  288. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +1 -1
  289. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
  290. package/lib-mjs/edit/keyboardDelete.js +9 -1
  291. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  292. package/lib-mjs/edit/keyboardInput.js +2 -1
  293. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  294. package/lib-mjs/edit/keyboardTab.js.map +1 -1
  295. package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -1
  296. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +7 -0
  297. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  298. package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
  299. package/lib-mjs/index.d.ts +2 -1
  300. package/lib-mjs/index.js +2 -1
  301. package/lib-mjs/index.js.map +1 -1
  302. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +1 -1
  303. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  304. package/lib-mjs/paste/PastePlugin.js +1 -1
  305. package/lib-mjs/paste/PastePlugin.js.map +1 -1
  306. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  307. package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
  308. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +1 -1
  309. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  310. package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
  311. package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  312. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +1 -1
  313. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  314. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -14
  315. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  316. package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
  317. package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
  318. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  319. package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
  320. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  321. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  322. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  323. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  324. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  325. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  326. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  327. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  328. package/lib-mjs/paste/utils/addParser.d.ts +1 -1
  329. package/lib-mjs/paste/utils/addParser.js +1 -1
  330. package/lib-mjs/paste/utils/addParser.js.map +1 -1
  331. package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
  332. package/lib-mjs/paste/utils/getStyles.js.map +1 -1
  333. package/lib-mjs/paste/utils/linkParser.js.map +1 -1
  334. package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
  335. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  336. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  337. package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +2 -2
  338. package/lib-mjs/pluginUtils/CreateElement/createElement.js +1 -1
  339. package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
  340. package/lib-mjs/pluginUtils/Disposable.d.ts +1 -1
  341. package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
  342. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  343. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  344. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  345. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +1 -1
  346. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  347. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  348. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +2 -2
  349. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  350. package/lib-mjs/shortcut/ShortcutCommand.js.map +1 -1
  351. package/lib-mjs/shortcut/ShortcutPlugin.js +3 -1
  352. package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -1
  353. package/lib-mjs/shortcut/shortcuts.d.ts +12 -0
  354. package/lib-mjs/shortcut/shortcuts.js +33 -0
  355. package/lib-mjs/shortcut/shortcuts.js.map +1 -1
  356. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  357. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +18 -0
  358. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  359. package/lib-mjs/tableEdit/TableEditPlugin.js +4 -4
  360. package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -1
  361. package/lib-mjs/tableEdit/editors/TableEditor.d.ts +1 -1
  362. package/lib-mjs/tableEdit/editors/TableEditor.js +7 -8
  363. package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -1
  364. package/lib-mjs/tableEdit/editors/features/CellResizer.d.ts +2 -2
  365. package/lib-mjs/tableEdit/editors/features/CellResizer.js +4 -5
  366. package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -1
  367. package/{lib/tableEdit/editors/features/TableEditorFeature.d.ts → lib-mjs/tableEdit/editors/features/TableEditFeature.d.ts} +2 -2
  368. package/lib-mjs/tableEdit/editors/features/{TableEditorFeature.js → TableEditFeature.js} +1 -1
  369. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  370. package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +2 -2
  371. package/lib-mjs/tableEdit/editors/features/TableInserter.js +4 -5
  372. package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -1
  373. package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +2 -2
  374. package/lib-mjs/tableEdit/editors/features/TableMover.js +4 -5
  375. package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -1
  376. package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +2 -2
  377. package/lib-mjs/tableEdit/editors/features/TableResizer.js +7 -5
  378. package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -1
  379. package/package.json +5 -5
  380. package/lib/autoFormat/keyboardListTrigger.js.map +0 -1
  381. package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  382. package/lib/autoFormat/utils/getIndex.js.map +0 -1
  383. package/lib/autoFormat/utils/getListTypeStyle.js.map +0 -1
  384. package/lib/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  385. package/lib/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  386. package/lib/pluginUtils/Rect/normalizeRect.js +0 -20
  387. package/lib/pluginUtils/Rect/normalizeRect.js.map +0 -1
  388. package/lib/tableEdit/editors/features/TableEditorFeature.js.map +0 -1
  389. package/lib-amd/autoFormat/keyboardListTrigger.js +0 -44
  390. package/lib-amd/autoFormat/keyboardListTrigger.js.map +0 -1
  391. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  392. package/lib-amd/autoFormat/utils/getIndex.js.map +0 -1
  393. package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +0 -1
  394. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  395. package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  396. package/lib-amd/pluginUtils/Rect/normalizeRect.js +0 -22
  397. package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +0 -1
  398. package/lib-amd/tableEdit/editors/features/TableEditorFeature.js.map +0 -1
  399. package/lib-mjs/autoFormat/keyboardListTrigger.js.map +0 -1
  400. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  401. package/lib-mjs/autoFormat/utils/getIndex.js.map +0 -1
  402. package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +0 -1
  403. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  404. package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  405. package/lib-mjs/pluginUtils/Rect/normalizeRect.js +0 -17
  406. package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +0 -1
  407. package/lib-mjs/tableEdit/editors/features/TableEditorFeature.js.map +0 -1
  408. /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  409. /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  410. /package/lib/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  411. /package/lib/autoFormat/{utils → list}/getIndex.js +0 -0
  412. /package/lib/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  413. /package/lib/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  414. /package/lib/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  415. /package/lib/autoFormat/{keyboardListTrigger.d.ts → list/keyboardListTrigger.d.ts} +0 -0
  416. /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  417. /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  418. /package/lib-amd/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  419. /package/lib-amd/autoFormat/{utils → list}/getIndex.js +0 -0
  420. /package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  421. /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  422. /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  423. /package/lib-amd/autoFormat/{keyboardListTrigger.d.ts → list/keyboardListTrigger.d.ts} +0 -0
  424. /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  425. /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  426. /package/lib-mjs/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  427. /package/lib-mjs/autoFormat/{utils → list}/getIndex.js +0 -0
  428. /package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  429. /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  430. /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  431. /package/lib-mjs/autoFormat/{keyboardListTrigger.d.ts → list/keyboardListTrigger.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";;;IAGA;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAwB,kBAAkB,CACtC,QAAuB,EACvB,eAA4B;QAA5B,gCAAA,EAAA,oBAA4B;QAE5B,IAAM,KAAK,GAAG,QAAQ;aACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,IAAA,uBAAa,EAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAA9C,CAA8C,CAAC;aAC9D,MAAM,CAAC,eAAe,CAAC;aACvB,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAW,CAAC;QAE5C,IAAM,MAAM,GAAS;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;YACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;YACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,UAAC;SAC9C,CAAC;QAEF,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACpF,CAAC;IAjBD,qCAiBC","sourcesContent":["import normalizeRect from './normalizeRect';\nimport type { Rect } from 'roosterjs-content-model-types';\n\n/**\n * Get the intersected Rect of elements provided\n *\n * @example\n * The result of the following Elements Rects would be:\n {\n top: Element2.top,\n bottom: Element1.bottom,\n left: Element2.left,\n right: Element2.right\n }\n +-------------------------+\n | Element 1 |\n | +-----------------+ |\n | | Element2 | |\n | | | |\n | | | |\n +-------------------------+\n | |\n +-----------------+\n * @internal\n * @param elements Elements to use.\n * @param additionalRects additional rects to use\n * @returns If the Rect is valid return the rect, if not, return null.\n */\nexport default function getIntersectedRect(\n elements: HTMLElement[],\n additionalRects: Rect[] = []\n): Rect | null {\n const rects = elements\n .map(element => normalizeRect(element.getBoundingClientRect()))\n .concat(additionalRects)\n .filter(element => !!element) as Rect[];\n\n const result: Rect = {\n top: Math.max(...rects.map(r => r.top)),\n bottom: Math.min(...rects.map(r => r.bottom)),\n left: Math.max(...rects.map(r => r.left)),\n right: Math.min(...rects.map(r => r.right)),\n };\n\n return result.top < result.bottom && result.left < result.right ? result : null;\n}\n"]}
1
+ {"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";;;;IAGA;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAgB,kBAAkB,CAC9B,QAAuB,EACvB,eAA4B;QAA5B,gCAAA,EAAA,oBAA4B;QAE5B,IAAM,KAAK,GAAG,QAAQ;aACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,IAAA,2CAAa,EAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAA9C,CAA8C,CAAC;aAC9D,MAAM,CAAC,eAAe,CAAC;aACvB,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAW,CAAC;QAE5C,IAAM,MAAM,GAAS;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;YACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;YACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,qDAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,UAAC;SAC9C,CAAC;QAEF,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACpF,CAAC;IAjBD,gDAiBC","sourcesContent":["import { normalizeRect } from 'roosterjs-content-model-dom';\nimport type { Rect } from 'roosterjs-content-model-types';\n\n/**\n * Get the intersected Rect of elements provided\n *\n * @example\n * The result of the following Elements Rects would be:\n {\n top: Element2.top,\n bottom: Element1.bottom,\n left: Element2.left,\n right: Element2.right\n }\n +-------------------------+\n | Element 1 |\n | +-----------------+ |\n | | Element2 | |\n | | | |\n | | | |\n +-------------------------+\n | |\n +-----------------+\n * @internal\n * @param elements Elements to use.\n * @param additionalRects additional rects to use\n * @returns If the Rect is valid return the rect, if not, return null.\n */\nexport function getIntersectedRect(\n elements: HTMLElement[],\n additionalRects: Rect[] = []\n): Rect | null {\n const rects = elements\n .map(element => normalizeRect(element.getBoundingClientRect()))\n .concat(additionalRects)\n .filter(element => !!element) as Rect[];\n\n const result: Rect = {\n top: Math.max(...rects.map(r => r.top)),\n bottom: Math.min(...rects.map(r => r.bottom)),\n left: Math.max(...rects.map(r => r.left)),\n right: Math.min(...rects.map(r => r.right)),\n };\n\n return result.top < result.bottom && result.left < result.right ? result : null;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ShortcutCommand.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/shortcut/ShortcutCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Definition of the shortcut key\n */\nexport interface ShortcutKeyDefinition {\n /**\n * Modifier key for this shortcut, allowed values are:\n * ctrl: Ctrl key (or Meta key on MacOS)\n * alt: Alt key\n */\n modifierKey: 'ctrl' | 'alt';\n\n /**\n * Whether ALT key is required for this shortcut\n */\n shiftKey: boolean;\n\n /**\n * Key code for this shortcut. The value should be the value of KeyboardEvent.which\n * We are still using key code here rather than key name (event.key) although event.which is deprecated because of globalization.\n * For example, on US keyboard, Shift+Comma=\"<\" but on Spanish keyboard it is \":\"\n * And we still want the shortcut key to be registered on the same key, in that case key name is different but key code keeps the same.\n */\n which: number;\n}\n\n/**\n * Represents a command for shortcut\n */\nexport interface ShortcutCommand {\n /**\n * Definition of the shortcut key\n */\n shortcutKey: ShortcutKeyDefinition;\n\n /**\n * @optional Required environment for this command\n * all: (Default) This feature is available for all environments\n * mac: This feature is available on MacOS only\n * nonMac: This feature is available on OS other than MacOS\n */\n environment?: 'all' | 'mac' | 'nonMac';\n\n /**\n * The callback function to invoke when this shortcut is triggered\n * @param editor The editor object\n */\n onClick: (editor: IEditor) => void;\n}\n"]}
1
+ {"version":3,"file":"ShortcutCommand.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/ShortcutCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type { IEditor } from 'roosterjs-content-model-types';\n\n/**\n * Definition of the shortcut key\n */\nexport interface ShortcutKeyDefinition {\n /**\n * Modifier key for this shortcut, allowed values are:\n * ctrl: Ctrl key (or Meta key on MacOS)\n * alt: Alt key\n */\n modifierKey: 'ctrl' | 'alt';\n\n /**\n * Whether ALT key is required for this shortcut\n */\n shiftKey: boolean;\n\n /**\n * Key code for this shortcut. The value should be the value of KeyboardEvent.which\n * We are still using key code here rather than key name (event.key) although event.which is deprecated because of globalization.\n * For example, on US keyboard, Shift+Comma=\"<\" but on Spanish keyboard it is \":\"\n * And we still want the shortcut key to be registered on the same key, in that case key name is different but key code keeps the same.\n */\n which: number;\n}\n\n/**\n * Represents a command for shortcut\n */\nexport interface ShortcutCommand {\n /**\n * Definition of the shortcut key\n */\n shortcutKey: ShortcutKeyDefinition;\n\n /**\n * @optional Required environment for this command\n * all: (Default) This feature is available for all environments\n * mac: This feature is available on MacOS only\n * nonMac: This feature is available on OS other than MacOS\n */\n environment?: 'all' | 'mac' | 'nonMac';\n\n /**\n * The callback function to invoke when this shortcut is triggered\n * @param editor The editor object\n */\n onClick: (editor: IEditor) => void;\n}\n"]}
@@ -15,6 +15,8 @@ define(["require", "exports", "roosterjs-content-model-core", "./shortcuts"], fu
15
15
  shortcuts_1.ShortcutNumbering,
16
16
  shortcuts_1.ShortcutIncreaseFont,
17
17
  shortcuts_1.ShortcutDecreaseFont,
18
+ shortcuts_1.ShortcutIndentList,
19
+ shortcuts_1.ShortcutOutdentList,
18
20
  ];
19
21
  var CommandCacheKey = '__ShortcutCommandCache';
20
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ShortcutPlugin.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/shortcut/ShortcutPlugin.ts"],"names":[],"mappings":";;;;IAuBA,IAAM,gBAAgB,GAAsB;QACxC,wBAAY;QACZ,0BAAc;QACd,6BAAiB;QACjB,+BAAmB;QACnB,wBAAY;QACZ,yBAAa;QACb,wBAAY;QACZ,6BAAiB;QACjB,0BAAc;QACd,6BAAiB;QACjB,gCAAoB;QACpB,gCAAoB;KACvB,CAAC;IACF,IAAM,eAAe,GAAG,wBAAwB,CAAC;IAEjD;;OAEG;IACH;QAII;;;WAGG;QACH,wBAAoB,SAA+C;YAA/C,0BAAA,EAAA,4BAA+C;YAA/C,cAAS,GAAT,SAAS,CAAsC;YAP3D,WAAM,GAAmB,IAAI,CAAC;YAC9B,UAAK,GAAG,KAAK,CAAC;QAMgD,CAAC;QAEvE;;WAEG;QACH,gCAAO,GAAP;YACI,OAAO,UAAU,CAAC;QACtB,CAAC;QAED;;;;;WAKG;QACH,mCAAU,GAAV,UAAW,MAAe;YACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,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oBADvD,CACuD,CAC9D,CAAC,CAAC,CAAC,CACP,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC;QAEO,gCAAO,GAAf,UAAgB,WAAsC;YAClD,QAAQ,WAAW,EAAE;gBACjB,KAAK,KAAK;oBACN,OAAO,IAAI,CAAC,KAAK,CAAC;gBAEtB,KAAK,QAAQ;oBACT,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;gBAEvB;oBACI,OAAO,IAAI,CAAC;aACnB;QACL,CAAC;QAEO,sCAAa,GAArB,UAAsB,WAAkC,EAAE,KAAoB;YAClE,IAAA,OAAO,GAAuC,KAAK,QAA5C,EAAE,MAAM,GAA+B,KAAK,OAApC,EAAE,QAAQ,GAAqB,KAAK,SAA1B,EAAE,KAAK,GAAc,KAAK,MAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;YAC5D,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YAClD,IAAM,aAAa,GACf,CAAC,WAAW,CAAC,WAAW,IAAI,MAAM,IAAI,UAAU,IAAI,CAAC,MAAM,CAAC;gBAC5D,CAAC,WAAW,CAAC,WAAW,IAAI,KAAK,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;YAEhE,OAAO,aAAa,IAAI,QAAQ,IAAI,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,KAAK,IAAI,KAAK,CAAC;QAC3F,CAAC;QACL,qBAAC;IAAD,CAAC,AA3GD,IA2GC;IA3GY,wCAAc","sourcesContent":["import { cacheGetEventData } from 'roosterjs-content-model-core';\nimport type { ShortcutCommand, ShortcutKeyDefinition } from './ShortcutCommand';\nimport {\n ShortcutBold,\n ShortcutBullet,\n ShortcutClearFormat,\n ShortcutDecreaseFont,\n ShortcutIncreaseFont,\n ShortcutItalic,\n ShortcutNumbering,\n ShortcutRedo,\n ShortcutRedoMacOS,\n ShortcutUnderline,\n ShortcutUndo,\n ShortcutUndo2,\n} from './shortcuts';\nimport type {\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst defaultShortcuts: ShortcutCommand[] = [\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];\nconst CommandCacheKey = '__ShortcutCommandCache';\n\n/**\n * Shortcut plugin hook on the specified shortcut keys and trigger related format API\n */\nexport class ShortcutPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private isMac = false;\n\n /**\n * Create a new instance of ShortcutPlugin\n * @param [shortcuts=defaultShortcuts] Allowed commands\n */\n constructor(private shortcuts: ShortcutCommand[] = defaultShortcuts) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'Shortcut';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.isMac = !!this.editor.getEnvironment().isMac;\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n }\n\n /**\n * Check if the plugin should handle the given event exclusively.\n * Handle an event exclusively means other plugin will not receive this event in\n * onPluginEvent method.\n * If two plugins will return true in willHandleEventExclusively() for the same event,\n * the final result depends on the order of the plugins are added into editor\n * @param event The event to check:\n */\n willHandleEventExclusively(event: PluginEvent) {\n return (\n event.eventType == 'keyDown' &&\n (event.rawEvent.ctrlKey || event.rawEvent.altKey || event.rawEvent.metaKey) &&\n !!this.cacheGetCommand(event)\n );\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor && event.eventType == 'keyDown') {\n const command = this.cacheGetCommand(event);\n\n if (command) {\n command.onClick(this.editor);\n event.rawEvent.preventDefault();\n }\n }\n }\n\n private cacheGetCommand(event: KeyDownEvent) {\n return cacheGetEventData(event, CommandCacheKey, event => {\n const editor = this.editor;\n\n return (\n editor &&\n this.shortcuts.filter(\n command =>\n this.matchOS(command.environment) &&\n this.matchShortcut(command.shortcutKey, event.rawEvent)\n )[0]\n );\n });\n }\n\n private matchOS(environment?: 'all' | 'mac' | 'nonMac') {\n switch (environment) {\n case 'mac':\n return this.isMac;\n\n case 'nonMac':\n return !this.isMac;\n\n default:\n return true;\n }\n }\n\n private matchShortcut(shortcutKey: ShortcutKeyDefinition, event: KeyboardEvent) {\n const { ctrlKey, altKey, shiftKey, which, metaKey } = event;\n const ctrlOrMeta = this.isMac ? metaKey : ctrlKey;\n const matchModifier =\n (shortcutKey.modifierKey == 'ctrl' && ctrlOrMeta && !altKey) ||\n (shortcutKey.modifierKey == 'alt' && altKey && !ctrlOrMeta);\n\n return matchModifier && shiftKey == shortcutKey.shiftKey && shortcutKey.which == which;\n }\n}\n"]}
1
+ {"version":3,"file":"ShortcutPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/ShortcutPlugin.ts"],"names":[],"mappings":";;;;IAyBA,IAAM,gBAAgB,GAAsB;QACxC,wBAAY;QACZ,0BAAc;QACd,6BAAiB;QACjB,+BAAmB;QACnB,wBAAY;QACZ,yBAAa;QACb,wBAAY;QACZ,6BAAiB;QACjB,0BAAc;QACd,6BAAiB;QACjB,gCAAoB;QACpB,gCAAoB;QACpB,8BAAkB;QAClB,+BAAmB;KACtB,CAAC;IACF,IAAM,eAAe,GAAG,wBAAwB,CAAC;IAEjD;;OAEG;IACH;QAII;;;WAGG;QACH,wBAAoB,SAA+C;YAA/C,0B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C,AA3GD,IA2GC;IA3GY,wCAAc","sourcesContent":["import { cacheGetEventData } from 'roosterjs-content-model-core';\nimport type { ShortcutCommand, ShortcutKeyDefinition } from './ShortcutCommand';\nimport {\n ShortcutBold,\n ShortcutBullet,\n ShortcutClearFormat,\n ShortcutDecreaseFont,\n ShortcutIncreaseFont,\n ShortcutIndentList,\n ShortcutItalic,\n ShortcutNumbering,\n ShortcutOutdentList,\n ShortcutRedo,\n ShortcutRedoMacOS,\n ShortcutUnderline,\n ShortcutUndo,\n ShortcutUndo2,\n} from './shortcuts';\nimport type {\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst defaultShortcuts: ShortcutCommand[] = [\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];\nconst CommandCacheKey = '__ShortcutCommandCache';\n\n/**\n * Shortcut plugin hook on the specified shortcut keys and trigger related format API\n */\nexport class ShortcutPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private isMac = false;\n\n /**\n * Create a new instance of ShortcutPlugin\n * @param [shortcuts=defaultShortcuts] Allowed commands\n */\n constructor(private shortcuts: ShortcutCommand[] = defaultShortcuts) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'Shortcut';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.isMac = !!this.editor.getEnvironment().isMac;\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n }\n\n /**\n * Check if the plugin should handle the given event exclusively.\n * Handle an event exclusively means other plugin will not receive this event in\n * onPluginEvent method.\n * If two plugins will return true in willHandleEventExclusively() for the same event,\n * the final result depends on the order of the plugins are added into editor\n * @param event The event to check:\n */\n willHandleEventExclusively(event: PluginEvent) {\n return (\n event.eventType == 'keyDown' &&\n (event.rawEvent.ctrlKey || event.rawEvent.altKey || event.rawEvent.metaKey) &&\n !!this.cacheGetCommand(event)\n );\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor && event.eventType == 'keyDown') {\n const command = this.cacheGetCommand(event);\n\n if (command) {\n command.onClick(this.editor);\n event.rawEvent.preventDefault();\n }\n }\n }\n\n private cacheGetCommand(event: KeyDownEvent) {\n return cacheGetEventData(event, CommandCacheKey, event => {\n const editor = this.editor;\n\n return (\n editor &&\n this.shortcuts.filter(\n command =>\n this.matchOS(command.environment) &&\n this.matchShortcut(command.shortcutKey, event.rawEvent)\n )[0]\n );\n });\n }\n\n private matchOS(environment?: 'all' | 'mac' | 'nonMac') {\n switch (environment) {\n case 'mac':\n return this.isMac;\n\n case 'nonMac':\n return !this.isMac;\n\n default:\n return true;\n }\n }\n\n private matchShortcut(shortcutKey: ShortcutKeyDefinition, event: KeyboardEvent) {\n const { ctrlKey, altKey, shiftKey, which, metaKey } = event;\n const ctrlOrMeta = this.isMac ? metaKey : ctrlKey;\n const matchModifier =\n (shortcutKey.modifierKey == 'ctrl' && ctrlOrMeta && !altKey) ||\n (shortcutKey.modifierKey == 'alt' && altKey && !ctrlOrMeta);\n\n return matchModifier && shiftKey == shortcutKey.shiftKey && shortcutKey.which == which;\n }\n}\n"]}
@@ -71,3 +71,15 @@ export declare const ShortcutIncreaseFont: ShortcutCommand;
71
71
  * MacOS: Meta + Shift + , (Comma)
72
72
  */
73
73
  export declare const ShortcutDecreaseFont: ShortcutCommand;
74
+ /**
75
+ * Shortcut command for Intent list
76
+ * Windows: Alt + Shift + Arrow Right
77
+ * MacOS: Option + Shift+ Arrow Right
78
+ */
79
+ export declare const ShortcutIndentList: ShortcutCommand;
80
+ /**
81
+ * Shortcut command for Outdent list
82
+ * Windows: Alt + Shift + Arrow Left
83
+ * MacOS: Option + Shift+ Arrow Left
84
+ */
85
+ export declare const ShortcutOutdentList: ShortcutCommand;
@@ -1,7 +1,7 @@
1
- define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_core_1, roosterjs_content_model_api_1) {
1
+ define(["require", "exports", "roosterjs-content-model-core", "./utils/setShortcutIndentationCommand", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_core_1, setShortcutIndentationCommand_1, roosterjs_content_model_api_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- 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
+ 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;
5
5
  var Keys;
6
6
  (function (Keys) {
7
7
  Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
@@ -14,6 +14,8 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
14
14
  Keys[Keys["COMMA"] = 188] = "COMMA";
15
15
  Keys[Keys["PERIOD"] = 190] = "PERIOD";
16
16
  Keys[Keys["FORWARD_SLASH"] = 191] = "FORWARD_SLASH";
17
+ Keys[Keys["ArrowRight"] = 39] = "ArrowRight";
18
+ Keys[Keys["ArrowLeft"] = 37] = "ArrowLeft";
17
19
  })(Keys || (Keys = {}));
18
20
  /**
19
21
  * Shortcut command for Bold
@@ -174,5 +176,35 @@ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content
174
176
  },
175
177
  onClick: function (editor) { return (0, roosterjs_content_model_api_1.changeFontSize)(editor, 'decrease'); },
176
178
  };
179
+ /**
180
+ * Shortcut command for Intent list
181
+ * Windows: Alt + Shift + Arrow Right
182
+ * MacOS: Option + Shift+ Arrow Right
183
+ */
184
+ exports.ShortcutIndentList = {
185
+ shortcutKey: {
186
+ modifierKey: 'alt',
187
+ shiftKey: true,
188
+ which: 39 /* ArrowRight */,
189
+ },
190
+ onClick: function (editor) {
191
+ (0, setShortcutIndentationCommand_1.setShortcutIndentationCommand)(editor, 'indent');
192
+ },
193
+ };
194
+ /**
195
+ * Shortcut command for Outdent list
196
+ * Windows: Alt + Shift + Arrow Left
197
+ * MacOS: Option + Shift+ Arrow Left
198
+ */
199
+ exports.ShortcutOutdentList = {
200
+ shortcutKey: {
201
+ modifierKey: 'alt',
202
+ shiftKey: true,
203
+ which: 37 /* ArrowLeft */,
204
+ },
205
+ onClick: function (editor) {
206
+ (0, setShortcutIndentationCommand_1.setShortcutIndentationCommand)(editor, 'outdent');
207
+ },
208
+ };
177
209
  });
178
210
  //# sourceMappingURL=shortcuts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/shortcut/shortcuts.ts"],"names":[],"mappings":";;;;IAYA,IAAW,IAWV;IAXD,WAAW,IAAI;QACX,yCAAa,CAAA;QACb,kCAAU,CAAA;QACV,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,0BAAM,CAAA;Q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B;KAC7C,CAAC;IAEF;;;;OAIG;IACU,QAAA,oBAAoB,GAAoB;QACjD,WAAW,EAAE;YACT,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;YACd,KAAK,kBAAa;SACrB;QACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,4CAAc,EAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;KACxD,CAAC;IAEF;;;;OAIG;IACU,QAAA,oBAAoB,GAAoB;QACjD,WAAW,EAAE;YACT,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;YACd,KAAK,iBAAY;SACpB;QACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,4CAAc,EAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;KACxD,CAAC","sourcesContent":["import { redo, undo } from 'roosterjs-content-model-core';\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}\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"]}
1
+ {"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/shortcuts.ts"],"names":[],"mappings":";;;;IAaA,IAAW,IAaV;IAbD,WAAW,IAAI;QACX,yCAAa,CAAA;QACb,kCAAU,CAAA;QACV,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,0BAAM,CAAA;QACN,mCAAW,CAAA;QACX,qCAAY,CAAA;QACZ,mDAAmB,CAAA;QACnB,4CAAe,CAAA;QACf,0CAAc,CAAA;IAClB,CAAC,EAbU,IAAI,KAAJ,IAAI,QAad;IAED;;;;OAIG;IACU,QAAA,YAAY,GAAoB;QACzC,WAAW,EAAE;YACT,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,YAAQ;SAChB;QACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,wCAAU,EAAC,MAAM,CAAC,EAAlB,CAAkB;KACxC,CAA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WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;YACd,KAAK,iBAAY;SACpB;QACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,4CAAc,EAAC,MAAM,EAAE,UAAU,CAAC,EAAlC,CAAkC;KACxD,CAAC;IAEF;;;;OAIG;IACU,QAAA,kBAAkB,GAAoB;QAC/C,WAAW,EAAE;YACT,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,IAAI;YACd,KAAK,qBAAiB;SACzB;QACD,OAAO,EAAE,UAAA,MAAM;YACX,IAAA,6DAA6B,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC;KACJ,CAAC;IAEF;;;;OAIG;IACU,QAAA,mBAAmB,GAAoB;QAChD,WAAW,EAAE;YACT,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,IAAI;YACd,KAAK,oBAAgB;SACxB;QACD,OAAO,EAAE,UAAA,MAAM;YACX,IAAA,6DAA6B,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACrD,CAAC;KACJ,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
+ define(["require", "exports", "roosterjs-content-model-core", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_core_1, roosterjs_content_model_api_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.setShortcutIndentationCommand = void 0;
5
+ /**
6
+ * @internal
7
+ */
8
+ function setShortcutIndentationCommand(editor, operation) {
9
+ editor.formatContentModel(function (model) {
10
+ var listItem = (0, roosterjs_content_model_core_1.getFirstSelectedListItem)(model);
11
+ if (listItem &&
12
+ listItem.blocks[0].blockType == 'Paragraph' &&
13
+ listItem.blocks[0].segments[0].segmentType == 'SelectionMarker') {
14
+ (0, roosterjs_content_model_api_1.setModelIndentation)(model, operation);
15
+ return true;
16
+ }
17
+ return false;
18
+ });
19
+ }
20
+ exports.setShortcutIndentationCommand = setShortcutIndentationCommand;
21
+ });
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":";;;;IAIA;;OAEG;IACH,SAAgB,6BAA6B,CAAC,MAAe,EAAE,SAA+B;QAC1F,MAAM,CAAC,kBAAkB,CAAC,UAAA,KAAK;YAC3B,IAAM,QAAQ,GAAG,IAAA,uDAAwB,EAAC,KAAK,CAAC,CAAC;YAEjD,IACI,QAAQ;gBACR,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;gBAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,EACjE;gBACE,IAAA,iDAAmB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;aACf;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;IAdD,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"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "../pluginUtils/Rect/normalizeRect", "./editors/TableEditor", "roosterjs-content-model-dom"], function (require, exports, normalizeRect_1, TableEditor_1, roosterjs_content_model_dom_1) {
1
+ define(["require", "exports", "roosterjs-content-model-dom", "./editors/TableEditor"], function (require, exports, roosterjs_content_model_dom_1, TableEditor_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.TableEditPlugin = void 0;
@@ -119,10 +119,11 @@ define(["require", "exports", "../pluginUtils/Rect/normalizeRect", "./editors/Ta
119
119
  this.disposeTableEditor();
120
120
  }
121
121
  if (!this.tableEditor && table && this.editor && table.rows.length > 0) {
122
+ // anchorContainerSelector is used to specify the container to host the plugin, which can be outside of the editor's div
122
123
  var container = this.anchorContainerSelector
123
- ? this.editor.getDOMHelper().queryElements(this.anchorContainerSelector)[0]
124
+ ? this.editor.getDocument().querySelector(this.anchorContainerSelector)
124
125
  : undefined;
125
- this.tableEditor = new TableEditor_1.default(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);
126
+ 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);
126
127
  }
127
128
  };
128
129
  TableEditPlugin.prototype.disposeTableEditor = function () {
@@ -137,7 +138,7 @@ define(["require", "exports", "../pluginUtils/Rect/normalizeRect", "./editors/Ta
137
138
  var tables = this.editor.getDOMHelper().queryElements('table');
138
139
  tables.forEach(function (table) {
139
140
  if (table.isContentEditable) {
140
- var rect = (0, normalizeRect_1.default)(table.getBoundingClientRect());
141
+ var rect = (0, roosterjs_content_model_dom_1.normalizeRect)(table.getBoundingClientRect());
141
142
  if (rect && _this.tableRectMap) {
142
143
  _this.tableRectMap.push({
143
144
  table: table,
@@ -1 +1 @@
1
- {"version":3,"file":"TableEditPlugin.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/tableEdit/TableEditPlugin.ts"],"names":[],"mappings":";;;;IAKA,IAAM,oBAAoB,GAAG,EAAE,CAAC;IAEhC;;OAEG;IACH;QAMI;;;;;WAKG;QACH,yBAAoB,uBAAgC;YAApD,iBAAwD;YAApC,4BAAuB,GAAvB,uBAAuB,CAAS;YAX5C,WAAM,GAAmB,IAAI,CAAC;YAC9B,wBAAmB,GAAwB,IAAI,CAAC;YAChD,iBAAY,GAAqD,IAAI,CAAC;YACtE,gBAAW,GAAuB,IAAI,CAAC;YA8BvC,eAAU,GAAG,UAAC,EAA4C;oBAA1C,aAAa,mBAAA,EAAE,aAAa,mBAAA;gBAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;gBAChD,IAAM,iBAAiB,GAAG,aAAqB,CAAC;gBAChD,IACI,IAAA,0CAAY,EAAC,iBAAiB,EAAE,cAAc,CAAC;oBAC/C,IAAA,0CAAY,EA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AI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;QAEO,0CAAgB,GAAxB;YAAA,iBAiBC;YAhBG,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,EAAE;gBACnC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;gBAEvB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBACjE,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;oBAChB,IAAI,KAAK,CAAC,iBAAiB,EAAE;wBACzB,IAAM,IAAI,GAAG,IAAA,uBAAa,EAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC;wBAC1D,IAAI,IAAI,IAAI,KAAI,CAAC,YAAY,EAAE;4BAC3B,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC;gCACnB,KAAK,OAAA;gCACL,IAAI,MAAA;6BACP,CAAC,CAAC;yBACN;qBACJ;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC;QACL,sBAAC;IAAD,CAAC,AApKD,IAoKC;IApKY,0CAAe","sourcesContent":["import normalizeRect from '../pluginUtils/Rect/normalizeRect';\nimport TableEditor from './editors/TableEditor';\nimport { isNodeOfType } from 'roosterjs-content-model-dom';\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 const container = this.anchorContainerSelector\n ? this.editor.getDOMHelper().queryElements(this.anchorContainerSelector)[0]\n : undefined;\n\n this.tableEditor = new TableEditor(\n this.editor,\n table,\n this.invalidateTableRects,\n isNodeOfType(container as Node, '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"]}
1
+ {"version":3,"file":"TableEditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/tableEdit/TableEditPlugin.ts"],"names":[],"mappings":";;;;IAIA,IAAM,oBAAoB,GAAG,EAAE,CAAC;IAEhC;;OAEG;IACH;QAMI;;;;;WAKG;QACH,yBAAoB,uBAAgC;YAApD,iBAAwD;YAApC,4BAAuB,GAAvB,uBAAuB,CAAS;YAX5C,WA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I,CAAC,WAAW,GAAG,IAAI,yBAAW,CAC9B,IAAI,CAAC,MAAM,EACX,KAAK,EACL,IAAI,CAAC,oBAAoB,EACzB,IAAA,0CAAY,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAC/D,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CACvB,CAAC;aACL;QACL,CAAC;QAMO,4CAAkB,GAA1B;;YACI,MAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;QAEO,0CAAgB,GAAxB;YAAA,iBAiBC;YAhBG,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,EAAE;gBACnC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;gBAEvB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBACjE,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;oBAChB,IAAI,KAAK,CAAC,iBAAiB,EAAE;wBACzB,IAAM,IAAI,GAAG,IAAA,2CAAa,EAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC;wBAC1D,IAAI,IAAI,IAAI,KAAI,CAAC,YAAY,EAAE;4BAC3B,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC;gCACnB,KAAK,OAAA;gCACL,IAAI,MAAA;6BACP,CAAC,CAAC;yBACN;qBACJ;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC;QACL,sBAAC;IAAD,CAAC,AArKD,IAqKC;IArKY,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"]}
@@ -28,7 +28,7 @@ import type { IEditor } from 'roosterjs-content-model-types';
28
28
  *
29
29
  * When set a different current table or change current TD, we need to update these areas
30
30
  */
31
- export default class TableEditor {
31
+ export declare class TableEditor {
32
32
  private editor;
33
33
  readonly table: HTMLTableElement;
34
34
  private onChanged;
@@ -1,6 +1,7 @@
1
- define(["require", "exports", "./features/CellResizer", "./features/TableInserter", "./features/TableMover", "./features/TableResizer", "../../pluginUtils/Rect/normalizeRect", "./features/TableEditorFeature", "roosterjs-content-model-dom"], function (require, exports, CellResizer_1, TableInserter_1, TableMover_1, TableResizer_1, normalizeRect_1, TableEditorFeature_1, roosterjs_content_model_dom_1) {
1
+ define(["require", "exports", "./features/CellResizer", "./features/TableInserter", "./features/TableMover", "./features/TableResizer", "./features/TableEditFeature", "roosterjs-content-model-dom"], function (require, exports, CellResizer_1, TableInserter_1, TableMover_1, TableResizer_1, TableEditFeature_1, roosterjs_content_model_dom_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TableEditor = void 0;
4
5
  var INSERTER_HOVER_OFFSET = 6;
5
6
  var TOP_OR_SIDE;
6
7
  (function (TOP_OR_SIDE) {
@@ -136,7 +137,7 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
136
137
  TableEditor.prototype.onMouseMove = function (x, y) {
137
138
  var _a;
138
139
  // Get whole table rect
139
- var tableRect = (0, normalizeRect_1.default)(this.table.getBoundingClientRect());
140
+ var tableRect = (0, roosterjs_content_model_dom_1.normalizeRect)(this.table.getBoundingClientRect());
140
141
  //console.log('>>>tableRect', tableRect);
141
142
  if (!tableRect) {
142
143
  return;
@@ -158,7 +159,7 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
158
159
  var j = 0;
159
160
  for (; j < tr.cells.length; j++) {
160
161
  var td = tr.cells[j];
161
- var tdRect = (0, normalizeRect_1.default)(td.getBoundingClientRect());
162
+ var tdRect = (0, roosterjs_content_model_dom_1.normalizeRect)(td.getBoundingClientRect());
162
163
  if (!tdRect || !tableRect) {
163
164
  continue;
164
165
  }
@@ -180,7 +181,7 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
180
181
  else if (j === 0 && topOrSide == 1 /* side */) {
181
182
  var tdAbove = (_a = this.table.rows[i - 1]) === null || _a === void 0 ? void 0 : _a.cells[0];
182
183
  var tdAboveRect = tdAbove
183
- ? (0, normalizeRect_1.default)(tdAbove.getBoundingClientRect())
184
+ ? (0, roosterjs_content_model_dom_1.normalizeRect)(tdAbove.getBoundingClientRect())
184
185
  : null;
185
186
  var isTdNotAboveMerged = !tdAboveRect
186
187
  ? null
@@ -208,10 +209,10 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
208
209
  };
209
210
  TableEditor.prototype.setEditorFeatures = function () {
210
211
  if (!this.tableMover) {
211
- this.tableMover = (0, TableMover_1.default)(this.table, this.editor, this.isRTL, this.onSelect, this.getOnMouseOut, this.contentDiv, this.anchorContainer);
212
+ this.tableMover = (0, TableMover_1.createTableMover)(this.table, this.editor, this.isRTL, this.onSelect, this.getOnMouseOut, this.contentDiv, this.anchorContainer);
212
213
  }
213
214
  if (!this.tableResizer) {
214
- this.tableResizer = (0, TableResizer_1.default)(this.table, this.editor, this.isRTL, this.onStartTableResize, this.onFinishEditing, this.contentDiv, this.anchorContainer);
215
+ this.tableResizer = (0, TableResizer_1.createTableResizer)(this.table, this.editor, this.isRTL, this.onStartTableResize, this.onFinishEditing, this.contentDiv, this.anchorContainer);
215
216
  }
216
217
  };
217
218
  TableEditor.prototype.setResizingTd = function (td) {
@@ -219,8 +220,8 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
219
220
  this.disposeCellResizers();
220
221
  }
221
222
  if (!this.horizontalResizer && td) {
222
- this.horizontalResizer = (0, CellResizer_1.default)(this.editor, td, this.table, this.isRTL, true /*isHorizontal*/, this.onStartCellResize, this.onFinishEditing, this.anchorContainer);
223
- this.verticalResizer = (0, CellResizer_1.default)(this.editor, td, this.table, this.isRTL, false /*isHorizontal*/, this.onStartCellResize, this.onFinishEditing, this.anchorContainer);
223
+ this.horizontalResizer = (0, CellResizer_1.createCellResizer)(this.editor, td, this.table, this.isRTL, true /*isHorizontal*/, this.onStartCellResize, this.onFinishEditing, this.anchorContainer);
224
+ this.verticalResizer = (0, CellResizer_1.createCellResizer)(this.editor, td, this.table, this.isRTL, false /*isHorizontal*/, this.onStartCellResize, this.onFinishEditing, this.anchorContainer);
224
225
  }
225
226
  };
226
227
  /**
@@ -233,7 +234,7 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
233
234
  this.disposeTableInserter();
234
235
  }
235
236
  if (!this.horizontalInserter && !this.verticalInserter && td) {
236
- var newInserter = (0, TableInserter_1.default)(this.editor, td, this.table, this.isRTL, !!isHorizontal, this.onInserted, this.getOnMouseOut, this.anchorContainer);
237
+ var newInserter = (0, TableInserter_1.createTableInserter)(this.editor, td, this.table, this.isRTL, !!isHorizontal, this.onInserted, this.getOnMouseOut, this.anchorContainer);
237
238
  if (isHorizontal) {
238
239
  this.horizontalInserter = newInserter;
239
240
  }
@@ -244,33 +245,33 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
244
245
  };
245
246
  TableEditor.prototype.disposeTableResizer = function () {
246
247
  if (this.tableResizer) {
247
- (0, TableEditorFeature_1.disposeTableEditFeature)(this.tableResizer);
248
+ (0, TableEditFeature_1.disposeTableEditFeature)(this.tableResizer);
248
249
  this.tableResizer = null;
249
250
  }
250
251
  };
251
252
  TableEditor.prototype.disposeTableInserter = function () {
252
253
  if (this.horizontalInserter) {
253
- (0, TableEditorFeature_1.disposeTableEditFeature)(this.horizontalInserter);
254
+ (0, TableEditFeature_1.disposeTableEditFeature)(this.horizontalInserter);
254
255
  this.horizontalInserter = null;
255
256
  }
256
257
  if (this.verticalInserter) {
257
- (0, TableEditorFeature_1.disposeTableEditFeature)(this.verticalInserter);
258
+ (0, TableEditFeature_1.disposeTableEditFeature)(this.verticalInserter);
258
259
  this.verticalInserter = null;
259
260
  }
260
261
  };
261
262
  TableEditor.prototype.disposeCellResizers = function () {
262
263
  if (this.horizontalResizer) {
263
- (0, TableEditorFeature_1.disposeTableEditFeature)(this.horizontalResizer);
264
+ (0, TableEditFeature_1.disposeTableEditFeature)(this.horizontalResizer);
264
265
  this.horizontalResizer = null;
265
266
  }
266
267
  if (this.verticalResizer) {
267
- (0, TableEditorFeature_1.disposeTableEditFeature)(this.verticalResizer);
268
+ (0, TableEditFeature_1.disposeTableEditFeature)(this.verticalResizer);
268
269
  this.verticalResizer = null;
269
270
  }
270
271
  };
271
272
  TableEditor.prototype.disposeTableMover = function () {
272
273
  if (this.tableMover) {
273
- (0, TableEditorFeature_1.disposeTableEditFeature)(this.tableMover);
274
+ (0, TableEditFeature_1.disposeTableEditFeature)(this.tableMover);
274
275
  this.tableMover = null;
275
276
  }
276
277
  };
@@ -284,6 +285,6 @@ define(["require", "exports", "./features/CellResizer", "./features/TableInserte
284
285
  };
285
286
  return TableEditor;
286
287
  }());
287
- exports.default = TableEditor;
288
+ exports.TableEditor = TableEditor;
288
289
  });
289
290
  //# sourceMappingURL=TableEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableEditor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/tableEdit/editors/TableEditor.ts"],"names":[],"mappings":";;;IAUA,IAAM,qBAAqB,GAAG,CAAC,CAAC;IAChC,IAAW,WAGV;IAHD,WAAW,WAAW;QAClB,2CAAO,CAAA;QACP,6CAAQ,CAAA;IACZ,CAAC,EAHU,WAAW,KAAX,WAAW,QAGrB;IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH;QAmBI,qBACY,MAAe,EACP,KAAuB,EAC/B,SAAqB,EACrB,eAA6B,EAC7B,UAA+B;YAL3C,iBAUC;;YATW,WAAM,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er from './features/CellResizer';\nimport createTableInserter from './features/TableInserter';\nimport createTableMover from './features/TableMover';\nimport createTableResizer from './features/TableResizer';\nimport normalizeRect from '../../pluginUtils/Rect/normalizeRect';\nimport { disposeTableEditFeature } from './features/TableEditorFeature';\nimport { isNodeOfType } from 'roosterjs-content-model-dom';\nimport type TableEditFeature from './features/TableEditorFeature';\nimport type { IEditor, TableSelection } from 'roosterjs-content-model-types';\n\nconst INSERTER_HOVER_OFFSET = 6;\nconst enum TOP_OR_SIDE {\n top = 0,\n side = 1,\n}\n/**\n * @internal\n *\n * A table has 6 hot areas to be resized/edited (take LTR example):\n *\n * [6] [ ]\n * +[ 1 ]+--------------------+\n * |[ ]| |\n * [ ] [ ] |\n * [ ] [ ] |\n * [2] [3] |\n * [ ] [ ] |\n * [ ][ 4 ]| |\n * +------------------+--------------------+\n * | | |\n * | | |\n * | | |\n * +------------------+--------------------+\n * [5]\n *\n * 1 - Hover area to show insert column button\n * 2 - Hover area to show insert row button\n * 3 - Hover area to show vertical resizing bar\n * 4 - Hover area to show horizontal resizing bar\n * 5 - Hover area to show whole table resize handle\n * 6 - Hover area to show whole table mover handle\n *\n * When set a different current table or change current TD, we need to update these areas\n */\nexport default class TableEditor {\n // 1, 2 - Insert a column or a row\n private horizontalInserter: TableEditFeature | null = null;\n private verticalInserter: TableEditFeature | null = null;\n\n // 3, 4 - Resize a column or a row from a cell\n private horizontalResizer: TableEditFeature | null = null;\n private verticalResizer: TableEditFeature | null = null;\n\n // 5 - Resize whole table\n private tableResizer: TableEditFeature | null = null;\n\n // 6 - Move as well as select whole table\n private tableMover: TableEditFeature | null = null;\n\n private isRTL: boolean;\n private range: Range | null = null;\n private isCurrentlyEditing: boolean;\n\n constructor(\n private editor: IEditor,\n public readonly table: HTMLTableElement,\n private onChanged: () => void,\n private anchorContainer?: HTMLElement,\n private contentDiv?: EventTarget | null\n ) {\n this.isRTL = editor.getDocument().defaultView?.getComputedStyle(table).direction == 'rtl';\n this.setEditorFeatures();\n this.isCurrentlyEditing = false;\n }\n\n dispose() {\n this.disposeTableResizer();\n this.disposeCellResizers();\n this.disposeTableInserter();\n this.disposeTableMover();\n }\n\n isEditing(): boolean {\n return this.isCurrentlyEditing;\n }\n\n isOwnedElement(node: Node) {\n return [\n this.tableResizer,\n this.tableMover,\n this.horizontalInserter,\n this.verticalInserter,\n this.horizontalResizer,\n this.verticalResizer,\n ]\n .filter(feature => !!feature?.div)\n .some(feature => feature?.div == node);\n }\n\n onMouseMove(x: number, y: number) {\n // Get whole table rect\n const tableRect = normalizeRect(this.table.getBoundingClientRect());\n\n //console.log('>>>tableRect', tableRect);\n if (!tableRect) {\n return;\n }\n\n // Determine if cursor is on top or side\n const topOrSide =\n y <= tableRect.top + INSERTER_HOVER_OFFSET\n ? TOP_OR_SIDE.top\n : this.isRTL\n ? x >= tableRect.right - INSERTER_HOVER_OFFSET\n ? TOP_OR_SIDE.side\n : undefined\n : x <= tableRect.left + INSERTER_HOVER_OFFSET\n ? TOP_OR_SIDE.side\n : undefined;\n const topOrSideBinary = topOrSide ? 1 : 0;\n\n // i is row index, j is column index\n for (let i = 0; i < this.table.rows.length; i++) {\n const tr = this.table.rows[i];\n let j = 0;\n for (; j < tr.cells.length; j++) {\n const td = tr.cells[j];\n const tdRect = normalizeRect(td.getBoundingClientRect());\n\n if (!tdRect || !tableRect) {\n continue;\n }\n\n // Determine the cell the cursor is in range of\n // Offset is only used for first row and column\n const lessThanBottom = y <= tdRect.bottom;\n const lessThanRight = this.isRTL\n ? x <= tdRect.right + INSERTER_HOVER_OFFSET * topOrSideBinary\n : x <= tdRect.right;\n const moreThanLeft = this.isRTL\n ? x >= tdRect.left\n : x >= tdRect.left - INSERTER_HOVER_OFFSET * topOrSideBinary;\n\n if (lessThanBottom && lessThanRight && moreThanLeft) {\n if (i === 0 && topOrSide == TOP_OR_SIDE.top) {\n const center = (tdRect.left + tdRect.right) / 2;\n const isOnRightHalf = this.isRTL ? x < center : x > center;\n this.setInserterTd(\n isOnRightHalf ? td : tr.cells[j - 1],\n false /*isHorizontal*/\n );\n } else if (j === 0 && topOrSide == TOP_OR_SIDE.side) {\n const tdAbove = this.table.rows[i - 1]?.cells[0];\n const tdAboveRect = tdAbove\n ? normalizeRect(tdAbove.getBoundingClientRect())\n : null;\n\n const isTdNotAboveMerged = !tdAboveRect\n ? null\n : this.isRTL\n ? tdAboveRect.right === tdRect.right\n : tdAboveRect.left === tdRect.left;\n\n this.setInserterTd(\n y < (tdRect.top + tdRect.bottom) / 2 && isTdNotAboveMerged\n ? tdAbove\n : td,\n true /*isHorizontal*/\n );\n } else {\n this.setInserterTd(null);\n }\n\n this.setResizingTd(td);\n\n //Cell found\n break;\n }\n }\n\n if (j < tr.cells.length) {\n break;\n }\n }\n\n // Create Mover and Resizer\n this.setEditorFeatures();\n }\n\n private setEditorFeatures() {\n if (!this.tableMover) {\n this.tableMover = createTableMover(\n this.table,\n this.editor,\n this.isRTL,\n this.onSelect,\n this.getOnMouseOut,\n this.contentDiv,\n this.anchorContainer\n );\n }\n\n if (!this.tableResizer) {\n this.tableResizer = createTableResizer(\n this.table,\n this.editor,\n this.isRTL,\n this.onStartTableResize,\n this.onFinishEditing,\n this.contentDiv,\n this.anchorContainer\n );\n }\n }\n\n private setResizingTd(td: HTMLTableCellElement) {\n if (this.horizontalResizer && this.horizontalResizer.node != td) {\n this.disposeCellResizers();\n }\n\n if (!this.horizontalResizer && td) {\n this.horizontalResizer = createCellResizer(\n this.editor,\n td,\n this.table,\n this.isRTL,\n true /*isHorizontal*/,\n this.onStartCellResize,\n this.onFinishEditing,\n this.anchorContainer\n );\n this.verticalResizer = createCellResizer(\n this.editor,\n td,\n this.table,\n this.isRTL,\n false /*isHorizontal*/,\n this.onStartCellResize,\n this.onFinishEditing,\n this.anchorContainer\n );\n }\n }\n\n /**\n * create or remove TableInserter\n * @param td td to attach to, set this to null to remove inserters (both horizontal and vertical)\n */\n private setInserterTd(td: HTMLTableCellElement | null, isHorizontal?: boolean) {\n const inserter = isHorizontal ? this.horizontalInserter : this.verticalInserter;\n if (td === null || (inserter && inserter.node != td)) {\n this.disposeTableInserter();\n }\n\n if (!this.horizontalInserter && !this.verticalInserter && td) {\n const newInserter = createTableInserter(\n this.editor,\n td,\n this.table,\n this.isRTL,\n !!isHorizontal,\n this.onInserted,\n this.getOnMouseOut,\n this.anchorContainer\n );\n if (isHorizontal) {\n this.horizontalInserter = newInserter;\n } else {\n this.verticalInserter = newInserter;\n }\n }\n }\n\n private disposeTableResizer() {\n if (this.tableResizer) {\n disposeTableEditFeature(this.tableResizer);\n this.tableResizer = null;\n }\n }\n\n private disposeTableInserter() {\n if (this.horizontalInserter) {\n disposeTableEditFeature(this.horizontalInserter);\n this.horizontalInserter = null;\n }\n if (this.verticalInserter) {\n disposeTableEditFeature(this.verticalInserter);\n this.verticalInserter = null;\n }\n }\n\n private disposeCellResizers() {\n if (this.horizontalResizer) {\n disposeTableEditFeature(this.horizontalResizer);\n this.horizontalResizer = null;\n }\n if (this.verticalResizer) {\n disposeTableEditFeature(this.verticalResizer);\n this.verticalResizer = null;\n }\n }\n\n private disposeTableMover() {\n if (this.tableMover) {\n disposeTableEditFeature(this.tableMover);\n this.tableMover = null;\n }\n }\n\n private onFinishEditing = (): false => {\n this.editor.focus();\n\n if (this.range) {\n this.editor.setDOMSelection({ type: 'range', range: this.range, isReverted: false });\n }\n\n this.editor.takeSnapshot(); // Pass in an empty callback to make sure ContentChangedEvent is triggered\n this.onChanged();\n this.isCurrentlyEditing = false;\n\n return false;\n };\n\n private onStartTableResize = () => {\n this.isCurrentlyEditing = true;\n this.onStartResize();\n };\n\n private onStartCellResize = () => {\n this.isCurrentlyEditing = true;\n this.disposeTableResizer();\n this.onStartResize();\n };\n\n private onStartResize() {\n this.isCurrentlyEditing = true;\n const range = this.editor.getDOMSelection();\n\n if (range && range.type == 'range') {\n this.range = range.range;\n }\n\n this.editor.takeSnapshot();\n }\n\n private onInserted = () => {\n this.disposeTableResizer();\n this.onFinishEditing();\n };\n\n /**\n * Public only for testing purposes\n * @param table the table to select\n */\n public onSelect = (table: HTMLTableElement) => {\n this.editor.focus();\n\n if (table) {\n const selection: TableSelection = {\n table: table,\n firstRow: 0,\n firstColumn: 0,\n lastRow: table.rows.length - 1,\n lastColumn: table.rows[table.rows.length - 1].cells.length - 1,\n type: 'table',\n };\n\n this.editor.setDOMSelection(selection);\n }\n };\n\n private getOnMouseOut = (feature: HTMLElement) => {\n return (ev: MouseEvent) => {\n if (\n feature &&\n ev.relatedTarget != feature &&\n isNodeOfType(this.contentDiv as Node, 'ELEMENT_NODE') &&\n isNodeOfType(ev.relatedTarget as Node, 'ELEMENT_NODE') &&\n !(this.contentDiv == ev.relatedTarget)\n ) {\n this.dispose();\n }\n };\n };\n}\n"]}
1
+ {"version":3,"file":"TableEditor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/tableEdit/editors/TableEditor.ts"],"names":[],"mappings":";;;;IASA,IAAM,qBAAqB,GAAG,CAAC,CAAC;IAChC,IAAW,WAGV;IAHD,WAAW,WAAW;QAClB,2CAAO,CAAA;QACP,6CAAQ,CAAA;IACZ,CAAC,EAHU,WAAW,KAAX,WAAW,QAGrB;IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH;QAmBI,qBACY,MAAe,EACP,KAAuB,EAC/B,SAAqB,EACrB,eAA6B,EAC7B,UAA+B;YAL3C,iBAUC;;YATW,WAAM,GAAN,MAAM,CAAS;YACP,UAAK,GAAL,KAAK,CAAkB;YAC/B,cAAS,GAAT,SAAS,CAAY;YACrB,oBAAe,GAAf,eAAe,CAAc;YAC7B,eAAU,GAAV,UAAU,CAAqB;YAvB3C,kCAAkC;YAC1B,uBAAkB,GAA4B,IAAI,CAAC;YACnD,qBAAgB,GAA4B,IAAI,CAAC;YAEzD,8CAA8C;YACtC,sBAAiB,GAA4B,IAAI,CAAC;YAClD,oBAAe,GAA4B,IAAI,CAAC;YAExD,yBAAyB;YACjB,iBAAY,GAA4B,I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;QACL,CAAC;QAEO,yCAAmB,GAA3B;YACI,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBACxB,IAAA,0CAAuB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBAChD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;aACjC;YACD,IAAI,IAAI,CAAC,eAAe,EAAE;gBACtB,IAAA,0CAAuB,EAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAC9C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC/B;QACL,CAAC;QAEO,uCAAiB,GAAzB;YACI,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjB,IAAA,0CAAuB,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACzC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;aAC1B;QACL,CAAC;QA2BO,mCAAa,GAArB;YACI,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAC/B,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YAE5C,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,OAAO,EAAE;gBAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;aAC5B;YAED,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAC/B,CAAC;QAyCL,kBAAC;IAAD,CAAC,AApVD,IAoVC;IApVY,kCAAW","sourcesContent":["import { createCellResizer } from './features/CellResizer';\nimport { createTableInserter } from './features/TableInserter';\nimport { createTableMover } from './features/TableMover';\nimport { createTableResizer } from './features/TableResizer';\nimport { disposeTableEditFeature } from './features/TableEditFeature';\nimport { isNodeOfType, normalizeRect } from 'roosterjs-content-model-dom';\nimport type { TableEditFeature } from './features/TableEditFeature';\nimport type { IEditor, TableSelection } from 'roosterjs-content-model-types';\n\nconst INSERTER_HOVER_OFFSET = 6;\nconst enum TOP_OR_SIDE {\n top = 0,\n side = 1,\n}\n/**\n * @internal\n *\n * A table has 6 hot areas to be resized/edited (take LTR example):\n *\n * [6] [ ]\n * +[ 1 ]+--------------------+\n * |[ ]| |\n * [ ] [ ] |\n * [ ] [ ] |\n * [2] [3] |\n * [ ] [ ] |\n * [ ][ 4 ]| |\n * +------------------+--------------------+\n * | | |\n * | | |\n * | | |\n * +------------------+--------------------+\n * [5]\n *\n * 1 - Hover area to show insert column button\n * 2 - Hover area to show insert row button\n * 3 - Hover area to show vertical resizing bar\n * 4 - Hover area to show horizontal resizing bar\n * 5 - Hover area to show whole table resize handle\n * 6 - Hover area to show whole table mover handle\n *\n * When set a different current table or change current TD, we need to update these areas\n */\nexport class TableEditor {\n // 1, 2 - Insert a column or a row\n private horizontalInserter: TableEditFeature | null = null;\n private verticalInserter: TableEditFeature | null = null;\n\n // 3, 4 - Resize a column or a row from a cell\n private horizontalResizer: TableEditFeature | null = null;\n private verticalResizer: TableEditFeature | null = null;\n\n // 5 - Resize whole table\n private tableResizer: TableEditFeature | null = null;\n\n // 6 - Move as well as select whole table\n private tableMover: TableEditFeature | null = null;\n\n private isRTL: boolean;\n private range: Range | null = null;\n private isCurrentlyEditing: boolean;\n\n constructor(\n private editor: IEditor,\n public readonly table: HTMLTableElement,\n private onChanged: () => void,\n private anchorContainer?: HTMLElement,\n private contentDiv?: EventTarget | null\n ) {\n this.isRTL = editor.getDocument().defaultView?.getComputedStyle(table).direction == 'rtl';\n this.setEditorFeatures();\n this.isCurrentlyEditing = false;\n }\n\n dispose() {\n this.disposeTableResizer();\n this.disposeCellResizers();\n this.disposeTableInserter();\n this.disposeTableMover();\n }\n\n isEditing(): boolean {\n return this.isCurrentlyEditing;\n }\n\n isOwnedElement(node: Node) {\n return [\n this.tableResizer,\n this.tableMover,\n this.horizontalInserter,\n this.verticalInserter,\n this.horizontalResizer,\n this.verticalResizer,\n ]\n .filter(feature => !!feature?.div)\n .some(feature => feature?.div == node);\n }\n\n onMouseMove(x: number, y: number) {\n // Get whole table rect\n const tableRect = normalizeRect(this.table.getBoundingClientRect());\n\n //console.log('>>>tableRect', tableRect);\n if (!tableRect) {\n return;\n }\n\n // Determine if cursor is on top or side\n const topOrSide =\n y <= tableRect.top + INSERTER_HOVER_OFFSET\n ? TOP_OR_SIDE.top\n : this.isRTL\n ? x >= tableRect.right - INSERTER_HOVER_OFFSET\n ? TOP_OR_SIDE.side\n : undefined\n : x <= tableRect.left + INSERTER_HOVER_OFFSET\n ? TOP_OR_SIDE.side\n : undefined;\n const topOrSideBinary = topOrSide ? 1 : 0;\n\n // i is row index, j is column index\n for (let i = 0; i < this.table.rows.length; i++) {\n const tr = this.table.rows[i];\n let j = 0;\n for (; j < tr.cells.length; j++) {\n const td = tr.cells[j];\n const tdRect = normalizeRect(td.getBoundingClientRect());\n\n if (!tdRect || !tableRect) {\n continue;\n }\n\n // Determine the cell the cursor is in range of\n // Offset is only used for first row and column\n const lessThanBottom = y <= tdRect.bottom;\n const lessThanRight = this.isRTL\n ? x <= tdRect.right + INSERTER_HOVER_OFFSET * topOrSideBinary\n : x <= tdRect.right;\n const moreThanLeft = this.isRTL\n ? x >= tdRect.left\n : x >= tdRect.left - INSERTER_HOVER_OFFSET * topOrSideBinary;\n\n if (lessThanBottom && lessThanRight && moreThanLeft) {\n if (i === 0 && topOrSide == TOP_OR_SIDE.top) {\n const center = (tdRect.left + tdRect.right) / 2;\n const isOnRightHalf = this.isRTL ? x < center : x > center;\n this.setInserterTd(\n isOnRightHalf ? td : tr.cells[j - 1],\n false /*isHorizontal*/\n );\n } else if (j === 0 && topOrSide == TOP_OR_SIDE.side) {\n const tdAbove = this.table.rows[i - 1]?.cells[0];\n const tdAboveRect = tdAbove\n ? normalizeRect(tdAbove.getBoundingClientRect())\n : null;\n\n const isTdNotAboveMerged = !tdAboveRect\n ? null\n : this.isRTL\n ? tdAboveRect.right === tdRect.right\n : tdAboveRect.left === tdRect.left;\n\n this.setInserterTd(\n y < (tdRect.top + tdRect.bottom) / 2 && isTdNotAboveMerged\n ? tdAbove\n : td,\n true /*isHorizontal*/\n );\n } else {\n this.setInserterTd(null);\n }\n\n this.setResizingTd(td);\n\n //Cell found\n break;\n }\n }\n\n if (j < tr.cells.length) {\n break;\n }\n }\n\n // Create Mover and Resizer\n this.setEditorFeatures();\n }\n\n private setEditorFeatures() {\n if (!this.tableMover) {\n this.tableMover = createTableMover(\n this.table,\n this.editor,\n this.isRTL,\n this.onSelect,\n this.getOnMouseOut,\n this.contentDiv,\n this.anchorContainer\n );\n }\n\n if (!this.tableResizer) {\n this.tableResizer = createTableResizer(\n this.table,\n this.editor,\n this.isRTL,\n this.onStartTableResize,\n this.onFinishEditing,\n this.contentDiv,\n this.anchorContainer\n );\n }\n }\n\n private setResizingTd(td: HTMLTableCellElement) {\n if (this.horizontalResizer && this.horizontalResizer.node != td) {\n this.disposeCellResizers();\n }\n\n if (!this.horizontalResizer && td) {\n this.horizontalResizer = createCellResizer(\n this.editor,\n td,\n this.table,\n this.isRTL,\n true /*isHorizontal*/,\n this.onStartCellResize,\n this.onFinishEditing,\n this.anchorContainer\n );\n this.verticalResizer = createCellResizer(\n this.editor,\n td,\n this.table,\n this.isRTL,\n false /*isHorizontal*/,\n this.onStartCellResize,\n this.onFinishEditing,\n this.anchorContainer\n );\n }\n }\n\n /**\n * create or remove TableInserter\n * @param td td to attach to, set this to null to remove inserters (both horizontal and vertical)\n */\n private setInserterTd(td: HTMLTableCellElement | null, isHorizontal?: boolean) {\n const inserter = isHorizontal ? this.horizontalInserter : this.verticalInserter;\n if (td === null || (inserter && inserter.node != td)) {\n this.disposeTableInserter();\n }\n\n if (!this.horizontalInserter && !this.verticalInserter && td) {\n const newInserter = createTableInserter(\n this.editor,\n td,\n this.table,\n this.isRTL,\n !!isHorizontal,\n this.onInserted,\n this.getOnMouseOut,\n this.anchorContainer\n );\n if (isHorizontal) {\n this.horizontalInserter = newInserter;\n } else {\n this.verticalInserter = newInserter;\n }\n }\n }\n\n private disposeTableResizer() {\n if (this.tableResizer) {\n disposeTableEditFeature(this.tableResizer);\n this.tableResizer = null;\n }\n }\n\n private disposeTableInserter() {\n if (this.horizontalInserter) {\n disposeTableEditFeature(this.horizontalInserter);\n this.horizontalInserter = null;\n }\n if (this.verticalInserter) {\n disposeTableEditFeature(this.verticalInserter);\n this.verticalInserter = null;\n }\n }\n\n private disposeCellResizers() {\n if (this.horizontalResizer) {\n disposeTableEditFeature(this.horizontalResizer);\n this.horizontalResizer = null;\n }\n if (this.verticalResizer) {\n disposeTableEditFeature(this.verticalResizer);\n this.verticalResizer = null;\n }\n }\n\n private disposeTableMover() {\n if (this.tableMover) {\n disposeTableEditFeature(this.tableMover);\n this.tableMover = null;\n }\n }\n\n private onFinishEditing = (): false => {\n this.editor.focus();\n\n if (this.range) {\n this.editor.setDOMSelection({ type: 'range', range: this.range, isReverted: false });\n }\n\n this.editor.takeSnapshot(); // Pass in an empty callback to make sure ContentChangedEvent is triggered\n this.onChanged();\n this.isCurrentlyEditing = false;\n\n return false;\n };\n\n private onStartTableResize = () => {\n this.isCurrentlyEditing = true;\n this.onStartResize();\n };\n\n private onStartCellResize = () => {\n this.isCurrentlyEditing = true;\n this.disposeTableResizer();\n this.onStartResize();\n };\n\n private onStartResize() {\n this.isCurrentlyEditing = true;\n const range = this.editor.getDOMSelection();\n\n if (range && range.type == 'range') {\n this.range = range.range;\n }\n\n this.editor.takeSnapshot();\n }\n\n private onInserted = () => {\n this.disposeTableResizer();\n this.onFinishEditing();\n };\n\n /**\n * Public only for testing purposes\n * @param table the table to select\n */\n public onSelect = (table: HTMLTableElement) => {\n this.editor.focus();\n\n if (table) {\n const selection: TableSelection = {\n table: table,\n firstRow: 0,\n firstColumn: 0,\n lastRow: table.rows.length - 1,\n lastColumn: table.rows[table.rows.length - 1].cells.length - 1,\n type: 'table',\n };\n\n this.editor.setDOMSelection(selection);\n }\n };\n\n private getOnMouseOut = (feature: HTMLElement) => {\n return (ev: MouseEvent) => {\n if (\n feature &&\n ev.relatedTarget != feature &&\n isNodeOfType(this.contentDiv as Node, 'ELEMENT_NODE') &&\n isNodeOfType(ev.relatedTarget as Node, 'ELEMENT_NODE') &&\n !(this.contentDiv == ev.relatedTarget)\n ) {\n this.dispose();\n }\n };\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { IEditor } from 'roosterjs-content-model-types';
2
- import type TableEditFeature from './TableEditorFeature';
2
+ import type { TableEditFeature } from './TableEditFeature';
3
3
  /**
4
4
  * @internal
5
5
  */
6
- export default function createCellResizer(editor: IEditor, td: HTMLTableCellElement, table: HTMLTableElement, isRTL: boolean, isHorizontal: boolean, onStart: () => void, onEnd: () => false, anchorContainer?: HTMLElement): TableEditFeature | null;
6
+ export declare function createCellResizer(editor: IEditor, td: HTMLTableCellElement, table: HTMLTableElement, isRTL: boolean, isHorizontal: boolean, onStart: () => void, onEnd: () => false, anchorContainer?: HTMLElement): TableEditFeature | null;