@atlaskit/editor-core 171.0.0 → 172.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/CHANGELOG.md +96 -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/table/ui/common-styles.js +1 -1
  58. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
  59. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
  60. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
  61. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
  62. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
  63. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  64. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
  65. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
  66. package/dist/cjs/types/browser.js +6 -0
  67. package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
  68. package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
  69. package/dist/cjs/ui/ContentStyles/index.js +1 -3
  70. package/dist/cjs/ui/DropList/index.js +215 -0
  71. package/dist/cjs/ui/Dropdown/index.js +2 -5
  72. package/dist/cjs/ui/DropdownMenu/index.js +140 -86
  73. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
  74. package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
  75. package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
  76. package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
  77. package/dist/cjs/ui/Layer/index.js +245 -0
  78. package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
  79. package/dist/cjs/ui/PortalProvider/index.js +7 -26
  80. package/dist/cjs/version-wrapper.js +1 -1
  81. package/dist/cjs/version.json +1 -1
  82. package/dist/es2019/create-editor/ReactEditorView.js +15 -4
  83. package/dist/es2019/create-editor/create-plugins-list.js +21 -11
  84. package/dist/es2019/editor.js +9 -23
  85. package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
  86. package/dist/es2019/labs/next/presets/default.js +1 -1
  87. package/dist/es2019/nodeviews/context-adapter.js +2 -2
  88. package/dist/es2019/plugins/analytics/plugin.js +19 -4
  89. package/dist/es2019/plugins/base/index.js +3 -3
  90. package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
  91. package/dist/es2019/plugins/card/index.js +1 -1
  92. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
  93. package/dist/es2019/plugins/card/toolbar.js +10 -5
  94. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
  95. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  96. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
  97. package/dist/es2019/plugins/code-block/actions.js +12 -0
  98. package/dist/es2019/plugins/code-block/index.js +4 -0
  99. package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
  100. package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
  101. package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
  102. package/dist/es2019/plugins/code-block/styles.js +2 -159
  103. package/dist/es2019/plugins/code-block/toolbar.js +8 -0
  104. package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
  105. package/dist/es2019/plugins/copy-button/commands.js +35 -15
  106. package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
  107. package/dist/es2019/plugins/copy-button/utils.js +15 -27
  108. package/dist/es2019/plugins/expand/toolbar.js +4 -1
  109. package/dist/es2019/plugins/extension/toolbar.js +4 -1
  110. package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  111. package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  112. package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
  113. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
  114. package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
  115. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
  116. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
  117. package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
  118. package/dist/es2019/plugins/hyperlink/index.js +4 -4
  119. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
  120. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
  121. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
  122. package/dist/es2019/plugins/indentation/commands/index.js +24 -9
  123. package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
  124. package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
  125. package/dist/es2019/plugins/layout/toolbar.js +2 -1
  126. package/dist/es2019/plugins/media/toolbar/index.js +10 -3
  127. package/dist/es2019/plugins/mentions/analytics.js +1 -1
  128. package/dist/es2019/plugins/panel/toolbar.js +1 -1
  129. package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
  130. package/dist/es2019/plugins/paste/handlers.js +27 -2
  131. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
  132. package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
  133. package/dist/es2019/plugins/status/analytics.js +1 -1
  134. package/dist/es2019/plugins/table/toolbar.js +1 -1
  135. package/dist/es2019/plugins/table/ui/common-styles.js +2 -0
  136. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
  137. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
  138. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
  139. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
  140. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
  141. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  142. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
  143. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
  144. package/dist/es2019/types/browser.js +2 -0
  145. package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
  146. package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
  147. package/dist/es2019/ui/ContentStyles/index.js +5 -9
  148. package/dist/es2019/ui/DropList/index.js +186 -0
  149. package/dist/es2019/ui/Dropdown/index.js +2 -6
  150. package/dist/es2019/ui/DropdownMenu/index.js +124 -75
  151. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
  152. package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
  153. package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
  154. package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
  155. package/dist/es2019/ui/Layer/index.js +195 -0
  156. package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
  157. package/dist/es2019/ui/PortalProvider/index.js +5 -23
  158. package/dist/es2019/version-wrapper.js +1 -1
  159. package/dist/es2019/version.json +1 -1
  160. package/dist/esm/create-editor/ReactEditorView.js +13 -4
  161. package/dist/esm/create-editor/create-plugins-list.js +21 -12
  162. package/dist/esm/editor.js +9 -23
  163. package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
  164. package/dist/esm/labs/next/presets/default.js +1 -1
  165. package/dist/esm/nodeviews/context-adapter.js +2 -2
  166. package/dist/esm/plugins/analytics/plugin.js +24 -11
  167. package/dist/esm/plugins/base/index.js +3 -3
  168. package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
  169. package/dist/esm/plugins/card/index.js +1 -1
  170. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
  171. package/dist/esm/plugins/card/toolbar.js +11 -5
  172. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
  173. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  174. package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
  175. package/dist/esm/plugins/code-block/actions.js +12 -0
  176. package/dist/esm/plugins/code-block/index.js +6 -0
  177. package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
  178. package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
  179. package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
  180. package/dist/esm/plugins/code-block/styles.js +4 -32
  181. package/dist/esm/plugins/code-block/toolbar.js +8 -0
  182. package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
  183. package/dist/esm/plugins/copy-button/commands.js +35 -15
  184. package/dist/esm/plugins/copy-button/toolbar.js +31 -0
  185. package/dist/esm/plugins/copy-button/utils.js +14 -29
  186. package/dist/esm/plugins/expand/toolbar.js +6 -2
  187. package/dist/esm/plugins/extension/toolbar.js +4 -1
  188. package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  189. package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  190. package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
  191. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
  192. package/dist/esm/plugins/feedback-dialog/index.js +1 -1
  193. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
  194. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
  195. package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
  196. package/dist/esm/plugins/hyperlink/index.js +4 -4
  197. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
  198. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
  199. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
  200. package/dist/esm/plugins/indentation/commands/index.js +30 -9
  201. package/dist/esm/plugins/indentation/commands/utils.js +12 -8
  202. package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
  203. package/dist/esm/plugins/layout/toolbar.js +2 -1
  204. package/dist/esm/plugins/media/toolbar/index.js +12 -5
  205. package/dist/esm/plugins/mentions/analytics.js +1 -1
  206. package/dist/esm/plugins/panel/toolbar.js +1 -1
  207. package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
  208. package/dist/esm/plugins/paste/handlers.js +23 -2
  209. package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
  210. package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
  211. package/dist/esm/plugins/status/analytics.js +1 -1
  212. package/dist/esm/plugins/table/toolbar.js +1 -1
  213. package/dist/esm/plugins/table/ui/common-styles.js +1 -1
  214. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
  215. package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
  216. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
  217. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
  218. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
  219. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  220. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
  221. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
  222. package/dist/esm/types/browser.js +2 -0
  223. package/dist/esm/ui/Addon/click-area-helper.js +37 -18
  224. package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
  225. package/dist/esm/ui/ContentStyles/index.js +2 -4
  226. package/dist/esm/ui/DropList/index.js +203 -0
  227. package/dist/esm/ui/Dropdown/index.js +2 -6
  228. package/dist/esm/ui/DropdownMenu/index.js +134 -88
  229. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
  230. package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
  231. package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
  232. package/dist/esm/ui/ElementBrowser/constants.js +1 -4
  233. package/dist/esm/ui/Layer/index.js +228 -0
  234. package/dist/esm/ui/Layer/internal/helpers.js +62 -0
  235. package/dist/esm/ui/PortalProvider/index.js +7 -26
  236. package/dist/esm/version-wrapper.js +1 -1
  237. package/dist/esm/version.json +1 -1
  238. package/dist/types/labs/next/presets/default.d.ts +2 -0
  239. package/dist/types/plugins/analytics/plugin.d.ts +5 -1
  240. package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
  241. package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
  242. package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
  243. package/dist/types/plugins/base/index.d.ts +1 -1
  244. package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
  245. package/dist/types/plugins/card/index.d.ts +2 -7
  246. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
  247. package/dist/types/plugins/card/toolbar.d.ts +3 -5
  248. package/dist/types/plugins/card/types.d.ts +2 -0
  249. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
  250. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
  251. package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
  252. package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
  253. package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
  254. package/dist/types/plugins/code-block/styles.d.ts +0 -1
  255. package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
  256. package/dist/types/plugins/copy-button/commands.d.ts +2 -2
  257. package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
  258. package/dist/types/plugins/copy-button/utils.d.ts +7 -6
  259. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
  260. package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
  261. package/dist/types/plugins/hyperlink/index.d.ts +2 -2
  262. package/dist/types/plugins/hyperlink/types.d.ts +30 -0
  263. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
  264. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
  265. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
  266. package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
  267. package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
  268. package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
  269. package/dist/types/plugins/paste/handlers.d.ts +1 -0
  270. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
  271. package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
  272. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
  273. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
  274. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
  275. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  276. package/dist/types/types/browser.d.ts +10 -0
  277. package/dist/types/types/editor-props.d.ts +6 -5
  278. package/dist/types/types/feature-flags.d.ts +29 -24
  279. package/dist/types/types/index.d.ts +1 -0
  280. package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
  281. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  282. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  283. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  284. package/dist/types/ui/DropList/index.d.ts +22 -0
  285. package/dist/types/ui/Dropdown/index.d.ts +2 -1
  286. package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
  287. package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
  288. package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
  289. package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
  290. package/dist/types/ui/Layer/index.d.ts +47 -0
  291. package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
  292. package/package.json +23 -18
  293. package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
  294. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
  295. package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
  296. package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
  297. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
  298. package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
  299. package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
  300. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
  301. package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
  302. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
  303. package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
