@atlaskit/editor-core 185.2.0 → 185.2.5

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 (258) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/actions/index.js +2 -2
  3. package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -2
  4. package/dist/cjs/index.js +0 -6
  5. package/dist/cjs/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
  6. package/dist/cjs/messages.js +6 -56
  7. package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +2 -2
  8. package/dist/cjs/plugins/base/pm-plugins/scroll-gutter.js +1 -1
  9. package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -2
  10. package/dist/cjs/plugins/card/nodeviews/embedCard.js +6 -6
  11. package/dist/cjs/plugins/card/nodeviews/genericCard.js +2 -1
  12. package/dist/cjs/plugins/card/pm-plugins/doc.js +9 -11
  13. package/dist/cjs/plugins/card/pm-plugins/keymap.js +3 -6
  14. package/dist/cjs/plugins/card/pm-plugins/main.js +2 -2
  15. package/dist/cjs/plugins/card/toolbar.js +13 -16
  16. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +19 -18
  17. package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +7 -10
  18. package/dist/cjs/plugins/card/utils.js +3 -4
  19. package/dist/cjs/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
  20. package/dist/cjs/plugins/custom-autoformat/doc.js +1 -1
  21. package/dist/cjs/plugins/date/pm-plugins/main.js +2 -2
  22. package/dist/cjs/plugins/emoji/index.js +2 -2
  23. package/dist/cjs/plugins/floating-toolbar/index.js +8 -2
  24. package/dist/cjs/plugins/hyperlink/Toolbar.js +8 -8
  25. package/dist/cjs/plugins/hyperlink/commands.js +2 -3
  26. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
  27. package/dist/cjs/plugins/layout/actions.js +1 -1
  28. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  29. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -3
  30. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -2
  31. package/dist/cjs/plugins/media/toolbar/index.js +10 -9
  32. package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +4 -3
  33. package/dist/cjs/plugins/media/toolbar/linking.js +6 -6
  34. package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +1 -1
  35. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +6 -8
  36. package/dist/cjs/plugins/media/utils/media-files.js +8 -7
  37. package/dist/cjs/plugins/mentions/pm-plugins/main.js +2 -2
  38. package/dist/cjs/plugins/placeholder/index.js +2 -3
  39. package/dist/cjs/plugins/status/plugin.js +2 -2
  40. package/dist/cjs/plugins/unsupported-content/index.js +3 -3
  41. package/dist/cjs/ui/LinkSearch/ToolbarComponents.js +4 -11
  42. package/dist/cjs/utils/document.js +7 -249
  43. package/dist/cjs/utils/index.js +1 -23
  44. package/dist/cjs/version-wrapper.js +1 -1
  45. package/dist/cjs/version.json +1 -1
  46. package/dist/es2019/actions/index.js +2 -1
  47. package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
  48. package/dist/es2019/index.js +1 -1
  49. package/dist/es2019/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
  50. package/dist/es2019/messages.js +2 -54
  51. package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  52. package/dist/es2019/plugins/base/pm-plugins/scroll-gutter.js +1 -1
  53. package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
  54. package/dist/es2019/plugins/card/nodeviews/embedCard.js +3 -3
  55. package/dist/es2019/plugins/card/nodeviews/genericCard.js +2 -1
  56. package/dist/es2019/plugins/card/pm-plugins/doc.js +2 -3
  57. package/dist/es2019/plugins/card/pm-plugins/keymap.js +3 -3
  58. package/dist/es2019/plugins/card/pm-plugins/main.js +1 -1
  59. package/dist/es2019/plugins/card/toolbar.js +8 -10
  60. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +10 -8
  61. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -4
  62. package/dist/es2019/plugins/card/utils.js +1 -2
  63. package/dist/es2019/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
  64. package/dist/es2019/plugins/custom-autoformat/doc.js +1 -1
  65. package/dist/es2019/plugins/date/pm-plugins/main.js +1 -1
  66. package/dist/es2019/plugins/emoji/index.js +1 -1
  67. package/dist/es2019/plugins/floating-toolbar/index.js +5 -2
  68. package/dist/es2019/plugins/hyperlink/Toolbar.js +3 -3
  69. package/dist/es2019/plugins/hyperlink/commands.js +1 -2
  70. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
  71. package/dist/es2019/plugins/layout/actions.js +1 -1
  72. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  73. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
  74. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  75. package/dist/es2019/plugins/media/toolbar/index.js +10 -9
  76. package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
  77. package/dist/es2019/plugins/media/toolbar/linking.js +4 -4
  78. package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +1 -1
  79. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
  80. package/dist/es2019/plugins/media/utils/media-files.js +4 -3
  81. package/dist/es2019/plugins/mentions/pm-plugins/main.js +1 -1
  82. package/dist/es2019/plugins/placeholder/index.js +1 -1
  83. package/dist/es2019/plugins/status/plugin.js +1 -1
  84. package/dist/es2019/plugins/unsupported-content/index.js +1 -1
  85. package/dist/es2019/ui/LinkSearch/ToolbarComponents.js +1 -4
  86. package/dist/es2019/utils/document.js +3 -244
  87. package/dist/es2019/utils/index.js +1 -4
  88. package/dist/es2019/version-wrapper.js +1 -1
  89. package/dist/es2019/version.json +1 -1
  90. package/dist/esm/actions/index.js +2 -1
  91. package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
  92. package/dist/esm/index.js +1 -1
  93. package/dist/esm/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
  94. package/dist/esm/messages.js +2 -54
  95. package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  96. package/dist/esm/plugins/base/pm-plugins/scroll-gutter.js +1 -1
  97. package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
  98. package/dist/esm/plugins/card/nodeviews/embedCard.js +3 -3
  99. package/dist/esm/plugins/card/nodeviews/genericCard.js +2 -1
  100. package/dist/esm/plugins/card/pm-plugins/doc.js +2 -3
  101. package/dist/esm/plugins/card/pm-plugins/keymap.js +3 -3
  102. package/dist/esm/plugins/card/pm-plugins/main.js +1 -1
  103. package/dist/esm/plugins/card/toolbar.js +8 -10
  104. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +18 -16
  105. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -4
  106. package/dist/esm/plugins/card/utils.js +1 -2
  107. package/dist/esm/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
  108. package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
  109. package/dist/esm/plugins/date/pm-plugins/main.js +1 -1
  110. package/dist/esm/plugins/emoji/index.js +1 -1
  111. package/dist/esm/plugins/floating-toolbar/index.js +5 -2
  112. package/dist/esm/plugins/hyperlink/Toolbar.js +3 -3
  113. package/dist/esm/plugins/hyperlink/commands.js +1 -2
  114. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
  115. package/dist/esm/plugins/layout/actions.js +1 -1
  116. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  117. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  118. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  119. package/dist/esm/plugins/media/toolbar/index.js +10 -9
  120. package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
  121. package/dist/esm/plugins/media/toolbar/linking.js +4 -4
  122. package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +1 -1
  123. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
  124. package/dist/esm/plugins/media/utils/media-files.js +4 -3
  125. package/dist/esm/plugins/mentions/pm-plugins/main.js +1 -1
  126. package/dist/esm/plugins/placeholder/index.js +1 -1
  127. package/dist/esm/plugins/status/plugin.js +1 -1
  128. package/dist/esm/plugins/unsupported-content/index.js +1 -1
  129. package/dist/esm/ui/LinkSearch/ToolbarComponents.js +1 -4
  130. package/dist/esm/utils/document.js +6 -240
  131. package/dist/esm/utils/index.js +1 -4
  132. package/dist/esm/version-wrapper.js +1 -1
  133. package/dist/esm/version.json +1 -1
  134. package/dist/types/index.d.ts +1 -2
  135. package/dist/types/labs/next/presets/cxhtml.d.ts +9 -3
  136. package/dist/types/labs/next/presets/default.d.ts +13 -1
  137. package/dist/types/labs/next/presets/mobile.d.ts +9 -3
  138. package/dist/types/messages.d.ts +2 -53
  139. package/dist/types/plugins/card/index.d.ts +3 -1
  140. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +1 -1
  141. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +3 -3
  142. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
  143. package/dist/types/plugins/card/toolbar.d.ts +1 -1
  144. package/dist/types/plugins/card/types.d.ts +1 -1
  145. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +7 -4
  146. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
  147. package/dist/types/plugins/date/nodeviews/date.d.ts +1 -1
  148. package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +1 -1
  149. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -6
  150. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
  151. package/dist/types/plugins/hyperlink/Toolbar.d.ts +1 -1
  152. package/dist/types/plugins/hyperlink/commands.d.ts +2 -3
  153. package/dist/types/plugins/hyperlink/index.d.ts +1 -1
  154. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
  155. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
  156. package/dist/types/plugins/media/index.d.ts +3 -1
  157. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +1 -1
  158. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -1
  159. package/dist/types/plugins/media/nodeviews/types.d.ts +1 -1
  160. package/dist/types/plugins/media/toolbar/linking.d.ts +3 -1
  161. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
  162. package/dist/types/plugins/media/utils/media-files.d.ts +1 -1
  163. package/dist/types/plugins/mentions/nodeviews/mention.d.ts +1 -1
  164. package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
  165. package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
  166. package/dist/types/types/editor-props.d.ts +1 -1
  167. package/dist/types/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
  168. package/dist/types/utils/document.d.ts +0 -12
  169. package/dist/types/utils/index.d.ts +1 -2
  170. package/dist/types-ts4.5/index.d.ts +1 -2
  171. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +9 -3
  172. package/dist/types-ts4.5/labs/next/presets/default.d.ts +13 -1
  173. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +9 -3
  174. package/dist/types-ts4.5/messages.d.ts +2 -53
  175. package/dist/types-ts4.5/plugins/card/index.d.ts +3 -1
  176. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +1 -1
  177. package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +3 -3
  178. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -1
  179. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -1
  180. package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
  181. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +7 -4
  182. package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
  183. package/dist/types-ts4.5/plugins/date/nodeviews/date.d.ts +1 -1
  184. package/dist/types-ts4.5/plugins/emoji/nodeviews/emoji.d.ts +1 -1
  185. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +2 -9
  186. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
  187. package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +1 -1
  188. package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +2 -3
  189. package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +1 -1
  190. package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
  191. package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
  192. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  193. package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +1 -1
  194. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -1
  195. package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +1 -1
  196. package/dist/types-ts4.5/plugins/media/toolbar/linking.d.ts +3 -1
  197. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
  198. package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +1 -1
  199. package/dist/types-ts4.5/plugins/mentions/nodeviews/mention.d.ts +1 -1
  200. package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +1 -1
  201. package/dist/types-ts4.5/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
  202. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  203. package/dist/types-ts4.5/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
  204. package/dist/types-ts4.5/utils/document.d.ts +0 -12
  205. package/dist/types-ts4.5/utils/index.d.ts +1 -2
  206. package/package.json +11 -14
  207. package/report.api.md +11 -34
  208. package/tmp/api-report-tmp.d.ts +10 -34
  209. package/dist/cjs/nodeviews/getInlineNodeViewProducer.js +0 -227
  210. package/dist/cjs/plugins/hyperlink/types.js +0 -5
  211. package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +0 -152
  212. package/dist/cjs/ui/Resizer/index.js +0 -210
  213. package/dist/cjs/ui/Resizer/styled.js +0 -15
  214. package/dist/cjs/ui/Resizer/types.js +0 -5
  215. package/dist/cjs/ui/Resizer/utils.js +0 -21
  216. package/dist/cjs/utils/filter/privacy-filter.js +0 -55
  217. package/dist/cjs/utils/linking-utils.js +0 -84
  218. package/dist/cjs/utils/rich-media-utils.js +0 -130
  219. package/dist/es2019/nodeviews/getInlineNodeViewProducer.js +0 -221
  220. package/dist/es2019/plugins/hyperlink/types.js +0 -1
  221. package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +0 -159
  222. package/dist/es2019/ui/Resizer/index.js +0 -191
  223. package/dist/es2019/ui/Resizer/styled.js +0 -15
  224. package/dist/es2019/ui/Resizer/types.js +0 -1
  225. package/dist/es2019/ui/Resizer/utils.js +0 -12
  226. package/dist/es2019/utils/filter/privacy-filter.js +0 -47
  227. package/dist/es2019/utils/linking-utils.js +0 -74
  228. package/dist/es2019/utils/rich-media-utils.js +0 -108
  229. package/dist/esm/nodeviews/getInlineNodeViewProducer.js +0 -217
  230. package/dist/esm/plugins/hyperlink/types.js +0 -1
  231. package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +0 -144
  232. package/dist/esm/ui/Resizer/index.js +0 -203
  233. package/dist/esm/ui/Resizer/styled.js +0 -7
  234. package/dist/esm/ui/Resizer/types.js +0 -1
  235. package/dist/esm/ui/Resizer/utils.js +0 -12
  236. package/dist/esm/utils/filter/privacy-filter.js +0 -48
  237. package/dist/esm/utils/linking-utils.js +0 -74
  238. package/dist/esm/utils/rich-media-utils.js +0 -117
  239. package/dist/types/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
  240. package/dist/types/plugins/hyperlink/types.d.ts +0 -35
  241. package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
  242. package/dist/types/ui/Resizer/index.d.ts +0 -41
  243. package/dist/types/ui/Resizer/styled.d.ts +0 -2
  244. package/dist/types/ui/Resizer/types.d.ts +0 -26
  245. package/dist/types/ui/Resizer/utils.d.ts +0 -6
  246. package/dist/types/utils/filter/privacy-filter.d.ts +0 -9
  247. package/dist/types/utils/linking-utils.d.ts +0 -14
  248. package/dist/types/utils/rich-media-utils.d.ts +0 -8
  249. package/dist/types-ts4.5/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
  250. package/dist/types-ts4.5/plugins/hyperlink/types.d.ts +0 -35
  251. package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
  252. package/dist/types-ts4.5/ui/Resizer/index.d.ts +0 -41
  253. package/dist/types-ts4.5/ui/Resizer/styled.d.ts +0 -2
  254. package/dist/types-ts4.5/ui/Resizer/types.d.ts +0 -26
  255. package/dist/types-ts4.5/ui/Resizer/utils.d.ts +0 -6
  256. package/dist/types-ts4.5/utils/filter/privacy-filter.d.ts +0 -9
  257. package/dist/types-ts4.5/utils/linking-utils.d.ts +0 -14
  258. package/dist/types-ts4.5/utils/rich-media-utils.d.ts +0 -8
