@atlaskit/editor-core 151.1.2 → 151.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/create-editor/ReactEditorView.js +22 -8
  3. package/dist/cjs/create-editor/create-plugins-list.js +30 -11
  4. package/dist/cjs/labs/next/presets/cxhtml.js +1 -2
  5. package/dist/cjs/labs/next/presets/default.js +3 -1
  6. package/dist/cjs/nodeviews/ReactNodeView.js +2 -2
  7. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +6 -0
  8. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  9. package/dist/cjs/plugins/annotation/utils.js +19 -8
  10. package/dist/cjs/plugins/avatar-group/index.js +2 -1
  11. package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  12. package/dist/cjs/plugins/before-primaryToolbar/index.js +26 -0
  13. package/dist/cjs/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +28 -0
  14. package/dist/cjs/plugins/code-bidi-warning/index.js +5 -2
  15. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +12 -3
  16. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +15 -5
  17. package/dist/cjs/plugins/code-block/index.js +3 -3
  18. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  19. package/dist/cjs/plugins/code-block/pm-plugins/main.js +11 -3
  20. package/dist/cjs/plugins/extension/extension-api.js +10 -2
  21. package/dist/cjs/plugins/extension/ui/styles.js +1 -1
  22. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  23. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +172 -0
  24. package/dist/cjs/plugins/find-replace/index.js +14 -137
  25. package/dist/cjs/plugins/find-replace/ui/Find.js +16 -9
  26. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +9 -2
  27. package/dist/cjs/plugins/find-replace/ui/Replace.js +11 -3
  28. package/dist/cjs/plugins/find-replace/ui/styles.js +44 -35
  29. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -4
  30. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  31. package/dist/cjs/plugins/fragment/index.js +34 -0
  32. package/dist/cjs/plugins/fragment/plugin-key.js +11 -0
  33. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  34. package/dist/cjs/plugins/index.js +16 -0
  35. package/dist/cjs/plugins/list/actions/conversions.js +39 -71
  36. package/dist/cjs/plugins/list/transforms.js +7 -1
  37. package/dist/cjs/plugins/media/index.js +2 -3
  38. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +3 -1
  39. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +12 -5
  40. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  41. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +6 -4
  42. package/dist/cjs/plugins/media/nodeviews/styles.js +6 -1
  43. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  44. package/dist/cjs/plugins/media/pm-plugins/main.js +49 -15
  45. package/dist/cjs/plugins/media/toolbar/commands.js +59 -0
  46. package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +7 -2
  47. package/dist/cjs/plugins/media/toolbar/index.js +90 -3
  48. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  49. package/dist/cjs/plugins/media/utils/media-common.js +1 -1
  50. package/dist/cjs/plugins/media/utils/media-files.js +5 -1
  51. package/dist/cjs/plugins/panel/actions.js +2 -2
  52. package/dist/cjs/plugins/panel/index.js +3 -3
  53. package/dist/cjs/plugins/panel/nodeviews/panel.js +2 -2
  54. package/dist/cjs/plugins/panel/toolbar.js +10 -5
  55. package/dist/cjs/plugins/panel/utils.js +15 -0
  56. package/dist/cjs/plugins/rank.js +3 -2
  57. package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +49 -1
  58. package/dist/cjs/plugins/status/ui/statusPicker.js +4 -2
  59. package/dist/cjs/plugins/table/commands/insert.js +1 -0
  60. package/dist/cjs/plugins/table/index.js +3 -2
  61. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -3
  62. package/dist/cjs/plugins/table/pm-plugins/main.js +26 -3
  63. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  64. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  65. package/dist/cjs/plugins/table/transforms/column-width.js +14 -5
  66. package/dist/cjs/plugins/table/transforms/fix-tables.js +43 -6
  67. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  68. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  69. package/dist/cjs/plugins/table/ui/common-styles.css.js +1 -1
  70. package/dist/cjs/plugins/table/ui/consts.js +1 -1
  71. package/dist/cjs/plugins/table/ui/messages.js +1 -1
  72. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  73. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  74. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -2
  75. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  76. package/dist/cjs/plugins/text-formatting/index.js +2 -1
  77. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +1 -0
  78. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +77 -26
  79. package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +32 -9
  80. package/dist/cjs/ui/ColorPalette/Color/index.js +8 -18
  81. package/dist/cjs/ui/ColorPalette/index.js +7 -4
  82. package/dist/cjs/ui/ColorPickerButton/index.js +1 -1
  83. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +114 -61
  84. package/dist/cjs/ui/ConfigPanel/FormContent.js +39 -26
  85. package/dist/cjs/ui/ConfigPanel/transformers.js +490 -248
  86. package/dist/cjs/ui/ConfigPanel/utils.js +2 -10
  87. package/dist/cjs/ui/DropdownMenu/index.js +3 -1
  88. package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +1 -1
  89. package/dist/cjs/ui/Resizer/index.js +9 -1
  90. package/dist/cjs/version-wrapper.js +1 -1
  91. package/dist/cjs/version.json +1 -1
  92. package/dist/es2019/create-editor/ReactEditorView.js +19 -8
  93. package/dist/es2019/create-editor/create-plugins-list.js +31 -12
  94. package/dist/es2019/labs/next/presets/cxhtml.js +1 -2
  95. package/dist/es2019/labs/next/presets/default.js +3 -1
  96. package/dist/es2019/nodeviews/ReactNodeView.js +1 -1
  97. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +11 -0
  98. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  99. package/dist/es2019/plugins/annotation/utils.js +18 -7
  100. package/dist/es2019/plugins/avatar-group/index.js +2 -1
  101. package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +3 -2
  102. package/dist/es2019/plugins/before-primaryToolbar/index.js +15 -0
  103. package/dist/es2019/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  104. package/dist/es2019/plugins/code-bidi-warning/index.js +8 -2
  105. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +12 -2
  106. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +16 -5
  107. package/dist/es2019/plugins/code-block/index.js +3 -2
  108. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  109. package/dist/es2019/plugins/code-block/pm-plugins/main.js +11 -3
  110. package/dist/es2019/plugins/extension/extension-api.js +9 -2
  111. package/dist/es2019/plugins/extension/ui/styles.js +6 -0
  112. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  113. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +152 -0
  114. package/dist/es2019/plugins/find-replace/index.js +15 -128
  115. package/dist/es2019/plugins/find-replace/ui/Find.js +18 -10
  116. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +11 -3
  117. package/dist/es2019/plugins/find-replace/ui/Replace.js +12 -4
  118. package/dist/es2019/plugins/find-replace/ui/styles.js +37 -47
  119. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  120. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -2
  121. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  122. package/dist/es2019/plugins/fragment/index.js +22 -0
  123. package/dist/es2019/plugins/fragment/plugin-key.js +2 -0
  124. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  125. package/dist/es2019/plugins/index.js +2 -0
  126. package/dist/es2019/plugins/list/actions/conversions.js +38 -69
  127. package/dist/es2019/plugins/list/transforms.js +5 -1
  128. package/dist/es2019/plugins/media/index.js +2 -2
  129. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +2 -1
  130. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +8 -4
  131. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  132. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +7 -5
  133. package/dist/es2019/plugins/media/nodeviews/styles.js +2 -0
  134. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  135. package/dist/es2019/plugins/media/pm-plugins/main.js +32 -17
  136. package/dist/es2019/plugins/media/toolbar/commands.js +47 -0
  137. package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +6 -2
  138. package/dist/es2019/plugins/media/toolbar/index.js +90 -3
  139. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +7 -1
  140. package/dist/es2019/plugins/media/utils/media-common.js +1 -1
  141. package/dist/es2019/plugins/media/utils/media-files.js +6 -1
  142. package/dist/es2019/plugins/panel/actions.js +2 -2
  143. package/dist/es2019/plugins/panel/index.js +5 -5
  144. package/dist/es2019/plugins/panel/nodeviews/panel.js +2 -2
  145. package/dist/es2019/plugins/panel/toolbar.js +10 -5
  146. package/dist/es2019/plugins/panel/utils.js +8 -1
  147. package/dist/es2019/plugins/rank.js +3 -2
  148. package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +48 -1
  149. package/dist/es2019/plugins/status/ui/statusPicker.js +4 -2
  150. package/dist/es2019/plugins/table/commands/insert.js +1 -2
  151. package/dist/es2019/plugins/table/index.js +2 -1
  152. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  153. package/dist/es2019/plugins/table/pm-plugins/main.js +25 -4
  154. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  155. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  156. package/dist/es2019/plugins/table/transforms/column-width.js +13 -3
  157. package/dist/es2019/plugins/table/transforms/fix-tables.js +43 -5
  158. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  159. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  160. package/dist/es2019/plugins/table/ui/common-styles.css.js +5 -1
  161. package/dist/es2019/plugins/table/ui/consts.js +2 -2
  162. package/dist/es2019/plugins/table/ui/messages.js +1 -1
  163. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  164. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  165. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  166. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  167. package/dist/es2019/plugins/text-formatting/index.js +3 -2
  168. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  169. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  170. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +60 -27
  171. package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +51 -7
  172. package/dist/es2019/ui/ColorPalette/Color/index.js +9 -18
  173. package/dist/es2019/ui/ColorPalette/index.js +7 -4
  174. package/dist/es2019/ui/ColorPickerButton/index.js +1 -1
  175. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +101 -49
  176. package/dist/es2019/ui/ConfigPanel/FormContent.js +35 -26
  177. package/dist/es2019/ui/ConfigPanel/transformers.js +243 -72
  178. package/dist/es2019/ui/ConfigPanel/utils.js +1 -2
  179. package/dist/es2019/ui/Dropdown/index.js +2 -1
  180. package/dist/es2019/ui/DropdownMenu/index.js +7 -3
  181. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
  182. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  183. package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +2 -2
  184. package/dist/es2019/ui/Resizer/index.js +9 -1
  185. package/dist/es2019/version-wrapper.js +1 -1
  186. package/dist/es2019/version.json +1 -1
  187. package/dist/esm/create-editor/ReactEditorView.js +22 -8
  188. package/dist/esm/create-editor/create-plugins-list.js +31 -12
  189. package/dist/esm/labs/next/presets/cxhtml.js +1 -2
  190. package/dist/esm/labs/next/presets/default.js +3 -1
  191. package/dist/esm/nodeviews/ReactNodeView.js +2 -2
  192. package/dist/esm/nodeviews/SelectionBasedNodeView.js +7 -0
  193. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  194. package/dist/esm/plugins/annotation/utils.js +18 -7
  195. package/dist/esm/plugins/avatar-group/index.js +2 -1
  196. package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  197. package/dist/esm/plugins/before-primaryToolbar/index.js +15 -0
  198. package/dist/esm/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  199. package/dist/esm/plugins/code-bidi-warning/index.js +5 -2
  200. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +12 -3
  201. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +15 -5
  202. package/dist/esm/plugins/code-block/index.js +3 -3
  203. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  204. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  205. package/dist/esm/plugins/extension/extension-api.js +9 -2
  206. package/dist/esm/plugins/extension/ui/styles.js +1 -1
  207. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  208. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +155 -0
  209. package/dist/esm/plugins/find-replace/index.js +14 -131
  210. package/dist/esm/plugins/find-replace/ui/Find.js +17 -10
  211. package/dist/esm/plugins/find-replace/ui/FindReplace.js +10 -3
  212. package/dist/esm/plugins/find-replace/ui/Replace.js +11 -4
  213. package/dist/esm/plugins/find-replace/ui/styles.js +39 -18
  214. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  215. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +9 -4
  216. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  217. package/dist/esm/plugins/fragment/index.js +22 -0
  218. package/dist/esm/plugins/fragment/plugin-key.js +2 -0
  219. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  220. package/dist/esm/plugins/index.js +2 -0
  221. package/dist/esm/plugins/list/actions/conversions.js +38 -71
  222. package/dist/esm/plugins/list/transforms.js +7 -1
  223. package/dist/esm/plugins/media/index.js +2 -3
  224. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +2 -1
  225. package/dist/esm/plugins/media/nodeviews/mediaInline.js +11 -6
  226. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  227. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +7 -5
  228. package/dist/esm/plugins/media/nodeviews/styles.js +2 -0
  229. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  230. package/dist/esm/plugins/media/pm-plugins/main.js +47 -16
  231. package/dist/esm/plugins/media/toolbar/commands.js +45 -0
  232. package/dist/esm/plugins/media/toolbar/filePreviewItem.js +6 -2
  233. package/dist/esm/plugins/media/toolbar/index.js +88 -3
  234. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  235. package/dist/esm/plugins/media/utils/media-common.js +1 -1
  236. package/dist/esm/plugins/media/utils/media-files.js +6 -1
  237. package/dist/esm/plugins/panel/actions.js +2 -2
  238. package/dist/esm/plugins/panel/index.js +5 -5
  239. package/dist/esm/plugins/panel/nodeviews/panel.js +2 -2
  240. package/dist/esm/plugins/panel/toolbar.js +9 -4
  241. package/dist/esm/plugins/panel/utils.js +13 -0
  242. package/dist/esm/plugins/rank.js +3 -2
  243. package/dist/esm/plugins/selection/pm-plugins/selection-main.js +50 -1
  244. package/dist/esm/plugins/status/ui/statusPicker.js +4 -2
  245. package/dist/esm/plugins/table/commands/insert.js +1 -2
  246. package/dist/esm/plugins/table/index.js +3 -2
  247. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  248. package/dist/esm/plugins/table/pm-plugins/main.js +27 -4
  249. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  250. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  251. package/dist/esm/plugins/table/transforms/column-width.js +13 -3
  252. package/dist/esm/plugins/table/transforms/fix-tables.js +42 -4
  253. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  254. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  255. package/dist/esm/plugins/table/ui/common-styles.css.js +1 -1
  256. package/dist/esm/plugins/table/ui/consts.js +2 -2
  257. package/dist/esm/plugins/table/ui/messages.js +1 -1
  258. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  259. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  260. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  261. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  262. package/dist/esm/plugins/text-formatting/index.js +3 -2
  263. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  264. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  265. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +67 -27
  266. package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +20 -7
  267. package/dist/esm/ui/ColorPalette/Color/index.js +9 -16
  268. package/dist/esm/ui/ColorPalette/index.js +7 -4
  269. package/dist/esm/ui/ColorPickerButton/index.js +1 -1
  270. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +113 -62
  271. package/dist/esm/ui/ConfigPanel/FormContent.js +39 -26
  272. package/dist/esm/ui/ConfigPanel/transformers.js +488 -248
  273. package/dist/esm/ui/ConfigPanel/utils.js +1 -6
  274. package/dist/esm/ui/Dropdown/index.js +2 -1
  275. package/dist/esm/ui/DropdownMenu/index.js +7 -3
  276. package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
  277. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  278. package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +2 -2
  279. package/dist/esm/ui/Resizer/index.js +9 -1
  280. package/dist/esm/version-wrapper.js +1 -1
  281. package/dist/esm/version.json +1 -1
  282. package/dist/types/labs/next/full-page.d.ts +1 -1
  283. package/dist/types/nodeviews/ReactNodeView.d.ts +1 -1
  284. package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +1 -0
  285. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  286. package/dist/types/plugins/analytics/types/events.d.ts +7 -1
  287. package/dist/types/plugins/annotation/utils.d.ts +1 -1
  288. package/dist/types/plugins/avatar-group/index.d.ts +1 -0
  289. package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +1 -0
  290. package/dist/types/plugins/before-primaryToolbar/index.d.ts +5 -0
  291. package/dist/types/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.d.ts +5 -0
  292. package/dist/types/plugins/code-bidi-warning/index.d.ts +4 -2
  293. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +4 -2
  294. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +2 -1
  295. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +1 -0
  296. package/dist/types/plugins/code-block/index.d.ts +1 -1
  297. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +12 -1
  298. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +3 -1
  299. package/dist/types/plugins/code-block/types.d.ts +2 -0
  300. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  301. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +15 -0
  302. package/dist/types/plugins/find-replace/index.d.ts +1 -0
  303. package/dist/types/plugins/find-replace/ui/Find.d.ts +1 -0
  304. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +1 -0
  305. package/dist/types/plugins/find-replace/ui/Replace.d.ts +1 -0
  306. package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -14
  307. package/dist/types/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +1 -1
  308. package/dist/types/plugins/fragment/index.d.ts +5 -0
  309. package/dist/types/plugins/fragment/plugin-key.d.ts +2 -0
  310. package/dist/types/plugins/index.d.ts +2 -0
  311. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +3 -2
  312. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +2 -2
  313. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  314. package/dist/types/plugins/media/nodeviews/styles.d.ts +2 -0
  315. package/dist/types/plugins/media/toolbar/commands.d.ts +3 -0
  316. package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +2 -0
  317. package/dist/types/plugins/media/types.d.ts +0 -1
  318. package/dist/types/plugins/panel/actions.d.ts +1 -1
  319. package/dist/types/plugins/panel/types.d.ts +8 -2
  320. package/dist/types/plugins/quick-insert/index.d.ts +2 -1
  321. package/dist/types/plugins/table/commands/insert.d.ts +3 -0
  322. package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
  323. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -0
  324. package/dist/types/plugins/table/transforms/column-width.d.ts +4 -1
  325. package/dist/types/plugins/table/transforms/fix-tables.d.ts +3 -2
  326. package/dist/types/plugins/table/types.d.ts +8 -0
  327. package/dist/types/plugins/table/ui/consts.d.ts +1 -1
  328. package/dist/types/types/editor-appearance-component.d.ts +2 -2
  329. package/dist/types/types/editor-props.d.ts +11 -1
  330. package/dist/types/types/feature-flags.d.ts +13 -0
  331. package/dist/types/types/index.d.ts +1 -1
  332. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -2
  333. package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +10 -1
  334. package/dist/types/ui/ColorPalette/Color/index.d.ts +8 -5
  335. package/dist/types/ui/ColorPalette/index.d.ts +1 -0
  336. package/dist/types/ui/ConfigPanel/transformers.d.ts +7 -1
  337. package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
  338. package/dist/types/ui/Resizer/index.d.ts +1 -0
  339. package/package.json +14 -10
  340. package/dist/cjs/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -38
  341. package/dist/es2019/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  342. package/dist/esm/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  343. package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +0 -1
