@atlaskit/editor-core 171.0.1 → 172.0.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 (300) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/codemods/172.0.0-transform-smartlinks-prop.ts +8 -0
  3. package/codemods/__tests__/rename-smartlinks-prop.ts +204 -0
  4. package/codemods/migrates/rename-smartlinks-prop.ts +56 -0
  5. package/dist/cjs/create-editor/ReactEditorView.js +13 -4
  6. package/dist/cjs/create-editor/create-plugins-list.js +21 -12
  7. package/dist/cjs/editor.js +8 -23
  8. package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +6 -1
  9. package/dist/cjs/labs/next/presets/default.js +1 -1
  10. package/dist/cjs/nodeviews/context-adapter.js +2 -2
  11. package/dist/cjs/plugins/analytics/plugin.js +24 -11
  12. package/dist/cjs/plugins/base/index.js +3 -3
  13. package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +84 -0
  14. package/dist/cjs/plugins/card/index.js +1 -1
  15. package/dist/cjs/plugins/card/toolbar.js +11 -5
  16. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +5 -1
  17. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  18. package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -2
  19. package/dist/cjs/plugins/code-block/actions.js +13 -0
  20. package/dist/cjs/plugins/code-block/index.js +7 -0
  21. package/dist/cjs/plugins/code-block/nodeviews/code-block.js +2 -4
  22. package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +132 -0
  23. package/dist/cjs/plugins/code-block/pm-plugins/main.js +1 -23
  24. package/dist/cjs/plugins/code-block/styles.js +3 -36
  25. package/dist/cjs/plugins/code-block/toolbar.js +9 -0
  26. package/dist/cjs/plugins/code-block/ui/class-names.js +1 -2
  27. package/dist/cjs/plugins/copy-button/commands.js +40 -20
  28. package/dist/cjs/plugins/copy-button/toolbar.js +51 -0
  29. package/dist/cjs/plugins/copy-button/utils.js +16 -38
  30. package/dist/cjs/plugins/expand/toolbar.js +8 -2
  31. package/dist/cjs/plugins/extension/toolbar.js +5 -1
  32. package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  33. package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  34. package/dist/cjs/plugins/extension/ui/Extension/styles.js +2 -4
  35. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +29 -18
  36. package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
  37. package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -20
  38. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +7 -32
  39. package/dist/cjs/plugins/hyperlink/Toolbar.js +146 -135
  40. package/dist/cjs/plugins/hyperlink/index.js +4 -4
  41. package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +50 -0
  42. package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +38 -0
  43. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -5
  44. package/dist/cjs/plugins/indentation/commands/index.js +35 -7
  45. package/dist/cjs/plugins/indentation/commands/utils.js +11 -7
  46. package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -3
  47. package/dist/cjs/plugins/layout/toolbar.js +3 -1
  48. package/dist/cjs/plugins/media/toolbar/index.js +13 -5
  49. package/dist/cjs/plugins/mentions/analytics.js +5 -5
  50. package/dist/cjs/plugins/panel/toolbar.js +3 -3
  51. package/dist/cjs/plugins/paste/edge-cases/index.js +16 -3
  52. package/dist/cjs/plugins/paste/handlers.js +25 -2
  53. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +16 -3
  54. package/dist/cjs/plugins/paste/pm-plugins/main.js +22 -3
  55. package/dist/cjs/plugins/status/analytics.js +3 -3
  56. package/dist/cjs/plugins/table/toolbar.js +2 -2
  57. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
  58. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
  59. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
  60. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
  61. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
  62. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  63. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
  64. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
  65. package/dist/cjs/types/browser.js +6 -0
  66. package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
  67. package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
  68. package/dist/cjs/ui/ContentStyles/index.js +1 -3
  69. package/dist/cjs/ui/DropList/index.js +215 -0
  70. package/dist/cjs/ui/Dropdown/index.js +2 -5
  71. package/dist/cjs/ui/DropdownMenu/index.js +140 -86
  72. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
  73. package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
  74. package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
  75. package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
  76. package/dist/cjs/ui/Layer/index.js +245 -0
  77. package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
  78. package/dist/cjs/ui/PortalProvider/index.js +7 -26
  79. package/dist/cjs/version-wrapper.js +1 -1
  80. package/dist/cjs/version.json +1 -1
  81. package/dist/es2019/create-editor/ReactEditorView.js +15 -4
  82. package/dist/es2019/create-editor/create-plugins-list.js +21 -11
  83. package/dist/es2019/editor.js +9 -23
  84. package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
  85. package/dist/es2019/labs/next/presets/default.js +1 -1
  86. package/dist/es2019/nodeviews/context-adapter.js +2 -2
  87. package/dist/es2019/plugins/analytics/plugin.js +19 -4
  88. package/dist/es2019/plugins/base/index.js +3 -3
  89. package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
  90. package/dist/es2019/plugins/card/index.js +1 -1
  91. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
  92. package/dist/es2019/plugins/card/toolbar.js +10 -5
  93. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
  94. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  95. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
  96. package/dist/es2019/plugins/code-block/actions.js +12 -0
  97. package/dist/es2019/plugins/code-block/index.js +4 -0
  98. package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
  99. package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
  100. package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
  101. package/dist/es2019/plugins/code-block/styles.js +2 -159
  102. package/dist/es2019/plugins/code-block/toolbar.js +8 -0
  103. package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
  104. package/dist/es2019/plugins/copy-button/commands.js +35 -15
  105. package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
  106. package/dist/es2019/plugins/copy-button/utils.js +15 -27
  107. package/dist/es2019/plugins/expand/toolbar.js +4 -1
  108. package/dist/es2019/plugins/extension/toolbar.js +4 -1
  109. package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  110. package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  111. package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
  112. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
  113. package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
  114. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
  115. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
  116. package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
  117. package/dist/es2019/plugins/hyperlink/index.js +4 -4
  118. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
  119. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
  120. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
  121. package/dist/es2019/plugins/indentation/commands/index.js +24 -9
  122. package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
  123. package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
  124. package/dist/es2019/plugins/layout/toolbar.js +2 -1
  125. package/dist/es2019/plugins/media/toolbar/index.js +10 -3
  126. package/dist/es2019/plugins/mentions/analytics.js +1 -1
  127. package/dist/es2019/plugins/panel/toolbar.js +1 -1
  128. package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
  129. package/dist/es2019/plugins/paste/handlers.js +27 -2
  130. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
  131. package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
  132. package/dist/es2019/plugins/status/analytics.js +1 -1
  133. package/dist/es2019/plugins/table/toolbar.js +1 -1
  134. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
  135. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
  136. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
  137. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
  138. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
  139. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  140. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
  141. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
  142. package/dist/es2019/types/browser.js +2 -0
  143. package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
  144. package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
  145. package/dist/es2019/ui/ContentStyles/index.js +5 -9
  146. package/dist/es2019/ui/DropList/index.js +186 -0
  147. package/dist/es2019/ui/Dropdown/index.js +2 -6
  148. package/dist/es2019/ui/DropdownMenu/index.js +124 -75
  149. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
  150. package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
  151. package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
  152. package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
  153. package/dist/es2019/ui/Layer/index.js +195 -0
  154. package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
  155. package/dist/es2019/ui/PortalProvider/index.js +5 -23
  156. package/dist/es2019/version-wrapper.js +1 -1
  157. package/dist/es2019/version.json +1 -1
  158. package/dist/esm/create-editor/ReactEditorView.js +13 -4
  159. package/dist/esm/create-editor/create-plugins-list.js +21 -12
  160. package/dist/esm/editor.js +9 -23
  161. package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
  162. package/dist/esm/labs/next/presets/default.js +1 -1
  163. package/dist/esm/nodeviews/context-adapter.js +2 -2
  164. package/dist/esm/plugins/analytics/plugin.js +24 -11
  165. package/dist/esm/plugins/base/index.js +3 -3
  166. package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
  167. package/dist/esm/plugins/card/index.js +1 -1
  168. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
  169. package/dist/esm/plugins/card/toolbar.js +11 -5
  170. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
  171. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  172. package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
  173. package/dist/esm/plugins/code-block/actions.js +12 -0
  174. package/dist/esm/plugins/code-block/index.js +6 -0
  175. package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
  176. package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
  177. package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
  178. package/dist/esm/plugins/code-block/styles.js +4 -32
  179. package/dist/esm/plugins/code-block/toolbar.js +8 -0
  180. package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
  181. package/dist/esm/plugins/copy-button/commands.js +35 -15
  182. package/dist/esm/plugins/copy-button/toolbar.js +31 -0
  183. package/dist/esm/plugins/copy-button/utils.js +14 -29
  184. package/dist/esm/plugins/expand/toolbar.js +6 -2
  185. package/dist/esm/plugins/extension/toolbar.js +4 -1
  186. package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  187. package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  188. package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
  189. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
  190. package/dist/esm/plugins/feedback-dialog/index.js +1 -1
  191. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
  192. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
  193. package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
  194. package/dist/esm/plugins/hyperlink/index.js +4 -4
  195. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
  196. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
  197. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
  198. package/dist/esm/plugins/indentation/commands/index.js +30 -9
  199. package/dist/esm/plugins/indentation/commands/utils.js +12 -8
  200. package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
  201. package/dist/esm/plugins/layout/toolbar.js +2 -1
  202. package/dist/esm/plugins/media/toolbar/index.js +12 -5
  203. package/dist/esm/plugins/mentions/analytics.js +1 -1
  204. package/dist/esm/plugins/panel/toolbar.js +1 -1
  205. package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
  206. package/dist/esm/plugins/paste/handlers.js +23 -2
  207. package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
  208. package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
  209. package/dist/esm/plugins/status/analytics.js +1 -1
  210. package/dist/esm/plugins/table/toolbar.js +1 -1
  211. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
  212. package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
  213. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
  214. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
  215. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
  216. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  217. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
  218. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
  219. package/dist/esm/types/browser.js +2 -0
  220. package/dist/esm/ui/Addon/click-area-helper.js +37 -18
  221. package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
  222. package/dist/esm/ui/ContentStyles/index.js +2 -4
  223. package/dist/esm/ui/DropList/index.js +203 -0
  224. package/dist/esm/ui/Dropdown/index.js +2 -6
  225. package/dist/esm/ui/DropdownMenu/index.js +134 -88
  226. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
  227. package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
  228. package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
  229. package/dist/esm/ui/ElementBrowser/constants.js +1 -4
  230. package/dist/esm/ui/Layer/index.js +228 -0
  231. package/dist/esm/ui/Layer/internal/helpers.js +62 -0
  232. package/dist/esm/ui/PortalProvider/index.js +7 -26
  233. package/dist/esm/version-wrapper.js +1 -1
  234. package/dist/esm/version.json +1 -1
  235. package/dist/types/labs/next/presets/default.d.ts +2 -0
  236. package/dist/types/plugins/analytics/plugin.d.ts +5 -1
  237. package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
  238. package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
  239. package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
  240. package/dist/types/plugins/base/index.d.ts +1 -1
  241. package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
  242. package/dist/types/plugins/card/index.d.ts +2 -7
  243. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
  244. package/dist/types/plugins/card/toolbar.d.ts +3 -5
  245. package/dist/types/plugins/card/types.d.ts +2 -0
  246. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
  247. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
  248. package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
  249. package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
  250. package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
  251. package/dist/types/plugins/code-block/styles.d.ts +0 -1
  252. package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
  253. package/dist/types/plugins/copy-button/commands.d.ts +2 -2
  254. package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
  255. package/dist/types/plugins/copy-button/utils.d.ts +7 -6
  256. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
  257. package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
  258. package/dist/types/plugins/hyperlink/index.d.ts +2 -2
  259. package/dist/types/plugins/hyperlink/types.d.ts +30 -0
  260. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
  261. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
  262. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
  263. package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
  264. package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
  265. package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
  266. package/dist/types/plugins/paste/handlers.d.ts +1 -0
  267. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
  268. package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
  269. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
  270. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
  271. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
  272. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  273. package/dist/types/types/browser.d.ts +10 -0
  274. package/dist/types/types/editor-props.d.ts +6 -5
  275. package/dist/types/types/feature-flags.d.ts +29 -24
  276. package/dist/types/types/index.d.ts +1 -0
  277. package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
  278. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  279. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  280. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  281. package/dist/types/ui/DropList/index.d.ts +22 -0
  282. package/dist/types/ui/Dropdown/index.d.ts +2 -1
  283. package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
  284. package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
  285. package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
  286. package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
  287. package/dist/types/ui/Layer/index.d.ts +47 -0
  288. package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
  289. package/package.json +23 -18
  290. package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
  291. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
  292. package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
  293. package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
  294. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
  295. package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
  296. package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
  297. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
  298. package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
  299. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
  300. package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