@@ -1,9 +1,7 @@
1
- import { Node, Fragment } from 'prosemirror-model';
2
- import { transformMediaLinkMarks, transformTextLinkCodeMarks, transformDedupeMarks, transformNodesMissingContent, transformIndentationMarks, transformInvalidMediaContent } from '@atlaskit/adf-utils/transforms';
3
- import { sanitizeNodeForPrivacy } from '../utils/filter/privacy-filter';
4
- import { isEmptyParagraph, validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common/utils';
1
+ import { Fragment } from 'prosemirror-model';
2
+ import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
5
3
  import { getBreakoutMode } from './node-width';
6
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../plugins/analytics/types/enums';
4
+ import { processRawValue, hasDocAsParent, getStepRange } from '@atlaskit/editor-common/utils';
7
5
 
8
6
  /**
9
7
  * Returns false if node contains only empty inline nodes and hardBreaks.
@@ -46,25 +44,6 @@ export function isNodeEmpty(node) {
46
44
  });
47
45
  return !nonBlock.length && !block.filter(childNode => !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom).length;
48
46
  }
49
-
50
- /**
51
- * Checks if a node looks like an empty document
52
- */
53
- export function isEmptyDocument(node) {
54
- const nodeChild = node.content.firstChild;
55
- if (node.childCount !== 1 || !nodeChild) {
56
- return false;
57
- }
58
- return isEmptyParagraph(nodeChild);
59
- }
60
-
61
- // Checks to see if the parent node is the document, ie not contained within another entity
62
- export function hasDocAsParent($anchor) {
63
- return $anchor.depth === 1;
64
- }
65
- export function isProseMirrorSchemaCheckError(error) {
66
- return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
67
- }
68
47
  export function isInEmptyLine(state) {
69
48
  const {
70
49
  selection
@@ -82,27 +61,6 @@ export function isInEmptyLine(state) {
82
61
  }
83
62
  return isEmptyParagraph(node) && hasDocAsParent($anchor);
84
63
  }
85
- export function bracketTyped(state) {
86
- const {
87
- selection
88
- } = state;
89
- const {
90
- $cursor,
91
- $anchor
92
- } = selection;
93
- if (!$cursor) {
94
- return false;
95
- }
96
- const node = $cursor.nodeBefore;
97
- if (!node) {
98
- return false;
99
- }
100
- if (node.type.name === 'text' && node.text === '{') {
101
- const paragraphNode = $anchor.node();
102
- return paragraphNode.marks.length === 0 && hasDocAsParent($anchor);
103
- }
104
- return false;
105
- }
106
64
  export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
107
65
  if (!value) {
108
66
  return;
@@ -113,205 +71,6 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
113
71
  }
114
72
  return Fragment.from(adfEntities);
115
73
  }
116
- export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
117
- if (!value) {
118
- return;
119
- }
120
- let node;
121
- if (typeof value === 'string') {
122
- try {
123
- if (contentTransformer) {
124
- const doc = contentTransformer.parse(value);
125
- node = doc.toJSON();
126
- } else {
127
- node = JSON.parse(value);
128
- }
129
- } catch (e) {
130
- // eslint-disable-next-line no-console
131
- console.error(`Error processing value: ${value} isn't a valid JSON`);
132
- return;
133
- }
134
- } else {
135
- node = value;
136
- }
137
- if (Array.isArray(node)) {
138
- // eslint-disable-next-line no-console
139
- console.error(`Error processing value: ${node} is an array, but it must be an object.`);
140
- return;
141
- }
142
- try {
143
- // ProseMirror always require a child under doc
144
- if (node.type === 'doc') {
145
- if (Array.isArray(node.content) && node.content.length === 0) {
146
- node.content.push({
147
- type: 'paragraph',
148
- content: []
149
- });
150
- }
151
- // Just making sure doc is always valid
152
- if (!node.version) {
153
- node.version = 1;
154
- }
155
- }
156
- if (contentTransformer) {
157
- return Node.fromJSON(schema, node);
158
- }
159
-
160
- // link mark on mediaSingle is deprecated, need to move link mark to child media node
161
- // https://product-fabric.atlassian.net/browse/ED-14043
162
- let {
163
- transformedAdf,
164
- isTransformed
165
- } = transformMediaLinkMarks(node);
166
- if (isTransformed && dispatchAnalyticsEvent) {
167
- dispatchAnalyticsEvent({
168
- action: ACTION.MEDIA_LINK_TRANSFORMED,
169
- actionSubject: ACTION_SUBJECT.EDITOR,
170
- eventType: EVENT_TYPE.OPERATIONAL
171
- });
172
- }
173
-
174
- // See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
175
- // We declared in code mark spec that links and marks should not co-exist on
176
- // text nodes. This util strips code marks from bad text nodes and preserves links.
177
- // Otherwise, prosemirror will try to repair the invalid document by stripping links
178
- // and preserving code marks during content changes.
179
- ({
180
- transformedAdf,
181
- isTransformed
182
- } = transformTextLinkCodeMarks(transformedAdf));
183
- if (isTransformed && dispatchAnalyticsEvent) {
184
- dispatchAnalyticsEvent({
185
- action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
186
- actionSubject: ACTION_SUBJECT.EDITOR,
187
- eventType: EVENT_TYPE.OPERATIONAL
188
- });
189
- }
190
- let discardedMarks = [];
191
- ({
192
- transformedAdf,
193
- isTransformed,
194
- discardedMarks
195
- } = transformDedupeMarks(transformedAdf));
196
- if (isTransformed && dispatchAnalyticsEvent) {
197
- dispatchAnalyticsEvent({
198
- action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
199
- actionSubject: ACTION_SUBJECT.EDITOR,
200
- eventType: EVENT_TYPE.OPERATIONAL,
201
- attributes: {
202
- /** UGC WARNING
203
- *
204
- * DO NOT include the `mark` attributes inside, we map here to only
205
- * extract the mark type as that is the only non-UGC safe information
206
- * that we can add to event-attributes
207
- *
208
- */
209
- discardedMarkTypes: discardedMarks.map(mark => mark.type)
210
- }
211
- });
212
- }
213
- ({
214
- transformedAdf,
215
- isTransformed
216
- } = transformNodesMissingContent(transformedAdf));
217
- if (isTransformed && dispatchAnalyticsEvent) {
218
- dispatchAnalyticsEvent({
219
- action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
220
- actionSubject: ACTION_SUBJECT.EDITOR,
221
- eventType: EVENT_TYPE.OPERATIONAL
222
- });
223
- }
224
- ({
225
- transformedAdf,
226
- isTransformed
227
- } = transformIndentationMarks(transformedAdf));
228
- if (isTransformed && dispatchAnalyticsEvent) {
229
- dispatchAnalyticsEvent({
230
- action: ACTION.INDENTATION_MARKS_TRANSFORMED,
231
- actionSubject: ACTION_SUBJECT.EDITOR,
232
- eventType: EVENT_TYPE.OPERATIONAL
233
- });
234
- }
235
- ({
236
- transformedAdf,
237
- isTransformed
238
- } = transformInvalidMediaContent(transformedAdf));
239
- if (isTransformed && dispatchAnalyticsEvent) {
240
- dispatchAnalyticsEvent({
241
- action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
242
- actionSubject: ACTION_SUBJECT.EDITOR,
243
- eventType: EVENT_TYPE.OPERATIONAL
244
- });
245
- }
246
- const entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
247
- let newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
248
- const parsedDoc = Node.fromJSON(schema, newEntity);
249
-
250
- // throws an error if the document is invalid
251
- try {
252
- parsedDoc.check();
253
- } catch (err) {
254
- if (dispatchAnalyticsEvent) {
255
- dispatchAnalyticsEvent({
256
- action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
257
- actionSubject: ACTION_SUBJECT.EDITOR,
258
- eventType: EVENT_TYPE.OPERATIONAL,
259
- attributes: {
260
- errorStack: err instanceof Error ? err.stack : String(err)
261
- }
262
- });
263
- }
264
- throw err;
265
- }
266
- if (dispatchAnalyticsEvent) {
267
- findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
268
- }
269
- return parsedDoc;
270
- } catch (e) {
271
- if (dispatchAnalyticsEvent) {
272
- dispatchAnalyticsEvent({
273
- action: ACTION.DOCUMENT_PROCESSING_ERROR,
274
- actionSubject: ACTION_SUBJECT.EDITOR,
275
- eventType: EVENT_TYPE.OPERATIONAL,
276
- nonPrivacySafeAttributes: {
277
- errorStack: e instanceof Error ? e.stack : String(e)
278
- }
279
- });
280
- }
281
-
282
- // eslint-disable-next-line no-console
283
- console.error(`Error processing document:\n${e instanceof Error ? e.message : String(e)}\n\n`, JSON.stringify(node));
284
- if (isProseMirrorSchemaCheckError(e)) {
285
- throw e;
286
- }
287
- return;
288
- }
289
- }
290
- const maySanitizePrivateContent = (entity, providerFactory, sanitizePrivateContent) => {
291
- if (sanitizePrivateContent && providerFactory) {
292
- return sanitizeNodeForPrivacy(entity, providerFactory);
293
- }
294
- return entity;
295
- };
296
- export const getStepRange = transaction => {
297
- let from = -1;
298
- let to = -1;
299
- transaction.mapping.maps.forEach((stepMap, index) => {
300
- stepMap.forEach((oldStart, oldEnd) => {
301
- const newStart = transaction.mapping.slice(index).map(oldStart, -1);
302
- const newEnd = transaction.mapping.slice(index).map(oldEnd);
303
- from = newStart < from || from === -1 ? newStart : from;
304
- to = newEnd > to || to === -1 ? newEnd : to;
305
- });
306
- });
307
- if (from !== -1) {
308
- return {
309
- from,
310
- to
311
- };
312
- }
313
- return null;
314
- };
315
74
 