@@ -0,0 +1,22 @@
1
+ import { fragment } from '@atlaskit/adf-schema';
2
+ import { Plugin } from 'prosemirror-state';
3
+ import { pluginKey } from './plugin-key';
4
+ export function createPlugin() {
5
+ return new Plugin({
6
+ key: pluginKey
7
+ });
8
+ }
9
+
10
+ var fragmentMarkPlugin = function fragmentMarkPlugin() {
11
+ return {
12
+ name: 'fragmentPlugin',
13
+ marks: function marks() {
14
+ return [{
15
+ name: 'fragment',
16
+ mark: fragment
17
+ }];
18
+ }
19
+ };
20
+ };
21
+
22
+ export default fragmentMarkPlugin;
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from 'prosemirror-state';
2
+ export var pluginKey = new PluginKey('fragmentMarkPlugin');
@@ -22,7 +22,7 @@ import { isSafeUrl } from '@atlaskit/adf-schema';
22
22
  import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
23
23
  import EditorAlignLeftIcon from '@atlaskit/icon/glyph/editor/align-left';
24
24
  import LinkIcon from '@atlaskit/icon/glyph/link';
25
- import { N80, N30 } from '@atlaskit/theme/colors';
25
+ import { N90, N80, N30 } from '@atlaskit/theme/colors';
26
26
  import Page16Icon from '@atlaskit/icon-object/glyph/page/16';