@@ -28,6 +28,7 @@ import { FilePreviewItem } from './filePreviewItem';
28
28
  import { downloadMedia, removeMediaGroupNode } from './utils';
29
29
  import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard } from './commands';
30
30
  import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
31
+ import { getCopyButtonConfig, showCopyButton } from '../../copy-button/toolbar';
31
32
 
32
33
  var remove = function remove(state, dispatch) {
33
34
  if (dispatch) {
@@ -95,7 +96,9 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
95
96
  title: intl.formatMessage(messages.download)
96
97
  }, {
97
98
  type: 'separator'
98
- }, {
99
+ }].concat(_toConsumableArray(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, mediaGroup), {
100
+ type: 'separator'
101
+ }] : []), [{
99
102
  id: 'editor.media.delete',
100
103
  type: 'button',
101
104
  appearance: 'danger',
@@ -107,7 +110,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
107
110
  title: intl.formatMessage(commonMessages.remove),
108
111
  onClick: handleRemoveMediaGroup,
109
112
  testId: 'media-toolbar-remove-button'
110
- }];
113
+ }]);
111
114
  return items;
112
115
  };
113
116
 
@@ -159,7 +162,9 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
159
162
  title: intl.formatMessage(messages.download)
160
163
  }, {
161
164
  type: 'separator'
162
- }, {
165
+ }].concat(_toConsumableArray(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, mediaInline), {
166
+ type: 'separator'
167
+ }] : []), [{
163
168
  id: 'editor.media.delete',
164
169
  type: 'button',
165
170
  appearance: 'danger',
@@ -171,7 +176,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
171
176
  title: intl.formatMessage(commonMessages.remove),
172
177
  onClick: removeInlineCard,
173
178
  testId: 'media-toolbar-remove-button'
174
- }];
179
+ }]);
175
180
  return items;
