@atlaskit/editor-core 181.0.1 → 182.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 (318) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/codemods/140.0.0-rc-kraken-fix-type-errors.ts +0 -2
  3. package/codemods/__tests__/next-remove-allow-more-text-colors-prop.ts +0 -17
  4. package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +0 -4
  5. package/dist/cjs/create-editor/sort-by-order.js +12 -0
  6. package/dist/cjs/editor-next/editor-migration-component.js +4 -1
  7. package/dist/cjs/editor-next/utils/deprecationWarnings.js +0 -5
  8. package/dist/cjs/labs/next/full-page.js +2 -1
  9. package/dist/cjs/labs/next/presets/default.js +2 -1
  10. package/dist/cjs/labs/next/presets/universal.js +7 -1
  11. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +2 -1
  12. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/styles.js +4 -7
  13. package/dist/cjs/plugins/analytics/plugin.js +6 -6
  14. package/dist/cjs/plugins/avatar-group/index.js +5 -2
  15. package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +4 -2
  16. package/dist/cjs/plugins/base/index.js +4 -2
  17. package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +1 -3
  18. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -6
  19. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +2 -8
  20. package/dist/cjs/plugins/border/index.js +20 -0
  21. package/dist/cjs/plugins/card/index.js +4 -2
  22. package/dist/cjs/plugins/card/toolbar.js +12 -15
  23. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +7 -3
  24. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  25. package/dist/cjs/plugins/collab-edit/analytics.js +2 -3
  26. package/dist/cjs/plugins/collab-edit/events/handlers.js +2 -2
  27. package/dist/cjs/plugins/collab-edit/events/initialize.js +3 -2
  28. package/dist/cjs/plugins/collab-edit/index.js +5 -3
  29. package/dist/cjs/plugins/collab-edit/plugin.js +4 -3
  30. package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
  31. package/dist/cjs/plugins/collab-edit/ui/avatars.js +2 -3
  32. package/dist/cjs/plugins/date/index.js +90 -64
  33. package/dist/cjs/plugins/editor-disabled/index.js +8 -0
  34. package/dist/cjs/plugins/expand/index.js +4 -1
  35. package/dist/cjs/plugins/expand/nodeviews/index.js +6 -7
  36. package/dist/cjs/plugins/expand/pm-plugins/main.js +5 -2
  37. package/dist/cjs/plugins/extension/extension-api.js +27 -14
  38. package/dist/cjs/plugins/extension/pm-plugins/main.js +117 -177
  39. package/dist/cjs/plugins/extension/pm-plugins/utils.js +80 -0
  40. package/dist/cjs/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +7 -11
  41. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +3 -4
  42. package/dist/cjs/plugins/find-replace/index.js +5 -2
  43. package/dist/cjs/plugins/floating-toolbar/index.js +15 -7
  44. package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +2 -1
  45. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +13 -3
  46. package/dist/cjs/plugins/floating-toolbar/ui/SimpleModal.js +2 -1
  47. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +6 -5
  48. package/dist/cjs/plugins/hyperlink/Toolbar.js +9 -12
  49. package/dist/cjs/plugins/hyperlink/index.js +6 -2
  50. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -4
  51. package/dist/cjs/plugins/index.js +7 -0
  52. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
  53. package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +5 -5
  54. package/dist/cjs/plugins/list/commands/index.js +31 -27
  55. package/dist/cjs/plugins/list/commands/outdent-list.js +2 -3
  56. package/dist/cjs/plugins/list/index.js +4 -3
  57. package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +3 -1
  58. package/dist/cjs/plugins/list/pm-plugins/input-rules/index.js +2 -1
  59. package/dist/cjs/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +58 -0
  60. package/dist/cjs/plugins/list/pm-plugins/keymap.js +4 -4
  61. package/dist/cjs/plugins/list/pm-plugins/main.js +23 -21
  62. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +6 -1
  63. package/dist/cjs/plugins/media/nodeviews/styles.js +13 -1
  64. package/dist/cjs/plugins/media/toolbar/commands.js +105 -2
  65. package/dist/cjs/plugins/media/toolbar/imageBorder.js +20 -0
  66. package/dist/cjs/plugins/media/toolbar/index.js +33 -4
  67. package/dist/cjs/plugins/media/ui/ImageBorder/index.js +219 -0
  68. package/dist/cjs/plugins/media/ui/ImageBorder/messages.js +50 -0
  69. package/dist/cjs/plugins/media/ui/ImageBorder/styles.js +54 -0
  70. package/dist/cjs/plugins/media/utils/current-media-node.js +28 -5
  71. package/dist/cjs/plugins/paste/util/index.js +2 -0
  72. package/dist/cjs/plugins/rank.js +1 -1
  73. package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +5 -0
  74. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -1
  75. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +3 -1
  76. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -1
  77. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
  78. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +6 -3
  79. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +3 -2
  80. package/dist/cjs/test-utils.js +3 -1
  81. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +4 -2
  82. package/dist/cjs/ui/styles.js +1 -1
  83. package/dist/cjs/utils/input-rules.js +0 -17
  84. package/dist/cjs/utils/insert.js +53 -7
  85. package/dist/cjs/version-wrapper.js +1 -1
  86. package/dist/cjs/version.json +1 -1
  87. package/dist/es2019/create-editor/sort-by-order.js +11 -0
  88. package/dist/es2019/editor-next/editor-migration-component.js +4 -1
  89. package/dist/es2019/editor-next/utils/deprecationWarnings.js +0 -5
  90. package/dist/es2019/labs/next/full-page.js +2 -1
  91. package/dist/es2019/labs/next/presets/default.js +2 -1
  92. package/dist/es2019/labs/next/presets/universal.js +8 -2
  93. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +3 -2
  94. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -8
  95. package/dist/es2019/plugins/analytics/plugin.js +45 -43
  96. package/dist/es2019/plugins/avatar-group/index.js +26 -21
  97. package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +4 -2
  98. package/dist/es2019/plugins/base/index.js +101 -97
  99. package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +1 -3
  100. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -6
  101. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -7
  102. package/dist/es2019/plugins/border/index.js +11 -0
  103. package/dist/es2019/plugins/card/index.js +4 -2
  104. package/dist/es2019/plugins/card/toolbar.js +10 -11
  105. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +7 -3
  106. package/dist/es2019/plugins/code-block/toolbar.js +2 -2
  107. package/dist/es2019/plugins/collab-edit/analytics.js +2 -3
  108. package/dist/es2019/plugins/collab-edit/events/handlers.js +2 -2
  109. package/dist/es2019/plugins/collab-edit/events/initialize.js +3 -2
  110. package/dist/es2019/plugins/collab-edit/index.js +5 -3
  111. package/dist/es2019/plugins/collab-edit/plugin.js +4 -3
  112. package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
  113. package/dist/es2019/plugins/collab-edit/ui/avatars.js +2 -3
  114. package/dist/es2019/plugins/date/index.js +92 -64
  115. package/dist/es2019/plugins/editor-disabled/index.js +8 -0
  116. package/dist/es2019/plugins/expand/index.js +57 -53
  117. package/dist/es2019/plugins/expand/nodeviews/index.js +6 -9
  118. package/dist/es2019/plugins/expand/pm-plugins/main.js +5 -3
  119. package/dist/es2019/plugins/extension/extension-api.js +31 -13
  120. package/dist/es2019/plugins/extension/pm-plugins/main.js +77 -96
  121. package/dist/es2019/plugins/extension/pm-plugins/utils.js +30 -0
  122. package/dist/es2019/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +1 -8
  123. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +3 -3
  124. package/dist/es2019/plugins/find-replace/index.js +5 -2
  125. package/dist/es2019/plugins/floating-toolbar/index.js +159 -149
  126. package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +4 -1
  127. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +13 -3
  128. package/dist/es2019/plugins/floating-toolbar/ui/SimpleModal.js +4 -1
  129. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +6 -5
  130. package/dist/es2019/plugins/hyperlink/Toolbar.js +7 -9
  131. package/dist/es2019/plugins/hyperlink/index.js +66 -62
  132. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -3
  133. package/dist/es2019/plugins/index.js +2 -1
  134. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
  135. package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +5 -5
  136. package/dist/es2019/plugins/list/commands/index.js +4 -4
  137. package/dist/es2019/plugins/list/commands/outdent-list.js +2 -4
  138. package/dist/es2019/plugins/list/index.js +80 -77
  139. package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +3 -1
  140. package/dist/es2019/plugins/list/pm-plugins/input-rules/index.js +2 -1
  141. package/dist/es2019/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +52 -0
  142. package/dist/es2019/plugins/list/pm-plugins/keymap.js +4 -4
  143. package/dist/es2019/plugins/list/pm-plugins/main.js +46 -46
  144. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +4 -1
  145. package/dist/es2019/plugins/media/nodeviews/styles.js +12 -1
  146. package/dist/es2019/plugins/media/toolbar/commands.js +93 -0
  147. package/dist/es2019/plugins/media/toolbar/imageBorder.js +15 -0
  148. package/dist/es2019/plugins/media/toolbar/index.js +36 -5
  149. package/dist/es2019/plugins/media/ui/ImageBorder/index.js +206 -0
  150. package/dist/es2019/plugins/media/ui/ImageBorder/messages.js +43 -0
  151. package/dist/es2019/plugins/media/ui/ImageBorder/styles.js +124 -0
  152. package/dist/es2019/plugins/media/utils/current-media-node.js +22 -3
  153. package/dist/es2019/plugins/paste/util/index.js +2 -0
  154. package/dist/es2019/plugins/rank.js +1 -1
  155. package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +7 -0
  156. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -1
  157. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +59 -55
  158. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -1
  159. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
  160. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +6 -3
  161. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +3 -2
  162. package/dist/es2019/test-utils.js +3 -1
  163. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +4 -2
  164. package/dist/es2019/ui/styles.js +1 -0
  165. package/dist/es2019/utils/input-rules.js +0 -17
  166. package/dist/es2019/utils/insert.js +61 -10
  167. package/dist/es2019/version-wrapper.js +1 -1
  168. package/dist/es2019/version.json +1 -1
  169. package/dist/esm/create-editor/sort-by-order.js +11 -0
  170. package/dist/esm/editor-next/editor-migration-component.js +3 -0
  171. package/dist/esm/editor-next/utils/deprecationWarnings.js +0 -5
  172. package/dist/esm/labs/next/full-page.js +2 -1
  173. package/dist/esm/labs/next/presets/default.js +2 -1
  174. package/dist/esm/labs/next/presets/universal.js +8 -2
  175. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +3 -2
  176. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/styles.js +3 -5
  177. package/dist/esm/plugins/analytics/plugin.js +6 -6
  178. package/dist/esm/plugins/avatar-group/index.js +5 -2
  179. package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +4 -2
  180. package/dist/esm/plugins/base/index.js +4 -2
  181. package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +1 -3
  182. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -6
  183. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -8
  184. package/dist/esm/plugins/border/index.js +13 -0
  185. package/dist/esm/plugins/card/index.js +4 -2
  186. package/dist/esm/plugins/card/toolbar.js +12 -15
  187. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +7 -3
  188. package/dist/esm/plugins/code-block/toolbar.js +2 -2
  189. package/dist/esm/plugins/collab-edit/analytics.js +2 -3
  190. package/dist/esm/plugins/collab-edit/events/handlers.js +2 -2
  191. package/dist/esm/plugins/collab-edit/events/initialize.js +3 -2
  192. package/dist/esm/plugins/collab-edit/index.js +5 -3
  193. package/dist/esm/plugins/collab-edit/plugin.js +4 -3
  194. package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
  195. package/dist/esm/plugins/collab-edit/ui/avatars.js +2 -3
  196. package/dist/esm/plugins/date/index.js +90 -64
  197. package/dist/esm/plugins/editor-disabled/index.js +8 -0
  198. package/dist/esm/plugins/expand/index.js +4 -1
  199. package/dist/esm/plugins/expand/nodeviews/index.js +6 -7
  200. package/dist/esm/plugins/expand/pm-plugins/main.js +5 -2
  201. package/dist/esm/plugins/extension/extension-api.js +24 -12
  202. package/dist/esm/plugins/extension/pm-plugins/main.js +113 -173
  203. package/dist/esm/plugins/extension/pm-plugins/utils.js +72 -0
  204. package/dist/esm/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +1 -10
  205. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +3 -4
  206. package/dist/esm/plugins/find-replace/index.js +5 -2
  207. package/dist/esm/plugins/floating-toolbar/index.js +15 -7
  208. package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +2 -1
  209. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +13 -3
  210. package/dist/esm/plugins/floating-toolbar/ui/SimpleModal.js +2 -1
  211. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +6 -5
  212. package/dist/esm/plugins/hyperlink/Toolbar.js +9 -13
  213. package/dist/esm/plugins/hyperlink/index.js +6 -2
  214. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -4
  215. package/dist/esm/plugins/index.js +2 -1
  216. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
  217. package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +5 -5
  218. package/dist/esm/plugins/list/commands/index.js +31 -27
  219. package/dist/esm/plugins/list/commands/outdent-list.js +2 -3
  220. package/dist/esm/plugins/list/index.js +4 -3
  221. package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +3 -1
  222. package/dist/esm/plugins/list/pm-plugins/input-rules/index.js +2 -1
  223. package/dist/esm/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +51 -0
  224. package/dist/esm/plugins/list/pm-plugins/keymap.js +4 -4
  225. package/dist/esm/plugins/list/pm-plugins/main.js +23 -21
  226. package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +6 -1
  227. package/dist/esm/plugins/media/nodeviews/styles.js +13 -1
  228. package/dist/esm/plugins/media/toolbar/commands.js +99 -0
  229. package/dist/esm/plugins/media/toolbar/imageBorder.js +14 -0
  230. package/dist/esm/plugins/media/toolbar/index.js +34 -5
  231. package/dist/esm/plugins/media/ui/ImageBorder/index.js +211 -0
  232. package/dist/esm/plugins/media/ui/ImageBorder/messages.js +43 -0
  233. package/dist/esm/plugins/media/ui/ImageBorder/styles.js +37 -0
  234. package/dist/esm/plugins/media/utils/current-media-node.js +24 -3
  235. package/dist/esm/plugins/paste/util/index.js +2 -0
  236. package/dist/esm/plugins/rank.js +1 -1
  237. package/dist/esm/plugins/rule/pm-plugins/input-rule.js +5 -0
  238. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -1
  239. package/dist/esm/plugins/toolbar-lists-indentation/index.js +3 -1
  240. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -1
  241. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
  242. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +6 -3
  243. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +3 -2
  244. package/dist/esm/test-utils.js +3 -1
  245. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +4 -2
  246. package/dist/esm/ui/styles.js +1 -1
  247. package/dist/esm/utils/input-rules.js +0 -17
  248. package/dist/esm/utils/insert.js +56 -10
  249. package/dist/esm/version-wrapper.js +1 -1
  250. package/dist/esm/version.json +1 -1
  251. package/dist/types/create-editor/sort-by-order.d.ts +9 -0
  252. package/dist/types/editor-next/editor-migration-component.d.ts +1 -0
  253. package/dist/types/labs/next/presets/cxhtml.d.ts +36 -2
  254. package/dist/types/labs/next/presets/default.d.ts +72 -4
  255. package/dist/types/labs/next/presets/mobile.d.ts +36 -2
  256. package/dist/types/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -1
  257. package/dist/types/plugins/analytics/plugin.d.ts +2 -0
  258. package/dist/types/plugins/avatar-group/index.d.ts +2 -0
  259. package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +2 -0
  260. package/dist/types/plugins/base/index.d.ts +2 -0
  261. package/dist/types/plugins/base/pm-plugins/disable-spell-checking.d.ts +2 -1
  262. package/dist/types/plugins/border/index.d.ts +3 -0
  263. package/dist/types/plugins/card/index.d.ts +2 -0
  264. package/dist/types/plugins/card/toolbar.d.ts +2 -1
  265. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +5 -2
  266. package/dist/types/plugins/collab-edit/analytics.d.ts +2 -1
  267. package/dist/types/plugins/collab-edit/events/handlers.d.ts +2 -1
  268. package/dist/types/plugins/collab-edit/events/initialize.d.ts +3 -1
  269. package/dist/types/plugins/collab-edit/index.d.ts +2 -0
  270. package/dist/types/plugins/collab-edit/plugin.d.ts +2 -1
  271. package/dist/types/plugins/collab-edit/ui/avatars-with-plugin-state.d.ts +4 -0
  272. package/dist/types/plugins/collab-edit/ui/avatars.d.ts +2 -0
  273. package/dist/types/plugins/date/index.d.ts +9 -1
  274. package/dist/types/plugins/editor-disabled/index.d.ts +3 -1
  275. package/dist/types/plugins/expand/index.d.ts +2 -0
  276. package/dist/types/plugins/expand/nodeviews/index.d.ts +5 -2
  277. package/dist/types/plugins/expand/pm-plugins/main.d.ts +2 -1
  278. package/dist/types/plugins/extension/pm-plugins/main.d.ts +8 -2
  279. package/dist/types/plugins/extension/pm-plugins/utils.d.ts +3 -0
  280. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -7
  281. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +2 -0
  282. package/dist/types/plugins/find-replace/index.d.ts +2 -0
  283. package/dist/types/plugins/floating-toolbar/index.d.ts +4 -1
  284. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +2 -0
  285. package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
  286. package/dist/types/plugins/hyperlink/index.d.ts +2 -0
  287. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +2 -0
  288. package/dist/types/plugins/index.d.ts +1 -0
  289. package/dist/types/plugins/list/actions/outdent-list-items-selected.d.ts +2 -1
  290. package/dist/types/plugins/list/commands/index.d.ts +3 -2
  291. package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
  292. package/dist/types/plugins/list/index.d.ts +2 -0
  293. package/dist/types/plugins/list/pm-plugins/input-rules/create-list-input-rule.d.ts +1 -1
  294. package/dist/types/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +13 -0
  295. package/dist/types/plugins/list/pm-plugins/keymap.d.ts +2 -1
  296. package/dist/types/plugins/list/pm-plugins/main.d.ts +3 -2
  297. package/dist/types/plugins/media/nodeviews/styles.d.ts +3 -1
  298. package/dist/types/plugins/media/toolbar/commands.d.ts +5 -0
  299. package/dist/types/plugins/media/toolbar/imageBorder.d.ts +2 -0
  300. package/dist/types/plugins/media/types.d.ts +3 -0
  301. package/dist/types/plugins/media/ui/ImageBorder/index.d.ts +13 -0
  302. package/dist/types/plugins/media/ui/ImageBorder/messages.d.ts +42 -0
  303. package/dist/types/plugins/media/ui/ImageBorder/styles.d.ts +15 -0
  304. package/dist/types/plugins/media/utils/current-media-node.d.ts +6 -0
  305. package/dist/types/plugins/text-color/pm-plugins/main.d.ts +0 -2
  306. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -0
  307. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
  308. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  309. package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +3 -1
  310. package/dist/types/test-utils.d.ts +4 -2
  311. package/dist/types/types/editor-props.d.ts +5 -0
  312. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
  313. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  314. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  315. package/package.json +12 -11
  316. package/report.api.md +12 -4
  317. package/codemods/__tests__/rename-experimental-text-color-prop.ts +0 -204
  318. package/codemods/migrates/rename-experimental-text-color-prop.ts +0 -6