27
27
  import Tooltip from '@atlaskit/tooltip';
28
28
  import { PureComponent } from 'react';
@@ -42,7 +42,7 @@ import { hideLinkToolbar } from '../../commands';
42
42
  import { hideLinkToolbar as cardHideLinkToolbar } from '../../../card/pm-plugins/actions';
43
43
  import { ScreenReaderText } from '../../styles';
44
44
  export var RECENT_SEARCH_LIST_SIZE = 5;
45
- var ClearText = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n padding-right: 8px;\n color: ", ";\n"])), N80);
45
+ var ClearText = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n padding-right: 8px;\n color: ", ";\n"])), N90);
46
46
  var TextInputWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n border-top: 1px solid ", ";\n border-bottom: 1px solid ", ";\n"])), InputWrapper, N30, N30);
47
47
  var IconWrapper = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n padding: 4px 8px;\n width: 18px;\n"])), N80);
48
48
  export var messages = defineMessages({
@@ -42,6 +42,7 @@ export { default as breakoutPlugin } from './breakout';
42
42
  export { default as alignmentPlugin } from './alignment';
43
43
  export { default as dataConsumerMarkPlugin } from './data-consumer';
44
44
  export { default as editorDisabledPlugin } from './editor-disabled';
45
+ export { default as fragmentMarkPlugin } from './fragment';
45
46
  export { default as indentationPlugin } from './indentation';
46
47
  export { default as annotationPlugin } from './annotation';
47
48
  export { default as analyticsPlugin } from './analytics';
@@ -61,4 +62,5 @@ export { default as clipboardPlugin } from './clipboard';
61
62
  export { default as undoRedoPlugin } from './undo-redo';
62
63
  export { default as avatarGroupPlugin } from './avatar-group';
63
64
  export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
65
+ export { default as beforePrimaryToolbarPlugin } from './before-primaryToolbar';
64
66
  export { default as codeBidiWarningPlugin } from './code-bidi-warning';
@@ -4,6 +4,7 @@ import { findWrapping } from 'prosemirror-transform';
4
4
  import { findParentNodeClosestToPos } from 'prosemirror-utils';
5
5
  import { isListNode, joinSiblingLists } from '../utils/node';
6
6
  import { isEmptyParagraph } from '../../../utils';
7
+ import { findFirstParentListNode } from '../utils/find';
7
8
  export function convertListType(_ref) {
8
9
  var tr = _ref.tr,
9
10
  nextListNodeType = _ref.nextListNodeType;
@@ -29,84 +30,50 @@ export function convertListType(_ref) {
29
30
  var parentNode = nodeRangeAroundList.parent;
30
31
  var startIndex = nodeRangeAroundList.startIndex,
31
32
  endIndex = nodeRangeAroundList.endIndex,
32
- depth = nodeRangeAroundList.depth;
33
- var before = {
34
- from: !isListNode(parentNode.child(startIndex)) ? // @ts-ignore
35
- doc.resolve(nodeRangeAroundList.$from.posAtIndex(startIndex, depth) + 1) : null,
36
- to: null
37
- };
38
- var after = {
39
- from: null,
40
- to: !isListNode(parentNode.child(endIndex - 1)) ? doc.resolve( // @ts-ignore
41
- nodeRangeAroundList.$from.posAtIndex(endIndex - 1, depth) + 1) : null
42
- };
43
- var isListNodeFound = false;
44
- var firstEmptyParagraphAfterListFound = false;
45
-
46
- for (var i = startIndex; i < endIndex; i++) {
47
- // @ts-ignore posAtIndex is a public API but has no type yet
48
- var position = nodeRangeAroundList.$from.posAtIndex(i, depth);
49
- var resolvedPosition = doc.resolve(position);
50
-
51
- if (isEmptyParagraph(parentNode.child(i)) && !isListNodeFound) {
52
- before.from = doc.resolve( // @ts-ignore posAtIndex is a public API but has no type yet
53
- nodeRangeAroundList.$from.posAtIndex(i, depth) + 2);
54
- }
55
-
56
- if (isEmptyParagraph(parentNode.child(i)) && isListNodeFound && !firstEmptyParagraphAfterListFound) {
57
- after.to = resolvedPosition;
58
- firstEmptyParagraphAfterListFound = true;
59
- }
60
-
61
- if (!isListNode(parentNode.child(i)) && !isListNodeFound) {
62
- before.to = doc.resolve(resolvedPosition.pos + 1);
63
- } else if (!isListNodeFound) {
64
- isListNodeFound = true;
65
- var endNodePosition = doc.resolve(resolvedPosition.pos + 1).end() + 1;
66
-
67
- if (doc.resolve(endNodePosition).nodeAfter) {
68
- after.from = doc.resolve(endNodePosition + 1);
33
+ depth = nodeRangeAroundList.depth; // Checking for invalid nodes to prevent conversion
34
+ // eg. a panel cannot be wrapped in a list so return
35
+ // It will skip this check if the selection begins within a list
36
+ // This is to match the behaviour of the toolbar buttons being disabled
37
+
38
+ if (!findFirstParentListNode($from)) {
39
+ for (var i = startIndex; i < endIndex; i++) {
40
+ var position = nodeRangeAroundList.$from.posAtIndex(i, depth);
41
+ var resolvedPosition = doc.resolve(position);
42
+ var currentChild = parentNode.child(i);
43
+ var currentNodeRange = resolvedPosition.blockRange(tr.doc.resolve(position + currentChild.nodeSize));
44
+
45
+ if (currentNodeRange && !isListNode(currentChild) && !findWrapping(currentNodeRange, nextListNodeType)) {
46
+ return;
69
47
  }
70
48
  }
71
- }
72
-
73
- var beforeConversionArgs, beforeRange, afterConversionArgs, afterRange;
74
-
75
- if (after.from && after.to) {
76
- var mappedFrom = tr.mapping.map(after.from.pos);
77
- var mappedTo = tr.mapping.map(after.to.pos);
78
- afterRange = new NodeRange(tr.doc.resolve(mappedFrom), tr.doc.resolve(mappedTo), nodeRangeAroundList.depth);
79
- afterConversionArgs = {
80
- tr: tr,
81
- nextListNodeType: nextListNodeType,
82
- nodeRange: afterRange
83
- };
84
- }
49
+ } // Checking for any non list nodes and wrapping them in a list
50
+ // so they can be converted
85
51
 
86
- if (before.from && before.to) {
87
- var _mappedFrom = tr.mapping.map(before.from.pos);
88
52
 
89
- var _mappedTo = tr.mapping.map(before.to.pos);
53
+ tr.doc.nodesBetween(nodeRangeAroundList.start, nodeRangeAroundList.end, function (node, pos) {
54
+ // Skip over any nodes that are part of a list
55
+ if (findFirstParentListNode(tr.doc.resolve(tr.mapping.map(pos)))) {
56
+ return false;
57
+ } // The following applies to suitable nodes that are not within a list
90
58
 
91
- beforeRange = new NodeRange(tr.doc.resolve(_mappedFrom), tr.doc.resolve(_mappedTo), nodeRangeAroundList.depth);
92
- beforeConversionArgs = {
93
- tr: tr,
94
- nextListNodeType: nextListNodeType,
95
- nodeRange: beforeRange
96
- };
97
- }
98
59
 
99
- if (!afterRange && !beforeRange || afterRange && !findWrapping(afterRange, nextListNodeType) || beforeRange && !findWrapping(beforeRange, nextListNodeType)) {
100
- return;
101
- }
60
+ var currentNodeNotWrappedInList = node;
61
+ var isNotAnEmptyParagraphAndIsParagraphOrLeafNode = !isEmptyParagraph(currentNodeNotWrappedInList) && (!node.type.isBlock || node.type.name === 'paragraph');
102
62
 
103
- if (afterConversionArgs) {
104
- convertAroundList(afterConversionArgs);
105
- }
106
-
107
- if (beforeConversionArgs) {
108
- convertAroundList(beforeConversionArgs);
109
- }
63
+ if (isNotAnEmptyParagraphAndIsParagraphOrLeafNode) {
64
+ var remainingNodeRange = new NodeRange(tr.doc.resolve(tr.mapping.map(pos)), tr.doc.resolve(tr.mapping.map(pos) + currentNodeNotWrappedInList.nodeSize), nodeRangeAroundList.depth);
65
+ convertAroundList({
66
+ tr: tr,
67
+ nextListNodeType: nextListNodeType,
68
+ nodeRange: remainingNodeRange
69
+ });
70
+ return false;
71
+ }
72
+ });
73
+ convertSelectedList({
74
+ tr: tr,
75
+ nextListNodeType: nextListNodeType
76
+ });
110
77
 
111
78
  if (tr.docChanged) {
112
79
  joinSiblingLists({
@@ -194,11 +194,17 @@ var extractListFromParagraph = function extractListFromParagraph(node, parent, s
194
194
  } // Return false to prevent replaceWith from wrapping the text node in a paragraph
195
195
  // paragraph since that will be done later. If it's done here, it will fail
196
196
  // the paragraph.validContent check.
197
+ // Dont return false if there are lists, as they arent validContent for paragraphs
198
+ // and will result in hanging textNodes
197
199
 
198
200
 
201
+ var containsList = listified.some(function (node) {
202
+ return node.type === bulletList || node.type === orderedList;
203
+ });
204
+
199
205
  if (listified.some(function (node) {
200
206
  return node.isText;
201
- })) {
207
+ }) && !containsList) {
202
208
  return false;
203
209
  }
204
210
 
@@ -33,11 +33,10 @@ var mediaPlugin = function mediaPlugin(options) {
33
33
  allowMediaGroup = _ref$allowMediaGroup === void 0 ? true : _ref$allowMediaGroup,
34
34
  _ref$allowMediaSingle = _ref.allowMediaSingle,
35
35
  allowMediaSingle = _ref$allowMediaSingle === void 0 ? false : _ref$allowMediaSingle,
36
- _ref$allowMediaInline = _ref.allowMediaInline,
37
- allowMediaInline = _ref$allowMediaInline === void 0 ? false : _ref$allowMediaInline,
38
36
  featureFlags = _ref.featureFlags;
39
37
 
40
38
  var captions = getMediaFeatureFlag('captions', featureFlags);
39
+ var allowMediaInline = getMediaFeatureFlag('mediaInline', featureFlags);
41
40
  var mediaSingleNode = captions ? mediaSingleWithCaption : mediaSingle;
42
41
  return [{
43
42
  name: 'mediaGroup',
@@ -229,7 +228,7 @@ var mediaPlugin = function mediaPlugin(options) {
229
228
  floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
230
229
  return _floatingToolbar(state, intl, {
231
230
  providerFactory: providerFactory,
232
- allowMediaInline: options && options.allowMediaInline,
231
+ allowMediaInline: options && getMediaFeatureFlag('mediaInline', options.featureFlags),
233
232
  allowResizing: options && options.allowResizing,
234
233
  allowResizingInTables: options && options.allowResizingInTables,
235
234
  allowAnnotation: options && options.allowAnnotation,
@@ -28,6 +28,7 @@ import { isNodeSelectedOrInRange, SelectedState } from '../../../utils/nodes';
28
28
  import { pluginKey as editorDisabledPluginKey } from '../../editor-disabled';
29
29
  import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
30
30
  import { MediaNodeUpdater } from './mediaNodeUpdater';
31
+ import { getMediaFeatureFlag } from '@atlaskit/media-common';
31
32
 
32
33
  var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props) {
33
34
  return isNodeSelectedOrInRange(props.anchorPos, props.headPos, props.getPos(), props.node.nodeSize);
@@ -160,7 +161,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
160
161
  onClick: function onClick() {
161
162
  setNodeSelection(_this.props.view, getNodePos());
162
163
  }
163
- }, mediaInlineOptions(mediaOptions.allowMediaInline));
164
+ }, mediaInlineOptions(getMediaFeatureFlag('mediaInline', mediaOptions.featureFlags)));
164
165
  });
165
166
 
166
167
  return /*#__PURE__*/React.createElement(Filmstrip, {
@@ -1,5 +1,6 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _get from "@babel/runtime/helpers/get";
3
4
  import _inherits from "@babel/runtime/helpers/inherits";
4
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
@@ -12,9 +13,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
14
 
14
15
  import React, { useEffect, useState } from 'react';
15
- import { ReactNodeView } from '../../../nodeviews/';
16
+ import { SelectionBasedNodeView } from '../../../nodeviews/';
16
17
  import { MediaInlineCard } from '@atlaskit/media-card';
17
18
  import { WithProviders } from '@atlaskit/editor-common';
19
+ import { MediaInlineNodeSelector } from './styles';
18
20
  export var MediaInline = function MediaInline(props) {
19
21
  var _useState = useState({}),
20
22
  _useState2 = _slicedToArray(_useState, 2),
@@ -66,12 +68,13 @@ export var MediaInline = function MediaInline(props) {
66
68
  collectionName: collection
67
69
  };
68
70
  return /*#__PURE__*/React.createElement(MediaInlineCard, {
71
+ isSelected: props.isSelected,
69
72
  identifier: identifier,
70
73
  mediaClientConfig: viewMediaClientConfig
71
74
  });
72
75
  };
73
- export var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
74
- _inherits(MediaInlineNodeView, _ReactNodeView);
76
+ export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
77
+ _inherits(MediaInlineNodeView, _SelectionBasedNodeVi);
75
78
 
76
79
  var _super = _createSuper(MediaInlineNodeView);
77
80
 
@@ -86,6 +89,7 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
86
89
  value: function createDomRef() {
87
90
  var domRef = document.createElement('span');
88
91
  domRef.contentEditable = 'false';
92
+ domRef.classList.add(MediaInlineNodeSelector);
89
93
  return domRef;
90
94
  }
91
95
  }, {
@@ -108,7 +112,7 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
108
112
  return true;
109
113
  }
110
114
 
111
- return false;
115
+ return _get(_getPrototypeOf(MediaInlineNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode);
112
116
  }
113
117
  }, {
114
118
  key: "render",
@@ -129,7 +133,8 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
129
133
  return /*#__PURE__*/React.createElement(MediaInline, {
130
134
  identifier: _this.node.attrs.id,
131
135
  mediaProvider: mediaProvider,
132
- node: _this.node
136
+ node: _this.node,
137
+ isSelected: _this.nodeInsideSelection()
133
138
  });
134
139
  }
135
140
  });
@@ -137,7 +142,7 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
137
142
  }]);
138
143
 
139
144
  return MediaInlineNodeView;
140
- }(ReactNodeView);
145
+ }(SelectionBasedNodeView);
141
146
  export var ReactMediaInlineNode = function ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory) {
142
147
  return function (node, view, getPos) {
143
148
  return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
@@ -178,7 +178,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
178
178
 
179
179
  case 2:
180
180
  contextIdentifierProvider = _context3.sent;
181
- return _context3.abrupt("return", contextIdentifierProvider && contextIdentifierProvider.objectId);
181
+ return _context3.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
182
182
 
183
183
  case 4:
184
184
  case "end":
@@ -266,10 +266,10 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
266
266
  var attrs = _this.getAttrs();
267
267
 
268
268
  if (!attrs || attrs.type !== 'file') {
269
- return undefined;
269
+ return null;
270
270
  }
271
271
 
272
- return attrs.__contextId;
272
+ return attrs.__contextId || null;
273
273
  });