176
181
  };
177
182
 
@@ -257,7 +262,9 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
257
262
  onClick: remove,
258
263
  testId: 'media-toolbar-remove-button'
259
264
  };
260
- var items = [].concat(_toConsumableArray(toolbarButtons), [removeButton]);
265
+ var items = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, mediaSingle), {
266
+ type: 'separator'
267
+ }] : []), [removeButton]);
261
268
  return items;
262
269
  };
263
270
 
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
8
8
  import { isSpecialMention } from '@atlaskit/mention/resource';
9
- import { name as packageName, version as packageVersion } from '../../version.json';
9
+ import { name as packageName, version as packageVersion } from '../../version-wrapper';
10
10
  import { isTeamType } from './utils';
11
11
  var componentName = 'mention';
12
12
  export var buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action, eventType, sessionId) {
@@ -24,7 +24,7 @@ import { DEFAULT_BORDER_COLOR } from '../../ui/ColorPalette/Palettes';
24
24
  import { PanelType } from '@atlaskit/adf-schema';
25
25
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../analytics';
26
26
  import { messages } from './message';
27
- import { getCopyButtonConfig, showCopyButton } from '../copy-button/utils';
27
+ import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
28
28
  export var panelIconMap = (_panelIconMap = {}, _defineProperty(_panelIconMap, PanelType.INFO, {
29
29
  shortName: ':info:',
30
30
  id: 'atlassian-info'
@@ -1,9 +1,13 @@
1
+ import { findParentNodeOfType } from 'prosemirror-utils';
1
2
  import { insertSliceIntoRangeSelectionInsideList, insertSliceInsideOfPanelNodeSelected, insertSliceAtNodeEdge, insertSliceIntoEmptyNode } from './lists';
2
3
  import { isListNode } from '../../list/utils/node';
3
4
  import { isSelectionInsidePanel, isEmptyNode, isCursorSelectionAtTextStartOrEnd } from '../util';
4
5
  export function insertSliceForLists(_ref) {
6
+ var _slice$content$firstC;
7
+
5
8
  var tr = _ref.tr,
6
- slice = _ref.slice;
9
+ slice = _ref.slice,
10
+ schema = _ref.schema;
7
11
  var selection = tr.selection,
8
12
  _tr$selection = tr.selection,
9
13
  $to = _tr$selection.$to,
@@ -37,9 +41,17 @@ export function insertSliceForLists(_ref) {
37
41
  tr: tr,
38
42
  slice: slice
39
43
  });
40
- }
44
+ } // When pasting a single list item into an action or decision, we skip the special "insert at node edge"
45
+ // logic so that prosemirror pastes the list's content into the action/decision, rather than
46
+ // pasting a whole list node directly after the action/decision item. (But we still preserve the
47
+ // existing "insert at" node edge" behaviour if dealing with a list with more than one item, so that
48
+ // it still inserts whole list node after the action/decision item).
49
+
50
+
51
+ var pastingIntoActionOrDecision = Boolean(findParentNodeOfType([schema.nodes.taskList, schema.nodes.decisionList])(selection));
52
+ var oneListItem = slice.content.childCount === 1 && isListNode(slice.content.firstChild) && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.childCount) === 1;
41
53
 
42
- if (isCursorSelectionAtTextStartOrEnd(selection)) {
54
+ if (!(pastingIntoActionOrDecision && oneListItem) && isCursorSelectionAtTextStartOrEnd(selection)) {
43
55
  return insertSliceAtNodeEdge({
44
56
  tr: tr,
45
57
  slice: slice
@@ -111,6 +111,25 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
111
111
  dispatch(tr);
112
112
  }
113
113
 
114
+ return true;
115
+ };
116
+ }
117
+ export function handlePastePanelIntoList(slice) {
118
+ return function (state, dispatch) {
119
+ var schema = state.schema,
120
+ tr = state.tr;
121
+ var selection = tr.selection; // Check this pasting action is related to copy content from panel node into a selected the list node
122
+
123
+ var selectionParentListNode = selection.$to.node(selection.$to.depth - 1);
124
+ var panelNode = slice.content.firstChild;
125
+
126
+ if (!dispatch || !selectionParentListNode || (selectionParentListNode === null || selectionParentListNode === void 0 ? void 0 : selectionParentListNode.type) !== schema.nodes.listItem || !panelNode || (panelNode === null || panelNode === void 0 ? void 0 : panelNode.type) !== schema.nodes.panel || (panelNode === null || panelNode === void 0 ? void 0 : panelNode.content.firstChild) === undefined) {
127
+ return false;
128
+ } // Paste the panel node contents extracted instead of pasting the entire panel node
129
+
130
+
131
+ tr.replaceSelection(slice).scrollIntoView();
132
+ dispatch(tr);
114
133
  return true;
115
134
  };
116
135
  } // If we paste a link onto some selected text, apply the link as a mark
@@ -678,7 +697,8 @@ export function handleRichText(slice) {
678
697
  heading = _state$schema$nodes2.heading,
679
698
  paragraph = _state$schema$nodes2.paragraph,
680
699
  panel = _state$schema$nodes2.panel;
681
- var selection = state.selection;
700
+ var selection = state.selection,
701
+ schema = state.schema;
682
702
  var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
683
703
  var lastChildOfSlice = (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.lastChild; // In case user is pasting inline code,
684
704
  // any backtick ` immediately preceding it should be removed.
@@ -709,7 +729,8 @@ export function handleRichText(slice) {
709
729
  if (isSliceContentListNodes || isTargetPanelEmpty) {
710
730
  insertSliceForLists({
711
731
  tr: tr,
712
- slice: slice
732
+ slice: slice,
733
+ schema: schema
713
734
  });
714
735
  } else if (noNeedForSafeInsert) {
715
736
  tr.replaceSelection(slice);
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
 
8
8
  import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
9
9
  import { getPasteSource } from '../util';
10
- import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption } from '../handlers';
10
+ import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelIntoList } from '../handlers';
11
11
  import { pipe } from '../../../utils';
12
12
  import { findParentNode } from 'prosemirror-utils';
13
13
  import { mapSlice } from '../../../utils/slice';
@@ -252,6 +252,11 @@ export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(vi
252
252
  type: PasteTypes.richText
253
253
  }))(slice);
254
254
  };
255
+ export var handlePastePanelIntoListWithAnalytics = function handlePastePanelIntoListWithAnalytics(view, event, slice) {
256
+ return pipe(handlePastePanelIntoList, pasteCommandWithAnalytics(view, event, slice, {
257
+ type: PasteTypes.richText
258
+ }))(slice);
259
+ };
255
260
  export var handleExpandWithAnalytics = function handleExpandWithAnalytics(view, event, slice) {
256
261
  return pipe(handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
257
262
  type: PasteTypes.richText
@@ -268,7 +273,11 @@ export var handlePasteLinkOnSelectedTextWithAnalytics = function handlePasteLink
268
273
  hyperlinkPasteOnText: true
269
274
  }))(slice);