316
75
  /**
317
76
  * Find the farthest node given a condition
@@ -7,7 +7,7 @@ import { isNodeEmpty } from './document';
7
7
  import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
8
8
  import { isMediaNode } from '@atlaskit/editor-common/utils';
9
9
  export { insideTable } from '@atlaskit/editor-common/core-utils';
10
- export { hasVisibleContent, isNodeEmpty, isEmptyDocument, processRawValue, getStepRange, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
10
+ export { hasVisibleContent, isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
11
11
  export { sanitiseMarksInSelection } from './mark';
12
12
  export { isParagraph, isText, isLinkMark } from './nodes';
13
13
  export { setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
@@ -282,9 +282,6 @@ export const insideTableCell = state => {
282
282
  } = state.schema.nodes;
283
283
  return hasParentNodeOfType([tableCell, tableHeader])(state.selection);
284
284
  };
285
- export const isInLayoutColumn = state => {
286
- return hasParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
287
- };
288
285
  export const isInListItem = state => {
289
286
  return hasParentNodeOfType(state.schema.nodes.listItem)(state.selection);
290
287
  };
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "185.2.0";
2
+ export const version = "185.2.5";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.0",
3
+ "version": "185.2.5",
4
4
  "sideEffects": false
5
5
  }
@@ -13,7 +13,8 @@ import { findNodePosWithLocalId } from '../plugins/extension/utils';
13
13
  import { toJSON } from '../utils';
14
14
  import { getEditorValueWithMedia, __temporaryFixForConfigPanel as _temporaryFixForConfigPanel } from '../utils/action';
15
15
  import deprecationWarnings from '../utils/deprecation-warnings';
16
- import { isEmptyDocument, processRawFragmentValue, processRawValue } from '../utils/document';
16
+ import { isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
17
+ import { processRawFragmentValue } from '../utils/document';
17
18
  import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
18
19
  var EditorActions = /*#__PURE__*/function () {
19
20
  function EditorActions() {
@@ -18,7 +18,7 @@ import { editorMessages } from './messages';
18
18
  import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
19
19
  import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
20
20
  import { createDispatch, EventDispatcher } from '../event-dispatcher';
21
- import { processRawValue } from '../utils';
21
+ import { processRawValue } from '@atlaskit/editor-common/utils';
22
22
  import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
23
23
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
24
24
  import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
package/dist/esm/index.js CHANGED
@@ -44,7 +44,7 @@ export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } f
44
44
  export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
45
45
 
46
46
  // Used in editor-test-helpers and mobile bridge
47
- export { setTextSelection, dedupe, getNodesCount, measurements, hasVisibleContent, isEmptyDocument } from './utils';
47
+ export { setTextSelection, dedupe, getNodesCount, measurements, hasVisibleContent } from './utils';
48
48
  export { getListCommands } from './utils/list-commands';
49
49
  export { ReactEditorView, BaseReactEditorView } from './create-editor';
50
50
  export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
@@ -2,7 +2,7 @@ import { EditorView } from 'prosemirror-view';
2
2
  import { EditorState } from 'prosemirror-state';
3
3
  import { EventDispatcher, createDispatch } from '../../../../../event-dispatcher';
4
4
  import { processPluginsList, createPMPlugins } from '../../../../../create-editor/create-editor';
5
- import { processRawValue } from '../../../../../utils';
5
+ import { processRawValue } from '@atlaskit/editor-common/utils';
6
6
  import { createSchema } from '../../../../../create-editor/create-schema';
7
7
  export function createEditor(_ref) {
8
8
  var context = _ref.context,
@@ -1,61 +1,9 @@
1
1
  // Common Translations will live here
2
- import { defineMessages } from 'react-intl-next';
3
- import commonMessages, { linkMessages } from '@atlaskit/editor-common/messages';
2
+ import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
4
3
  import { messages as statusMessages } from './plugins/status/nodeviews/messages';
5
4
  import { messages as dateMessages } from './plugins/date/nodeviews/messages';
6
5
  export { linkMessages };
7
6
  export { statusMessages };
8
7
  export { dateMessages };
9
- export var linkToolbarMessages = defineMessages({
10
- addLink: {
11
- id: 'fabric.editor.mediaAddLink',
12
- defaultMessage: 'Add link',
13
- description: 'Add link'
14
- },
15
- unableToOpenLink: {
16
- id: 'fabric.editor.unableToOpenLink',
17
- defaultMessage: 'Unable to open this link',
18
- description: 'Unable to open this link'
19
- },
20
- unlink: {
21
- id: 'fabric.editor.unlink',
22
- defaultMessage: 'Unlink',
23
- description: 'Removes the hyperlink but keeps your text.'
24
- },
25
- editLink: {
26
- id: 'fabric.editor.editLink',
27
- defaultMessage: 'Edit link',
28
- description: 'Edit the link, update display text'
29
- },
30
- placeholder: {
31
- id: 'fabric.editor.hyperlinkToolbarPlaceholder',
32
- defaultMessage: 'Paste or search for link',
33
- description: 'Paste or search for link'
34
- },
35
- linkPlaceholder: {
36
- id: 'fabric.editor.linkPlaceholder',
37
- defaultMessage: 'Paste link',
38
- description: 'Create a new link by pasting a URL.'
39
- },
40
- linkAddress: {
41
- id: 'fabric.editor.linkAddress',
42
- defaultMessage: 'Link address',
43
- description: 'Insert the address of the link'
44
- },
45
- invalidLink: {
46
- id: 'fabric.editor.invalidLink',
47
- defaultMessage: 'Please enter a valid link.',
48
- description: 'Please enter a valid link.'
49
- },
50
- emptyLink: {
51
- id: 'fabric.editor.emptyLink',
52
- defaultMessage: 'Please enter a link.',
53
- description: 'Please enter a link.'
54
- },
55
- settingsLink: {
56
- id: 'fabric.editor.settingsLinks',
57
- defaultMessage: 'Go to Link Preferences',
58
- description: 'Go to Link Preferences'
59
- }
60
- });
8
+ export { linkToolbarMessages };
61
9
  export default commonMessages;
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
  var _templateObject;
3
3
  import { css } from '@emotion/react';
4
4
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
5
- import { inlineNodeViewClassname } from './getInlineNodeViewProducer';
5
+ import { inlineNodeViewClassname } from '@atlaskit/editor-common/react-node-view';
6
6
 
7
7
  // For reasoning behind styles, see comments in:
8
8
  // ./getInlineNodeViewProducer -> portalChildren()
@@ -1,5 +1,5 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { isEmptyDocument } from '../../../utils';
2
+ import { isEmptyDocument } from '@atlaskit/editor-common/utils';
3
3
  import { getMobileDimensionsPluginState } from '../../mobile-dimensions/utils';
4
4
  export var GUTTER_SIZE_IN_PX = 120; // Default gutter size
5
5
  export var GUTTER_SIZE_MOBILE_IN_PX = 36; // Gutter size for Mobile
@@ -14,7 +14,7 @@ import { browser } from '@atlaskit/editor-common/utils';
14
14
  import PropTypes from 'prop-types';
15
15
  import rafSchedule from 'raf-schd';
16
16
  import { Card } from './genericCard';
17
- import { ReactNodeView } from '../../../nodeviews/';
17
+ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
18
18
  import { registerCard } from '../pm-plugins/actions';
19
19
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
20
20
  export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
@@ -21,7 +21,7 @@ import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/e
21
21
  import { SelectionBasedNodeView } from '../../../nodeviews/';
22
22
  import { registerCard } from '../pm-plugins/actions';
23
23
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
24
- import { floatingLayouts, isRichMediaInsideOfBlockNode } from '../../../utils/rich-media-utils';
24
+ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
25
25
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
26
26
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
27
27
  var CardInner = function CardInner(_ref) {
@@ -71,8 +71,8 @@ var CardInner = function CardInner(_ref) {
71
71
  }), smartCard);
72
72
  }