274
274
 
275
275
  _defineProperty(this, "updateDimensions", function (dimensions) {
@@ -31,7 +31,7 @@ import { stateKey as mediaPluginKey } from '../pm-plugins/main';
31
31
  import { MediaNodeUpdater } from './mediaNodeUpdater';
32
32
  import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
33
33
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
34
- import { FigureWrapper } from './styles';
34
+ import { FigureWrapper, MediaSingleNodeSelector } from './styles';
35
35
  import { floatingLayouts, isRichMediaInsideOfBlockNode } from '../../../utils/rich-media-utils';
36
36
  import { getAttrsFromUrl } from '@atlaskit/media-client';
37
37
  import { isMediaBlobUrlFromAttrs } from '../utils/media-common';
@@ -416,7 +416,9 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
416
416
  var lineLength = this.getLineLength(view, getPos()) || this.props.lineLength;
417
417
  var isSelected = selected();
418
418
  var shouldShowPlaceholder = getMediaFeatureFlag('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
419
- var MediaChildren = /*#__PURE__*/React.createElement(FigureWrapper, null, /*#__PURE__*/React.createElement("div", {
419
+ var MediaChildren = /*#__PURE__*/React.createElement(FigureWrapper, {
420
+ className: MediaSingleNodeSelector
421
+ }, /*#__PURE__*/React.createElement("div", {
420
422
  ref: this.props.forwardRef
421
423
  }), shouldShowPlaceholder && /*#__PURE__*/React.createElement(CaptionPlaceholder, {
422
424
  onClick: this.clickPlaceholder
@@ -541,7 +543,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
541
543
  }
542
544
  }, {
543
545
  key: "update",
544
- value: function update(node, decorations, isValidUpdate) {
546
+ value: function update(node, decorations, _innerDecorations, isValidUpdate) {
545
547
  var _this3 = this;
546
548
 
547
549
  if (!isValidUpdate) {
@@ -550,7 +552,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
550
552
  };
551
553
  }
552
554
 
553
- return _get(_getPrototypeOf(MediaSingleNodeView.prototype), "update", this).call(this, node, decorations, isValidUpdate);
555
+ return _get(_getPrototypeOf(MediaSingleNodeView.prototype), "update", this).call(this, node, decorations, _innerDecorations, isValidUpdate);
554
556
  }
555
557
  }, {
556
558
  key: "render",
@@ -611,7 +613,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
611
613
  if (offsetLeft !== this.lastOffsetLeft) {
612
614
  this.lastOffsetLeft = offsetLeft;
613
615
  this.forceViewUpdate = true;
614
- this.update(this.node, [], function () {
616
+ this.update(this.node, [], [], function () {
615
617
  return true;
616
618
  });
617
619
  }
@@ -4,6 +4,8 @@ var _templateObject, _templateObject2, _templateObject3;
4
4
 
5
5
  import React from 'react';
6
6
  import styled from 'styled-components';
7
+ export var MediaInlineNodeSelector = 'media-inline-node';
8
+ export var MediaSingleNodeSelector = 'media-single-node';
7
9
  export var FigureWrapper = styled.figure(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0;\n"])));
8
10
  FigureWrapper.displayName = 'FigureWrapper';
9
11
  var AbsoluteDiv = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: 100%;\n height: 100%;\n"])));
@@ -168,6 +168,8 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
168
168
  onClick: this.closeMediaAltTextMenu
169
169
  })), /*#__PURE__*/React.createElement(PanelTextInput, {
170
170
  testId: "alt-text-input",
171
+ ariaLabel: formatMessage(messages.placeholder),
172
+ describedById: "support-text",
171
173
  placeholder: formatMessage(messages.placeholder),
172
174
  defaultValue: this.state.lastValue,
173
175
  onCancel: this.dispatchCancelEvent,
@@ -184,7 +186,9 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
184
186
  })),
185
187
  tooltipContent: formatMessage(messages.clear),
186
188
  onClick: this.handleClearText
187
- }))), !!errorsList.length && /*#__PURE__*/React.createElement(ValidationWrapper, null, errorsList), /*#__PURE__*/React.createElement(SupportText, null, formatMessage(messages.supportText)));
189
+ }))), !!errorsList.length && /*#__PURE__*/React.createElement(ValidationWrapper, null, errorsList), /*#__PURE__*/React.createElement(SupportText, {
190
+ id: "support-text"
191
+ }, formatMessage(messages.supportText)));
188
192
  }