270
275
  };
271
- export var createPasteMeasurePayload = function createPasteMeasurePayload(view, duration, content) {
276
+ export var createPasteMeasurePayload = function createPasteMeasurePayload(_ref) {
277
+ var view = _ref.view,
278
+ duration = _ref.duration,
279
+ content = _ref.content,
280
+ distortedDuration = _ref.distortedDuration;
272
281
  var pasteIntoNode = getActionSubjectId(view);
273
282
  return {
274
283
  action: ACTION.PASTED_TIMED,
@@ -277,7 +286,8 @@ export var createPasteMeasurePayload = function createPasteMeasurePayload(view,
277
286
  attributes: {
278
287
  pasteIntoNode: pasteIntoNode,
279
288
  content: content,
280
- time: duration
289
+ time: duration,
290
+ distortedDuration: distortedDuration
281
291
  }
282
292
  };
283
293
  };
@@ -14,7 +14,7 @@ import { linkifyContent } from '../../hyperlink/utils';
14
14
  import { transformSliceNestedExpandToExpand } from '../../expand/utils';
15
15
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
16
16
  import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
17
- import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics } from './analytics';
17
+ import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelIntoListWithAnalytics } from './analytics';
18
18
  import { analyticsPluginKey, PasteTypes } from '../../analytics';
