@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
@@ -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
 
@@ -88,11 +88,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
88
88
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
89
89
 
90
90
  var contentStyles = function contentStyles(props) {
91
- var _props$featureFlags;
92
-
93
91
  return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap,\n .pm-table-cell-content-wrap div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
94
92
  theme: props.theme
95
- }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, (0, _tokens.token)('color.border.focused', '#8cf'), _styles17.placeholderTextStyles, _styles5.placeholderStyles, (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.codeBlockSyntaxHighlighting ? (0, _styles7.highlightingCodeBlockStyles)(props) : (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles16.textFormattingStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, _styles11.layoutStyles, _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles18.gridStyles, _styles19.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles20.extensionStyles, (0, _styles21.expandStyles)(props), _styles22.findReplaceStyles, _styles23.taskDecisionStyles, _styles24.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles25.smartCardStyles, _styles.smartCardSharedStyles, _styles26.dateStyles, _styled.embedCardStyles, _styles2.unsupportedStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
93
+ }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, (0, _tokens.token)('color.border.focused', '#8cf'), _styles17.placeholderTextStyles, _styles5.placeholderStyles, (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles16.textFormattingStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, _styles11.layoutStyles, _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles18.gridStyles, _styles19.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles20.extensionStyles, (0, _styles21.expandStyles)(props), _styles22.findReplaceStyles, _styles23.taskDecisionStyles, _styles24.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles25.smartCardStyles, _styles.smartCardSharedStyles, _styles26.dateStyles, _styled.embedCardStyles, _styles2.unsupportedStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
96
94
  };
97
95
 
98
96
  var createEditorContentStyle = function createEditorContentStyle(styles) {
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
+ var _react = require("react");
27
+
28
+ var _react2 = require("@emotion/react");
29
+
30
+ var _analyticsNext = require("@atlaskit/analytics-next");
31
+
32
+ var _Layer = _interopRequireDefault(require("../Layer"));
33
+
34
+ var _constants = require("@atlaskit/theme/constants");
35
+
36
+ var _colors = require("@atlaskit/theme/colors");
37
+
38
+ var _components = require("@atlaskit/theme/components");
39
+
40
+ var _tokens = require("@atlaskit/tokens");
41
+
42
+ var _templateObject, _templateObject2, _templateObject3;
43
+
44
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
45
+
46
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
+
48
+ var packageName = "@atlaskit/editor-core";
49
+ var packageVersion = "172.0.1";
50
+ var halfFocusRing = 1;
51
+ var dropOffset = "0, ".concat((0, _constants.gridSize)(), "px");
52
+
53
+ var DropList = /*#__PURE__*/function (_Component) {
54
+ (0, _inherits2.default)(DropList, _Component);
55
+
56
+ var _super = _createSuper(DropList);
57
+
58
+ function DropList() {
59
+ var _this;
60
+
61
+ (0, _classCallCheck2.default)(this, DropList);
62
+
63
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
64
+ args[_key] = arguments[_key];
65
+ }
66
+
67
+ _this = _super.call.apply(_super, [this].concat(args));
68
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "wrapperStyles", (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n transition-duration: 0.2s;\n transition: box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n "])), _this.props.shouldFitContainer ? 'display: block; flex: 1 1 auto;' : 'display: inline-flex;'));
69
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "triggerStyles", (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n transition-duration: 0.2s;\n transition: box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n ", "\n "])), _this.props.shouldFitContainer ? 'display: block; box-sizing: border-box;' : 'display: inline-flex;'));
70
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuWrapper", function (theme) {
71
+ return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: 0 ", "px ", "px -", "px ", ",\n 0 0 1px ", ";\n box-sizing: border-box;\n overflow: auto;\n padding: ", "px 0;\n max-height: 90vh;\n "])), (0, _components.themed)({
72
+ light: (0, _tokens.token)('color.text', _colors.N900),
73
+ dark: (0, _tokens.token)('color.text', _colors.DN600)
74
+ })(theme), (0, _components.themed)({
75
+ light: (0, _tokens.token)('elevation.surface.overlay', _colors.N0),
76
+ dark: (0, _tokens.token)('elevation.surface.overlay', _colors.DN50)
77
+ })(theme), (0, _constants.borderRadius)(), (0, _constants.gridSize)() / 2, (0, _constants.gridSize)(), (0, _constants.gridSize)() / 4, _colors.N50A, _colors.N60A, (0, _constants.gridSize)() / 2);
78
+ });
79
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidMount", function () {
80
+ _this.setContentWidth(); // We use a captured event here to avoid a radio or checkbox dropdown item firing its
81
+ // click event first, which would cause a re-render of the element and prevent DropList
82
+ // from detecting the actual source of this original click event.
83
+
84
+
85
+ document.addEventListener('click', _this.handleClickOutside, true);
86
+ document.addEventListener('keydown', _this.handleEsc);
87
+ });
88
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidUpdate", function () {
89
+ if (_this.props.isOpen) {
90
+ _this.setContentWidth();
91
+ }
92
+ });
93
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentWillUnmount", function () {
94
+ document.removeEventListener('click', _this.handleClickOutside, true);
95
+ document.removeEventListener('keydown', _this.handleEsc);
96
+ });
97
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setContentWidth", function () {
98
+ var _assertThisInitialize = (0, _assertThisInitialized2.default)(_this),
99
+ dropContentRef = _assertThisInitialize.dropContentRef,
100
+ triggerRef = _assertThisInitialize.triggerRef;
101
+
102
+ var shouldFitContainer = _this.props.shouldFitContainer; // We need to manually set the content width to match the trigger width
103
+
104
+ if (shouldFitContainer && dropContentRef && triggerRef) {
105
+ dropContentRef.style.width = "".concat(triggerRef.offsetWidth - halfFocusRing * 2, "px");
106
+ }
107
+ });
108
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEsc", function (event) {
109
+ if ((event.key === 'Escape' || event.key === 'Esc') && _this.props.isOpen) {
110
+ _this.close(event);
111
+ }
112
+ });
113
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClickOutside", function (event) {
114
+ if (_this.props.isOpen) {
115
+ if (event.target instanceof Node) {
116
+ // Rather than check for the target within the entire DropList, we specify the trigger/content.
117
+ // This aids with future effort in scroll-locking DropList when isMenuFixed is enabled; the scroll
118
+ // blanket which stretches to the viewport should not stop 'close' from being triggered.
119
+ var withinTrigger = _this.triggerRef && _this.triggerRef.contains(event.target);
120
+
121
+ var withinContent = _this.dropContentRef && _this.dropContentRef.contains(event.target);
122
+
123
+ if (!withinTrigger && !withinContent) {
124
+ _this.close(event);
125
+ }
126
+ }
127
+ }
128
+ });
129
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "close", function (event) {
130
+ if (_this.props.onOpenChange) {
131
+ _this.props.onOpenChange({
132
+ isOpen: false,
133
+ event: event
134
+ });
135
+ }
136
+ });
137
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleContentRef", function (ref) {
138
+ _this.dropContentRef = ref; // If the dropdown has just been opened, we focus on the containing element so the
139
+ // user can tab to the first dropdown item. We will only receive this ref if isOpen
140
+ // is true or null, so no need to check for truthiness here.
141
+
142
+ if (ref) {
143
+ ref.focus();
144
+ }
145
+ });
146
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTriggerRef", function (ref) {
147
+ _this.triggerRef = ref;
148
+ });
149
+ return _this;
150
+ }
151
+
152
+ (0, _createClass2.default)(DropList, [{
153
+ key: "getChildContext",
154
+ value: function getChildContext() {
155
+ return {
156
+ shouldAllowMultilineItems: false
157
+ };
158
+ }
159
+ }, {
160
+ key: "render",
161
+ value: function render() {
162
+ var _this2 = this;
163
+
164
+ var _this$props = this.props,
165
+ children = _this$props.children,
166
+ isOpen = _this$props.isOpen,
167
+ position = _this$props.position,
168
+ trigger = _this$props.trigger,
169
+ onPositioned = _this$props.onPositioned,
170
+ testId = _this$props.testId;
171
+ var layerContent = isOpen ? (0, _react2.jsx)("div", {
172
+ css: function css(theme) {
173
+ return _this2.menuWrapper({
174
+ theme: theme
175
+ });
176
+ },
177
+ "data-role": "droplistContent",
178
+ "data-testid": testId && "".concat(testId, "--content"),
179
+ ref: this.handleContentRef
180
+ }, children) : null;
181
+ return (0, _react2.jsx)("div", {
182
+ css: this.wrapperStyles
183
+ }, (0, _react2.jsx)(_Layer.default, {
184
+ content: layerContent,
185
+ offset: dropOffset,
186
+ position: position,
187
+ onPositioned: onPositioned
188
+ }, (0, _react2.jsx)("div", {
189
+ css: this.triggerStyles,
190
+ ref: this.handleTriggerRef
191
+ }, trigger)));
192
+ }
193
+ }]);
194
+ return DropList;
195
+ }(_react.Component);
196
+
197
+ var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
198
+
199
+ var _default = (0, _analyticsNext.withAnalyticsContext)({
200
+ componentName: 'droplist',
201
+ packageName: packageName,
202
+ packageVersion: packageVersion
203
+ })((0, _analyticsNext.withAnalyticsEvents)({
204
+ onOpenChange: createAndFireEventOnAtlaskit({
205
+ action: 'toggled',
206
+ actionSubject: 'droplist',
207
+ attributes: {
208
+ componentName: 'droplist',
209
+ packageName: packageName,
210
+ packageVersion: packageVersion
211
+ }
212
+ })
213
+ })(DropList));
214
+
215
+ exports.default = _default;
@@ -25,7 +25,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
25
25
 
26
26
  var _react = _interopRequireWildcard(require("react"));
27
27
 
28
- var _droplist = _interopRequireDefault(require("@atlaskit/droplist"));
28
+ var _DropList = _interopRequireDefault(require("../DropList"));
29
29
 
30
30
  var _ui = require("@atlaskit/editor-common/ui");
31
31
 
@@ -100,13 +100,10 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
100
100
  height: 0,
101
101
  minWidth: fitWidth || 0
102
102
  }
103
- }, /*#__PURE__*/_react.default.createElement(_droplist.default, {
104
- disabled: true,
103
+ }, /*#__PURE__*/_react.default.createElement(_DropList.default, {
105
104
  isOpen: true,
106
105
  onOpenChange: onOpenChange,
107
- appearance: "tall",
108
106
  position: popupPlacement.join(' '),
109
- shouldFlip: false,
110
107
  shouldFitContainer: true
111
108
  }, children)));
112
109
  }