189
193
  }, {
190
194
  key: "fireAnalytics",
@@ -4,6 +4,12 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
 
7
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
+
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
7
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
8
14
 
9
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -13,7 +19,7 @@ import ReactDOM from 'react-dom';
13
19
  import { NodeSelection, Plugin } from 'prosemirror-state';
14
20
  import { insertPoint } from 'prosemirror-transform';
15
21
  import { Decoration, DecorationSet } from 'prosemirror-view';
16
- import { ErrorReporter } from '@atlaskit/editor-common';
22
+ import { ErrorReporter, browser } from '@atlaskit/editor-common';
17
23
  import assert from 'assert';
18
24
  import { findDomRefAtPos, isNodeSelection } from 'prosemirror-utils';
19
25
  import { insertMediaSingleNode, isMediaSingle } from '../utils/media-single';
@@ -27,6 +33,9 @@ import PickerFacade from '../picker-facade';
27
33
  import { INPUT_METHOD } from '../../analytics/types';
28
34
  import { isImage } from '../utils/is-image';
29
35
  import { isInEmptyLine } from '../../../utils/document';
36
+ import { getMediaFeatureFlag } from '@atlaskit/media-common';
37
+ import { isInListItem } from '../../../utils';
38
+ import { CAPTION_PLACEHOLDER_ID } from '../ui/CaptionPlaceholder';
30
39
  export { stateKey } from './plugin-key';
31
40
 
32
41
  var createDropPlaceholder = function createDropPlaceholder(allowDropLine) {
@@ -243,7 +252,7 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
243
252
  mediaSingle = _this$view$state$sche.mediaSingle,
244
253
  media = _this$view$state$sche.media;
245
254
 
246
- if ((_this$mediaOptions = _this.mediaOptions) !== null && _this$mediaOptions !== void 0 && _this$mediaOptions.allowMediaInline) {
255
+ if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions = _this.mediaOptions) === null || _this$mediaOptions === void 0 ? void 0 : _this$mediaOptions.featureFlags)) {
247
256
  return type === mediaSingle || type === media || type === mediaInline;
248
257
  }