19
19
  import { insideTable, measurements } from '../../../utils';
20
20
  import { measureRender } from '@atlaskit/editor-common/utils';
@@ -168,8 +168,15 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
168
168
  var content = getContentNodeTypes(slice.content);
169
169
  var pasteId = uuid();
170
170
  var measureName = "".concat(measurements.PASTE, "_").concat(pasteId);
171
- measureRender(measureName, function (duration) {
172
- var payload = createPasteMeasurePayload(view, duration, content);
171
+ measureRender(measureName, function (_ref) {
172
+ var duration = _ref.duration,
173
+ distortedDuration = _ref.distortedDuration;
174
+ var payload = createPasteMeasurePayload({
175
+ view: view,
176
+ duration: duration,
177
+ content: content,
178
+ distortedDuration: distortedDuration
179
+ });
173
180
 
174
181
  if (payload) {
175
182
  dispatchAnalyticsEvent(payload);
@@ -222,7 +229,15 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
222
229
  var markdownSlice;
223
230
 
224
231
  if (isPlainText) {
225
- markdownSlice = getMarkdownSlice(text, slice.openStart, slice.openEnd);
232
+ var _markdownSlice;
233
+
234
+ markdownSlice = getMarkdownSlice(text, slice.openStart, slice.openEnd); // https://product-fabric.atlassian.net/browse/ED-15134
235
+ // Lists are not allowed within Blockquotes at this time. Attempting to
236
+ // paste a markdown list ie. ">- foo" will yeild a markdownSlice of size 0.
237
+ // Rather then blocking the paste action with no UI feedback, this will instead
238
+ // force a "paste as plain text" action by clearing the markdownSlice.
239
+
240
+ markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
226
241
 
227
242
  if (markdownSlice) {
228
243
  // linkify text prior to converting to macro
@@ -351,6 +366,10 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
351
366
  return true;
352
367
  }
353
368
 
369
+ if (handlePastePanelIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
370
+ return true;
371
+ }
372
+
354
373
  return handleRichTextWithAnalytics(view, event, slice)(state, dispatch);
355
374
  }
356
375
 
@@ -4,7 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
- import { name as packageName, version as packageVersion } from '../../version.json';
7
+ import { name as packageName, version as packageVersion } from '../../version-wrapper';
8
8
  export var FABRIC_CHANNEL = 'fabric-elements';
9
9
  export var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
10
10
  return function (payload) {
@@ -16,7 +16,7 @@ import tableMessages from './ui/messages';
16
16
  import { messages as ContextualMenuMessages } from './ui/FloatingContextualMenu/ContextualMenu';
17
17
  import { findParentDomRefOfType } from 'prosemirror-utils';
18
18
  import { closestElement } from '../../utils/dom';
19
- import { getCopyButtonConfig, showCopyButton } from '../copy-button/utils'; // TODO: ED-14403 investigate why these translations don't work
19
+ import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar'; // TODO: ED-14403 investigate why these translations don't work
20
20
 
21
21
  export var messages = defineMessages({
22
22
  tableOptions: {
@@ -16,14 +16,14 @@ import { insertTaskDecisionWithAnalytics } from '../commands';
16
16
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
17
17
  import { getBlockRange, getCurrentIndentLevel, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInsideTask, isInsideTaskOrDecisionItem, liftBlock, subtreeHeight, walkOut, isTable, getTaskItemIndex, isInsideDecision } from './helpers';
18
18
 
19
- var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction) {
19
+ var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction, inputMethod) {
20
20
  return {
21
21
  action: ACTION.FORMATTED,
22
22
  actionSubject: ACTION_SUBJECT.TEXT,
23
23
  actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
24
24
  eventType: EVENT_TYPE.TRACK,
25
25
  attributes: {
26
- inputMethod: INPUT_METHOD.KEYBOARD,
26
+ inputMethod: inputMethod,
27
27
  previousIndentationLevel: curIndentLevel,
28
28
  newIndentLevel: direction === INDENT_DIRECTION.OUTDENT ? curIndentLevel - 1 : curIndentLevel + 1,
29
29
  direction: direction,
@@ -92,15 +92,18 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
92
92
  return false;
93
93
  };
94
94
 
95
- var unindent = filter(isInsideTask, function (state, dispatch) {
96
- var curIndentLevel = getCurrentIndentLevel(state.selection);
95
+ export var getUnindentCommand = function getUnindentCommand() {
96
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
97
+ return filter(isInsideTask, function (state, dispatch) {
98
+ var curIndentLevel = getCurrentIndentLevel(state.selection);
97
99
 
98
- if (!curIndentLevel || curIndentLevel === 1) {
99
- return false;
100
- }
100
+ if (!curIndentLevel || curIndentLevel === 1) {
101
+ return false;
102
+ }
101
103
 
102
- return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
103
- }); // if selection is decision item or first action item in table cell
104
+ return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT, inputMethod))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
105
+ });
106
+ }; // if selection is decision item or first action item in table cell
104
107
  // then dont consume the Tab, as table-keymap should tab to the next cell
105
108
 
106
109
  var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
@@ -118,28 +121,31 @@ var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
118
121
  return false;
119
122
  };
120
123
 
121
- var indent = filter(isInsideTask, function (state, dispatch) {
122
- // limit ui indentation to 6 levels
123
- var curIndentLevel = getCurrentIndentLevel(state.selection);
124
+ export var getIndentCommand = function getIndentCommand() {
125
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
126
+ return filter(isInsideTask, function (state, dispatch) {
127
+ // limit ui indentation to 6 levels
128
+ var curIndentLevel = getCurrentIndentLevel(state.selection);
124
129
 
125
- if (!curIndentLevel || curIndentLevel >= 6) {
126
- return true;
127
- }
130
+ if (!curIndentLevel || curIndentLevel >= 6) {
131
+ return true;
132
+ }
128
133
 
129
- var _state$schema$nodes3 = state.schema.nodes,
130
- taskList = _state$schema$nodes3.taskList,
131
- taskItem = _state$schema$nodes3.taskItem;
132
- var _state$selection = state.selection,
133
- $from = _state$selection.$from,
134
- $to = _state$selection.$to;
135
- var maxDepth = subtreeHeight($from, $to, [taskList, taskItem]);
134
+ var _state$schema$nodes3 = state.schema.nodes,
135
+ taskList = _state$schema$nodes3.taskList,
136
+ taskItem = _state$schema$nodes3.taskItem;
137
+ var _state$selection = state.selection,
138
+ $from = _state$selection.$from,
139
+ $to = _state$selection.$to;
140
+ var maxDepth = subtreeHeight($from, $to, [taskList, taskItem]);
136
141
 
137
- if (maxDepth >= 6) {
138
- return true;
139
- }
142
+ if (maxDepth >= 6) {
143
+ return true;
144
+ }
140
145
 
141
- return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
142
- });
146
+ return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT, inputMethod))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
147
+ });
148
+ };
143
149
 
144
150
  var backspaceFrom = function backspaceFrom($from) {
145
151
  return function (state, dispatch) {
@@ -156,7 +162,7 @@ var backspaceFrom = function backspaceFrom($from) {
156
162
  paragraph = _state$schema$nodes4.paragraph;
157
163
 
158
164
  if ($from.node($from.depth - 2).type === taskList) {
159
- return unindent(state, dispatch);
165
+ return getUnindentCommand()(state, dispatch);
160
166
  } // bottom level, should "unwrap" taskItem contents into paragraph
161
167
  // we achieve this by slicing the content out, and replacing
162
168
 
@@ -305,7 +311,7 @@ var splitListItem = function splitListItem(state, dispatch) {
305
311
  return false;
306
312
  };
307
313
 
308
- var enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(unindent, splitListItem)), function (state, dispatch) {
314
+ var enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(getUnindentCommand(), splitListItem)), function (state, dispatch) {
309
315
  var selection = state.selection,
310
316
  schema = state.schema;
311
317
  var taskItem = schema.nodes.taskItem;
@@ -353,12 +359,12 @@ export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
353
359
  'Shift-Tab': filter([isInsideTaskOrDecisionItem, function (state) {
354
360
  return !shouldLetTabThroughInTable(state);
355
361
  }], function (state, dispatch) {
356
- return unindent(state, dispatch) || !!consumeTabs;
362
+ return getUnindentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
357
363
  }),
358
364
  Tab: filter([isInsideTaskOrDecisionItem, function (state) {
359
365
  return !shouldLetTabThroughInTable(state);
360
366
  }], function (state, dispatch) {
361
- return indent(state, dispatch) || !!consumeTabs;
367
+ return getIndentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
362
368
  })
363
369
  };
364
370
  var defaultHandlers = consumeTabs ? {
@@ -3,26 +3,43 @@ import ToolbarListsIndentation from './ui';
3
3
  import WithPluginState from '../../ui/WithPluginState';
4
4
  import { ToolbarSize } from '../../ui/Toolbar/types';
5
5
  import { pluginKey as listPluginKey } from '../list/pm-plugins/main';
6
+ import { pluginKey as indentationButtonsPluginKey, createPlugin as indentationButtonsPlugin } from './pm-plugins/indentation-buttons';
6
7
 
7
8
  var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
8
- var showIndentationButtons = _ref.showIndentationButtons;
9
+ var showIndentationButtons = _ref.showIndentationButtons,
10
+ allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
9
11
  return {
10
12
  name: 'toolbarListsIndentation',
11
- primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
12
- var editorView = _ref2.editorView,
13
- popupsMountPoint = _ref2.popupsMountPoint,
14
- popupsBoundariesElement = _ref2.popupsBoundariesElement,
15
- popupsScrollableElement = _ref2.popupsScrollableElement,
16
- toolbarSize = _ref2.toolbarSize,
17
- disabled = _ref2.disabled,
18
- isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
13
+ pmPlugins: function pmPlugins() {
14
+ return [{
15
+ name: 'indentationButtons',
16
+ plugin: function plugin(_ref2) {
17
+ var dispatch = _ref2.dispatch;
18
+ return indentationButtonsPlugin({
19
+ dispatch: dispatch,
20
+ showIndentationButtons: showIndentationButtons,
21
+ allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
22
+ });
23
+ }
24
+ }];
25
+ },
26
+ primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
27
+ var editorView = _ref3.editorView,
28
+ popupsMountPoint = _ref3.popupsMountPoint,
29
+ popupsBoundariesElement = _ref3.popupsBoundariesElement,
30
+ popupsScrollableElement = _ref3.popupsScrollableElement,
31
+ toolbarSize = _ref3.toolbarSize,
32
+ disabled = _ref3.disabled,
33
+ isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
19
34
  var isSmall = toolbarSize < ToolbarSize.L;
20
35
  return /*#__PURE__*/React.createElement(WithPluginState, {
21
36
  plugins: {
22
- listState: listPluginKey
37
+ listState: listPluginKey,
38
+ indentationState: indentationButtonsPluginKey
23
39
  },
24
- render: function render(_ref3) {
25
- var listState = _ref3.listState;
40
+ render: function render(_ref4) {
41
+ var listState = _ref4.listState,
42
+ indentationState = _ref4.indentationState;
26
43
 
27
44
  if (!listState) {
28
45
  return null;
@@ -40,7 +57,9 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
40
57
  bulletListDisabled: listState.bulletListDisabled,
41
58
  orderedListActive: listState.orderedListActive,
42
59
  orderedListDisabled: listState.orderedListDisabled,
43
- showIndentationButtons: !!showIndentationButtons
60
+ showIndentationButtons: !!showIndentationButtons,
61
+ indentDisabled: indentationState.indentDisabled,
62
+ outdentDisabled: indentationState.outdentDisabled
44
63
  });
45
64
  }
46
65
  });
@@ -0,0 +1,105 @@
1
+ import { PluginKey } from 'prosemirror-state';
2
+ import { hasParentNodeOfType } from 'prosemirror-utils';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import { shallowEqual } from '../../../utils';
5
+ import { getListItemAttributes, isInsideListItem } from '../../list/utils/selection';
6
+ import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
7
+ import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
8
+ export var pluginKey = new PluginKey('indentationButtonsPlugin');
9
+
10
+ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
11
+ var state = {
12
+ indentDisabled: true,
13
+ outdentDisabled: true,
14
+ node: null
15
+ };
16
+ var selection = editorState.selection;
17
+ var node = selection.$from.node(); // Handle bullet and numbered lists seperately as they do
18
+ // not use the indentation mark.
19
+ // Check for lists before paragraphs and headings in case
20
+ // the selection is in a list nested in a layout column.
21
+
22
+ if (isInsideListItem(editorState)) {
23
+ var _getListItemAttribute = getListItemAttributes(selection.$head),
24
+ indentLevel = _getListItemAttribute.indentLevel,
25
+ itemIndex = _getListItemAttribute.itemIndex;
26
+
27
+ return {
28
+ // List indent levels are zero indexed so we need to subtract 1
29
+ indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL - 1,
30
+ outdentDisabled: false,
31
+ node: 'list'
32
+ };
33
+ } // Handle tasks seperately as they do not use the indentation mark
34
+ // and have different behaviour for outdent compared to lists
35
+
36
+
37
+ if (isInsideTask(editorState)) {
38
+ var _indentLevel = getTaskListIndentLevel(selection) || 0;
39
+
40
+ var _itemIndex = getTaskItemIndex(editorState);
41
+
42
+ return {
43
+ indentDisabled: _itemIndex === 0 || _indentLevel >= MAX_INDENTATION_LEVEL,
44
+ outdentDisabled: _indentLevel <= 1,
45
+ node: 'taskList'
46
+ };
47
+ }
48
+
49
+ var isTopLevelParagraphOrHeading = selection.$from.depth === 1;
50
+ var isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) && // depth of non-nested paragraphs and headings in layouts will always be 3
51
+ selection.$from.depth === 3;
52
+
53
+ if (allowHeadingAndParagraphIndentation && isIndentationAllowed(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
54
+ var indentationMark = node.marks.find(function (mark) {
55
+ return mark.type === editorState.schema.marks.indentation;
56
+ });
57
+
58
+ if (!indentationMark) {
59
+ return {
60
+ outdentDisabled: true,
61
+ indentDisabled: false,
62
+ node: 'paragraph_heading'
63
+ };
64
+ }
65
+
66
+ return {
67
+ indentDisabled: indentationMark.attrs.level >= MAX_INDENTATION_LEVEL,
68
+ outdentDisabled: false,
69
+ node: 'paragraph_heading'
70
+ };
71
+ }
72
+
73
+ return state;
74
+ }
75
+
76
+ export var createPlugin = function createPlugin(_ref) {
77
+ var dispatch = _ref.dispatch,
78
+ showIndentationButtons = _ref.showIndentationButtons,
79
+ allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
80
+ return new SafePlugin({
81
+ state: {
82
+ init: function init(_config, state) {
83
+ var initialState = {
84
+ indentDisabled: true,
85
+ outdentDisabled: true,
86
+ node: null
87
+ };
88
+ return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation) : initialState;
89
+ },
90
+ apply: function apply(_tr, pluginState, _oldState, newState) {
91
+ if (showIndentationButtons) {
92
+ var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation);
93
+
94
+ if (!shallowEqual(pluginState, state)) {
95
+ dispatch(pluginKey, state);
96
+ return state;
97
+ }
98
+ }
99
+
100
+ return pluginState;
101
+ }
102
+ },
103
+ key: pluginKey
104
+ });
105
+ };
@@ -21,6 +21,8 @@ export function Toolbar(props) {
21
21
  orderedListActive = props.orderedListActive,
22
22
  orderedListDisabled = props.orderedListDisabled,
23
23
  showIndentationButtons = props.showIndentationButtons,
24
+ indentDisabled = props.indentDisabled,
25
+ outdentDisabled = props.outdentDisabled,
24
26
  onItemActivated = props.onItemActivated;
25
27
  var labelUnorderedList = formatMessage(messages.unorderedList);
26
28
  var labelOrderedList = formatMessage(messages.orderedList);
@@ -68,24 +70,28 @@ export function Toolbar(props) {
68
70
  })
69
71
  }), showIndentationButtons && jsx(ToolbarButton, {
70
72
  buttonId: TOOLBAR_BUTTON.INDENT,
73
+ testId: TOOLBAR_BUTTON.INDENT,
71
74
  spacing: isReducedSpacing ? 'none' : 'default',
72
75
  onClick: handleOnItemActivated('indent'),
73
76
  iconBefore: jsx(IndentIcon, {
74
77
  label: ""
75
78
  }),
76
- disabled: true,
79
+ disabled: indentDisabled || disabled,
80
+ "aria-label": formatMessage(indentationMessages.indent),
77
81
  title: jsx(ToolTipContent, {
78
82
  description: formatMessage(indentationMessages.indent),
79
83
  keymap: toggleIndentKeymap
80
84
  })
81
85
  }), showIndentationButtons && jsx(ToolbarButton, {
82
86
  buttonId: TOOLBAR_BUTTON.OUTDENT,
87
+ testId: TOOLBAR_BUTTON.OUTDENT,
83
88
  spacing: isReducedSpacing ? 'none' : 'default',
84
89
  onClick: handleOnItemActivated('outdent'),
85
90
  iconBefore: jsx(OutdentIcon, {
86
91
  label: ""
87
92
  }),
88
- disabled: true,
93
+ disabled: outdentDisabled || disabled,
94
+ "aria-label": formatMessage(indentationMessages.outdent),
89
95
  title: jsx(ToolTipContent, {
90
96
  description: formatMessage(indentationMessages.outdent),
91
97
  keymap: toggleOutdentKeymap
@@ -128,7 +128,7 @@ function useItems(props) {
128
128
  value: {
129
129
  name: 'indent'
130
130
  },
131
- isDisabled: true,
131
+ isDisabled: props.indentDisabled,
132
132
  isActive: false,
133
133
  elemAfter: jsx("div", {
134
134
  css: shortcutStyle
@@ -139,7 +139,7 @@ function useItems(props) {
139
139
  value: {
140
140
  name: 'outdent'
141
141
  },
142
- isDisabled: true,
142
+ isDisabled: props.outdentDisabled,
143
143
  isActive: false,
144
144
  elemAfter: jsx("div", {
145
145
  css: shortcutStyle