roosterjs-content-model-plugins 0.26.4 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (479) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +11 -2
  2. package/lib/autoFormat/AutoFormatPlugin.js +24 -4
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
  4. package/lib/autoFormat/link/createLink.d.ts +5 -0
  5. package/lib/autoFormat/link/createLink.js +26 -0
  6. package/lib/autoFormat/link/createLink.js.map +1 -0
  7. package/lib/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  8. package/lib/autoFormat/link/createLinkAfterSpace.js +39 -0
  9. package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  10. package/lib/autoFormat/link/getLinkSegment.d.ts +5 -0
  11. package/lib/autoFormat/link/getLinkSegment.js +27 -0
  12. package/lib/autoFormat/link/getLinkSegment.js.map +1 -0
  13. package/lib/autoFormat/link/unlink.d.ts +5 -0
  14. package/lib/autoFormat/link/unlink.js +20 -0
  15. package/lib/autoFormat/link/unlink.js.map +1 -0
  16. package/lib/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  17. package/lib/autoFormat/list/getIndex.js.map +1 -0
  18. package/lib/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  19. package/lib/autoFormat/list/getListTypeStyle.js.map +1 -0
  20. package/lib/autoFormat/list/getNumberingListStyle.js.map +1 -0
  21. package/lib/autoFormat/list/keyboardListTrigger.d.ts +5 -0
  22. package/lib/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
  23. package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -0
  24. package/lib/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  25. package/lib/contextMenuBase/ContextMenuPluginBase.js +84 -0
  26. package/lib/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  27. package/lib/edit/EditPlugin.d.ts +3 -3
  28. package/lib/edit/EditPlugin.js +1 -1
  29. package/lib/edit/EditPlugin.js.map +1 -1
  30. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  31. package/lib/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
  32. package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  33. package/lib/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  34. package/lib/edit/deleteSteps/deleteEmptyQuote.js +60 -0
  35. package/lib/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  36. package/lib/edit/deleteSteps/deleteList.js +2 -1
  37. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  38. package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  39. package/lib/edit/handleKeyboardEventCommon.d.ts +2 -2
  40. package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
  41. package/lib/edit/inputSteps/handleEnterOnList.js +40 -10
  42. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
  43. package/lib/edit/keyboardDelete.d.ts +3 -3
  44. package/lib/edit/keyboardDelete.js +10 -2
  45. package/lib/edit/keyboardDelete.js.map +1 -1
  46. package/lib/edit/keyboardInput.d.ts +2 -2
  47. package/lib/edit/keyboardInput.js +2 -1
  48. package/lib/edit/keyboardInput.js.map +1 -1
  49. package/lib/edit/keyboardTab.d.ts +2 -2
  50. package/lib/edit/keyboardTab.js +19 -11
  51. package/lib/edit/keyboardTab.js.map +1 -1
  52. package/lib/edit/tabUtils/handleTabOnList.d.ts +7 -0
  53. package/lib/edit/tabUtils/handleTabOnList.js +34 -0
  54. package/lib/edit/tabUtils/handleTabOnList.js.map +1 -0
  55. package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
  56. package/lib/edit/tabUtils/handleTabOnParagraph.js +81 -0
  57. package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
  58. package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
  59. package/lib/index.d.ts +5 -0
  60. package/lib/index.js +22 -1
  61. package/lib/index.js.map +1 -1
  62. package/lib/paste/Excel/processPastedContentFromExcel.js +1 -1
  63. package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  64. package/lib/paste/PastePlugin.d.ts +2 -3
  65. package/lib/paste/PastePlugin.js +6 -7
  66. package/lib/paste/PastePlugin.js.map +1 -1
  67. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  68. package/lib/paste/WacComponents/constants.js.map +1 -1
  69. package/lib/paste/WacComponents/processPastedContentWacComponents.js +6 -6
  70. package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  71. package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
  72. package/lib/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  73. package/lib/paste/WordDesktop/getStyleMetadata.js +2 -1
  74. package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  75. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
  76. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  77. package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
  78. package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
  79. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  80. package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
  81. package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  82. package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  83. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  84. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  85. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  86. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  87. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  88. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  89. package/lib/paste/utils/addParser.d.ts +1 -1
  90. package/lib/paste/utils/addParser.js +2 -1
  91. package/lib/paste/utils/addParser.js.map +1 -1
  92. package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
  93. package/lib/paste/utils/getStyles.js.map +1 -1
  94. package/lib/paste/utils/linkParser.js.map +1 -1
  95. package/lib/paste/utils/setProcessor.js.map +1 -1
  96. package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  97. package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  98. package/lib/pluginUtils/CreateElement/createElement.d.ts +2 -2
  99. package/lib/pluginUtils/CreateElement/createElement.js +2 -1
  100. package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
  101. package/lib/pluginUtils/Disposable.d.ts +1 -1
  102. package/lib/pluginUtils/Disposable.js.map +1 -1
  103. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  104. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  105. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  106. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
  107. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  108. package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  109. package/lib/pluginUtils/Rect/getIntersectedRect.js +4 -3
  110. package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  111. package/lib/shortcut/ShortcutCommand.d.ts +44 -0
  112. package/lib/shortcut/ShortcutCommand.js +3 -0
  113. package/lib/shortcut/ShortcutCommand.js.map +1 -0
  114. package/lib/shortcut/ShortcutPlugin.d.ts +51 -0
  115. package/lib/shortcut/ShortcutPlugin.js +120 -0
  116. package/lib/shortcut/ShortcutPlugin.js.map +1 -0
  117. package/lib/shortcut/shortcuts.d.ts +85 -0
  118. package/lib/shortcut/shortcuts.js +211 -0
  119. package/lib/shortcut/shortcuts.js.map +1 -0
  120. package/lib/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  121. package/lib/shortcut/utils/setShortcutIndentationCommand.js +22 -0
  122. package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  123. package/lib/tableEdit/TableEditPlugin.d.ts +47 -0
  124. package/lib/tableEdit/TableEditPlugin.js +156 -0
  125. package/lib/tableEdit/TableEditPlugin.js.map +1 -0
  126. package/lib/tableEdit/editors/TableEditor.d.ts +73 -0
  127. package/lib/tableEdit/editors/TableEditor.js +294 -0
  128. package/lib/tableEdit/editors/TableEditor.js.map +1 -0
  129. package/lib/tableEdit/editors/features/CellResizer.d.ts +6 -0
  130. package/lib/tableEdit/editors/features/CellResizer.js +169 -0
  131. package/lib/tableEdit/editors/features/CellResizer.js.map +1 -0
  132. package/lib/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
  133. package/lib/tableEdit/editors/features/TableEditFeature.js +17 -0
  134. package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  135. package/lib/tableEdit/editors/features/TableInserter.d.ts +6 -0
  136. package/lib/tableEdit/editors/features/TableInserter.js +113 -0
  137. package/lib/tableEdit/editors/features/TableInserter.js.map +1 -0
  138. package/lib/tableEdit/editors/features/TableMover.d.ts +8 -0
  139. package/lib/tableEdit/editors/features/TableMover.js +83 -0
  140. package/lib/tableEdit/editors/features/TableMover.js.map +1 -0
  141. package/lib/tableEdit/editors/features/TableResizer.d.ts +6 -0
  142. package/lib/tableEdit/editors/features/TableResizer.js +166 -0
  143. package/lib/tableEdit/editors/features/TableResizer.js.map +1 -0
  144. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +11 -2
  145. package/lib-amd/autoFormat/AutoFormatPlugin.js +21 -4
  146. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
  147. package/lib-amd/autoFormat/link/createLink.d.ts +5 -0
  148. package/lib-amd/autoFormat/link/createLink.js +26 -0
  149. package/lib-amd/autoFormat/link/createLink.js.map +1 -0
  150. package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  151. package/lib-amd/autoFormat/link/createLinkAfterSpace.js +38 -0
  152. package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  153. package/lib-amd/autoFormat/link/getLinkSegment.d.ts +5 -0
  154. package/lib-amd/autoFormat/link/getLinkSegment.js +27 -0
  155. package/lib-amd/autoFormat/link/getLinkSegment.js.map +1 -0
  156. package/lib-amd/autoFormat/link/unlink.d.ts +5 -0
  157. package/lib-amd/autoFormat/link/unlink.js +21 -0
  158. package/lib-amd/autoFormat/link/unlink.js.map +1 -0
  159. package/lib-amd/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  160. package/lib-amd/autoFormat/list/getIndex.js.map +1 -0
  161. package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  162. package/lib-amd/autoFormat/list/getListTypeStyle.js.map +1 -0
  163. package/lib-amd/autoFormat/list/getNumberingListStyle.js.map +1 -0
  164. package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +5 -0
  165. package/lib-amd/autoFormat/list/keyboardListTrigger.js +46 -0
  166. package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -0
  167. package/lib-amd/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  168. package/lib-amd/contextMenuBase/ContextMenuPluginBase.js +86 -0
  169. package/lib-amd/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  170. package/lib-amd/edit/EditPlugin.d.ts +3 -3
  171. package/lib-amd/edit/EditPlugin.js +1 -1
  172. package/lib-amd/edit/EditPlugin.js.map +1 -1
  173. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  174. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +19 -1
  175. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  176. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  177. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js +60 -0
  178. package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  179. package/lib-amd/edit/deleteSteps/deleteList.js +2 -1
  180. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  181. package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  182. package/lib-amd/edit/handleKeyboardEventCommon.d.ts +2 -2
  183. package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
  184. package/lib-amd/edit/inputSteps/handleEnterOnList.js +40 -10
  185. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
  186. package/lib-amd/edit/keyboardDelete.d.ts +3 -3
  187. package/lib-amd/edit/keyboardDelete.js +10 -3
  188. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  189. package/lib-amd/edit/keyboardInput.d.ts +2 -2
  190. package/lib-amd/edit/keyboardInput.js +2 -2
  191. package/lib-amd/edit/keyboardInput.js.map +1 -1
  192. package/lib-amd/edit/keyboardTab.d.ts +2 -2
  193. package/lib-amd/edit/keyboardTab.js +18 -12
  194. package/lib-amd/edit/keyboardTab.js.map +1 -1
  195. package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +7 -0
  196. package/lib-amd/edit/tabUtils/handleTabOnList.js +34 -0
  197. package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -0
  198. package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
  199. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +81 -0
  200. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
  201. package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
  202. package/lib-amd/index.d.ts +5 -0
  203. package/lib-amd/index.js +19 -2
  204. package/lib-amd/index.js.map +1 -1
  205. package/lib-amd/paste/Excel/processPastedContentFromExcel.js +1 -1
  206. package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  207. package/lib-amd/paste/PastePlugin.d.ts +2 -3
  208. package/lib-amd/paste/PastePlugin.js +6 -7
  209. package/lib-amd/paste/PastePlugin.js.map +1 -1
  210. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  211. package/lib-amd/paste/WacComponents/constants.js.map +1 -1
  212. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +6 -6
  213. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  214. package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
  215. package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  216. package/lib-amd/paste/WordDesktop/getStyleMetadata.js +2 -1
  217. package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  218. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -17
  219. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  220. package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
  221. package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
  222. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  223. package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
  224. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  225. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  226. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  227. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  228. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  229. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  230. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  231. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  232. package/lib-amd/paste/utils/addParser.d.ts +1 -1
  233. package/lib-amd/paste/utils/addParser.js +2 -1
  234. package/lib-amd/paste/utils/addParser.js.map +1 -1
  235. package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
  236. package/lib-amd/paste/utils/getStyles.js.map +1 -1
  237. package/lib-amd/paste/utils/linkParser.js.map +1 -1
  238. package/lib-amd/paste/utils/setProcessor.js.map +1 -1
  239. package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  240. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  241. package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +2 -2
  242. package/lib-amd/pluginUtils/CreateElement/createElement.js +2 -1
  243. package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
  244. package/lib-amd/pluginUtils/Disposable.d.ts +1 -1
  245. package/lib-amd/pluginUtils/Disposable.js.map +1 -1
  246. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  247. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  248. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  249. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +2 -1
  250. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  251. package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  252. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +4 -3
  253. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  254. package/lib-amd/shortcut/ShortcutCommand.d.ts +44 -0
  255. package/lib-amd/shortcut/ShortcutCommand.js +5 -0
  256. package/lib-amd/shortcut/ShortcutCommand.js.map +1 -0
  257. package/lib-amd/shortcut/ShortcutPlugin.d.ts +51 -0
  258. package/lib-amd/shortcut/ShortcutPlugin.js +120 -0
  259. package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -0
  260. package/lib-amd/shortcut/shortcuts.d.ts +85 -0
  261. package/lib-amd/shortcut/shortcuts.js +210 -0
  262. package/lib-amd/shortcut/shortcuts.js.map +1 -0
  263. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  264. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +22 -0
  265. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  266. package/lib-amd/tableEdit/TableEditPlugin.d.ts +47 -0
  267. package/lib-amd/tableEdit/TableEditPlugin.js +156 -0
  268. package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -0
  269. package/lib-amd/tableEdit/editors/TableEditor.d.ts +73 -0
  270. package/lib-amd/tableEdit/editors/TableEditor.js +290 -0
  271. package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -0
  272. package/lib-amd/tableEdit/editors/features/CellResizer.d.ts +6 -0
  273. package/lib-amd/tableEdit/editors/features/CellResizer.js +166 -0
  274. package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -0
  275. package/lib-amd/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
  276. package/lib-amd/tableEdit/editors/features/TableEditFeature.js +19 -0
  277. package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  278. package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +6 -0
  279. package/lib-amd/tableEdit/editors/features/TableInserter.js +111 -0
  280. package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -0
  281. package/lib-amd/tableEdit/editors/features/TableMover.d.ts +8 -0
  282. package/lib-amd/tableEdit/editors/features/TableMover.js +81 -0
  283. package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -0
  284. package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +6 -0
  285. package/lib-amd/tableEdit/editors/features/TableResizer.js +164 -0
  286. package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -0
  287. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +11 -2
  288. package/lib-mjs/autoFormat/AutoFormatPlugin.js +24 -4
  289. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
  290. package/lib-mjs/autoFormat/link/createLink.d.ts +5 -0
  291. package/lib-mjs/autoFormat/link/createLink.js +22 -0
  292. package/lib-mjs/autoFormat/link/createLink.js.map +1 -0
  293. package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +5 -0
  294. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +35 -0
  295. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -0
  296. package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +5 -0
  297. package/lib-mjs/autoFormat/link/getLinkSegment.js +23 -0
  298. package/lib-mjs/autoFormat/link/getLinkSegment.js.map +1 -0
  299. package/lib-mjs/autoFormat/link/unlink.d.ts +5 -0
  300. package/lib-mjs/autoFormat/link/unlink.js +16 -0
  301. package/lib-mjs/autoFormat/link/unlink.js.map +1 -0
  302. package/lib-mjs/autoFormat/list/convertAlphaToDecimals.js.map +1 -0
  303. package/lib-mjs/autoFormat/list/getIndex.js.map +1 -0
  304. package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.js +3 -0
  305. package/lib-mjs/autoFormat/list/getListTypeStyle.js.map +1 -0
  306. package/lib-mjs/autoFormat/list/getNumberingListStyle.js.map +1 -0
  307. package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +5 -0
  308. package/lib-mjs/autoFormat/{keyboardListTrigger.js → list/keyboardListTrigger.js} +17 -15
  309. package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -0
  310. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.d.ts +58 -0
  311. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js +81 -0
  312. package/lib-mjs/contextMenuBase/ContextMenuPluginBase.js.map +1 -0
  313. package/lib-mjs/edit/EditPlugin.d.ts +3 -3
  314. package/lib-mjs/edit/EditPlugin.js +1 -1
  315. package/lib-mjs/edit/EditPlugin.js.map +1 -1
  316. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  317. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +20 -1
  318. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  319. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.d.ts +5 -0
  320. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js +56 -0
  321. package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js.map +1 -0
  322. package/lib-mjs/edit/deleteSteps/deleteList.js +2 -1
  323. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  324. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  325. package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +2 -2
  326. package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
  327. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +42 -12
  328. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
  329. package/lib-mjs/edit/keyboardDelete.d.ts +3 -3
  330. package/lib-mjs/edit/keyboardDelete.js +10 -2
  331. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  332. package/lib-mjs/edit/keyboardInput.d.ts +2 -2
  333. package/lib-mjs/edit/keyboardInput.js +2 -1
  334. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  335. package/lib-mjs/edit/keyboardTab.d.ts +2 -2
  336. package/lib-mjs/edit/keyboardTab.js +19 -11
  337. package/lib-mjs/edit/keyboardTab.js.map +1 -1
  338. package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +7 -0
  339. package/lib-mjs/edit/tabUtils/handleTabOnList.js +30 -0
  340. package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -0
  341. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +17 -0
  342. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +77 -0
  343. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -0
  344. package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
  345. package/lib-mjs/index.d.ts +5 -0
  346. package/lib-mjs/index.js +4 -0
  347. package/lib-mjs/index.js.map +1 -1
  348. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +1 -1
  349. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  350. package/lib-mjs/paste/PastePlugin.d.ts +2 -3
  351. package/lib-mjs/paste/PastePlugin.js +1 -2
  352. package/lib-mjs/paste/PastePlugin.js.map +1 -1
  353. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  354. package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
  355. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +1 -1
  356. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  357. package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
  358. package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +1 -1
  359. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +1 -1
  360. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  361. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +2 -14
  362. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  363. package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
  364. package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
  365. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  366. package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
  367. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  368. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  369. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  370. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  371. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  372. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  373. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  374. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  375. package/lib-mjs/paste/utils/addParser.d.ts +1 -1
  376. package/lib-mjs/paste/utils/addParser.js +1 -1
  377. package/lib-mjs/paste/utils/addParser.js.map +1 -1
  378. package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
  379. package/lib-mjs/paste/utils/getStyles.js.map +1 -1
  380. package/lib-mjs/paste/utils/linkParser.js.map +1 -1
  381. package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
  382. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +1 -1
  383. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  384. package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +2 -2
  385. package/lib-mjs/pluginUtils/CreateElement/createElement.js +1 -1
  386. package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
  387. package/lib-mjs/pluginUtils/Disposable.d.ts +1 -1
  388. package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
  389. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +1 -1
  390. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  391. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +3 -3
  392. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +1 -1
  393. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  394. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +1 -1
  395. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +2 -2
  396. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  397. package/lib-mjs/shortcut/ShortcutCommand.d.ts +44 -0
  398. package/lib-mjs/shortcut/ShortcutCommand.js +2 -0
  399. package/lib-mjs/shortcut/ShortcutCommand.js.map +1 -0
  400. package/lib-mjs/shortcut/ShortcutPlugin.d.ts +51 -0
  401. package/lib-mjs/shortcut/ShortcutPlugin.js +117 -0
  402. package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -0
  403. package/lib-mjs/shortcut/shortcuts.d.ts +85 -0
  404. package/lib-mjs/shortcut/shortcuts.js +208 -0
  405. package/lib-mjs/shortcut/shortcuts.js.map +1 -0
  406. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.d.ts +5 -0
  407. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +18 -0
  408. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -0
  409. package/lib-mjs/tableEdit/TableEditPlugin.d.ts +47 -0
  410. package/lib-mjs/tableEdit/TableEditPlugin.js +153 -0
  411. package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -0
  412. package/lib-mjs/tableEdit/editors/TableEditor.d.ts +73 -0
  413. package/lib-mjs/tableEdit/editors/TableEditor.js +291 -0
  414. package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -0
  415. package/lib-mjs/tableEdit/editors/features/CellResizer.d.ts +6 -0
  416. package/lib-mjs/tableEdit/editors/features/CellResizer.js +165 -0
  417. package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -0
  418. package/lib-mjs/tableEdit/editors/features/TableEditFeature.d.ts +13 -0
  419. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +13 -0
  420. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -0
  421. package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +6 -0
  422. package/lib-mjs/tableEdit/editors/features/TableInserter.js +109 -0
  423. package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -0
  424. package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +8 -0
  425. package/lib-mjs/tableEdit/editors/features/TableMover.js +79 -0
  426. package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -0
  427. package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +6 -0
  428. package/lib-mjs/tableEdit/editors/features/TableResizer.js +162 -0
  429. package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -0
  430. package/package.json +5 -5
  431. package/lib/autoFormat/keyboardListTrigger.d.ts +0 -5
  432. package/lib/autoFormat/keyboardListTrigger.js.map +0 -1
  433. package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  434. package/lib/autoFormat/utils/getIndex.js.map +0 -1
  435. package/lib/autoFormat/utils/getListTypeStyle.js.map +0 -1
  436. package/lib/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  437. package/lib/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  438. package/lib/pluginUtils/Rect/normalizeRect.js +0 -20
  439. package/lib/pluginUtils/Rect/normalizeRect.js.map +0 -1
  440. package/lib-amd/autoFormat/keyboardListTrigger.d.ts +0 -5
  441. package/lib-amd/autoFormat/keyboardListTrigger.js +0 -44
  442. package/lib-amd/autoFormat/keyboardListTrigger.js.map +0 -1
  443. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  444. package/lib-amd/autoFormat/utils/getIndex.js.map +0 -1
  445. package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +0 -1
  446. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  447. package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  448. package/lib-amd/pluginUtils/Rect/normalizeRect.js +0 -22
  449. package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +0 -1
  450. package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +0 -5
  451. package/lib-mjs/autoFormat/keyboardListTrigger.js.map +0 -1
  452. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +0 -1
  453. package/lib-mjs/autoFormat/utils/getIndex.js.map +0 -1
  454. package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +0 -1
  455. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +0 -1
  456. package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +0 -7
  457. package/lib-mjs/pluginUtils/Rect/normalizeRect.js +0 -17
  458. package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +0 -1
  459. /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  460. /package/lib/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  461. /package/lib/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  462. /package/lib/autoFormat/{utils → list}/getIndex.js +0 -0
  463. /package/lib/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  464. /package/lib/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  465. /package/lib/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  466. /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  467. /package/lib-amd/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  468. /package/lib-amd/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  469. /package/lib-amd/autoFormat/{utils → list}/getIndex.js +0 -0
  470. /package/lib-amd/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  471. /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  472. /package/lib-amd/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
  473. /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.d.ts +0 -0
  474. /package/lib-mjs/autoFormat/{utils → list}/convertAlphaToDecimals.js +0 -0
  475. /package/lib-mjs/autoFormat/{utils → list}/getIndex.d.ts +0 -0
  476. /package/lib-mjs/autoFormat/{utils → list}/getIndex.js +0 -0
  477. /package/lib-mjs/autoFormat/{utils → list}/getListTypeStyle.d.ts +0 -0
  478. /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.d.ts +0 -0
  479. /package/lib-mjs/autoFormat/{utils → list}/getNumberingListStyle.js +0 -0