@@ -10,13 +10,13 @@ import { insertTaskDecisionWithAnalytics } from '../commands';
10
10
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
11
11
  import { getBlockRange, getCurrentIndentLevel, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInsideTask, isInsideTaskOrDecisionItem, liftBlock, subtreeHeight, walkOut, isTable, getTaskItemIndex, isInsideDecision } from './helpers';
12
12
 
13
- const indentationAnalytics = (curIndentLevel, direction) => ({
13
+ const indentationAnalytics = (curIndentLevel, direction, inputMethod) => ({
14
14
  action: ACTION.FORMATTED,
15
15
  actionSubject: ACTION_SUBJECT.TEXT,
16
16
  actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
17
17
  eventType: EVENT_TYPE.TRACK,
18
18
  attributes: {
19
- inputMethod: INPUT_METHOD.KEYBOARD,
19
+ inputMethod,
20
20
  previousIndentationLevel: curIndentLevel,
21
21
  newIndentLevel: direction === INDENT_DIRECTION.OUTDENT ? curIndentLevel - 1 : curIndentLevel + 1,
22
22
  direction,
@@ -83,14 +83,14 @@ const joinTaskDecisionFollowing = (state, dispatch) => {
83
83
  return false;
84
84
  };
85
85
 
86
- const unindent = filter(isInsideTask, (state, dispatch) => {
86
+ export const getUnindentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
87
87
  const curIndentLevel = getCurrentIndentLevel(state.selection);
88
88
 
89
89
  if (!curIndentLevel || curIndentLevel === 1) {
90
90
  return false;
91
91
  }
92
92
 
93
- return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
93
+ return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT, inputMethod))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
94
94
  }); // if selection is decision item or first action item in table cell
95
95
  // then dont consume the Tab, as table-keymap should tab to the next cell
96
96
 
@@ -110,7 +110,7 @@ const shouldLetTabThroughInTable = state => {
110
110
  return false;
111
111
  };
112
112
 
113
- const indent = filter(isInsideTask, (state, dispatch) => {
113
+ export const getIndentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
114
114
  // limit ui indentation to 6 levels
115
115
  const curIndentLevel = getCurrentIndentLevel(state.selection);
116
116
 
@@ -132,7 +132,7 @@ const indent = filter(isInsideTask, (state, dispatch) => {
132
132
  return true;
133
133
  }
134
134
 
135
- return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
135
+ return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT, inputMethod))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
136
136
  });
137
137
 
138
138
  const backspaceFrom = $from => (state, dispatch) => {
@@ -150,7 +150,7 @@ const backspaceFrom = $from => (state, dispatch) => {
150
150
  } = state.schema.nodes;
151
151
 
152
152
  if ($from.node($from.depth - 2).type === taskList) {
153
- return unindent(state, dispatch);
153
+ return getUnindentCommand()(state, dispatch);
154
154
  } // bottom level, should "unwrap" taskItem contents into paragraph
155
155
  // we achieve this by slicing the content out, and replacing
156
156
 
@@ -305,7 +305,7 @@ const splitListItem = (state, dispatch) => {
305
305
  return false;
306
306
  };
307
307
 
308
- const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(unindent, splitListItem)), (state, dispatch) => {
308
+ const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(getUnindentCommand(), splitListItem)), (state, dispatch) => {
309
309
  const {
310
310
  selection,
311
311
  schema
@@ -356,8 +356,8 @@ const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTas
356
356
  }));
357
357
  export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
358
358
  const indentHandlers = {
359
- 'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => unindent(state, dispatch) || !!consumeTabs),
360
- Tab: filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => indent(state, dispatch) || !!consumeTabs)
359
+ 'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => getUnindentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs),
360
+ Tab: filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => getIndentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs)
361
361
  };
