@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
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.getUnindentCommand = exports.getIndentCommand = exports.default = void 0;
9
9
  exports.keymapPlugin = keymapPlugin;
10
10
 
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -36,14 +36,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
36
36
 
37
37
  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) { (0, _defineProperty2.default)(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; }
38
38
 
39
- var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction) {
39
+ var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction, inputMethod) {
40
40
  return {
41
41
  action: _analytics.ACTION.FORMATTED,
42
42
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
43
43
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_INDENT,
44
44
  eventType: _analytics.EVENT_TYPE.TRACK,
45
45
  attributes: {
46
- inputMethod: _analytics.INPUT_METHOD.KEYBOARD,
46
+ inputMethod: inputMethod,
47
47
  previousIndentationLevel: curIndentLevel,
48
48
  newIndentLevel: direction === _analytics.INDENT_DIRECTION.OUTDENT ? curIndentLevel - 1 : curIndentLevel + 1,
49
49
  direction: direction,
@@ -112,17 +112,23 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
112
112
  return false;
113
113
  };
114
114
 
115
- var unindent = (0, _commands.filter)(_helpers.isInsideTask, function (state, dispatch) {
116
- var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
115
+ var getUnindentCommand = function getUnindentCommand() {
116
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
117
+ return (0, _commands.filter)(_helpers.isInsideTask, function (state, dispatch) {
118
+ var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
117
119
 
118
- if (!curIndentLevel || curIndentLevel === 1) {
119
- return false;
120
- }
120
+ if (!curIndentLevel || curIndentLevel === 1) {
121
+ return false;
122
+ }
121
123
 
122
- return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT))((0, _prosemirrorCommands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
123
- }); // if selection is decision item or first action item in table cell
124
+ return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _prosemirrorCommands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
125
+ });
126
+ }; // if selection is decision item or first action item in table cell
124
127
  // then dont consume the Tab, as table-keymap should tab to the next cell
125
128
 
129
+
130
+ exports.getUnindentCommand = getUnindentCommand;
131
+
126
132
  var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
127
133
  var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
128
134
  var curIndex = (0, _helpers.getTaskItemIndex)(state);
@@ -138,28 +144,33 @@ var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
138
144
  return false;
139
145
  };
140
146
 
141
- var indent = (0, _commands.filter)(_helpers.isInsideTask, function (state, dispatch) {
142
- // limit ui indentation to 6 levels
143
- var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
147
+ var getIndentCommand = function getIndentCommand() {
148
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
149
+ return (0, _commands.filter)(_helpers.isInsideTask, function (state, dispatch) {
150
+ // limit ui indentation to 6 levels
151
+ var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
144
152
 
145
- if (!curIndentLevel || curIndentLevel >= 6) {
146
- return true;
147
- }
153
+ if (!curIndentLevel || curIndentLevel >= 6) {
154
+ return true;
155
+ }
148
156
 
149
- var _state$schema$nodes3 = state.schema.nodes,
150
- taskList = _state$schema$nodes3.taskList,
151
- taskItem = _state$schema$nodes3.taskItem;
152
- var _state$selection = state.selection,
153
- $from = _state$selection.$from,
154
- $to = _state$selection.$to;
155
- var maxDepth = (0, _helpers.subtreeHeight)($from, $to, [taskList, taskItem]);
157
+ var _state$schema$nodes3 = state.schema.nodes,
158
+ taskList = _state$schema$nodes3.taskList,
159
+ taskItem = _state$schema$nodes3.taskItem;
160
+ var _state$selection = state.selection,
161
+ $from = _state$selection.$from,
162
+ $to = _state$selection.$to;
163
+ var maxDepth = (0, _helpers.subtreeHeight)($from, $to, [taskList, taskItem]);
156
164
 
157
- if (maxDepth >= 6) {
158
- return true;
159
- }
165
+ if (maxDepth >= 6) {
166
+ return true;
167
+ }
160
168
 
161
- return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT))((0, _prosemirrorCommands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
162
- });
169
+ return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _prosemirrorCommands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
170
+ });
171
+ };
172
+
173
+ exports.getIndentCommand = getIndentCommand;
163
174
 
164
175
  var backspaceFrom = function backspaceFrom($from) {
165
176
  return function (state, dispatch) {
@@ -176,7 +187,7 @@ var backspaceFrom = function backspaceFrom($from) {
176
187
  paragraph = _state$schema$nodes4.paragraph;
177
188
 
178
189
  if ($from.node($from.depth - 2).type === taskList) {
179
- return unindent(state, dispatch);
190
+ return getUnindentCommand()(state, dispatch);
180
191
  } // bottom level, should "unwrap" taskItem contents into paragraph
181
192
  // we achieve this by slicing the content out, and replacing
182
193
 
@@ -326,7 +337,7 @@ var splitListItem = function splitListItem(state, dispatch) {
326
337
  return false;
327
338
  };
328
339
 
329
- var enter = (0, _commands.filter)(_helpers.isInsideTaskOrDecisionItem, (0, _prosemirrorCommands.chainCommands)((0, _commands.filter)(_helpers.isEmptyTaskDecision, (0, _prosemirrorCommands.chainCommands)(unindent, splitListItem)), function (state, dispatch) {
340
+ var enter = (0, _commands.filter)(_helpers.isInsideTaskOrDecisionItem, (0, _prosemirrorCommands.chainCommands)((0, _commands.filter)(_helpers.isEmptyTaskDecision, (0, _prosemirrorCommands.chainCommands)(getUnindentCommand(), splitListItem)), function (state, dispatch) {
330
341
  var selection = state.selection,
331
342
  schema = state.schema;
332
343
  var taskItem = schema.nodes.taskItem;
@@ -375,12 +386,12 @@ function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
375
386
  'Shift-Tab': (0, _commands.filter)([_helpers.isInsideTaskOrDecisionItem, function (state) {
376
387
  return !shouldLetTabThroughInTable(state);
377
388
  }], function (state, dispatch) {
378
- return unindent(state, dispatch) || !!consumeTabs;
389
+ return getUnindentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
379
390
  }),
380
391
  Tab: (0, _commands.filter)([_helpers.isInsideTaskOrDecisionItem, function (state) {
381
392
  return !shouldLetTabThroughInTable(state);
382
393
  }], function (state, dispatch) {
383
- return indent(state, dispatch) || !!consumeTabs;
394
+ return getIndentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
384
395
  })
385
396
  };
386
397
  var defaultHandlers = consumeTabs ? {
@@ -17,25 +17,43 @@ var _types = require("../../ui/Toolbar/types");
17
17
 
18
18
  var _main = require("../list/pm-plugins/main");
19
19
 
20
+ var _indentationButtons = require("./pm-plugins/indentation-buttons");
21
+
20
22
  var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
21
- var showIndentationButtons = _ref.showIndentationButtons;
23
+ var showIndentationButtons = _ref.showIndentationButtons,
24
+ allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
22
25
  return {
23
26
  name: 'toolbarListsIndentation',
24
- primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
25
- var editorView = _ref2.editorView,
26
- popupsMountPoint = _ref2.popupsMountPoint,
27
- popupsBoundariesElement = _ref2.popupsBoundariesElement,
28
- popupsScrollableElement = _ref2.popupsScrollableElement,
29
- toolbarSize = _ref2.toolbarSize,
30
- disabled = _ref2.disabled,
31
- isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
27
+ pmPlugins: function pmPlugins() {
28
+ return [{
29
+ name: 'indentationButtons',
30
+ plugin: function plugin(_ref2) {
31
+ var dispatch = _ref2.dispatch;
32
+ return (0, _indentationButtons.createPlugin)({
33
+ dispatch: dispatch,
34
+ showIndentationButtons: showIndentationButtons,
35
+ allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
36
+ });
37
+ }
38
+ }];
39
+ },
40
+ primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
41
+ var editorView = _ref3.editorView,
42
+ popupsMountPoint = _ref3.popupsMountPoint,
43
+ popupsBoundariesElement = _ref3.popupsBoundariesElement,
44
+ popupsScrollableElement = _ref3.popupsScrollableElement,
45
+ toolbarSize = _ref3.toolbarSize,
46
+ disabled = _ref3.disabled,
47
+ isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
32
48
  var isSmall = toolbarSize < _types.ToolbarSize.L;
33
49
  return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
34
50
  plugins: {
35
- listState: _main.pluginKey
51
+ listState: _main.pluginKey,
52
+ indentationState: _indentationButtons.pluginKey
36
53
  },
37
- render: function render(_ref3) {
38
- var listState = _ref3.listState;
54
+ render: function render(_ref4) {
55
+ var listState = _ref4.listState,
56
+ indentationState = _ref4.indentationState;
39
57
 
40
58
  if (!listState) {
41
59
  return null;
@@ -53,7 +71,9 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
53
71
  bulletListDisabled: listState.bulletListDisabled,
54
72
  orderedListActive: listState.orderedListActive,
55
73
  orderedListDisabled: listState.orderedListDisabled,
56
- showIndentationButtons: !!showIndentationButtons
74
+ showIndentationButtons: !!showIndentationButtons,
75
+ indentDisabled: indentationState.indentDisabled,
76
+ outdentDisabled: indentationState.outdentDisabled
57
77
  });
58
78
  }
59
79
  });
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pluginKey = exports.createPlugin = void 0;
7
+
8
+ var _prosemirrorState = require("prosemirror-state");
9
+
10
+ var _prosemirrorUtils = require("prosemirror-utils");
11
+
12
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
+
14
+ var _utils = require("../../../utils");
15
+
16
+ var _selection = require("../../list/utils/selection");
17
+
18
+ var _helpers = require("../../tasks-and-decisions/pm-plugins/helpers");
19
+
20
+ var _commands = require("../../indentation/commands");
21
+
22
+ var pluginKey = new _prosemirrorState.PluginKey('indentationButtonsPlugin');
23
+ exports.pluginKey = pluginKey;
24
+
25
+ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
26
+ var state = {
27
+ indentDisabled: true,
28
+ outdentDisabled: true,
29
+ node: null
30
+ };
31
+ var selection = editorState.selection;
32
+ var node = selection.$from.node(); // Handle bullet and numbered lists seperately as they do
33
+ // not use the indentation mark.
34
+ // Check for lists before paragraphs and headings in case
35
+ // the selection is in a list nested in a layout column.
36
+
37
+ if ((0, _selection.isInsideListItem)(editorState)) {
38
+ var _getListItemAttribute = (0, _selection.getListItemAttributes)(selection.$head),
39
+ indentLevel = _getListItemAttribute.indentLevel,
40
+ itemIndex = _getListItemAttribute.itemIndex;
41
+
42
+ return {
43
+ // List indent levels are zero indexed so we need to subtract 1
44
+ indentDisabled: itemIndex === 0 || indentLevel >= _commands.MAX_INDENTATION_LEVEL - 1,
45
+ outdentDisabled: false,
46
+ node: 'list'
47
+ };
48
+ } // Handle tasks seperately as they do not use the indentation mark
49
+ // and have different behaviour for outdent compared to lists
50
+
51
+
52
+ if ((0, _helpers.isInsideTask)(editorState)) {
53
+ var _indentLevel = (0, _helpers.getCurrentIndentLevel)(selection) || 0;
54
+
55
+ var _itemIndex = (0, _helpers.getTaskItemIndex)(editorState);
56
+
57
+ return {
58
+ indentDisabled: _itemIndex === 0 || _indentLevel >= _commands.MAX_INDENTATION_LEVEL,
59
+ outdentDisabled: _indentLevel <= 1,
60
+ node: 'taskList'
61
+ };
62
+ }
63
+
64
+ var isTopLevelParagraphOrHeading = selection.$from.depth === 1;
65
+ var isInLayoutNode = (0, _prosemirrorUtils.hasParentNodeOfType)(editorState.schema.nodes.layoutColumn)(selection) && // depth of non-nested paragraphs and headings in layouts will always be 3
66
+ selection.$from.depth === 3;
67
+
68
+ if (allowHeadingAndParagraphIndentation && (0, _commands.isIndentationAllowed)(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
69
+ var indentationMark = node.marks.find(function (mark) {
70
+ return mark.type === editorState.schema.marks.indentation;
71
+ });
72
+
73
+ if (!indentationMark) {
74
+ return {
75
+ outdentDisabled: true,
76
+ indentDisabled: false,
77
+ node: 'paragraph_heading'
78
+ };
79
+ }
80
+
81
+ return {
82
+ indentDisabled: indentationMark.attrs.level >= _commands.MAX_INDENTATION_LEVEL,
83
+ outdentDisabled: false,
84
+ node: 'paragraph_heading'
85
+ };
86
+ }
87
+
88
+ return state;
89
+ }
90
+
91
+ var createPlugin = function createPlugin(_ref) {
92
+ var dispatch = _ref.dispatch,
93
+ showIndentationButtons = _ref.showIndentationButtons,
94
+ allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
95
+ return new _safePlugin.SafePlugin({
96
+ state: {
97
+ init: function init(_config, state) {
98
+ var initialState = {
99
+ indentDisabled: true,
100
+ outdentDisabled: true,
101
+ node: null
102
+ };
103
+ return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation) : initialState;
104
+ },
105
+ apply: function apply(_tr, pluginState, _oldState, newState) {
106
+ if (showIndentationButtons) {
107
+ var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation);
108
+
109
+ if (!(0, _utils.shallowEqual)(pluginState, state)) {
110
+ dispatch(pluginKey, state);
111
+ return state;
112
+ }
113
+ }
114
+
115
+ return pluginState;
116
+ }
117
+ },
118
+ key: pluginKey
119
+ });
120
+ };
121
+
122
+ exports.createPlugin = createPlugin;
@@ -47,6 +47,8 @@ function Toolbar(props) {
47
47
  orderedListActive = props.orderedListActive,
48
48
  orderedListDisabled = props.orderedListDisabled,
49
49
  showIndentationButtons = props.showIndentationButtons,
50
+ indentDisabled = props.indentDisabled,
51
+ outdentDisabled = props.outdentDisabled,
50
52
  onItemActivated = props.onItemActivated;
51
53
  var labelUnorderedList = formatMessage(_messages.messages.unorderedList);
52
54
  var labelOrderedList = formatMessage(_messages.messages.orderedList);
@@ -94,24 +96,28 @@ function Toolbar(props) {
94
96
  })
95
97
  }), showIndentationButtons && (0, _react.jsx)(_ToolbarButton.default, {
96
98
  buttonId: _ToolbarButton.TOOLBAR_BUTTON.INDENT,
99
+ testId: _ToolbarButton.TOOLBAR_BUTTON.INDENT,
97
100
  spacing: isReducedSpacing ? 'none' : 'default',
98
101
  onClick: handleOnItemActivated('indent'),
99
102
  iconBefore: (0, _react.jsx)(_indent.default, {
100
103
  label: ""
101
104
  }),
102
- disabled: true,
105
+ disabled: indentDisabled || disabled,
106
+ "aria-label": formatMessage(_messages2.messages.indent),
103
107
  title: (0, _react.jsx)(_keymaps.ToolTipContent, {
104
108
  description: formatMessage(_messages2.messages.indent),
105
109
  keymap: _keymaps.indent
106
110
  })
107
111
  }), showIndentationButtons && (0, _react.jsx)(_ToolbarButton.default, {
108
112
  buttonId: _ToolbarButton.TOOLBAR_BUTTON.OUTDENT,
113
+ testId: _ToolbarButton.TOOLBAR_BUTTON.OUTDENT,
109
114
  spacing: isReducedSpacing ? 'none' : 'default',
110
115
  onClick: handleOnItemActivated('outdent'),
111
116
  iconBefore: (0, _react.jsx)(_outdent.default, {
112
117
  label: ""
113
118
  }),
114
- disabled: true,
119
+ disabled: outdentDisabled || disabled,
120
+ "aria-label": formatMessage(_messages2.messages.outdent),
115
121
  title: (0, _react.jsx)(_keymaps.ToolTipContent, {
116
122
  description: formatMessage(_messages2.messages.outdent),
117
123
  keymap: _keymaps.outdent
@@ -148,7 +148,7 @@ function useItems(props) {
148
148
  value: {
149
149
  name: 'indent'
150
150
  },
151
- isDisabled: true,
151
+ isDisabled: props.indentDisabled,
152
152
  isActive: false,
153
153
  elemAfter: (0, _react.jsx)("div", {
154
154
  css: _styles.shortcutStyle
@@ -159,7 +159,7 @@ function useItems(props) {
159
159
  value: {
160
160
  name: 'outdent'
161
161
  },
162
- isDisabled: true,
162
+ isDisabled: props.outdentDisabled,
163
163
  isActive: false,
164
164
  elemAfter: (0, _react.jsx)("div", {
165
165
  css: _styles.shortcutStyle
@@ -25,7 +25,9 @@ function ToolbarListsIndentation(props) {
25
25
  showIndentationButtons = props.showIndentationButtons,
26
26
  popupsMountPoint = props.popupsMountPoint,
27
27
  popupsBoundariesElement = props.popupsBoundariesElement,
28
- popupsScrollableElement = props.popupsScrollableElement;
28
+ popupsScrollableElement = props.popupsScrollableElement,
29
+ indentDisabled = props.indentDisabled,
30
+ outdentDisabled = props.outdentDisabled;
29
31
 
30
32
  if (isSmall) {
31
33
  return (0, _react.jsx)(_ToolbarDropdown.ToolbarDropdown, {
@@ -39,6 +41,8 @@ function ToolbarListsIndentation(props) {
39
41
  showIndentationButtons: showIndentationButtons,
40
42
  orderedListActive: orderedListActive,
41
43
  orderedListDisabled: orderedListDisabled,
44
+ indentDisabled: indentDisabled,
45
+ outdentDisabled: outdentDisabled,
42
46
  disabled: disabled,
43
47
  onItemActivated: _onItemActivated.onItemActivated
44
48
  });
@@ -52,6 +56,8 @@ function ToolbarListsIndentation(props) {
52
56
  showIndentationButtons: showIndentationButtons,
53
57
  orderedListActive: orderedListActive,
54
58
  orderedListDisabled: orderedListDisabled,
59
+ indentDisabled: indentDisabled,
60
+ outdentDisabled: outdentDisabled,
55
61
  disabled: disabled,
56
62
  onItemActivated: _onItemActivated.onItemActivated
57
63
  });
@@ -7,8 +7,14 @@ exports.onItemActivated = onItemActivated;
7
7
 
8
8
  var _commands = require("../../list/commands");
9
9
 
10
+ var _commands2 = require("../../indentation/commands");
11
+
12
+ var _keymaps = require("../../tasks-and-decisions/pm-plugins/keymaps");
13
+
10
14
  var _analytics = require("../../analytics");
11
15
 
16
+ var _indentationButtons = require("../pm-plugins/indentation-buttons");
17
+
12
18
  function onItemActivated(_ref) {
13
19
  var buttonName = _ref.buttonName,
14
20
  editorView = _ref.editorView;
@@ -23,26 +29,41 @@ function onItemActivated(_ref) {
23
29
  break;
24
30
 
25
31
  case 'indent':
26
- editorView.someProp('handleKeyDown', function (handleKeyDown) {
27
- return handleKeyDown(editorView, new KeyboardEvent('keydown', {
28
- bubbles: true,
29
- cancelable: true,
30
- key: 'Tab',
31
- code: 'Tab'
32
- }));
33
- });
34
- break;
32
+ {
33
+ var node = _indentationButtons.pluginKey.getState(editorView.state).node;
34
+
35
+ if (node === 'paragraph_heading') {
36
+ (0, _commands2.getIndentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
37
+ }
38
+
39
+ if (node === 'list') {
40
+ (0, _commands.indentList)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
41
+ }
42
+
43
+ if (node === 'taskList') {
44
+ (0, _keymaps.getIndentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
45
+ }
46
+
47
+ break;
48
+ }
35
49
 
36
50
  case 'outdent':
37
- editorView.someProp('handleKeyDown', function (handleKeyDown) {
38
- return handleKeyDown(editorView, new KeyboardEvent('keydown', {
39
- bubbles: true,
40
- cancelable: true,
41
- shiftKey: true,
42
- key: 'Tab',
43
- code: 'Tab'
44
- }));
45
- });
46
- break;
51
+ {
52
+ var _node = _indentationButtons.pluginKey.getState(editorView.state).node;
53
+
54
+ if (_node === 'paragraph_heading') {
55
+ (0, _commands2.getOutdentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
56
+ }
57
+
58
+ if (_node === 'list') {
59
+ (0, _commands.outdentList)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
60
+ }
61
+
62
+ if (_node === 'taskList') {
63
+ (0, _keymaps.getUnindentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
64
+ }
65
+
66
+ break;
67
+ }
47
68
  }
48
69
  }
@@ -11,6 +11,8 @@ var _key = require("../pm-plugins/key");
11
11
 
12
12
  var _actions = require("../pm-plugins/actions");
13
13
 
14
+ var _utils = require("@atlaskit/editor-common/utils");
15
+
14
16
  var openTypeAhead = function openTypeAhead(props) {
15
17
  return function (tr) {
16
18
  var triggerHandler = props.triggerHandler,
@@ -34,6 +36,8 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
34
36
  inputMethod = _ref.inputMethod,
35
37
  query = _ref.query;
36
38
  return function (tr) {
39
+ var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
40
+
37
41
  openTypeAhead({
38
42
  triggerHandler: triggerHandler,
39
43
  inputMethod: inputMethod,
@@ -57,6 +61,12 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
57
61
 
58
62
  if (nodeAtCursor && isPlaceholderAtCursorPosition) {
59
63
  tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
64
+ } // ME-2375 remove the superfluous '@' inserted before decoration
65
+ // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
66
+
67
+
68
+ if (_utils.browser.chrome && _utils.browser.android && cursorPos > 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, '@')) {
69
+ tr.delete(cursorPos - 1, cursorPos);
60
70
  }
61
71
 
62
72
  return tr;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var SupportedBrowsers = ['ie', 'gecko', 'chrome', 'safari'];
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.clickAreaClickHandler = void 0;
6
+ exports.clickAreaClickHandler = exports.checkForModal = void 0;
7
7
 
8
8
  var _dom = require("../../utils/dom");
9
9
 
@@ -23,10 +23,36 @@ var insideContentArea = function insideContentArea(ref) {
23
23
 
24
24
  return false;
25
25
  };
26
+ /**
27
+ * @see ED-14699 - check if editor is inside a modal to continue to bring cursor to input when
28
+ * any part of the editor container is clicked
29
+ *
30
+ * Handles two cases when a click event is fired:
31
+ *
32
+ * 1. if editor (e.g. comment inside of Jira ticket view) is inside modal then ensure focus and cursor is brought to the input
33
+ * 2. if another modal is open (e.g. delete confirmation modal for confluence table) then ignore clicks as they shouldn't influence editor state
34
+ */
35
+
36
+
37
+ var checkForModal = function checkForModal(target) {
38
+ var modalDialog = target.closest('[role=dialog]');
39
+
40
+ if (modalDialog) {
41
+ // return false if not an editor inside modal, otherwise return true
42
+ return !!(modalDialog !== null && modalDialog !== void 0 && modalDialog.querySelector('.akEditor'));
43
+ } // no modal present so we can return true
44
+
45
+
46
+ return true;
47
+ };
48
+
49
+ exports.checkForModal = checkForModal;
26
50
 
27
51
  var clickAreaClickHandler = function clickAreaClickHandler(view, event) {
28
- var contentArea = event.currentTarget.querySelector('.ak-editor-content-area');
29
- var editorFocused = !!(view && view.hasFocus());
52
+ var _view$hasFocus;
53
+
54
+ var isTargetContentArea = event.currentTarget.querySelector('.ak-editor-content-area');
55
+ var isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus = view.hasFocus) !== null && _view$hasFocus !== void 0 && _view$hasFocus.call(view));
30
56
  var target = event.target; // @see https://product-fabric.atlassian.net/browse/ED-4287
31
57
  // click event gets triggered twice on a checkbox (on <label> first and then on <input>)
32
58
  // by the time it gets triggered on input, PM already re-renders nodeView and detaches it from DOM
@@ -38,13 +64,10 @@ var clickAreaClickHandler = function clickAreaClickHandler(view, event) {
38
64
 
39
65
  var isTextAreaClicked = target.nodeName === 'TEXTAREA';
40
66
  var isBreadcrumbClicked = !!(0, _dom.closestElement)(target, 'nav[aria-label="Breadcrumbs"]');
41
- var targetIsNotContentArea = !contentArea;
42
- var tragetIsNotChildOfContentArea = !insideContentArea(target.parentNode);
43
- var editorIsNotInFocus = editorFocused === false;
67
+ var isTargetChildOfContentArea = insideContentArea(target.parentNode);
44
68
  var selection = window.getSelection();
45
69
  var isEditorPopupTextSelected = (selection === null || selection === void 0 ? void 0 : selection.type) === 'Range' && (0, _dom.closestElement)(selection === null || selection === void 0 ? void 0 : selection.anchorNode, '[data-editor-popup]');
46
- var isModalDialog = !!target.closest('[role=dialog]');
47
- var isClickOutsideEditor = (targetIsNotContentArea || tragetIsNotChildOfContentArea || editorIsNotInFocus) && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isModalDialog && !isBreadcrumbClicked && !isPopupClicked && !isEditorPopupTextSelected;
70
+ var isClickOutsideEditor = (!isTargetContentArea || !isTargetChildOfContentArea || !isEditorFocused) && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target); // click was within editor container and focus should be brought to input
48
71
 
49
72
  if (isClickOutsideEditor && view) {
50
73
  outsideProsemirrorEditorClickHandler(view, event);
@@ -54,15 +77,21 @@ var clickAreaClickHandler = function clickAreaClickHandler(view, event) {
54
77
  exports.clickAreaClickHandler = clickAreaClickHandler;
55
78
 
56
79
  var outsideProsemirrorEditorClickHandler = function outsideProsemirrorEditorClickHandler(view, event) {
80
+ var _view$hasFocus2;
81
+
57
82
  var dispatch = view.dispatch,
58
83
  dom = view.dom,
59
84
  state = view.state;
60
- var editorFocused = !!(view && view.hasFocus());
61
85
  var tr = state.tr;
62
- appendEmptyParagraph(event, dom, tr);
86
+ var isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus2 = view.hasFocus) !== null && _view$hasFocus2 !== void 0 && _view$hasFocus2.call(view));
87
+ var isBottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
88
+
89
+ if (isBottomAreaClicked) {
90
+ (0, _commands.addParagraphAtEnd)(tr);
91
+ }
63
92
 
64
93
  if ((0, _gapCursorSelection.hasGapCursorPlugin)(state)) {
65
- (0, _gapCursorSelection.setSelectionTopLevelBlocks)(tr, event, dom, view.posAtCoords.bind(view), editorFocused);
94
+ (0, _gapCursorSelection.setSelectionTopLevelBlocks)(tr, event, dom, view.posAtCoords.bind(view), isEditorFocused);
66
95
  }
67
96
 
68
97
  if (!tr.docChanged && !tr.selectionSet) {
@@ -76,12 +105,4 @@ var outsideProsemirrorEditorClickHandler = function outsideProsemirrorEditorClic
76
105
  view.focus();
77
106
  event.stopPropagation();
78
107
  event.preventDefault();
79
- };
80
-
81
- var appendEmptyParagraph = function appendEmptyParagraph(event, dom, tr) {
82
- var bottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
83
-
84
- if (bottomAreaClicked) {
85
- (0, _commands.addParagraphAtEnd)(tr);
86
- }
87
108
  };
@@ -79,8 +79,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
79
79
 
80
80
  var CommentEditorMargin = 14;
81
81
  var CommentEditorSmallerMargin = 8;
82
- var commentEditorStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Parahraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n\n height: auto;\n background-color: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), CommentEditorSmallerMargin, CommentEditorSmallerMargin, (0, _tokens.token)('color.background.input', 'white'), (0, _tokens.token)('color.border', _colors.N40), (0, _constants.borderRadius)());
83
- var ContentArea = (0, _ContentStyles.createEditorContentStyle)((0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n line-height: 24px;\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/\n .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, _Toolbar2.TableControlsPadding, _commonStyles.tableCommentEditorStyles));
82
+ var commentEditorStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Paragraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n\n height: auto;\n background-color: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), CommentEditorSmallerMargin, CommentEditorSmallerMargin, (0, _tokens.token)('color.background.input', 'white'), (0, _tokens.token)('color.border', _colors.N40), (0, _constants.borderRadius)());
83
+ var ContentArea = (0, _ContentStyles.createEditorContentStyle)((0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n line-height: 24px;\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for table controls. Otherwise margin collapse and controls are misplaced. **/\n .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, _Toolbar2.TableControlsPadding, _commonStyles.tableCommentEditorStyles));
84
84
  ContentArea.displayName = 'ContentArea';
85
85
  var secondaryToolbarStyle = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n box-sizing: border-box;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n padding: 12px 1px;\n"])));
86
86