@atlaskit/editor-core 171.0.1 → 172.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/codemods/172.0.0-transform-smartlinks-prop.ts +8 -0
  3. package/codemods/__tests__/rename-smartlinks-prop.ts +204 -0
  4. package/codemods/migrates/rename-smartlinks-prop.ts +56 -0
  5. package/dist/cjs/create-editor/ReactEditorView.js +13 -4
  6. package/dist/cjs/create-editor/create-plugins-list.js +21 -12
  7. package/dist/cjs/editor.js +8 -23
  8. package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +6 -1
  9. package/dist/cjs/labs/next/presets/default.js +1 -1
  10. package/dist/cjs/nodeviews/context-adapter.js +2 -2
  11. package/dist/cjs/plugins/analytics/plugin.js +24 -11
  12. package/dist/cjs/plugins/base/index.js +3 -3
  13. package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +84 -0
  14. package/dist/cjs/plugins/card/index.js +1 -1
  15. package/dist/cjs/plugins/card/toolbar.js +11 -5
  16. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +5 -1
  17. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  18. package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -2
  19. package/dist/cjs/plugins/code-block/actions.js +13 -0
  20. package/dist/cjs/plugins/code-block/index.js +7 -0
  21. package/dist/cjs/plugins/code-block/nodeviews/code-block.js +2 -4
  22. package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +132 -0
  23. package/dist/cjs/plugins/code-block/pm-plugins/main.js +1 -23
  24. package/dist/cjs/plugins/code-block/styles.js +3 -36
  25. package/dist/cjs/plugins/code-block/toolbar.js +9 -0
  26. package/dist/cjs/plugins/code-block/ui/class-names.js +1 -2
  27. package/dist/cjs/plugins/copy-button/commands.js +40 -20
  28. package/dist/cjs/plugins/copy-button/toolbar.js +51 -0
  29. package/dist/cjs/plugins/copy-button/utils.js +16 -38
  30. package/dist/cjs/plugins/expand/toolbar.js +8 -2
  31. package/dist/cjs/plugins/extension/toolbar.js +5 -1
  32. package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  33. package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  34. package/dist/cjs/plugins/extension/ui/Extension/styles.js +2 -4
  35. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +29 -18
  36. package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
  37. package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -20
  38. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +7 -32
  39. package/dist/cjs/plugins/hyperlink/Toolbar.js +146 -135
  40. package/dist/cjs/plugins/hyperlink/index.js +4 -4
  41. package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +50 -0
  42. package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +38 -0
  43. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -5
  44. package/dist/cjs/plugins/indentation/commands/index.js +35 -7
  45. package/dist/cjs/plugins/indentation/commands/utils.js +11 -7
  46. package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -3
  47. package/dist/cjs/plugins/layout/toolbar.js +3 -1
  48. package/dist/cjs/plugins/media/toolbar/index.js +13 -5
  49. package/dist/cjs/plugins/mentions/analytics.js +5 -5
  50. package/dist/cjs/plugins/panel/toolbar.js +3 -3
  51. package/dist/cjs/plugins/paste/edge-cases/index.js +16 -3
  52. package/dist/cjs/plugins/paste/handlers.js +25 -2
  53. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +16 -3
  54. package/dist/cjs/plugins/paste/pm-plugins/main.js +22 -3
  55. package/dist/cjs/plugins/status/analytics.js +3 -3
  56. package/dist/cjs/plugins/table/toolbar.js +2 -2
  57. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
  58. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
  59. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
  60. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
  61. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
  62. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  63. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
  64. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
  65. package/dist/cjs/types/browser.js +6 -0
  66. package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
  67. package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
  68. package/dist/cjs/ui/ContentStyles/index.js +1 -3
  69. package/dist/cjs/ui/DropList/index.js +215 -0
  70. package/dist/cjs/ui/Dropdown/index.js +2 -5
  71. package/dist/cjs/ui/DropdownMenu/index.js +140 -86
  72. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
  73. package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
  74. package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
  75. package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
  76. package/dist/cjs/ui/Layer/index.js +245 -0
  77. package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
  78. package/dist/cjs/ui/PortalProvider/index.js +7 -26
  79. package/dist/cjs/version-wrapper.js +1 -1
  80. package/dist/cjs/version.json +1 -1
  81. package/dist/es2019/create-editor/ReactEditorView.js +15 -4
  82. package/dist/es2019/create-editor/create-plugins-list.js +21 -11
  83. package/dist/es2019/editor.js +9 -23
  84. package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
  85. package/dist/es2019/labs/next/presets/default.js +1 -1
  86. package/dist/es2019/nodeviews/context-adapter.js +2 -2
  87. package/dist/es2019/plugins/analytics/plugin.js +19 -4
  88. package/dist/es2019/plugins/base/index.js +3 -3
  89. package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
  90. package/dist/es2019/plugins/card/index.js +1 -1
  91. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
  92. package/dist/es2019/plugins/card/toolbar.js +10 -5
  93. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
  94. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  95. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
  96. package/dist/es2019/plugins/code-block/actions.js +12 -0
  97. package/dist/es2019/plugins/code-block/index.js +4 -0
  98. package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
  99. package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
  100. package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
  101. package/dist/es2019/plugins/code-block/styles.js +2 -159
  102. package/dist/es2019/plugins/code-block/toolbar.js +8 -0
  103. package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
  104. package/dist/es2019/plugins/copy-button/commands.js +35 -15
  105. package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
  106. package/dist/es2019/plugins/copy-button/utils.js +15 -27
  107. package/dist/es2019/plugins/expand/toolbar.js +4 -1
  108. package/dist/es2019/plugins/extension/toolbar.js +4 -1
  109. package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  110. package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  111. package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
  112. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
  113. package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
  114. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
  115. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
  116. package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
  117. package/dist/es2019/plugins/hyperlink/index.js +4 -4
  118. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
  119. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
  120. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
  121. package/dist/es2019/plugins/indentation/commands/index.js +24 -9
  122. package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
  123. package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
  124. package/dist/es2019/plugins/layout/toolbar.js +2 -1
  125. package/dist/es2019/plugins/media/toolbar/index.js +10 -3
  126. package/dist/es2019/plugins/mentions/analytics.js +1 -1
  127. package/dist/es2019/plugins/panel/toolbar.js +1 -1
  128. package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
  129. package/dist/es2019/plugins/paste/handlers.js +27 -2
  130. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
  131. package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
  132. package/dist/es2019/plugins/status/analytics.js +1 -1
  133. package/dist/es2019/plugins/table/toolbar.js +1 -1
  134. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
  135. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
  136. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
  137. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
  138. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
  139. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  140. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
  141. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
  142. package/dist/es2019/types/browser.js +2 -0
  143. package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
  144. package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
  145. package/dist/es2019/ui/ContentStyles/index.js +5 -9
  146. package/dist/es2019/ui/DropList/index.js +186 -0
  147. package/dist/es2019/ui/Dropdown/index.js +2 -6
  148. package/dist/es2019/ui/DropdownMenu/index.js +124 -75
  149. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
  150. package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
  151. package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
  152. package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
  153. package/dist/es2019/ui/Layer/index.js +195 -0
  154. package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
  155. package/dist/es2019/ui/PortalProvider/index.js +5 -23
  156. package/dist/es2019/version-wrapper.js +1 -1
  157. package/dist/es2019/version.json +1 -1
  158. package/dist/esm/create-editor/ReactEditorView.js +13 -4
  159. package/dist/esm/create-editor/create-plugins-list.js +21 -12
  160. package/dist/esm/editor.js +9 -23
  161. package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
  162. package/dist/esm/labs/next/presets/default.js +1 -1
  163. package/dist/esm/nodeviews/context-adapter.js +2 -2
  164. package/dist/esm/plugins/analytics/plugin.js +24 -11
  165. package/dist/esm/plugins/base/index.js +3 -3
  166. package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
  167. package/dist/esm/plugins/card/index.js +1 -1
  168. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
  169. package/dist/esm/plugins/card/toolbar.js +11 -5
  170. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
  171. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
  172. package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
  173. package/dist/esm/plugins/code-block/actions.js +12 -0
  174. package/dist/esm/plugins/code-block/index.js +6 -0
  175. package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
  176. package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
  177. package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
  178. package/dist/esm/plugins/code-block/styles.js +4 -32
  179. package/dist/esm/plugins/code-block/toolbar.js +8 -0
  180. package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
  181. package/dist/esm/plugins/copy-button/commands.js +35 -15
  182. package/dist/esm/plugins/copy-button/toolbar.js +31 -0
  183. package/dist/esm/plugins/copy-button/utils.js +14 -29
  184. package/dist/esm/plugins/expand/toolbar.js +6 -2
  185. package/dist/esm/plugins/extension/toolbar.js +4 -1
  186. package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
  187. package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
  188. package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
  189. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
  190. package/dist/esm/plugins/feedback-dialog/index.js +1 -1
  191. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
  192. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
  193. package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
  194. package/dist/esm/plugins/hyperlink/index.js +4 -4
  195. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
  196. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
  197. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
  198. package/dist/esm/plugins/indentation/commands/index.js +30 -9
  199. package/dist/esm/plugins/indentation/commands/utils.js +12 -8
  200. package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
  201. package/dist/esm/plugins/layout/toolbar.js +2 -1
  202. package/dist/esm/plugins/media/toolbar/index.js +12 -5
  203. package/dist/esm/plugins/mentions/analytics.js +1 -1
  204. package/dist/esm/plugins/panel/toolbar.js +1 -1
  205. package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
  206. package/dist/esm/plugins/paste/handlers.js +23 -2
  207. package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
  208. package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
  209. package/dist/esm/plugins/status/analytics.js +1 -1
  210. package/dist/esm/plugins/table/toolbar.js +1 -1
  211. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
  212. package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
  213. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
  214. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
  215. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
  216. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
  217. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
  218. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
  219. package/dist/esm/types/browser.js +2 -0
  220. package/dist/esm/ui/Addon/click-area-helper.js +37 -18
  221. package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
  222. package/dist/esm/ui/ContentStyles/index.js +2 -4
  223. package/dist/esm/ui/DropList/index.js +203 -0
  224. package/dist/esm/ui/Dropdown/index.js +2 -6
  225. package/dist/esm/ui/DropdownMenu/index.js +134 -88
  226. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
  227. package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
  228. package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
  229. package/dist/esm/ui/ElementBrowser/constants.js +1 -4
  230. package/dist/esm/ui/Layer/index.js +228 -0
  231. package/dist/esm/ui/Layer/internal/helpers.js +62 -0
  232. package/dist/esm/ui/PortalProvider/index.js +7 -26
  233. package/dist/esm/version-wrapper.js +1 -1
  234. package/dist/esm/version.json +1 -1
  235. package/dist/types/labs/next/presets/default.d.ts +2 -0
  236. package/dist/types/plugins/analytics/plugin.d.ts +5 -1
  237. package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
  238. package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
  239. package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
  240. package/dist/types/plugins/base/index.d.ts +1 -1
  241. package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
  242. package/dist/types/plugins/card/index.d.ts +2 -7
  243. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
  244. package/dist/types/plugins/card/toolbar.d.ts +3 -5
  245. package/dist/types/plugins/card/types.d.ts +2 -0
  246. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
  247. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
  248. package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
  249. package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
  250. package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
  251. package/dist/types/plugins/code-block/styles.d.ts +0 -1
  252. package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
  253. package/dist/types/plugins/copy-button/commands.d.ts +2 -2
  254. package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
  255. package/dist/types/plugins/copy-button/utils.d.ts +7 -6
  256. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
  257. package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
  258. package/dist/types/plugins/hyperlink/index.d.ts +2 -2
  259. package/dist/types/plugins/hyperlink/types.d.ts +30 -0
  260. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
  261. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
  262. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
  263. package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
  264. package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
  265. package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
  266. package/dist/types/plugins/paste/handlers.d.ts +1 -0
  267. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
  268. package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
  269. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
  270. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
  271. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
  272. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  273. package/dist/types/types/browser.d.ts +10 -0
  274. package/dist/types/types/editor-props.d.ts +6 -5
  275. package/dist/types/types/feature-flags.d.ts +29 -24
  276. package/dist/types/types/index.d.ts +1 -0
  277. package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
  278. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  279. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  280. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  281. package/dist/types/ui/DropList/index.d.ts +22 -0
  282. package/dist/types/ui/Dropdown/index.d.ts +2 -1
  283. package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
  284. package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
  285. package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
  286. package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
  287. package/dist/types/ui/Layer/index.d.ts +47 -0
  288. package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
  289. package/package.json +23 -18
  290. package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
  291. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
  292. package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
  293. package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
  294. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
  295. package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
  296. package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
  297. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
  298. package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
  299. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
  300. package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