362
362
  const defaultHandlers = consumeTabs ? {
363
363
  'Shift-Tab': isInsideTaskOrDecisionItem,
@@ -3,12 +3,27 @@ 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
  const toolbarListsIndentationPlugin = ({
8
- showIndentationButtons
9
+ showIndentationButtons,
10
+ allowHeadingAndParagraphIndentation
9
11
  }) => ({
10
12
  name: 'toolbarListsIndentation',
11
13
 
14
+ pmPlugins() {
15
+ return [{
16
+ name: 'indentationButtons',
17
+ plugin: ({
18
+ dispatch
19
+ }) => indentationButtonsPlugin({
20
+ dispatch,
21
+ showIndentationButtons,
22
+ allowHeadingAndParagraphIndentation
23
+ })
24
+ }];
25
+ },
26
+
12
27
  primaryToolbarComponent({
13
28
  editorView,
14
29
  popupsMountPoint,
@@ -21,10 +36,12 @@ const toolbarListsIndentationPlugin = ({
21
36
  const isSmall = toolbarSize < ToolbarSize.L;
22
37
  return /*#__PURE__*/React.createElement(WithPluginState, {
23
38
  plugins: {
24
- listState: listPluginKey
39
+ listState: listPluginKey,
40
+ indentationState: indentationButtonsPluginKey
25
41
  },
26
42
  render: ({
27
- listState: listState
43
+ listState,
44
+ indentationState
28
45
  }) => {
29
46
  if (!listState) {
30
47
  return null;
@@ -42,7 +59,9 @@ const toolbarListsIndentationPlugin = ({
42
59
  bulletListDisabled: listState.bulletListDisabled,
43
60
  orderedListActive: listState.orderedListActive,
44
61
  orderedListDisabled: listState.orderedListDisabled,
45
- showIndentationButtons: !!showIndentationButtons
62
+ showIndentationButtons: !!showIndentationButtons,
63
+ indentDisabled: indentationState.indentDisabled,
64
+ outdentDisabled: indentationState.outdentDisabled
46
65
  });
47
66
  }
48
67
  });
@@ -0,0 +1,104 @@
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 const pluginKey = new PluginKey('indentationButtonsPlugin');
9
+
10
+ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
11
+ const state = {
12
+ indentDisabled: true,
13
+ outdentDisabled: true,
14
+ node: null
15
+ };
16
+ const {
17
+ selection
18
+ } = editorState;
19
+ const node = selection.$from.node(); // Handle bullet and numbered lists seperately as they do
20
+ // not use the indentation mark.
21
+ // Check for lists before paragraphs and headings in case
22
+ // the selection is in a list nested in a layout column.
23
+
24
+ if (isInsideListItem(editorState)) {
25
+ const {
26
+ indentLevel,
27
+ itemIndex
28
+ } = getListItemAttributes(selection.$head);
29
+ return {
30
+ // List indent levels are zero indexed so we need to subtract 1
31
+ indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL - 1,
32
+ outdentDisabled: false,
33
+ node: 'list'
34
+ };
35
+ } // Handle tasks seperately as they do not use the indentation mark
36
+ // and have different behaviour for outdent compared to lists
37
+
38
+
39
+ if (isInsideTask(editorState)) {
40
+ const indentLevel = getTaskListIndentLevel(selection) || 0;
41
+ const itemIndex = getTaskItemIndex(editorState);
42
+ return {
43
+ indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
44
+ outdentDisabled: indentLevel <= 1,
45
+ node: 'taskList'
46
+ };
47
+ }
48
+
49
+ const isTopLevelParagraphOrHeading = selection.$from.depth === 1;
50
+ const 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
+ const indentationMark = node.marks.find(mark => mark.type === editorState.schema.marks.indentation);
55
+
56
+ if (!indentationMark) {
57
+ return {
58
+ outdentDisabled: true,
59
+ indentDisabled: false,
60
+ node: 'paragraph_heading'
61
+ };
62
+ }
63
+
64
+ return {
65
+ indentDisabled: indentationMark.attrs.level >= MAX_INDENTATION_LEVEL,
66
+ outdentDisabled: false,
67
+ node: 'paragraph_heading'
68
+ };
69
+ }
70
+
71
+ return state;
72
+ }
73
+
74
+ export const createPlugin = ({
75
+ dispatch,
76
+ showIndentationButtons,
77
+ allowHeadingAndParagraphIndentation
78
+ }) => new SafePlugin({
79
+ state: {
80
+ init(_config, state) {
81
+ const initialState = {
82
+ indentDisabled: true,
83
+ outdentDisabled: true,
84
+ node: null
85
+ };
86
+ return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation) : initialState;
87
+ },
88
+
89
+ apply(_tr, pluginState, _oldState, newState) {
90
+ if (showIndentationButtons) {
91
+ const state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation);
92
+
93
+ if (!shallowEqual(pluginState, state)) {
94
+ dispatch(pluginKey, state);
95
+ return state;
96
+ }
97
+ }
98
+
99
+ return pluginState;
100
+ }
101
+
102
+ },
103
+ key: pluginKey
104
+ });
@@ -22,6 +22,8 @@ export function Toolbar(props) {
22
22
  orderedListActive,
23
23
  orderedListDisabled,
24
24
  showIndentationButtons,
25
+ indentDisabled,
26
+ outdentDisabled,
25
27
  onItemActivated
26
28
  } = props;
27
29
  const labelUnorderedList = formatMessage(messages.unorderedList);
@@ -65,28 +67,32 @@ export function Toolbar(props) {
65
67
  label: ""
66
68
  })
67
69
  }), showIndentationButtons && jsx(ToolbarButton, {
68
- buttonId: TOOLBAR_BUTTON.INDENT,
70
+ buttonId: TOOLBAR_BUTTON.OUTDENT,
71
+ testId: TOOLBAR_BUTTON.OUTDENT,
69
72
  spacing: isReducedSpacing ? 'none' : 'default',
70
- onClick: handleOnItemActivated('indent'),
71
- iconBefore: jsx(IndentIcon, {
73
+ onClick: handleOnItemActivated('outdent'),
74
+ iconBefore: jsx(OutdentIcon, {
72
75
  label: ""
73
76
  }),
74
- disabled: true,
77
+ disabled: outdentDisabled || disabled,
78
+ "aria-label": formatMessage(indentationMessages.outdent),
75
79
  title: jsx(ToolTipContent, {
76
- description: formatMessage(indentationMessages.indent),
77
- keymap: toggleIndentKeymap
80
+ description: formatMessage(indentationMessages.outdent),
81
+ keymap: toggleOutdentKeymap
78
82
  })
79
83
  }), showIndentationButtons && jsx(ToolbarButton, {
80
- buttonId: TOOLBAR_BUTTON.OUTDENT,
84
+ buttonId: TOOLBAR_BUTTON.INDENT,
85
+ testId: TOOLBAR_BUTTON.INDENT,
81
86
  spacing: isReducedSpacing ? 'none' : 'default',
82
- onClick: handleOnItemActivated('outdent'),
83
- iconBefore: jsx(OutdentIcon, {
87
+ onClick: handleOnItemActivated('indent'),
88
+ iconBefore: jsx(IndentIcon, {
84
89
  label: ""
85
90
  }),
86
- disabled: true,
91
+ disabled: indentDisabled || disabled,
92
+ "aria-label": formatMessage(indentationMessages.indent),
87
93
  title: jsx(ToolTipContent, {
88
- description: formatMessage(indentationMessages.outdent),
89
- keymap: toggleOutdentKeymap
94
+ description: formatMessage(indentationMessages.indent),
95
+ keymap: toggleIndentKeymap
90
96
  })
91
97
  }), jsx("span", {
92
98
  css: separatorStyles
@@ -119,27 +119,27 @@ function useItems(props) {
119
119
  const labelIndent = formatMessage(indentationMessages.indent);
120
120
  const labelOutdent = formatMessage(indentationMessages.outdent);
121
121
  items.push({
122
- key: 'indent',
123
- content: labelIndent,
122
+ key: 'outdent',
123
+ content: labelOutdent,
124
124
  value: {
125
- name: 'indent'
125
+ name: 'outdent'
126
126
  },
127
- isDisabled: true,
127
+ isDisabled: props.outdentDisabled,
128
128
  isActive: false,
129
129
  elemAfter: jsx("div", {
130
130
  css: shortcutStyle
131
- }, tooltip(toggleIndentKeymap))
131
+ }, tooltip(toggleOutdentKeymap))
132
132
  }, {
133
- key: 'outdent',
134
- content: labelOutdent,
133
+ key: 'indent',
134
+ content: labelIndent,
135
135
  value: {
136
- name: 'outdent'
136
+ name: 'indent'
137
137
  },
138
- isDisabled: true,
138
+ isDisabled: props.indentDisabled,
139
139
  isActive: false,
140
140
  elemAfter: jsx("div", {
141
141
  css: shortcutStyle
142
- }, tooltip(toggleOutdentKeymap))
142
+ }, tooltip(toggleIndentKeymap))
143
143
  });
144
144
  }
145
145
 
@@ -15,7 +15,9 @@ export default function ToolbarListsIndentation(props) {
15
15
  showIndentationButtons,
16
16
  popupsMountPoint,
17
17
  popupsBoundariesElement,
18
- popupsScrollableElement
18
+ popupsScrollableElement,
19
+ indentDisabled,
20
+ outdentDisabled
19
21
  } = props;
20
22
 
21
23
  if (isSmall) {
@@ -30,6 +32,8 @@ export default function ToolbarListsIndentation(props) {
30
32
  showIndentationButtons: showIndentationButtons,
31
33
  orderedListActive: orderedListActive,
32
34
  orderedListDisabled: orderedListDisabled,
35
+ indentDisabled: indentDisabled,
36
+ outdentDisabled: outdentDisabled,
33
37
  disabled: disabled,
34
38
  onItemActivated: onItemActivated
35
39
  });
@@ -43,6 +47,8 @@ export default function ToolbarListsIndentation(props) {
43
47
  showIndentationButtons: showIndentationButtons,
44
48
  orderedListActive: orderedListActive,
45
49
  orderedListDisabled: orderedListDisabled,
50
+ indentDisabled: indentDisabled,
51
+ outdentDisabled: outdentDisabled,
46
52
  disabled: disabled,
47
53
  onItemActivated: onItemActivated
48
54
  });
@@ -1,5 +1,8 @@
1
- import { toggleBulletList, toggleOrderedList } from '../../list/commands';
1
+ import { indentList, outdentList, toggleBulletList, toggleOrderedList } from '../../list/commands';
2
+ import { getIndentCommand as indentParagraphOrHeading, getOutdentCommand as outdentParagraphOrHeading } from '../../indentation/commands';
3
+ import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
2
4
  import { INPUT_METHOD } from '../../analytics';
5
+ import { pluginKey as indentationButtonsPluginKey } from '../pm-plugins/indentation-buttons';
3
6
  export function onItemActivated({
4
7
  buttonName,
5
8
  editorView
@@ -14,22 +17,41 @@ export function onItemActivated({
14
17
  break;
15
18
 
16
19
  case 'indent':
17
- editorView.someProp('handleKeyDown', handleKeyDown => handleKeyDown(editorView, new KeyboardEvent('keydown', {
18
- bubbles: true,
19
- cancelable: true,
20
- key: 'Tab',
21
- code: 'Tab'
22
- })));
23
- break;
20
+ {
21
+ const node = indentationButtonsPluginKey.getState(editorView.state).node;
22
+
23
+ if (node === 'paragraph_heading') {
24
+ indentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
25
+ }
26
+
27
+ if (node === 'list') {
28
+ indentList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
29
+ }
30
+
31
+ if (node === 'taskList') {
32
+ indentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
33
+ }
34
+
35
+ break;
36
+ }
24
37
 
25
38
  case 'outdent':
26
- editorView.someProp('handleKeyDown', handleKeyDown => handleKeyDown(editorView, new KeyboardEvent('keydown', {
27
- bubbles: true,
28
- cancelable: true,
29
- shiftKey: true,
30
- key: 'Tab',
31
- code: 'Tab'
32
- })));
33
- break;
39
+ {
40
+ const node = indentationButtonsPluginKey.getState(editorView.state).node;
41
+
42
+ if (node === 'paragraph_heading') {
43
+ outdentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
44
+ }
45
+
46
+ if (node === 'list') {
47
+ outdentList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
48
+ }
49
+
50
+ if (node === 'taskList') {
51
+ outdentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
52
+ }
53
+
54
+ break;
55
+ }
34
56
  }
35
57
  }
@@ -1,6 +1,7 @@
1
1
  import { TextSelection } from 'prosemirror-state';
2
2
  import { pluginKey } from '../pm-plugins/key';
3
3
  import { ACTIONS } from '../pm-plugins/actions';
4
+ import { browser } from '@atlaskit/editor-common/utils';
4
5
  export const openTypeAhead = props => tr => {
5
6
  const {
6
7
  triggerHandler,
@@ -21,6 +22,8 @@ export const openTypeAheadAtCursor = ({
21
22
  inputMethod,
22
23
  query
23
24
  }) => tr => {
25
+ var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
26
+
24
27
  openTypeAhead({
25
28
  triggerHandler,
26
29
  inputMethod,
@@ -46,6 +49,12 @@ export const openTypeAheadAtCursor = ({
46
49
 
47
50
  if (nodeAtCursor && isPlaceholderAtCursorPosition) {
48
51
  tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
52
+ } // ME-2375 remove the superfluous '@' inserted before decoration
53
+ // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
54
+
55
+
56
+ if (browser.chrome && 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, '@')) {
57
+ tr.delete(cursorPos - 1, cursorPos);
49
58
  }
50
59
 
51
60
  return tr;
@@ -0,0 +1,2 @@
1
+ const SupportedBrowsers = ['ie', 'gecko', 'chrome', 'safari'];
2
+ export {};
@@ -13,10 +13,34 @@ const insideContentArea = ref => {
13
13
 
14
14
  return false;
15
15
  };
16
+ /**
17
+ * @see ED-14699 - check if editor is inside a modal to continue to bring cursor to input when
18
+ * any part of the editor container is clicked
19
+ *
20
+ * Handles two cases when a click event is fired:
21
+ *
22
+ * 1. if editor (e.g. comment inside of Jira ticket view) is inside modal then ensure focus and cursor is brought to the input
23
+ * 2. if another modal is open (e.g. delete confirmation modal for confluence table) then ignore clicks as they shouldn't influence editor state
24
+ */
25
+
26
+
27
+ export const checkForModal = target => {
28
+ const modalDialog = target.closest('[role=dialog]');
29
+
30
+ if (modalDialog) {
31
+ // return false if not an editor inside modal, otherwise return true
32
+ return !!(modalDialog !== null && modalDialog !== void 0 && modalDialog.querySelector('.akEditor'));
33
+ } // no modal present so we can return true
34
+
35
+
36
+ return true;
37
+ };
16
38
 
17
39
  const clickAreaClickHandler = (view, event) => {
18
- const contentArea = event.currentTarget.querySelector('.ak-editor-content-area');
19
- const editorFocused = !!(view && view.hasFocus());
40
+ var _view$hasFocus;
41
+
42
+ const isTargetContentArea = event.currentTarget.querySelector('.ak-editor-content-area');
43
+ const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus = view.hasFocus) !== null && _view$hasFocus !== void 0 && _view$hasFocus.call(view));
20
44
  const target = event.target; // @see https://product-fabric.atlassian.net/browse/ED-4287
21
45
  // click event gets triggered twice on a checkbox (on <label> first and then on <input>)
22
46
  // by the time it gets triggered on input, PM already re-renders nodeView and detaches it from DOM
@@ -28,13 +52,10 @@ const clickAreaClickHandler = (view, event) => {
28
52
 
29
53
  const isTextAreaClicked = target.nodeName === 'TEXTAREA';
30
54
  const isBreadcrumbClicked = !!closestElement(target, 'nav[aria-label="Breadcrumbs"]');
31
- const targetIsNotContentArea = !contentArea;
32
- const tragetIsNotChildOfContentArea = !insideContentArea(target.parentNode);
33
- const editorIsNotInFocus = editorFocused === false;
55
+ const isTargetChildOfContentArea = insideContentArea(target.parentNode);
34
56
  const selection = window.getSelection();
35
57
  const isEditorPopupTextSelected = (selection === null || selection === void 0 ? void 0 : selection.type) === 'Range' && closestElement(selection === null || selection === void 0 ? void 0 : selection.anchorNode, '[data-editor-popup]');
36
- const isModalDialog = !!target.closest('[role=dialog]');
37
- const isClickOutsideEditor = (targetIsNotContentArea || tragetIsNotChildOfContentArea || editorIsNotInFocus) && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isModalDialog && !isBreadcrumbClicked && !isPopupClicked && !isEditorPopupTextSelected;
58
+ const isClickOutsideEditor = (!isTargetContentArea || !isTargetChildOfContentArea || !isEditorFocused) && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target); // click was within editor container and focus should be brought to input
38
59
 
39
60
  if (isClickOutsideEditor && view) {
40
61
  outsideProsemirrorEditorClickHandler(view, event);
@@ -42,19 +63,25 @@ const clickAreaClickHandler = (view, event) => {
42
63
  };
43
64
 
44
65
  const outsideProsemirrorEditorClickHandler = (view, event) => {
66
+ var _view$hasFocus2;
67
+
45
68
  const {
46
69
  dispatch,
47
70
  dom,
48
71
  state
49
72
  } = view;
50
- const editorFocused = !!(view && view.hasFocus());
51
73
  const {
52
74
  tr
53
75
  } = state;
54
- appendEmptyParagraph(event, dom, tr);
76
+ const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus2 = view.hasFocus) !== null && _view$hasFocus2 !== void 0 && _view$hasFocus2.call(view));
77
+ const isBottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
78
+
79
+ if (isBottomAreaClicked) {
80
+ addParagraphAtEnd(tr);
81
+ }
55
82
 
56
83
  if (hasGapCursorPlugin(state)) {
57
- setSelectionTopLevelBlocks(tr, event, dom, view.posAtCoords.bind(view), editorFocused);
84
+ setSelectionTopLevelBlocks(tr, event, dom, view.posAtCoords.bind(view), isEditorFocused);
58
85
  }
59
86
 
60
87
  if (!tr.docChanged && !tr.selectionSet) {
@@ -70,12 +97,4 @@ const outsideProsemirrorEditorClickHandler = (view, event) => {
70
97
  event.preventDefault();
71
98
  };
72
99
 
73
- const appendEmptyParagraph = (event, dom, tr) => {
74
- const bottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
75
-
76
- if (bottomAreaClicked) {
77
- addParagraphAtEnd(tr);
78
- }
79
- };
80
-
81
100
  export { clickAreaClickHandler };
@@ -36,7 +36,7 @@ const commentEditorStyle = css`
36
36
  }
37
37
 
38
38
  min-width: 272px;
39
- /* Border + Toolbar + Footer + (Paragraph + ((Parahraph + Margin) * (DefaultLines - 1)) */
39
+ /* Border + Toolbar + Footer + (Paragraph + ((Paragraph + Margin) * (DefaultLines - 1)) */
40
40
  /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */
41
41
 
42
42
  height: auto;
@@ -55,7 +55,7 @@ const ContentArea = createEditorContentStyle(css`
55
55
  line-height: 24px;
56
56
 
57
57
  /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/
58
- /** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/
58
+ /** Hack for table controls. Otherwise margin collapse and controls are misplaced. **/
59
59
  .ProseMirror {
60
60
  margin: 12px ${CommentEditorMargin}px ${CommentEditorMargin}px;
61
61
  }
@@ -10,7 +10,7 @@ import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
10
10
  import { tableStyles } from '../../plugins/table/ui/common-styles';
11
11
  import { placeholderStyles } from '../../plugins/placeholder/styles';
12
12
  import { blocktypeStyles } from '../../plugins/block-type/styles';
13
- import { codeBlockStyles, highlightingCodeBlockStyles } from '../../plugins/code-block/styles';
13
+ import { codeBlockStyles } from '../../plugins/code-block/styles';
14
14
  import { listsStyles } from '../../plugins/list/styles';
15
15
  import { ruleStyles } from '../../plugins/rule/styles';
16
16
  import { mediaStyles } from '../../plugins/media/styles';
@@ -35,15 +35,12 @@ import { embedCardStyles } from '../../plugins/card/ui/styled';
35
35
  import { useFeatureFlags } from '../../plugins/feature-flags-context';
36
36
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
37
37
 
38
- const contentStyles = props => {
39
- var _props$featureFlags;
40
-
41
- return css`
38
+ const contentStyles = props => css`
42
39
  .ProseMirror {
43
40
  outline: none;
44
41
  font-size: ${editorFontSize({
45
- theme: props.theme
46
- })}px;
42
+ theme: props.theme
43
+ })}px;
47
44
  ${whitespaceSharedStyles};
48
45
  ${paragraphSharedStyles};
49
46
  ${listsSharedStyles};
@@ -75,7 +72,7 @@ const contentStyles = props => {
75
72
 
76
73
  ${placeholderTextStyles}
77
74
  ${placeholderStyles}
78
- ${(_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockStyles(props) : codeBlockStyles(props)}
75
+ ${codeBlockStyles(props)}
79
76
 
80
77
  ${blocktypeStyles(props)}
81
78
  ${textFormattingStyles(props)}
@@ -158,7 +155,6 @@ const contentStyles = props => {
158
155
  }
159
156
  }
160
157
  `;
161
- };
162
158
 
163
159
  export const createEditorContentStyle = styles => {
164
160
  return /*#__PURE__*/React.forwardRef((props, ref) => {