@@ -0,0 +1,44 @@
1
+ import type { IEditor } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Definition of the shortcut key
4
+ */
5
+ export interface ShortcutKeyDefinition {
6
+ /**
7
+ * Modifier key for this shortcut, allowed values are:
8
+ * ctrl: Ctrl key (or Meta key on MacOS)
9
+ * alt: Alt key
10
+ */
11
+ modifierKey: 'ctrl' | 'alt';
12
+ /**
13
+ * Whether ALT key is required for this shortcut
14
+ */
15
+ shiftKey: boolean;
16
+ /**
17
+ * Key code for this shortcut. The value should be the value of KeyboardEvent.which
18
+ * We are still using key code here rather than key name (event.key) although event.which is deprecated because of globalization.
19
+ * For example, on US keyboard, Shift+Comma="<" but on Spanish keyboard it is ":"
20
+ * 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.
21
+ */
22
+ which: number;
23
+ }
24
+ /**
25
+ * Represents a command for shortcut
26
+ */
27
+ export interface ShortcutCommand {
28
+ /**
29
+ * Definition of the shortcut key
30
+ */
31
+ shortcutKey: ShortcutKeyDefinition;
32
+ /**
33
+ * @optional Required environment for this command
34
+ * all: (Default) This feature is available for all environments
35
+ * mac: This feature is available on MacOS only
36
+ * nonMac: This feature is available on OS other than MacOS
37
+ */
38
+ environment?: 'all' | 'mac' | 'nonMac';
39
+ /**
40
+ * The callback function to invoke when this shortcut is triggered
41
+ * @param editor The editor object
42
+ */
43
+ onClick: (editor: IEditor) => void;
44
+ }
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=ShortcutCommand.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,51 @@
1
+ import type { ShortcutCommand } from './ShortcutCommand';
2
+ import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
3
+ /**
4
+ * Shortcut plugin hook on the specified shortcut keys and trigger related format API
5
+ */
6
+ export declare class ShortcutPlugin implements EditorPlugin {
7
+ private shortcuts;
8
+ private editor;
9
+ private isMac;
10
+ /**
11
+ * Create a new instance of ShortcutPlugin
12
+ * @param [shortcuts=defaultShortcuts] Allowed commands
13
+ */
14
+ constructor(shortcuts?: ShortcutCommand[]);
15
+ /**
16
+ * Get name of this plugin
17
+ */
18
+ getName(): string;
19
+ /**
20
+ * The first method that editor will call to a plugin when editor is initializing.
21
+ * It will pass in the editor instance, plugin should take this chance to save the
22
+ * editor reference so that it can call to any editor method or format API later.
23
+ * @param editor The editor object
24
+ */
25
+ initialize(editor: IEditor): void;
26
+ /**
27
+ * The last method that editor will call to a plugin before it is disposed.
28
+ * Plugin can take this chance to clear the reference to editor. After this method is
29
+ * called, plugin should not call to any editor method since it will result in error.
30
+ */
31
+ dispose(): void;
32
+ /**
33
+ * Check if the plugin should handle the given event exclusively.
34
+ * Handle an event exclusively means other plugin will not receive this event in
35
+ * onPluginEvent method.
36
+ * If two plugins will return true in willHandleEventExclusively() for the same event,
37
+ * the final result depends on the order of the plugins are added into editor
38
+ * @param event The event to check:
39
+ */
40
+ willHandleEventExclusively(event: PluginEvent): boolean;
41
+ /**
42
+ * Core method for a plugin. Once an event happens in editor, editor will call this
43
+ * method of each plugin to handle the event as long as the event is not handled
44
+ * exclusively by another plugin.
45
+ * @param event The event to handle:
46
+ */
47
+ onPluginEvent(event: PluginEvent): void;
48
+ private cacheGetCommand;
49
+ private matchOS;
50
+ private matchShortcut;
51
+ }
@@ -0,0 +1,120 @@
1
+ define(["require", "exports", "roosterjs-content-model-core", "./shortcuts"], function (require, exports, roosterjs_content_model_core_1, shortcuts_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ShortcutPlugin = void 0;
5
+ var defaultShortcuts = [
6
+ shortcuts_1.ShortcutBold,
7
+ shortcuts_1.ShortcutItalic,
8
+ shortcuts_1.ShortcutUnderline,
9
+ shortcuts_1.ShortcutClearFormat,
10
+ shortcuts_1.ShortcutUndo,
11
+ shortcuts_1.ShortcutUndo2,
12
+ shortcuts_1.ShortcutRedo,
13
+ shortcuts_1.ShortcutRedoMacOS,
14
+ shortcuts_1.ShortcutBullet,
15
+ shortcuts_1.ShortcutNumbering,
16
+ shortcuts_1.ShortcutIncreaseFont,
17
+ shortcuts_1.ShortcutDecreaseFont,
18
+ shortcuts_1.ShortcutIndentList,
19
+ shortcuts_1.ShortcutOutdentList,
20
+ ];
21
+ var CommandCacheKey = '__ShortcutCommandCache';
22
+ /**
23
+ * Shortcut plugin hook on the specified shortcut keys and trigger related format API
24
+ */
25
+ var ShortcutPlugin = /** @class */ (function () {
26
+ /**
27
+ * Create a new instance of ShortcutPlugin
28
+ * @param [shortcuts=defaultShortcuts] Allowed commands
29
+ */
30
+ function ShortcutPlugin(shortcuts) {
31
+ if (shortcuts === void 0) { shortcuts = defaultShortcuts; }
32
+ this.shortcuts = shortcuts;
33
+ this.editor = null;
34
+ this.isMac = false;
35
+ }
36
+ /**
37
+ * Get name of this plugin
38
+ */
39
+ ShortcutPlugin.prototype.getName = function () {
40
+ return 'Shortcut';
41
+ };
42
+ /**
43
+ * The first method that editor will call to a plugin when editor is initializing.
44
+ * It will pass in the editor instance, plugin should take this chance to save the
45
+ * editor reference so that it can call to any editor method or format API later.
46
+ * @param editor The editor object
47
+ */
48
+ ShortcutPlugin.prototype.initialize = function (editor) {
49
+ this.editor = editor;
50
+ this.isMac = !!this.editor.getEnvironment().isMac;
51
+ };
52
+ /**
53
+ * The last method that editor will call to a plugin before it is disposed.
54
+ * Plugin can take this chance to clear the reference to editor. After this method is
55
+ * called, plugin should not call to any editor method since it will result in error.
56
+ */
57
+ ShortcutPlugin.prototype.dispose = function () {
58
+ this.editor = null;
59
+ };
60
+ /**
61
+ * Check if the plugin should handle the given event exclusively.
62
+ * Handle an event exclusively means other plugin will not receive this event in
63
+ * onPluginEvent method.
64
+ * If two plugins will return true in willHandleEventExclusively() for the same event,
65
+ * the final result depends on the order of the plugins are added into editor
66
+ * @param event The event to check:
67
+ */
68
+ ShortcutPlugin.prototype.willHandleEventExclusively = function (event) {
69
+ return (event.eventType == 'keyDown' &&
70
+ (event.rawEvent.ctrlKey || event.rawEvent.altKey || event.rawEvent.metaKey) &&
71
+ !!this.cacheGetCommand(event));
72
+ };
73
+ /**
74
+ * Core method for a plugin. Once an event happens in editor, editor will call this
75
+ * method of each plugin to handle the event as long as the event is not handled
76
+ * exclusively by another plugin.
77
+ * @param event The event to handle:
78
+ */
79
+ ShortcutPlugin.prototype.onPluginEvent = function (event) {
80
+ if (this.editor && event.eventType == 'keyDown') {
81
+ var command = this.cacheGetCommand(event);
82
+ if (command) {
83
+ command.onClick(this.editor);
84
+ event.rawEvent.preventDefault();
85
+ }
86
+ }
87
+ };
88
+ ShortcutPlugin.prototype.cacheGetCommand = function (event) {
89
+ var _this = this;
90
+ return (0, roosterjs_content_model_core_1.cacheGetEventData)(event, CommandCacheKey, function (event) {
91
+ var editor = _this.editor;
92
+ return (editor &&
93
+ _this.shortcuts.filter(function (command) {
94
+ return _this.matchOS(command.environment) &&
95
+ _this.matchShortcut(command.shortcutKey, event.rawEvent);
96
+ })[0]);
97
+ });
98
+ };
99
+ ShortcutPlugin.prototype.matchOS = function (environment) {
100
+ switch (environment) {
101
+ case 'mac':
102
+ return this.isMac;
103
+ case 'nonMac':
104
+ return !this.isMac;
105
+ default:
106
+ return true;
107
+ }
108
+ };
109
+ ShortcutPlugin.prototype.matchShortcut = function (shortcutKey, event) {
110
+ var ctrlKey = event.ctrlKey, altKey = event.altKey, shiftKey = event.shiftKey, which = event.which, metaKey = event.metaKey;
111
+ var ctrlOrMeta = this.isMac ? metaKey : ctrlKey;
112
+ var matchModifier = (shortcutKey.modifierKey == 'ctrl' && ctrlOrMeta && !altKey) ||
113
+ (shortcutKey.modifierKey == 'alt' && altKey && !ctrlOrMeta);
114
+ return matchModifier && shiftKey == shortcutKey.shiftKey && shortcutKey.which == which;
115
+ };
116
+ return ShortcutPlugin;
117
+ }());
118
+ exports.ShortcutPlugin = ShortcutPlugin;
119
+ });
120
+ //# sourceMappingURL=ShortcutPlugin.js.map
@@ -0,0 +1 @@
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,eA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C,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 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"]}
@@ -0,0 +1,85 @@
1
+ import type { ShortcutCommand } from './ShortcutCommand';
2
+ /**
3
+ * Shortcut command for Bold
4
+ * Windows: Ctrl + B
5
+ * MacOS: Meta + B
6
+ */
7
+ export declare const ShortcutBold: ShortcutCommand;
8
+ /**
9
+ * Shortcut command for Italic
10
+ * Windows: Ctrl + I
11
+ * MacOS: Meta + I
12
+ */
13
+ export declare const ShortcutItalic: ShortcutCommand;
14
+ /**
15
+ * Shortcut command for Underline
16
+ * Windows: Ctrl + U
17
+ * MacOS: Meta + U
18
+ */
19
+ export declare const ShortcutUnderline: ShortcutCommand;
20
+ /**
21
+ * Shortcut command for Clear Format
22
+ * Windows: Ctrl + Space
23
+ * MacOS: Meta + Space
24
+ */
25
+ export declare const ShortcutClearFormat: ShortcutCommand;
26
+ /**
27
+ * Shortcut command for Undo 1
28
+ * Windows: Ctrl + Z
29
+ * MacOS: Meta + Z
30
+ */
31
+ export declare const ShortcutUndo: ShortcutCommand;
32
+ /**
33
+ * Shortcut command for Undo 2
34
+ * Windows: Alt + Backspace
35
+ * MacOS: N/A
36
+ */
37
+ export declare const ShortcutUndo2: ShortcutCommand;
38
+ /**
39
+ * Shortcut command for Redo 1
40
+ * Windows: Ctrl + Y
41
+ * MacOS: N/A
42
+ */
43
+ export declare const ShortcutRedo: ShortcutCommand;
44
+ /**
45
+ * Shortcut command for Redo 2
46
+ * Windows: N/A
47
+ * MacOS: Meta + Shift + Z
48
+ */
49
+ export declare const ShortcutRedoMacOS: ShortcutCommand;
50
+ /**
51
+ * Shortcut command for Bullet List
52
+ * Windows: Ctrl + . (Period)
53
+ * MacOS: Meta + . (Period)
54
+ */
55
+ export declare const ShortcutBullet: ShortcutCommand;
56
+ /**
57
+ * Shortcut command for Numbering List
58
+ * Windows: Ctrl + / (Forward slash)
59
+ * MacOS: Meta + / (Forward slash)
60
+ */
61
+ export declare const ShortcutNumbering: ShortcutCommand;
62
+ /**
63
+ * Shortcut command for Increase Font
64
+ * Windows: Ctrl + Shift + . (Period)
65
+ * MacOS: Meta + Shift + . (Period)
66
+ */
67
+ export declare const ShortcutIncreaseFont: ShortcutCommand;
68
+ /**
69
+ * Shortcut command for Decrease Font
70
+ * Windows: Ctrl + Shift + , (Comma)
71
+ * MacOS: Meta + Shift + , (Comma)
72
+ */
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;
@@ -0,0 +1,210 @@
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
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
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
+ var Keys;
6
+ (function (Keys) {
7
+ Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
8
+ Keys[Keys["SPACE"] = 32] = "SPACE";
9
+ Keys[Keys["B"] = 66] = "B";
10
+ Keys[Keys["I"] = 73] = "I";
11
+ Keys[Keys["U"] = 85] = "U";
12
+ Keys[Keys["Y"] = 89] = "Y";
13
+ Keys[Keys["Z"] = 90] = "Z";
14
+ Keys[Keys["COMMA"] = 188] = "COMMA";
15
+ Keys[Keys["PERIOD"] = 190] = "PERIOD";
16
+ Keys[Keys["FORWARD_SLASH"] = 191] = "FORWARD_SLASH";
17
+ Keys[Keys["ArrowRight"] = 39] = "ArrowRight";
18
+ Keys[Keys["ArrowLeft"] = 37] = "ArrowLeft";
19
+ })(Keys || (Keys = {}));
20
+ /**
21
+ * Shortcut command for Bold
22
+ * Windows: Ctrl + B
23
+ * MacOS: Meta + B
24
+ */
25
+ exports.ShortcutBold = {
26
+ shortcutKey: {
27
+ modifierKey: 'ctrl',
28
+ shiftKey: false,
29
+ which: 66 /* B */,
30
+ },
31
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleBold)(editor); },
32
+ };
33
+ /**
34
+ * Shortcut command for Italic
35
+ * Windows: Ctrl + I
36
+ * MacOS: Meta + I
37
+ */
38
+ exports.ShortcutItalic = {
39
+ shortcutKey: {
40
+ modifierKey: 'ctrl',
41
+ shiftKey: false,
42
+ which: 73 /* I */,
43
+ },
44
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleItalic)(editor); },
45
+ };
46
+ /**
47
+ * Shortcut command for Underline
48
+ * Windows: Ctrl + U
49
+ * MacOS: Meta + U
50
+ */
51
+ exports.ShortcutUnderline = {
52
+ shortcutKey: {
53
+ modifierKey: 'ctrl',
54
+ shiftKey: false,
55
+ which: 85 /* U */,
56
+ },
57
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleUnderline)(editor); },
58
+ };
59
+ /**
60
+ * Shortcut command for Clear Format
61
+ * Windows: Ctrl + Space
62
+ * MacOS: Meta + Space
63
+ */
64
+ exports.ShortcutClearFormat = {
65
+ shortcutKey: {
66
+ modifierKey: 'ctrl',
67
+ shiftKey: false,
68
+ which: 32 /* SPACE */,
69
+ },
70
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.clearFormat)(editor); },
71
+ };
72
+ /**
73
+ * Shortcut command for Undo 1
74
+ * Windows: Ctrl + Z
75
+ * MacOS: Meta + Z
76
+ */
77
+ exports.ShortcutUndo = {
78
+ shortcutKey: {
79
+ modifierKey: 'ctrl',
80
+ shiftKey: false,
81
+ which: 90 /* Z */,
82
+ },
83
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.undo)(editor); },
84
+ };
85
+ /**
86
+ * Shortcut command for Undo 2
87
+ * Windows: Alt + Backspace
88
+ * MacOS: N/A
89
+ */
90
+ exports.ShortcutUndo2 = {
91
+ shortcutKey: {
92
+ modifierKey: 'alt',
93
+ shiftKey: false,
94
+ which: 8 /* BACKSPACE */,
95
+ },
96
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.undo)(editor); },
97
+ environment: 'nonMac',
98
+ };
99
+ /**
100
+ * Shortcut command for Redo 1
101
+ * Windows: Ctrl + Y
102
+ * MacOS: N/A
103
+ */
104
+ exports.ShortcutRedo = {
105
+ shortcutKey: {
106
+ modifierKey: 'ctrl',
107
+ shiftKey: false,
108
+ which: 89 /* Y */,
109
+ },
110
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.redo)(editor); },
111
+ environment: 'nonMac',
112
+ };
113
+ /**
114
+ * Shortcut command for Redo 2
115
+ * Windows: N/A
116
+ * MacOS: Meta + Shift + Z
117
+ */
118
+ exports.ShortcutRedoMacOS = {
119
+ shortcutKey: {
120
+ modifierKey: 'ctrl',
121
+ shiftKey: true,
122
+ which: 90 /* Z */,
123
+ },
124
+ onClick: function (editor) { return (0, roosterjs_content_model_core_1.redo)(editor); },
125
+ environment: 'mac',
126
+ };
127
+ /**
128
+ * Shortcut command for Bullet List
129
+ * Windows: Ctrl + . (Period)
130
+ * MacOS: Meta + . (Period)
131
+ */
132
+ exports.ShortcutBullet = {
133
+ shortcutKey: {
134
+ modifierKey: 'ctrl',
135
+ shiftKey: false,
136
+ which: 190 /* PERIOD */,
137
+ },
138
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleBullet)(editor); },
139
+ };
140
+ /**
141
+ * Shortcut command for Numbering List
142
+ * Windows: Ctrl + / (Forward slash)
143
+ * MacOS: Meta + / (Forward slash)
144
+ */
145
+ exports.ShortcutNumbering = {
146
+ shortcutKey: {
147
+ modifierKey: 'ctrl',
148
+ shiftKey: false,
149
+ which: 191 /* FORWARD_SLASH */,
150
+ },
151
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.toggleNumbering)(editor); },
152
+ };
153
+ /**
154
+ * Shortcut command for Increase Font
155
+ * Windows: Ctrl + Shift + . (Period)
156
+ * MacOS: Meta + Shift + . (Period)
157
+ */
158
+ exports.ShortcutIncreaseFont = {
159
+ shortcutKey: {
160
+ modifierKey: 'ctrl',
161
+ shiftKey: true,
162
+ which: 190 /* PERIOD */,
163
+ },
164
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.changeFontSize)(editor, 'increase'); },
165
+ };
166
+ /**
167
+ * Shortcut command for Decrease Font
168
+ * Windows: Ctrl + Shift + , (Comma)
169
+ * MacOS: Meta + Shift + , (Comma)
170
+ */
171
+ exports.ShortcutDecreaseFont = {
172
+ shortcutKey: {
173
+ modifierKey: 'ctrl',
174
+ shiftKey: true,
175
+ which: 188 /* COMMA */,
176
+ },
177
+ onClick: function (editor) { return (0, roosterjs_content_model_api_1.changeFontSize)(editor, 'decrease'); },
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
+ };
209
+ });
210
+ //# sourceMappingURL=shortcuts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/shortcut/shortcuts.ts"],"names":[],"mappings":";;;;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,CAAC;IAEF;;;;OAIG;IACU,QAAA,cAAc,GAAoB;QAC3C,WAAW,EAAE;YACT,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,YAAQ;SAChB;QACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,0CAAY,EAAC,MAAM,CAAC,EAApB,CAAoB;KAC1C,CAAC;IAEF;;;;OAIG;IACU,QAAA,iBAAiB,GAAoB;QAC9C,WAAW,EAAE;YACT,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,YAAQ;SAChB;QACD,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,IAAA,6CAAe,EAAC,MAAM,CAAC,EAAvB,CAAuB;KAC7C,CAAC;IAEF;;;;OAIG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E;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"]}
@@ -0,0 +1,47 @@
1
+ import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
2
+ /**
3
+ * TableEdit plugin, provides the ability to resize a table by drag-and-drop
4
+ */
5
+ export declare class TableEditPlugin implements EditorPlugin {
6
+ private anchorContainerSelector?;
7
+ private editor;
8
+ private onMouseMoveDisposer;
9
+ private tableRectMap;
10
+ private tableEditor;
11
+ /**
12
+ * Construct a new instance of TableResize plugin
13
+ * @param anchorContainerSelector An optional selector string to specify the container to host the plugin.
14
+ * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.
15
+ * If not specified, the plugin will be inserted in document.body
16
+ */
17
+ constructor(anchorContainerSelector?: string | undefined);
18
+ /**
19
+ * Get a friendly name of this plugin
20
+ */
21
+ getName(): string;
22
+ /**
23
+ * Initialize this plugin. This should only be called from Editor
24
+ * @param editor Editor instance
25
+ */
26
+ initialize(editor: IEditor): void;
27
+ private onMouseOut;
28
+ /**
29
+ * Dispose this plugin
30
+ */
31
+ dispose(): void;
32
+ /**
33
+ * Handle events triggered from editor
34
+ * @param event PluginEvent object
35
+ */
36
+ onPluginEvent(e: PluginEvent): void;
37
+ private onMouseMove;
38
+ /**
39
+ * @internal Public only for unit test
40
+ * @param table Table to use when setting the Editors
41
+ * @param event (Optional) Mouse event
42
+ */
43
+ setTableEditor(table: HTMLTableElement | null, event?: MouseEvent): void;
44
+ private invalidateTableRects;
45
+ private disposeTableEditor;
46
+ private ensureTableRects;
47
+ }