73
73
  var displayGrid = function displayGrid(visible, gridType, highlight) {
74
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
75
- return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.displayGrid(view)({
74
+ var _pluginInjectionApi$d;
75
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.grid.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.displayGrid(view)({
76
76
  visible: visible,
77
77
  gridType: gridType,
78
78
  highlight: highlight
@@ -80,6 +80,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
80
80
  // (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
81
81
 
82
82
  if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
83
+ var _pluginInjectionApi$d;
83
84
  this.setState({
84
85
  isError: true
85
86
  });
@@ -93,7 +94,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
93
94
  if (!getPos || typeof getPos === 'boolean') {
94
95
  return;
95
96
  }
96
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.analytics.actions)(view.state, view.dispatch);
97
+ changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions)(view.state, view.dispatch);
97
98
  return null;
98
99
  } else {
99
100
  // Otherwise, render a blue link as fallback (above in render()).
@@ -6,9 +6,8 @@ import { NodeSelection, TextSelection } from 'prosemirror-state';
6
6
  import { closeHistory } from 'prosemirror-history';
7
7
  import { isSafeUrl } from '@atlaskit/adf-schema';
8
8
  import { addLinkMetadata } from '@atlaskit/editor-common/card';
9
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics';
10
- import { nodesBetweenChanged, processRawValue } from '../../../utils';
11
- import { unlinkPayload } from '../../../utils/linking-utils';
9
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
10
+ import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
12
11
  import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
13
12
  import { appearanceForNodeType, selectedCardAppearance } from '../utils';
14
13
  import { queueCards, resolveCard } from './actions';
@@ -1,6 +1,6 @@
1
1
  import { keymap } from 'prosemirror-keymap';
2
2
  import { NodeSelection } from 'prosemirror-state';
3
- import * as keymaps from '../../../keymaps';
3
+ import { bindKeymapWithCommand, moveDown, moveUp } from '@atlaskit/editor-common/keymaps';
4
4
  import { findChildren, flatten } from 'prosemirror-utils';
5
5
  import { browser } from '@atlaskit/editor-common/utils';
6
6
  var lookupPixel = 10;
@@ -51,8 +51,8 @@ export function cardKeymap(featureFlags) {
51
51
 
52
52
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1227468 introduced since Chrome 91
53
53
  if (browser.chrome && browser.chrome_version > 90 && featureFlags.chromeCursorHandlerFixedVersion && browser.chrome_version < featureFlags.chromeCursorHandlerFixedVersion) {
54
- keymaps.bindKeymapWithCommand(keymaps.moveUp.common, selectAboveBelowInlineCard('up'), list);
55
- keymaps.bindKeymapWithCommand(keymaps.moveDown.common, selectAboveBelowInlineCard('down'), list);
54
+ bindKeymapWithCommand(moveUp.common, selectAboveBelowInlineCard('up'), list);
55
+ bindKeymapWithCommand(moveDown.common, selectAboveBelowInlineCard('down'), list);
56
56
  }
57
57
  return keymap(list);
58
58
  }
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import rafSchedule from 'raf-schd';
4
- import { getInlineNodeViewProducer } from '../../../nodeviews/getInlineNodeViewProducer';
4
+ import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
5
5
  import { BlockCard } from '../nodeviews/blockCard';
6
6
  import { EmbedCard } from '../nodeviews/embedCard';
7
7
  import { InlineCardNodeView } from '../nodeviews/inlineCard';
@@ -9,8 +9,8 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
9
9
  import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
10
10
  import CogIcon from '@atlaskit/icon/glyph/editor/settings';
11
11
  import OpenIcon from '@atlaskit/icon/glyph/shortcut';
12
- import { linkToolbarMessages } from '../../messages';
13
- import commonMessages, { linkMessages } from '@atlaskit/editor-common/messages';
12
+ import { buildLayoutButtons } from '@atlaskit/editor-common/card';
13
+ import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
14
14
  import { changeSelectedCardToText } from './pm-plugins/doc';
15
15
  import { commandWithMetadata } from '@atlaskit/editor-common/card';
16
16
  import { pluginKey } from './pm-plugins/main';
@@ -20,10 +20,8 @@ import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNo
20
20
  import { isSafeUrl } from '@atlaskit/adf-schema';
21
21
  import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
22
22
  import { messages } from './messages';
23
- import buildLayoutButtons from '../../ui/MediaAndEmbedsToolbar';
24
- import { buildOpenedSettingsPayload, buildVisitedLinkPayload } from '../../utils/linking-utils';
25
23
  import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from './styles';
26
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
24
+ import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
27
25
  export var removeCard = function removeCard(editorAnalyticsApi) {
28
26
  return commandWithMetadata(function (state, dispatch) {
29
27
  if (!(state.selection instanceof NodeSelection)) {
@@ -153,8 +151,8 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
153
151
  return false;
154
152
  };
155
153
  };
156
- var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, cardOptions) {
157
- return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
154
+ var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) {
155
+ return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
158
156
  };
159
157
  var withToolbarMetadata = function withToolbarMetadata(command) {
160
158
  return commandWithMetadata(command, {
@@ -191,7 +189,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
191
189
  linkPicker: linkPicker,
192
190
  node: node,
193
191
  featureFlags: featureFlags,
194
- editorAnalyticsApi: editorAnalyticsApi
192
+ pluginInjectionApi: pluginInjectionApi
195
193
  })];
196
194
  } else {
197
195
  var inlineCard = state.schema.nodes.inlineCard;
@@ -239,8 +237,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
239
237
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
240
238
  }]);
241
239
  if (currentAppearance === 'embed') {
242
- var _pluginInjectionApi$d6;
243
- var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, cardOptions);
240
+ var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
241
+ var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.analytics) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions, cardOptions);
244
242
  if (alignmentOptions.length) {
245
243
  alignmentOptions.push({
246
244
  type: 'separator'