@@ -74,9 +74,18 @@ function createPlugin(options) {
74
74
  // that has an analytics event.
75
75
  if (hasRequiredPerformanceAPIs && tr.docChanged && payload.action !== _types.ACTION.INSERTED && payload.action !== _types.ACTION.DELETED) {
76
76
  var measureName = "".concat(payload.actionSubject, ":").concat(payload.action, ":").concat(payload.actionSubjectId);
77
- (0, _utils.measureRender)(measureName, function (duration) {
77
+ (0, _utils.measureRender)( // NOTE this name could be resulting in misleading data -- where if multiple payloads are
78
+ // received before a render completes -- the measurement value will be inaccurate (this is
79
+ // due to measureRender requiring unique measureNames)
80
+ measureName, function (_ref) {
81
+ var duration = _ref.duration,
82
+ distortedDuration = _ref.distortedDuration;
78
83
  (0, _fireAnalyticsEvent.fireAnalyticsEvent)(pluginState.createAnalyticsEvent)({
79
- payload: extendPayload(payload, duration),
84
+ payload: extendPayload({
85
+ payload: payload,
86
+ duration: duration,
87
+ distortedDuration: distortedDuration
88
+ }),
80
89
  channel: channel
81
90
  });
82
91
  });
@@ -111,10 +120,10 @@ var analyticsPlugin = function analyticsPlugin(options) {
111
120
  }
112
121
  }];
113
122
  },
114
- onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref) {
115
- var originalTransaction = _ref.originalTransaction,
116
- transactions = _ref.transactions,
117
- newEditorState = _ref.newEditorState;
123
+ onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref2) {
124
+ var originalTransaction = _ref2.originalTransaction,
125
+ transactions = _ref2.transactions,
126
+ newEditorState = _ref2.newEditorState;
118
127
 
119
128
  var pluginState = _pluginKey.analyticsPluginKey.getState(newEditorState);
120
129
 
@@ -140,9 +149,9 @@ var analyticsPlugin = function analyticsPlugin(options) {
140
149
 
141
150
  var createAnalyticsEvent = pluginState.createAnalyticsEvent;
142
151
  var undoAnaltyicsEventTransformer = (0, _undoRedoInputSource.generateUndoRedoInputSoucePayload)(originalTransaction);
143
- steps.forEach(function (_ref2) {
144
- var payload = _ref2.payload,
145
- channel = _ref2.channel;
152
+ steps.forEach(function (_ref3) {
153
+ var payload = _ref3.payload,
154
+ channel = _ref3.channel;
146
155
  var nextPayload = undoAnaltyicsEventTransformer(payload);
147
156
  (0, _fireAnalyticsEvent.fireAnalyticsEvent)(createAnalyticsEvent)({
148
157
  payload: nextPayload,
@@ -153,10 +162,14 @@ var analyticsPlugin = function analyticsPlugin(options) {
153
162
  };
154
163
  };
155
164
 
156
- function extendPayload(payload, duration) {
165
+ function extendPayload(_ref4) {
166
+ var payload = _ref4.payload,
167
+ duration = _ref4.duration,
168
+ distortedDuration = _ref4.distortedDuration;
157
169
  return _objectSpread(_objectSpread({}, payload), {}, {
158
170
  attributes: _objectSpread(_objectSpread({}, payload.attributes), {}, {
159
- duration: duration
171
+ duration: duration,
172
+ distortedDuration: distortedDuration
160
173
  }),
161
174
  eventType: _types.EVENT_TYPE.OPERATIONAL
162
175
  });
@@ -23,7 +23,7 @@ var _focusHandler = _interopRequireDefault(require("./pm-plugins/focus-handler")
23
23
 
24
24
  var _fixChrome88Selection = _interopRequireDefault(require("./pm-plugins/fix-chrome-88-selection"));
25
25
 
26
- var _fixChromeSpellChecking = _interopRequireDefault(require("./pm-plugins/fix-chrome-spell-checking"));
26
+ var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable-spell-checking"));
27
27
 
28
28
  var _contextIdentifier = _interopRequireDefault(require("./pm-plugins/context-identifier"));
29
29
 
@@ -156,9 +156,9 @@ var basePlugin = function basePlugin(options) {
156
156
  }
157
157
 
158
158
  plugins.push({
159
- name: 'fixChromeSpellCheckingPlugin',
159
+ name: 'disableSpellcheckingPlugin',
160
160
  plugin: function plugin() {
161
- return (0, _fixChromeSpellChecking.default)();
161
+ return (0, _disableSpellChecking.default)();
162
162
  }
163
163
  });
164
164
  return plugins;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
+
10
+ var _prosemirrorState = require("prosemirror-state");
11
+
12
+ var _featureFlagsContext = require("../../feature-flags-context");
13
+
14
+ var _utils = require("@atlaskit/editor-common/utils");
15
+
16
+ function getCurrentBrowserAndVersion() {
17
+ switch (true) {
18
+ case _utils.browser.chrome === true:
19
+ return {
20
+ browser: 'chrome',
21
+ version: _utils.browser.chrome_version
22
+ };
23
+
24
+ case _utils.browser.ie === true:
25
+ return {
26
+ browser: 'ie',
27
+ version: _utils.browser.ie_version
28
+ };
29
+
30
+ case _utils.browser.gecko === true:
31
+ return {
32
+ browser: 'gecko',
33
+ version: _utils.browser.gecko_version
34
+ };
35
+
36
+ case _utils.browser.safari === true:
37
+ return {
38
+ browser: 'safari',
39
+ version: _utils.browser.safari_version
40
+ };
41
+ }
42
+
43
+ return undefined;
44
+ }
45
+
46
+ var _default = function _default() {
47
+ return new _safePlugin.SafePlugin({
48
+ key: new _prosemirrorState.PluginKey('disableSpellchecking'),
49
+ props: {
50
+ attributes: function attributes(editorState) {
51
+ var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(editorState) || undefined;
52
+
53
+ if (!featureFlags) {
54
+ return;
55
+ }
56
+
57
+ var browserConfigFeatureFlag = featureFlags.disableSpellcheckByBrowser;
58
+ var userCurrentBrowserAndVersion = getCurrentBrowserAndVersion();
59
+
60
+ if (!userCurrentBrowserAndVersion || !browserConfigFeatureFlag) {
61
+ return;
62
+ }
63
+
64
+ var browserVersionDisableRange = browserConfigFeatureFlag[userCurrentBrowserAndVersion.browser];
65
+
66
+ if (!browserVersionDisableRange || !_utils.browser[userCurrentBrowserAndVersion.browser]) {
67
+ return;
68
+ }
69
+
70
+ var shouldDisableSpellcheck = !!browserVersionDisableRange.maximum ? userCurrentBrowserAndVersion.version >= browserVersionDisableRange.minimum && userCurrentBrowserAndVersion.version <= browserVersionDisableRange.maximum : _utils.browser[userCurrentBrowserAndVersion.browser] && userCurrentBrowserAndVersion.version >= browserVersionDisableRange.minimum;
71
+
72
+ if (shouldDisableSpellcheck) {
73
+ return {
74
+ spellcheck: 'false'
75
+ };
76
+ }
77
+
78
+ return;
79
+ }
80
+ }
81
+ });
82
+ };
83
+
84
+ exports.default = _default;
@@ -76,7 +76,7 @@ var cardPlugin = function cardPlugin(options) {
76
76
  });
77
77
  },
78
78
  pluginsOptions: {
79
- floatingToolbar: (0, _toolbar.floatingToolbar)(options, options.platform)
79
+ floatingToolbar: (0, _toolbar.floatingToolbar)(options, options.platform, options.linkPicker)
80
80
  }
81
81
  };
82
82
  };
@@ -53,6 +53,8 @@ var _linkingUtils = require("../../utils/linking-utils");
53
53
 
54
54
  var _styles2 = require("./styles");
55
55
 
56
+ var _toolbar = require("../copy-button/toolbar");
57
+
56
58
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
57
59
 
58
60
  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; }
@@ -141,6 +143,9 @@ var generateDeleteButton = function generateDeleteButton(node, state, intl) {
141
143
  title: intl.formatMessage(_messages.default.remove),
142
144
  onClick: removeCard
143
145
  };
146
+ var copyButton = (0, _toConsumableArray2.default)(state && (0, _toolbar.showCopyButton)(state) ? [(0, _toolbar.getCopyButtonConfig)(state, intl.formatMessage, node.type), {
147
+ type: 'separator'
148
+ }] : []);
144
149
 
145
150
  if (node.type === inlineCard) {
146
151
  var unlinkButtonWithSeparator = [{
@@ -152,13 +157,13 @@ var generateDeleteButton = function generateDeleteButton(node, state, intl) {
152
157
  }, {
153
158
  type: 'separator'
154
159
  }];
155
- return [].concat(unlinkButtonWithSeparator, [removeButton]);
160
+ return [].concat(unlinkButtonWithSeparator, (0, _toConsumableArray2.default)(copyButton), [removeButton]);
156
161
  }
157
162
 
158
- return [removeButton];
163
+ return [].concat((0, _toConsumableArray2.default)(copyButton), [removeButton]);
159
164
  };
160
165
 
161
- var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, platform) {
166
+ var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, platform, linkPicker) {
162
167
  return function (node) {
163
168
  var _titleUrlPairFromNode2 = (0, _utils.titleUrlPairFromNode)(node),
164
169
  url = _titleUrlPairFromNode2.url;
@@ -185,6 +190,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
185
190
  if (pluginState.showLinkingToolbar && platform !== 'mobile') {
186
191
  return [(0, _EditLinkToolbar.buildEditLinkToolbar)({
187
192
  providerFactory: providerFactory,
193
+ linkPicker: linkPicker,
188
194
  node: node
189
195
  })];
190
196
  } else {
@@ -252,7 +258,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
252
258
  };
253
259
  };
254
260
 
255
- var floatingToolbar = function floatingToolbar(cardOptions, platform) {
261
+ var floatingToolbar = function floatingToolbar(cardOptions, platform, linkPickerOptions) {
256
262
  return function (state, intl, providerFactory) {
257
263
  var _state$schema$nodes = state.schema.nodes,
258
264
  inlineCard = _state$schema$nodes.inlineCard,
@@ -298,7 +304,7 @@ var floatingToolbar = function floatingToolbar(cardOptions, platform) {
298
304
 
299
305
  return element;
300
306
  },
301
- items: generateToolbarItems(state, intl, providerFactory, cardOptions, platform)
307
+ items: generateToolbarItems(state, intl, providerFactory, cardOptions, platform, linkPickerOptions)
302
308
  }, pluginState.showLinkingToolbar ? _EditLinkToolbar.editLinkToolbarConfig : {});
303
309
  };
304
310
  };
@@ -73,6 +73,7 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
73
73
  var _this = this;
74
74
 
75
75
  var _this$props = this.props,
76
+ linkPickerOptions = _this$props.linkPickerOptions,
76
77
  providerFactory = _this$props.providerFactory,
77
78
  url = _this$props.url,
78
79
  text = _this$props.text,
@@ -80,6 +81,7 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
80
81
  _onSubmit = _this$props.onSubmit;
81
82
  return /*#__PURE__*/_react.default.createElement(_HyperlinkAddToolbar.default, {
82
83
  view: view,
84
+ linkPickerOptions: linkPickerOptions,
83
85
  providerFactory: providerFactory,
84
86
  displayUrl: url,
85
87
  displayText: text,
@@ -117,7 +119,8 @@ exports.editLink = editLink;
117
119
 
118
120
  var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
119
121
  var providerFactory = _ref.providerFactory,
120
- node = _ref.node;
122
+ node = _ref.node,
123
+ linkPicker = _ref.linkPicker;
121
124
  return {
122
125
  type: 'custom',
123
126
  fallback: [],
@@ -130,6 +133,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
130
133
  return /*#__PURE__*/_react.default.createElement(EditLinkToolbar, {
131
134
  key: idx,
132
135
  view: view,
136
+ linkPickerOptions: linkPicker,
133
137
  providerFactory: providerFactory,
134
138
  url: displayInfo.url,
135
139
  text: displayInfo.title || '',
@@ -86,8 +86,8 @@ var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
86
86
  }
87
87
  }
88
88
 
89
- var isSmartLinkSupportedInParent = (0, _nodes.isSupportedInParent)(editorState, _prosemirrorModel.Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
90
- var tooltip = isSmartLinkSupportedInParent ? undefined : parentNodeName(editorState, intl);
89
+ var isBlockCardLinkSupportedInParent = (0, _nodes.isSupportedInParent)(editorState, _prosemirrorModel.Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
90
+ var isEmbedCardLinkSupportedInParent = allowEmbeds ? (0, _nodes.isSupportedInParent)(editorState, _prosemirrorModel.Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance) : false;
91
91
  var embedOption = allowEmbeds && preview && {
92
92
  appearance: 'embed',
93
93
  title: intl.formatMessage(_messages.messages.embed),
@@ -95,8 +95,8 @@ var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
95
95
  selected: currentAppearance === 'embed',
96
96
  hidden: false,
97
97
  testId: 'embed-appearance',
98
- disabled: !isSmartLinkSupportedInParent,
99
- tooltip: tooltip
98
+ disabled: !isEmbedCardLinkSupportedInParent,
99
+ tooltip: isEmbedCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
100
100
  };
101
101
  var options = [{
102
102
  title: intl.formatMessage(_messages.messages.url),
@@ -117,8 +117,8 @@ var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
117
117
  onClick: (0, _doc.setSelectedCardAppearance)('block'),
118
118
  selected: currentAppearance === 'block',
119
119
  testId: 'block-appearance',
120
- disabled: !isSmartLinkSupportedInParent,
121
- tooltip: tooltip
120
+ disabled: !isBlockCardLinkSupportedInParent,
121
+ tooltip: isBlockCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
122
122
  }];
123
123
 
124
124
  var dispatchCommand = function dispatchCommand(fn) {
@@ -185,7 +185,7 @@ exports.LinkToolbarAppearance = LinkToolbarAppearance;
185
185
  contextAdapter: _propTypes.default.object
186
186
  });
187
187
 
188
- var parentNodeName = function parentNodeName(state, intl) {
188
+ var getUnavailableMessage = function getUnavailableMessage(state, intl) {
189
189
  try {
190
190
  var parentNode = state.selection.$from.node(1);
191
191
  var parentName = intl.formatMessage(_messages2.default[parentNode.type.name]);
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.sendClipboardAnalytics = exports.createPlugin = exports.createClipboardSerializer = void 0;
8
+ exports.sendClipboardAnalytics = exports.getAnalyticsPayload = exports.createPlugin = exports.createClipboardSerializer = void 0;
9
9
 
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
 
@@ -199,4 +199,6 @@ var getAnalyticsPayload = function getAnalyticsPayload(state, action) {
199
199
  }
200
200
  };
201
201
  }
202
- };
202
+ };
203
+
204
+ exports.getAnalyticsPayload = getAnalyticsPayload;
@@ -11,6 +11,8 @@ var _prosemirrorState = require("prosemirror-state");
11
11
 
12
12
  var _pluginKey = require("./plugin-key");
13
13
 
14
+ var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
15
+
14
16
  var _actions = require("./pm-plugins/actions");
15
17
 
16
18
  var _clipboard = require("../../utils/clipboard");
@@ -87,6 +89,7 @@ var copyContentToClipboard = function copyContentToClipboard(state, dispatch) {
87
89
  type: _actions.ACTIONS.SET_COPIED_TO_CLIPBOARD,
88
90
  data: true
89
91
  });
92
+ copyToClipboardTr.setMeta(_codeBlockCopySelectionPlugin.copySelectionPluginKey, 'remove-selection');
90
93
 
91
94
  if (dispatch) {
92
95
  dispatch(copyToClipboardTr);
@@ -110,10 +113,20 @@ var resetCopiedState = function resetCopiedState(state, dispatch) {
110
113
  type: _actions.ACTIONS.SET_COPIED_TO_CLIPBOARD,
111
114
  data: false
112
115
  });
116
+ resetCopiedStateTr.setMeta(_codeBlockCopySelectionPlugin.copySelectionPluginKey, 'remove-selection');
113
117
 
114
118
  if (dispatch) {
115
119
  dispatch(resetCopiedStateTr);
116
120
  }
121
+ } else {
122
+ var clearSelectionStateTransaction = state.tr;
123
+ clearSelectionStateTransaction.setMeta(_codeBlockCopySelectionPlugin.copySelectionPluginKey, 'remove-selection'); // note: dispatch should always be defined when called from the
124
+ // floating toolbar. Howver the Command type which floating toolbar uses
125
+ // (and resetCopiedState) uses suggests it's optional.
126
+
127
+ if (dispatch) {
128
+ dispatch(clearSelectionStateTransaction);
129
+ }
117
130
  }
118
131
 
119
132
  return true;
@@ -21,6 +21,8 @@ var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
21
21
 
22
22
  var _ideUx = _interopRequireDefault(require("./pm-plugins/ide-ux"));
23
23
 
24
+ var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
25
+
24
26
  var _analytics = require("../analytics");
25
27
 
26
28
  var _assets = require("../quick-insert/assets");
@@ -63,6 +65,11 @@ var codeBlockPlugin = function codeBlockPlugin(options) {
63
65
  var schema = _ref2.schema;
64
66
  return (0, _keymaps.default)(schema);
65
67
  }
68
+ }, {
69
+ name: 'codeBlockCopySelection',
70
+ plugin: function plugin() {
71
+ return (0, _codeBlockCopySelectionPlugin.codeBlockCopySelectionPlugin)();
72
+ }
66
73
  }];
67
74
  },
68
75
  // Workaround for a firefox issue where dom selection is off sync
@@ -173,10 +173,8 @@ var CodeBlockView = /*#__PURE__*/function () {
173
173
 
174
174
  exports.CodeBlockView = CodeBlockView;
175
175
 
176
- var codeBlockNodeView = function codeBlockNodeView() {
177
- return function (node, view, getPos) {
178
- return new CodeBlockView(node, view, getPos);
179
- };
176
+ var codeBlockNodeView = function codeBlockNodeView(node, view, getPos) {
177
+ return new CodeBlockView(node, view, getPos);
180
178
  };
181
179
 
182
180
  exports.codeBlockNodeView = codeBlockNodeView;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.codeBlockCopySelectionPlugin = codeBlockCopySelectionPlugin;
9
+ exports.copySelectionPluginKey = void 0;
10
+ exports.provideVisualFeedbackForCopyButton = provideVisualFeedbackForCopyButton;
11
+ exports.removeVisualFeedbackForCopyButton = removeVisualFeedbackForCopyButton;
12
+
13
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
+
15
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
16
+
17
+ var _prosemirrorState = require("prosemirror-state");
18
+
19
+ var _prosemirrorView = require("prosemirror-view");
20
+
21
+ var _utils = require("../../copy-button/utils");
22
+
23
+ var copySelectionPluginKey = new _prosemirrorState.PluginKey('codeBlockCopySelectionPlugin');
24
+ exports.copySelectionPluginKey = copySelectionPluginKey;
25
+
26
+ function getSelectionDecorationStartAndEnd(_ref) {
27
+ var state = _ref.state,
28
+ transaction = _ref.transaction;
29
+ var codeBlockNode = (0, _utils.getSelectedNodeOrNodeParentByNodeType)({
30
+ nodeType: state.schema.nodes.codeBlock,
31
+ selection: transaction.selection
32
+ });
33
+
34
+ if (!codeBlockNode) {
35
+ return {
36
+ decorationStartAndEnd: undefined
37
+ };
38
+ }
39
+
40
+ var decorationStartAndEnd = [codeBlockNode.start, codeBlockNode.start + codeBlockNode.node.nodeSize];
41
+ return {
42
+ decorationStartAndEnd: decorationStartAndEnd
43
+ };
44
+ }
45
+
46
+ function codeBlockCopySelectionPlugin() {
47
+ return new _safePlugin.SafePlugin({
48
+ key: copySelectionPluginKey,
49
+ state: {
50
+ init: function init() {
51
+ return {
52
+ decorationStartAndEnd: undefined
53
+ };
54
+ },
55
+ apply: function apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
56
+ switch (transaction.getMeta(copySelectionPluginKey)) {
57
+ case 'show-selection':
58
+ {
59
+ return getSelectionDecorationStartAndEnd({
60
+ state: newState,
61
+ transaction: transaction
62
+ });
63
+ }
64
+
65
+ case 'remove-selection':
66
+ return {
67
+ decorationStartAndEnd: undefined
68
+ };
69
+
70
+ default:
71
+ // The contents of the code block can change while the selection is being shown
72
+ // (either from collab edits -- or from the user continuing to type while hovering
73
+ // the mouse over the copy button).
74
+ // This ensures the selection is updated in these cases.
75
+ if (currentCodeBlockCopySelectionPluginState.decorationStartAndEnd !== undefined) {
76
+ return getSelectionDecorationStartAndEnd({
77
+ state: newState,
78
+ transaction: transaction
79
+ });
80
+ }
81
+
82
+ return currentCodeBlockCopySelectionPluginState;
83
+ }
84
+ }
85
+ },
86
+ props: {
87
+ decorations: function decorations(state) {
88
+ if (copySelectionPluginKey.getState(state).decorationStartAndEnd) {
89
+ var _copySelectionPluginK = (0, _slicedToArray2.default)(copySelectionPluginKey.getState(state).decorationStartAndEnd, 2),
90
+ _start = _copySelectionPluginK[0],
91
+ _end = _copySelectionPluginK[1];
92
+
93
+ return _prosemirrorView.DecorationSet.create(state.doc, [_prosemirrorView.Decoration.inline(_start, _end, {
94
+ class: 'ProseMirror-fake-text-selection'
95
+ })]);
96
+ }
97
+
98
+ return _prosemirrorView.DecorationSet.empty;
99
+ }
100
+ }
101
+ });
102
+ }
103
+
104
+ function provideVisualFeedbackForCopyButton(state, dispatch) {
105
+ var tr = state.tr;
106
+ tr.setMeta(copySelectionPluginKey, 'show-selection'); // note: dispatch should always be defined when called from the
107
+ // floating toolbar. Howver the Command type which the floating toolbar
108
+ // uses suggests it's optional.
109
+ // Using the type here to protect against future refactors of the
110
+ // floating toolbar
111
+
112
+ if (dispatch) {
113
+ dispatch(tr);
114
+ }
115
+
116
+ return false;
117
+ }
118
+
119
+ function removeVisualFeedbackForCopyButton(state, dispatch) {
120
+ var tr = state.tr;
121
+ tr.setMeta(copySelectionPluginKey, 'remove-selection'); // note: dispatch should always be defined when called from the
122
+ // floating toolbar. Howver the Command type which the floating toolbar
123
+ // uses suggests it's optional.
124
+ // Using the type here to protect against future refactors of the
125
+ // floating toolbar
126
+
127
+ if (dispatch) {
128
+ dispatch(tr);
129
+ }
130
+
131
+ return false;
132
+ }
@@ -15,12 +15,8 @@ var _utils = require("@atlaskit/editor-common/utils");
15
15
 
16
16
  var _prosemirrorState = require("prosemirror-state");
17
17
 
18
- var _messages = require("@atlaskit/editor-common/messages");
19
-
20
18
  var _codeBlock = require("../nodeviews/code-block");
21
19
 
22
- var _highlightingCodeBlock = require("../nodeviews/highlighting-code-block");
23
-
24
20
  var _utils2 = require("../../selection/utils");
25
21
 
26
22
  var _pluginKey = require("../plugin-key");
@@ -33,8 +29,6 @@ var _utils3 = require("../utils");
33
29
 
34
30
  var _classNames = require("../ui/class-names");
35
31
 
36
- var _featureFlagsContext = require("../../feature-flags-context");
37
-
38
32
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
39
33
 
40
34
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -46,8 +40,6 @@ var createPlugin = function createPlugin(_ref) {
46
40
  appearance = _ref.appearance,
47
41
  _ref$allowComposition = _ref.allowCompositionInputOverride,
48
42
  allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition;
49
- var intl = getIntl();
50
- var codeBidiWarningLabel = intl.formatMessage(_messages.codeBidiWarningMessages.label);
51
43
  var handleDOMEvents = {}; // ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
52
44
  // incorrecly and lose content when pressing enter in the middle of a code block line.
53
45
 
@@ -133,21 +125,7 @@ var createPlugin = function createPlugin(_ref) {
133
125
  key: _pluginKey.pluginKey,
134
126
  props: {
135
127
  nodeViews: {
136
- codeBlock: function codeBlock(node, view, getPos) {
137
- var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(view.state); // The appearance being mobile indicates we are in an editor being
138
- // rendered by mobile bridge in a web view.
139
- // The tooltip is likely to have unexpected behaviour there, with being cut
140
- // off, so we disable it. This is also to keep the behaviour consistent with
141
- // the rendering in the mobile Native Renderer.
142
-
143
- var codeBidiWarningTooltipEnabled = appearance !== 'mobile';
144
- var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? (0, _highlightingCodeBlock.highlightingCodeBlockNodeView)({
145
- codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
146
- codeBidiWarningLabel: codeBidiWarningLabel,
147
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
148
- }) : (0, _codeBlock.codeBlockNodeView)();
149
- return createCodeBlockNodeView(node, view, getPos);
150
- }
128
+ codeBlock: _codeBlock.codeBlockNodeView
151
129
  },
152
130
  handleClickOn: (0, _utils2.createSelectionClickHandler)(['codeBlock'], function (target) {
153
131
  return !!(target.closest(".".concat(_classNames.codeBlockClassNames.gutter)) || target.classList.contains(_classNames.codeBlockClassNames.content));