249
258
 
@@ -282,7 +291,7 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
282
291
 
283
292
  if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
284
293
  insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert);
285
- } else if ((_this$mediaOptions2 = _this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInline && !isInEmptyLine(state) && !isInsidePotentialEmptyParagraph(state) && canInsertMediaInline(state)) {
294
+ } else if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInListItem(state)) && canInsertMediaInline(state)) {
286
295
  insertMediaInlineNode(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
287
296
  } else {
288
297
  insertMediaGroupNode(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
@@ -590,8 +599,6 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
590
599
  }, {
591
600
  key: "getDomElement",
592
601
  value: function getDomElement(domAtPos) {
593
- var _this$mediaOptions3;
594
-
595
602
  var selection = this.view.state.selection;
596
603
 
597
604
  if (!(selection instanceof NodeSelection)) {
@@ -602,16 +609,14 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
602
609
  return;
603
610
  }
604
611
 
605
- var position = (_this$mediaOptions3 = this.mediaOptions) !== null && _this$mediaOptions3 !== void 0 && _this$mediaOptions3.allowMediaInline ? selection.from + 1 : selection.from;
606
- var node = findDomRefAtPos(position, domAtPos);
612
+ var node = findDomRefAtPos(selection.from, domAtPos);
607
613
 
608
614
  if (node) {
609
615
  if (!node.childNodes.length) {
610
616
  return node.parentNode;
611
617
  }
612
618
 
613
- var target = node.querySelector('figure') || node;
614
- return target;
619
+ return node;
615
620
  }
616
621
 
617
622
  return;
@@ -804,13 +809,31 @@ export var createPlugin = function createPlugin(_schema, options, reactContext,
804
809
  return pluginState;
805
810
  }
806
811
  },
807
- filterTransaction: function filterTransaction(transaction, state) {
808
- // Media node inside mediaSingle should not be selected
809
- // We are relying on plugins/media/nodeviews/mediaNodeView/media.tsx#selectMediaSingleFromCard
810
- // to set selection on correct mediaSingle node,
811
- // We don't use 'appendTransaction' because we would like to avoid have additional transactions
812
- // http://product-fabric.atlassian.net/browse/ED-10091
813
- return !(transaction.selectionSet && isNodeSelection(transaction.selection) && transaction.selection.node.type === state.schema.nodes.media && transaction.selection.$anchor.parent.type === state.schema.nodes.mediaSingle);
812
+ appendTransaction: function appendTransaction(transactions, _oldState, newState) {
813
+ var _iterator = _createForOfIteratorHelper(transactions),
814
+ _step;
815
+
816
+ try {
817
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
818
+ var transaction = _step.value;
819
+ var isSelectionOnMediaInsideMediaSingle = transaction.selectionSet && isNodeSelection(transaction.selection) && transaction.selection.node.type === newState.schema.nodes.media && transaction.selection.$anchor.parent.type === newState.schema.nodes.mediaSingle; // Note: this causes an additional transaction when selecting a media node
820
+ // through clicking on it with the cursor.
821
+
822
+ if (isSelectionOnMediaInsideMediaSingle) {
823
+ // If a selection has been placed on a media inside a media single,
824
+ // we shift it to the media single parent as other code is opinionated about
825
+ // the selection landing there. In particular the caption insertion and selection
826
+ // action.
827
+ return newState.tr.setSelection(NodeSelection.create(newState.doc, transaction.selection.$from.pos - 1));
828
+ }
829
+ }
830
+ } catch (err) {
831
+ _iterator.e(err);
832
+ } finally {
833
+ _iterator.f();
834
+ }
835
+
836
+ return;
814
837
  },
815
838
  key: stateKey,
816
839
  view: function view(_view) {
@@ -866,6 +889,14 @@ export var createPlugin = function createPlugin(_schema, options, reactContext,
866
889
  handleTextInput: function handleTextInput(view) {
867
890
  getMediaPluginState(view.state).splitMediaGroup();
868
891
  return false;
892
+ },
893
+ handleClick: function handleClick(_editorView, _pos, event) {
894
+ var _parentElement;
895
+
896
+ // Workaround for Chrome given a regression introduced in prosemirror-view@1.18.6
897
+ // Returning true prevents that updateSelection() is getting called in the commit below:
898
+ // @see https://github.com/ProseMirror/prosemirror-view/compare/1.18.5...1.18.6
899
+ return Boolean((browser.chrome || browser.safari) && event.target && CAPTION_PLACEHOLDER_ID === ((_parentElement = event.target.parentElement) === null || _parentElement === void 0 ? void 0 : _parentElement.dataset.id));
869
900
  }
870
901
  }
871
902
  });
@@ -0,0 +1,45 @@
1
+ import { NodeSelection } from 'prosemirror-state';
2
+ import { isNodeSelection, removeSelectedNode, safeInsert } from 'prosemirror-utils';
3
+ export var changeInlineToMediaCard = function changeInlineToMediaCard(state, dispatch) {
4
+ var _state$schema$nodes = state.schema.nodes,
5
+ media = _state$schema$nodes.media,
6
+ mediaInline = _state$schema$nodes.mediaInline,
7
+ mediaGroup = _state$schema$nodes.mediaGroup;
8
+ var selectedNode = state.selection instanceof NodeSelection && state.selection.node.type === mediaInline && state.selection.node;
9
+
10
+ if (!selectedNode) {
11
+ return false;
12
+ }
13
+
14
+ var _selectedNode$attrs = selectedNode.attrs,
15
+ id = _selectedNode$attrs.id,
16
+ type = _selectedNode$attrs.type,
17
+ collection = _selectedNode$attrs.collection;
18
+ var mediaNode = media.createChecked({
19
+ id: id,
20
+ type: type,
21
+ collection: collection
22
+ });
23
+ var group = mediaGroup.createChecked({}, mediaNode);
24
+ var nodePos = state.tr.doc.resolve(state.selection.from).end();
25
+ var tr = state.tr;
26
+ tr = removeSelectedNode(tr);
27
+ tr = safeInsert(group, nodePos, true)(tr);
28
+
29
+ if (dispatch) {
30
+ dispatch(tr);
31
+ }
32
+
33
+ return true;
34
+ };
35
+ export var removeInlineCard = function removeInlineCard(state, dispatch) {
36
+ if (isNodeSelection(state.selection)) {
37
+ if (dispatch) {
38
+ dispatch(removeSelectedNode(state.tr));
39
+ }
40
+
41
+ return true;
42
+ }
43
+
44
+ return false;
45
+ };
@@ -2,11 +2,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useState } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import { MediaViewer } from '@atlaskit/media-viewer';
5
+ import { messages } from '@atlaskit/media-ui';
5
6
  import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
6
7
  import ToolbarButton from '../../floating-toolbar/ui/Button';
7
8
  import { getSelectedMediaContainerNodeAttrs } from './utils';
8
9
  export var FilePreviewItem = function FilePreviewItem(_ref) {
9
- var mediaPluginState = _ref.mediaPluginState;
10
+ var mediaPluginState = _ref.mediaPluginState,
11
+ intl = _ref.intl;
10
12
 
11
13
  var _useState = useState(false),
12
14
  _useState2 = _slicedToArray(_useState, 2),
@@ -51,12 +53,14 @@ export var FilePreviewItem = function FilePreviewItem(_ref) {
51
53
  };
52
54
 
53
55
  var mediaViewer = renderMediaViewer();
56
+ var tooltipContent = intl.formatMessage(messages.preview);
54
57
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ToolbarButton, {
55
58
  testId: "file-preview-toolbar-button",
56
59
  key: "editor.media.card.preview",
57
60
  onClick: openMediaViewer,
58
61
  icon: /*#__PURE__*/React.createElement(FilePreviewIcon, {
59
62
  label: "file preview"
60
- })
63
+ }),
64
+ tooltipContent: tooltipContent
61
65
  }), mediaViewer);
62
66
  };