@@ -1,8 +1,7 @@
1
1
  import { addAnalytics, ACTION, EVENT_TYPE, ACTION_SUBJECT } from '../analytics';
2
- import { getFeatureFlags } from '../feature-flags-context';
3
2
  import { getDocStructure } from '../../utils/document-logger';
4
3
  import { sniffUserBrowserExtensions } from '@atlaskit/editor-common/utils';
5
- export const addSynchronyErrorAnalytics = (state, tr) => {
4
+ export const addSynchronyErrorAnalytics = (state, tr, featureFlags) => {
6
5
  return error => {
7
6
  const browserExtensions = sniffUserBrowserExtensions({
8
7
  extensions: ['grammarly']
@@ -16,7 +15,7 @@ export const addSynchronyErrorAnalytics = (state, tr) => {
16
15
  browserExtensions
17
16
  }
18
17
  };
19
- if (getFeatureFlags(state).synchronyErrorDocStructure) {
18
+ if (featureFlags.synchronyErrorDocStructure) {
20
19
  payload.attributes.docStructure = getDocStructure(state.doc, {
21
20
  compact: true
22
21
  });
@@ -12,7 +12,7 @@ const effect = (fn, eq) => {
12
12
  return cleanup;
13
13
  };
14
14
  };
15
- export const subscribe = effect((view, provider, options, _providerFactory) => {
15
+ export const subscribe = effect((view, provider, options, featureFlags, _providerFactory) => {
16
16
  let entityRef;
17
17
  const entityHandlers = {
18
18
  disconnectedHandler: () => {
@@ -51,7 +51,7 @@ export const subscribe = effect((view, provider, options, _providerFactory) => {
51
51
  view.dispatch(tr);
52
52
  },
53
53
  errorHandler: error => {
54
- addSynchronyErrorAnalytics(view.state, view.state.tr)(error);
54
+ addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags)(error);
55
55
  },
56
56
  entityHandler: ({
57
57
  entity
@@ -17,14 +17,15 @@ const initCollabMemo = memoizeOne(initCollab);
17
17
  export const initialize = ({
18
18
  options,
19
19
  providerFactory,
20
- view
20
+ view,
21
+ featureFlags
21
22
  }) => provider => {
22
23
  let cleanup;
23
24
  const pluginState = pluginKey.getState(view.state);
24
25
  if (pluginState.isReady && cleanup) {
25
26
  cleanup();
26
27
  }
27
- cleanup = subscribe(view, provider, options, providerFactory);
28
+ cleanup = subscribe(view, provider, options, featureFlags, providerFactory);
28
29
 
29
30
  // Initialize provider
30
31
  if (options.useNativePlugin) {
@@ -19,7 +19,9 @@ const providerBuilder = collabEditProviderPromise => async (codeToExecute, onErr
19
19
  }
20
20
  }
21
21
  };
22
- const collabEditPlugin = options => {
22
+ const collabEditPlugin = (options, api) => {
23
+ var _api$dependencies, _api$dependencies$fea;
24
+ const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
23
25
  let providerResolver = () => {};
24
26
  const collabEditProviderPromise = new Promise(_providerResolver => {
25
27
  providerResolver = _providerResolver;
@@ -53,12 +55,12 @@ const collabEditPlugin = options => {
53
55
  providerPromise.then(provider => providerResolver(provider));
54
56
  }
55
57
  });
56
- return createPlugin(dispatch, providerFactory, executeProviderCode, options);
58
+ return createPlugin(dispatch, providerFactory, executeProviderCode, options, featureFlags);
57
59
  }
58
60
  }];
59
61
  },
60
62
  onEditorViewStateUpdated(props) {
61
- const addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr);
63
+ const addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr, featureFlags);
62
64
  executeProviderCode(sendTransaction({
63
65
  originalTransaction: props.originalTransaction,
64
66
  transactions: props.transactions,
@@ -5,7 +5,7 @@ import { pluginKey } from './plugin-key';
5
5
  import { addSynchronyErrorAnalytics } from './analytics';
6
6
  import { fireAnalyticsEvent, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
7
  export { PluginState, pluginKey };
8
- export const createPlugin = (dispatch, providerFactory, collabProviderCallback, options) => {
8
+ export const createPlugin = (dispatch, providerFactory, collabProviderCallback, options, featureFlags) => {
9
9
  const fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
10
10
  return new SafePlugin({
11
11
  key: pluginKey,
@@ -39,7 +39,7 @@ export const createPlugin = (dispatch, providerFactory, collabProviderCallback,
39
39
  return true;
40
40
  },
41
41
  view(view) {
42
- const addErrorAnalytics = addSynchronyErrorAnalytics(view.state, view.state.tr);
42
+ const addErrorAnalytics = addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags);
43
43
  const onSyncUpError = attributes => {
44
44
  fireAnalyticsCallback({
45
45
  payload: {
@@ -54,7 +54,8 @@ export const createPlugin = (dispatch, providerFactory, collabProviderCallback,
54
54
  const cleanup = collabProviderCallback(initialize({
55
55
  view,
56
56
  options,
57
- providerFactory
57
+ providerFactory,
58
+ featureFlags
58
59
  }), addErrorAnalytics);
59
60
  return {
60
61
  destroy() {
@@ -11,7 +11,8 @@ const AvatarsWithPluginState = props => {
11
11
  isInviteToEditButtonSelected: selected,
12
12
  inviteToEditHandler: onClick,
13
13
  inviteToEditComponent: Component,
14
- editorView
14
+ editorView,
15
+ featureFlags
15
16
  } = props;
16
17
  const render = React.useCallback(({
17
18
  data
@@ -22,14 +23,15 @@ const AvatarsWithPluginState = props => {
22
23
  return /*#__PURE__*/React.createElement(Avatars, {
23
24
  sessionId: data.sessionId,
24
25
  participants: data.activeParticipants,
25
- editorView: editorView
26
+ editorView: editorView,
27
+ featureFlags: featureFlags
26
28
  }, /*#__PURE__*/React.createElement(InviteToEditButton, {
27
29
  title: title,
28
30
  selected: selected,
29
31
  onClick: onClick,
30
32
  Component: Component
31
33
  }));
32
- }, [selected, onClick, Component, title, editorView]);
34
+ }, [selected, onClick, Component, title, editorView, featureFlags]);
33
35
  return /*#__PURE__*/React.createElement(WithPluginState, {
34
36
  plugins: {
35
37
  data: collabEditPluginKey
@@ -5,11 +5,11 @@ import AvatarGroup from '@atlaskit/avatar-group';
5
5
  import { avatarContainer } from './styles';
6
6
  import toAvatar from './to-avatar';
7
7
  import { scrollToCollabCursor } from '../utils';
8
- import { getFeatureFlags } from '../../feature-flags-context';
9
8
  export const Avatars = /*#__PURE__*/React.memo(props => {
10
9
  const {
11
10
  sessionId,
12
- editorView
11
+ editorView,
12
+ featureFlags
13
13
  } = props;
14
14
  const participants = props.participants.toArray();
15
15
  const avatars = participants.sort(p => p.sessionId === sessionId ? -1 : 1).map(toAvatar);
@@ -27,7 +27,6 @@ export const Avatars = /*#__PURE__*/React.memo(props => {
27
27
  if (!editorView) {
28
28
  return;
29
29
  }
30
- const featureFlags = getFeatureFlags(editorView.state);
31
30
  const allowCollabAvatarScroll = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.collabAvatarScroll;
32
31
 
33
32
  // user does not need to scroll to their own position (index 0)
@@ -2,21 +2,103 @@ import React from 'react';
2
2
  import { findDomRefAtPos } from 'prosemirror-utils';
3
3
  import Loadable from 'react-loadable';
4
4
  import { date } from '@atlaskit/adf-schema';
5
- import WithPluginState from '../../ui/WithPluginState';
6
5
  import { insertDate, closeDatePicker, closeDatePickerWithAnalytics, createDate, deleteDate } from './actions';
7
6
  import createDatePlugin from './pm-plugins/main';
8
7
  import keymap from './pm-plugins/keymap';
9
- import { pluginKey as editorDisabledPluginKey } from '../editor-disabled';
10
8
  import { IconDate } from '../quick-insert/assets';
11
9
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
12
10
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
13
11
  import { pluginKey as datePluginKey } from './pm-plugins/plugin-key';
12
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
14
13
  const DatePicker = Loadable({
15
14
  loader: () => import( /* webpackChunkName: "@atlaskit-internal_editor-datepicker" */'./ui/DatePicker').then(mod => mod.default),
16
15
  loading: () => null
17
16
  });
18
- const datePlugin = () => ({
17
+ function ContentComponent({
18
+ editorView,
19
+ dispatchAnalyticsEvent,
20
+ popupsMountPoint,
21
+ popupsBoundariesElement,
22
+ popupsScrollableElement,
23
+ dependencyApi
24
+ }) {
25
+ const {
26
+ dispatch
27
+ } = editorView;
28
+ const domAtPos = editorView.domAtPos.bind(editorView);
29
+ const {
30
+ editorDisabledState,
31
+ dateState
32
+ } = useSharedPluginState(dependencyApi, ['date', 'editorDisabled']);
33
+ if (!(dateState !== null && dateState !== void 0 && dateState.showDatePickerAt) || editorDisabledState !== null && editorDisabledState !== void 0 && editorDisabledState.editorDisabled) {
34
+ return null;
35
+ }
36
+ const {
37
+ showDatePickerAt,
38
+ isNew,
39
+ focusDateInput
40
+ } = dateState;
41
+ const element = findDomRefAtPos(showDatePickerAt, domAtPos);
42
+ return /*#__PURE__*/React.createElement(DatePicker, {
43
+ mountTo: popupsMountPoint,
44
+ boundariesElement: popupsBoundariesElement,
45
+ scrollableElement: popupsScrollableElement,
46
+ key: showDatePickerAt,
47
+ element: element,
48
+ isNew: isNew,
49
+ autoFocus: focusDateInput,
50
+ onDelete: () => {
51
+ deleteDate()(editorView.state, dispatch);
52
+ editorView.focus();
53
+ return;
54
+ },
55
+ onSelect: (date, commitMethod) => {
56
+ // Undefined means couldn't parse date, null means invalid (out of bounds) date
57
+ if (date === undefined || date === null) {
58
+ return;
59
+ }
60
+ insertDate(date, undefined, commitMethod)(editorView.state, dispatch);
61
+ editorView.focus();
62
+ },
63
+ onTextChanged: date => {
64
+ insertDate(date, undefined, undefined, false)(editorView.state, dispatch);
65
+ },
66
+ closeDatePicker: () => {
67
+ closeDatePicker()(editorView.state, dispatch);
68
+ editorView.focus();
69
+ },
70
+ closeDatePickerWithAnalytics: ({
71
+ date
72
+ }) => {
73
+ closeDatePickerWithAnalytics({
74
+ date
75
+ })(editorView.state, dispatch);
76
+ editorView.focus();
77
+ },
78
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent
79
+ });
80
+ }
81
+ const datePlugin = (_, api) => ({
19
82
  name: 'date',
83
+ getSharedState(editorState) {
84
+ if (!editorState) {
85
+ return {
86
+ showDatePickerAt: null,
87
+ isNew: false,
88
+ focusDateInput: false
89
+ };
90
+ }
91
+ const {
92
+ showDatePickerAt,
93
+ isNew,
94
+ focusDateInput
95
+ } = datePluginKey.getState(editorState);
96
+ return {
97
+ showDatePickerAt,
98
+ isNew,
99
+ focusDateInput
100
+ };
101
+ },
20
102
  nodes() {
21
103
  return [{
22
104
  name: 'date',
@@ -45,67 +127,13 @@ const datePlugin = () => ({
45
127
  popupsBoundariesElement,
46
128
  popupsScrollableElement
47
129
  }) {
48
- const {
49
- dispatch
50
- } = editorView;
51
- const domAtPos = editorView.domAtPos.bind(editorView);
52
- return /*#__PURE__*/React.createElement(WithPluginState, {
53
- plugins: {
54
- datePlugin: datePluginKey,
55
- editorDisabledPlugin: editorDisabledPluginKey
56
- },
57
- render: ({
58
- editorDisabledPlugin,
59
- datePlugin
60
- }) => {
61
- if (!(datePlugin !== null && datePlugin !== void 0 && datePlugin.showDatePickerAt) || editorDisabledPlugin !== null && editorDisabledPlugin !== void 0 && editorDisabledPlugin.editorDisabled) {
62
- return null;
63
- }
64
- const {
65
- showDatePickerAt,
66
- isNew,
67
- focusDateInput
68
- } = datePlugin;
69
- const element = findDomRefAtPos(showDatePickerAt, domAtPos);
70
- return /*#__PURE__*/React.createElement(DatePicker, {
71
- mountTo: popupsMountPoint,
72
- boundariesElement: popupsBoundariesElement,
73
- scrollableElement: popupsScrollableElement,
74
- key: showDatePickerAt,
75
- element: element,
76
- isNew: isNew,
77
- autoFocus: focusDateInput,
78
- onDelete: () => {
79
- deleteDate()(editorView.state, dispatch);
80
- editorView.focus();
81
- return;
82
- },
83
- onSelect: (date, commitMethod) => {
84
- // Undefined means couldn't parse date, null means invalid (out of bounds) date
85
- if (date === undefined || date === null) {
86
- return;
87
- }
88
- insertDate(date, undefined, commitMethod)(editorView.state, dispatch);
89
- editorView.focus();
90
- },
91
- onTextChanged: date => {
92
- insertDate(date, undefined, undefined, false)(editorView.state, dispatch);
93
- },
94
- closeDatePicker: () => {
95
- closeDatePicker()(editorView.state, dispatch);
96
- editorView.focus();
97
- },
98
- closeDatePickerWithAnalytics: ({
99
- date
100
- }) => {
101
- closeDatePickerWithAnalytics({
102
- date
103
- })(editorView.state, dispatch);
104
- editorView.focus();
105
- },
106
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
107
- });
108
- }
130
+ return /*#__PURE__*/React.createElement(ContentComponent, {
131
+ dependencyApi: api,
132
+ editorView: editorView,
133
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
134
+ popupsMountPoint: popupsMountPoint,
135
+ popupsBoundariesElement: popupsBoundariesElement,
136
+ popupsScrollableElement: popupsScrollableElement
109
137
  });
110
138
  },
111
139
  pluginsOptions: {
@@ -38,6 +38,14 @@ export function createPlugin(dispatch) {
38
38
  }
39
39
  const editorDisabledPlugin = () => ({
40
40
  name: 'editorDisabled',
41
+ getSharedState(editorState) {
42
+ if (!editorState) {
43
+ return {
44
+ editorDisabled: false
45
+ };
46
+ }
47
+ return pluginKey.getState(editorState);
48
+ },
41
49
  pmPlugins: () => [{
42
50
  name: 'editorDisabled',
43
51
  plugin: ({
@@ -7,63 +7,67 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, IN
7
7
  import { getToolbarConfig } from './toolbar';
8
8
  import { createExpandNode } from './commands';
9
9
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
10
- const expandPlugin = (options = {}) => ({
11
- name: 'expand',
12
- nodes() {
13
- return [{
14
- name: 'expand',
15
- node: expand
16
- }, {
17
- name: 'nestedExpand',
18
- node: nestedExpand
19
- }];
20
- },
21
- pmPlugins() {
22
- return [{
23
- name: 'expand',
24
- plugin: ({
25
- dispatch,
26
- getIntl
27
- }) => {
28
- return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection);
29
- }
30
- }, {
31
- name: 'expandKeymap',
32
- plugin: expandKeymap
33
- }];
34
- },
35
- pluginsOptions: {
36
- floatingToolbar: getToolbarConfig,
37
- quickInsert: ({
38
- formatMessage
39
- }) => {
40
- if (options && options.allowInsertion !== true) {
41
- return [];
42
- }
10
+ const expandPlugin = (options = {}, api) => {
11
+ var _api$dependencies, _api$dependencies$fea;
12
+ const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
13
+ return {
14
+ name: 'expand',
15
+ nodes() {
16
+ return [{
17
+ name: 'expand',
18
+ node: expand
19
+ }, {
20
+ name: 'nestedExpand',
21
+ node: nestedExpand
22
+ }];
23
+ },
24
+ pmPlugins() {
43
25
  return [{
44
- id: 'expand',
45
- title: formatMessage(messages.expand),
46
- description: formatMessage(messages.expandDescription),
47
- keywords: ['accordion', 'collapse'],
48
- priority: 600,
49
- icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
50
- action(insert, state) {
51
- const node = createExpandNode(state);
52
- const tr = insert(node);
53
- return addAnalytics(state, tr, {
54
- action: ACTION.INSERTED,
55
- actionSubject: ACTION_SUBJECT.DOCUMENT,
56
- actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
57
- attributes: {
58
- inputMethod: INPUT_METHOD.QUICK_INSERT
59
- },
60
- eventType: EVENT_TYPE.TRACK
61
- });
26
+ name: 'expand',
27
+ plugin: ({
28
+ dispatch,
29
+ getIntl
30
+ }) => {
31
+ return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, featureFlags);
62
32
  }
33
+ }, {
34
+ name: 'expandKeymap',
35
+ plugin: expandKeymap
63
36
  }];
37
+ },
38
+ pluginsOptions: {
39
+ floatingToolbar: getToolbarConfig,
40
+ quickInsert: ({
41
+ formatMessage
42
+ }) => {
43
+ if (options && options.allowInsertion !== true) {
44
+ return [];
45
+ }
46
+ return [{
47
+ id: 'expand',
48
+ title: formatMessage(messages.expand),
49
+ description: formatMessage(messages.expandDescription),
50
+ keywords: ['accordion', 'collapse'],
51
+ priority: 600,
52
+ icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
53
+ action(insert, state) {
54
+ const node = createExpandNode(state);
55
+ const tr = insert(node);
56
+ return addAnalytics(state, tr, {
57
+ action: ACTION.INSERTED,
58
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
59
+ actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
60
+ attributes: {
61
+ inputMethod: INPUT_METHOD.QUICK_INSERT
62
+ },
63
+ eventType: EVENT_TYPE.TRACK
64
+ });
65
+ }
66
+ }];
67
+ }
64
68
  }
65
- }
66
- });
69
+ };
70
+ };
67
71
  export default expandPlugin;
68
72
  export function isExpandInsertionEnabled({
69
73
  allowExpand
@@ -10,7 +10,6 @@ import { isEmptyNode } from '../../../utils';
10
10
  import { updateExpandTitle, toggleExpandExpanded, deleteExpandAtPos, setSelectionInsideExpand } from '../commands';
11
11
  import { expandClassNames } from '../ui/class-names';
12
12
  import { GapCursorSelection, Side } from '../../../plugins/selection/gap-cursor-selection';
13
- import { getFeatureFlags } from '../../feature-flags-context';
14
13
  import { closestElement } from '../../../utils/dom';
15
14
  import { RelativeSelectionPos } from '../../selection/types';
16
15
  import { setSelectionRelativeToNode } from '../../selection/commands';
@@ -50,7 +49,7 @@ const toDOM = (node, intl) => ['div', {
50
49
  'class': expandClassNames.content
51
50
  }, 0]];
52
51
  export class ExpandNodeView {
53
- constructor(node, view, getPos, getIntl, isMobile) {
52
+ constructor(node, view, getPos, getIntl, isMobile, featureFlags) {
54
53
  _defineProperty(this, "allowInteractiveExpand", true);
55
54
  _defineProperty(this, "isMobile", false);
56
55
  _defineProperty(this, "focusTitle", () => {
@@ -77,11 +76,7 @@ export class ExpandNodeView {
77
76
  }
78
77
  });
79
78
  _defineProperty(this, "isAllowInteractiveExpandEnabled", () => {
80
- const {
81
- state
82
- } = this.view;
83
- const featureFlags = getFeatureFlags(state);
84
- return featureFlags && !!featureFlags.interactiveExpand;
79
+ return this.featureFlags && !!this.featureFlags.interactiveExpand;
85
80
  });
86
81
  _defineProperty(this, "handleClick", event => {
87
82
  const target = event.target;
@@ -299,6 +294,7 @@ export class ExpandNodeView {
299
294
  this.dom = dom;
300
295
  this.contentDOM = contentDOM;
301
296
  this.isMobile = isMobile;
297
+ this.featureFlags = featureFlags;
302
298
  this.icon = this.dom.querySelector(`.${expandClassNames.icon}`);
303
299
  this.input = this.dom.querySelector(`.${expandClassNames.titleInput}`);
304
300
  this.titleContainer = this.dom.querySelector(`.${expandClassNames.titleContainer}`);
@@ -404,7 +400,8 @@ export class ExpandNodeView {
404
400
  }
405
401
  export default function ({
406
402
  getIntl,
407
- isMobile
403
+ isMobile,
404
+ featureFlags
408
405
  }) {
409
- return (node, view, getPos) => new ExpandNodeView(node, view, getPos, getIntl, isMobile);
406
+ return (node, view, getPos) => new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags);
410
407
  }
@@ -10,7 +10,7 @@ export function containsClass(element, className) {
10
10
  var _element$classList;
11
11
  return Boolean(element === null || element === void 0 ? void 0 : (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(className));
12
12
  }
13
- export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false) => {
13
+ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, featureFlags) => {
14
14
  const state = createPluginState(dispatch, {});
15
15
  const isMobile = appearance === 'mobile';
16
16
  return new SafePlugin({
@@ -20,11 +20,13 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
20
20
  nodeViews: {
21
21
  expand: ExpandNodeView({
22
22
  getIntl,
23
- isMobile
23
+ isMobile,
24
+ featureFlags
24
25
  }),
25
26
  nestedExpand: ExpandNodeView({
26
27
  getIntl,
27
- isMobile
28
+ isMobile,
29
+ featureFlags
28
30
  })
29
31
  },
30
32
  handleKeyDown(_view, event) {
@@ -1,13 +1,13 @@
1
1
  import { validator } from '@atlaskit/adf-utils/validator';
2
2
  import { JSONTransformer } from '@atlaskit/editor-json-transformer';
3
3
  import { Fragment, Mark } from 'prosemirror-model';
4
- import { NodeSelection } from 'prosemirror-state';
4
+ import { NodeSelection, Selection } from 'prosemirror-state';
5
5
  import { insertMacroFromMacroBrowser } from '../macro';
6
6
  import { pluginKey as macroPluginKey } from '../macro/plugin-key';
7
+ import { nodeToJSON } from '../../utils';
7
8
  import { setEditingContextToContextPanel } from './commands';
8
- import { findNodePosWithLocalId, getSelectedExtension } from './utils';
9
+ import { findNodePosWithLocalId, getDataConsumerMark, getNodeTypesReferenced, getSelectedExtension } from './utils';
9
10
  import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '../analytics';
10
- import { getNodeTypesReferenced, getDataConsumerMark } from './utils';
11
11
  import { setTextSelection } from 'prosemirror-utils';
12
12
  export const getEditInLegacyMacroBrowser = ({
13
13
  view,
@@ -37,7 +37,18 @@ const extensionAPICallPayload = functionName => ({
37
37
  eventType: EVENT_TYPE.TRACK
38
38
  });
39
39
  export const createExtensionAPI = options => {
40
- const validate = validator();
40
+ const {
41
+ editorView: {
42
+ state: {
43
+ schema
44
+ }
45
+ }
46
+ } = options;
47
+ const nodes = Object.keys(schema.nodes);
48
+ const marks = Object.keys(schema.marks);
49
+ const validate = validator(nodes, marks, {
50
+ allowPrivateAttributes: true
51
+ });
41
52
 
42
53
  /**
43
54
  * Finds the node and its position by `localId`. Throws if the node could not be found.
@@ -189,20 +200,20 @@ export const createExtensionAPI = options => {
189
200
  schema
190
201
  } = state;
191
202
  const changedValues = mutationCallback({
203
+ content: nodeToJSON(node).content,
192
204
  attrs: node.attrs,
193
205
  marks: node.marks.map(pmMark => ({
194
206
  type: pmMark.type.name,
195
207
  attrs: pmMark.attrs
196
208
  }))
197
209
  });
198
- const {
199
- parent
200
- } = state.doc.resolve(pos);
201
210
  const ensureValidMark = mark => {
202
211
  if (typeof mark !== 'object' || Array.isArray(mark)) {
203
212
  throw new Error(`update(): Invalid mark given.`);
204
213
  }
205
-
214
+ const {
215
+ parent
216
+ } = state.doc.resolve(pos);
206
217
  // Ensure that the given mark is present in the schema
207
218
  const markType = schema.marks[mark.type];
208
219
  if (!markType) {
@@ -216,20 +227,27 @@ export const createExtensionAPI = options => {
216
227
  attrs: mark.attrs
217
228
  };
218
229
  };
219
- const newMarks = (_changedValues$marks = changedValues.marks) === null || _changedValues$marks === void 0 ? void 0 : _changedValues$marks.map(ensureValidMark).map(({
230
+ const newMarks = changedValues.hasOwnProperty('marks') ? (_changedValues$marks = changedValues.marks) === null || _changedValues$marks === void 0 ? void 0 : _changedValues$marks.map(ensureValidMark).map(({
220
231
  mark,
221
232
  attrs
222
- }) => mark.create(attrs));
233
+ }) => mark.create(attrs)) : node.marks;
234
+ const newContent = changedValues.hasOwnProperty('content') ? Fragment.fromJSON(schema, changedValues.content) : node.content;
235
+ const newAttrs = changedValues.hasOwnProperty('attrs') ? changedValues.attrs : node.attrs;
223
236
 
224
- // Validate if the new attributes and marks result in a valid node and adf.
237
+ // Validate if the new attributes, content and marks result in a valid node and adf.
225
238
  try {
226
- const newNode = node.type.createChecked(changedValues.attrs, node.content, newMarks);
239
+ const newNode = node.type.createChecked(newAttrs, newContent, newMarks);
227
240
  const newNodeAdf = new JSONTransformer().encodeNode(newNode);
228
241
  validate(newNodeAdf);
242
+ tr.replaceWith(pos, pos + node.nodeSize, newNode);
243
+
244
+ // Keep selection if content does not change
245
+ if (newContent === node.content) {
246
+ tr.setSelection(Selection.fromJSON(tr.doc, state.selection.toJSON()));
247
+ }
229
248
  } catch (err) {
230
249
  throw new Error(`update(): The given ADFEntity cannot be inserted in the current position.\n${err}`);
231
250
  }
232
- tr.setNodeMarkup(pos, undefined, changedValues.attrs, newMarks);
233
251
 
234
252
  // Analytics - tracking the api call
235
253
  const apiCallPayload = extensionAPICallPayload('update');