@atlaskit/editor-core 183.1.6 → 184.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/labs/next/full-page.js +2 -6
  3. package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +4 -2
  4. package/dist/cjs/labs/next/presets/default.js +2 -2
  5. package/dist/cjs/labs/next/presets/universal.js +2 -1
  6. package/dist/cjs/plugins/breakout/index.js +54 -35
  7. package/dist/cjs/plugins/card/toolbar.js +4 -3
  8. package/dist/cjs/plugins/collab-edit/plugin-state.js +2 -3
  9. package/dist/cjs/plugins/copy-button/commands.js +8 -1
  10. package/dist/cjs/plugins/extension/index.js +1 -1
  11. package/dist/cjs/plugins/extension/nodeviews/extension.js +5 -3
  12. package/dist/cjs/plugins/extension/pm-plugins/main.js +6 -6
  13. package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +34 -4
  14. package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
  15. package/dist/cjs/plugins/extension/ui/Extension/index.js +4 -2
  16. package/dist/cjs/plugins/help-dialog/index.js +12 -8
  17. package/dist/cjs/plugins/index.js +0 -14
  18. package/dist/cjs/plugins/layout/pm-plugins/main.js +0 -1
  19. package/dist/cjs/plugins/media/index.js +15 -5
  20. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
  21. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +53 -34
  22. package/dist/cjs/plugins/media/styles.js +1 -1
  23. package/dist/cjs/plugins/media/toolbar/index.js +4 -3
  24. package/dist/cjs/plugins/paste/pm-plugins/main.js +7 -1
  25. package/dist/cjs/test-utils.js +6 -1
  26. package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
  27. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -2
  28. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +1 -2
  29. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
  30. package/dist/cjs/ui/ContentStyles/index.js +9 -10
  31. package/dist/cjs/ui/ContextPanel/index.js +67 -56
  32. package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +10 -11
  33. package/dist/cjs/ui/Resizer/index.js +8 -8
  34. package/dist/cjs/ui/WidthEmitter/index.js +10 -4
  35. package/dist/cjs/utils/clipboard.js +18 -11
  36. package/dist/cjs/utils/performance/instrumented-plugin.js +14 -2
  37. package/dist/cjs/version-wrapper.js +1 -1
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/labs/next/full-page.js +2 -5
  40. package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +4 -2
  41. package/dist/es2019/labs/next/presets/default.js +1 -1
  42. package/dist/es2019/labs/next/presets/universal.js +2 -1
  43. package/dist/es2019/plugins/breakout/index.js +48 -31
  44. package/dist/es2019/plugins/card/toolbar.js +4 -3
  45. package/dist/es2019/plugins/collab-edit/plugin-state.js +2 -4
  46. package/dist/es2019/plugins/copy-button/commands.js +9 -2
  47. package/dist/es2019/plugins/extension/index.js +1 -1
  48. package/dist/es2019/plugins/extension/nodeviews/extension.js +5 -3
  49. package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
  50. package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +38 -2
  51. package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
  52. package/dist/es2019/plugins/extension/ui/Extension/index.js +4 -2
  53. package/dist/es2019/plugins/help-dialog/index.js +14 -9
  54. package/dist/es2019/plugins/index.js +0 -2
  55. package/dist/es2019/plugins/layout/pm-plugins/main.js +0 -1
  56. package/dist/es2019/plugins/media/index.js +15 -5
  57. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +21 -10
  58. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +53 -33
  59. package/dist/es2019/plugins/media/styles.js +1 -7
  60. package/dist/es2019/plugins/media/toolbar/index.js +4 -4
  61. package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -1
  62. package/dist/es2019/test-utils.js +6 -1
  63. package/dist/es2019/ui/Appearance/Comment/Comment.js +1 -1
  64. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -1
  65. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
  66. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  67. package/dist/es2019/ui/ContentStyles/index.js +1 -2
  68. package/dist/es2019/ui/ContextPanel/index.js +66 -43
  69. package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +8 -9
  70. package/dist/es2019/ui/Resizer/index.js +1 -1
  71. package/dist/es2019/ui/WidthEmitter/index.js +10 -4
  72. package/dist/es2019/utils/clipboard.js +12 -7
  73. package/dist/es2019/utils/performance/instrumented-plugin.js +15 -2
  74. package/dist/es2019/version-wrapper.js +1 -1
  75. package/dist/es2019/version.json +1 -1
  76. package/dist/esm/labs/next/full-page.js +2 -5
  77. package/dist/esm/labs/next/presets/create-stub-internal-apis.js +4 -2
  78. package/dist/esm/labs/next/presets/default.js +1 -1
  79. package/dist/esm/labs/next/presets/universal.js +2 -1
  80. package/dist/esm/plugins/breakout/index.js +54 -35
  81. package/dist/esm/plugins/card/toolbar.js +4 -3
  82. package/dist/esm/plugins/collab-edit/plugin-state.js +2 -3
  83. package/dist/esm/plugins/copy-button/commands.js +9 -2
  84. package/dist/esm/plugins/extension/index.js +1 -1
  85. package/dist/esm/plugins/extension/nodeviews/extension.js +5 -3
  86. package/dist/esm/plugins/extension/pm-plugins/main.js +6 -6
  87. package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +33 -2
  88. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
  89. package/dist/esm/plugins/extension/ui/Extension/index.js +4 -2
  90. package/dist/esm/plugins/help-dialog/index.js +12 -8
  91. package/dist/esm/plugins/index.js +0 -2
  92. package/dist/esm/plugins/layout/pm-plugins/main.js +0 -1
  93. package/dist/esm/plugins/media/index.js +15 -5
  94. package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
  95. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +54 -35
  96. package/dist/esm/plugins/media/styles.js +2 -2
  97. package/dist/esm/plugins/media/toolbar/index.js +4 -3
  98. package/dist/esm/plugins/paste/pm-plugins/main.js +7 -1
  99. package/dist/esm/test-utils.js +6 -1
  100. package/dist/esm/ui/Appearance/Comment/Comment.js +1 -1
  101. package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -1
  102. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
  103. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  104. package/dist/esm/ui/ContentStyles/index.js +1 -2
  105. package/dist/esm/ui/ContextPanel/index.js +64 -53
  106. package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +10 -11
  107. package/dist/esm/ui/Resizer/index.js +1 -1
  108. package/dist/esm/ui/WidthEmitter/index.js +10 -4
  109. package/dist/esm/utils/clipboard.js +16 -10
  110. package/dist/esm/utils/performance/instrumented-plugin.js +14 -2
  111. package/dist/esm/version-wrapper.js +1 -1
  112. package/dist/esm/version.json +1 -1
  113. package/dist/types/actions/index.d.ts +1 -1
  114. package/dist/types/create-editor/get-plugins.d.ts +2 -0
  115. package/dist/types/index.d.ts +0 -1
  116. package/dist/types/plugins/breakout/index.d.ts +4 -0
  117. package/dist/types/plugins/breakout/ui/LayoutButton.d.ts +1 -1
  118. package/dist/types/plugins/card/index.d.ts +2 -2
  119. package/dist/types/plugins/collab-edit/actions.d.ts +3 -2
  120. package/dist/types/plugins/collab-edit/events/handlers.d.ts +3 -3
  121. package/dist/types/plugins/collab-edit/events/initialize.d.ts +1 -1
  122. package/dist/types/plugins/collab-edit/events/send-transaction.d.ts +1 -1
  123. package/dist/types/plugins/collab-edit/index.d.ts +0 -1
  124. package/dist/types/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
  125. package/dist/types/plugins/collab-edit/participants.d.ts +1 -1
  126. package/dist/types/plugins/collab-edit/plugin.d.ts +0 -2
  127. package/dist/types/plugins/collab-edit/types.d.ts +1 -3
  128. package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  129. package/dist/types/plugins/collab-edit/utils.d.ts +2 -1
  130. package/dist/types/plugins/extension/index.d.ts +2 -1
  131. package/dist/types/plugins/extension/nodeviews/extension.d.ts +4 -1
  132. package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
  133. package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
  134. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
  135. package/dist/types/plugins/extension/ui/Extension/index.d.ts +3 -0
  136. package/dist/types/plugins/help-dialog/index.d.ts +3 -1
  137. package/dist/types/plugins/index.d.ts +0 -3
  138. package/dist/types/plugins/media/index.d.ts +12 -2
  139. package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
  140. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  141. package/dist/types/plugins/media/nodeviews/types.d.ts +2 -1
  142. package/dist/types/plugins/media/toolbar/index.d.ts +3 -1
  143. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
  144. package/dist/types/test-utils.d.ts +3 -1
  145. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  146. package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
  147. package/dist/types/ui/ContextPanel/index.d.ts +3 -4
  148. package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
  149. package/dist/types/ui/PluginSlot/index.d.ts +1 -1
  150. package/dist/types/ui/Resizer/types.d.ts +2 -2
  151. package/dist/types/utils/clipboard.d.ts +1 -0
  152. package/dist/types-ts4.5/actions/index.d.ts +1 -1
  153. package/dist/types-ts4.5/create-editor/get-plugins.d.ts +2 -0
  154. package/dist/types-ts4.5/index.d.ts +0 -1
  155. package/dist/types-ts4.5/plugins/breakout/index.d.ts +6 -0
  156. package/dist/types-ts4.5/plugins/breakout/ui/LayoutButton.d.ts +1 -1
  157. package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
  158. package/dist/types-ts4.5/plugins/collab-edit/actions.d.ts +3 -2
  159. package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +3 -3
  160. package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +1 -1
  161. package/dist/types-ts4.5/plugins/collab-edit/events/send-transaction.d.ts +1 -1
  162. package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +0 -1
  163. package/dist/types-ts4.5/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
  164. package/dist/types-ts4.5/plugins/collab-edit/participants.d.ts +1 -1
  165. package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +0 -2
  166. package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +1 -3
  167. package/dist/types-ts4.5/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  168. package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +2 -1
  169. package/dist/types-ts4.5/plugins/extension/index.d.ts +3 -1
  170. package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +4 -1
  171. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
  172. package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
  173. package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
  174. package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +3 -0
  175. package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +5 -1
  176. package/dist/types-ts4.5/plugins/index.d.ts +0 -3
  177. package/dist/types-ts4.5/plugins/media/index.d.ts +9 -2
  178. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
  179. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  180. package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +2 -1
  181. package/dist/types-ts4.5/plugins/media/toolbar/index.d.ts +3 -1
  182. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
  183. package/dist/types-ts4.5/test-utils.d.ts +3 -1
  184. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  185. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -1
  186. package/dist/types-ts4.5/ui/ContextPanel/index.d.ts +3 -4
  187. package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
  188. package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +1 -1
  189. package/dist/types-ts4.5/ui/Resizer/types.d.ts +2 -2
  190. package/dist/types-ts4.5/utils/clipboard.d.ts +1 -0
  191. package/package.json +18 -16
  192. package/report.api.md +15 -63
  193. package/dist/cjs/plugins/collab-edit/provider/index.js +0 -5
  194. package/dist/cjs/plugins/collab-edit/provider/types.js +0 -5
  195. package/dist/cjs/plugins/grid/index.js +0 -207
  196. package/dist/cjs/plugins/grid/styles.js +0 -16
  197. package/dist/cjs/plugins/grid/types.js +0 -5
  198. package/dist/cjs/plugins/width/index.js +0 -88
  199. package/dist/cjs/ui/ContextPanel/context.js +0 -89
  200. package/dist/es2019/plugins/collab-edit/provider/index.js +0 -1
  201. package/dist/es2019/plugins/collab-edit/provider/types.js +0 -1
  202. package/dist/es2019/plugins/grid/index.js +0 -168
  203. package/dist/es2019/plugins/grid/styles.js +0 -36
  204. package/dist/es2019/plugins/grid/types.js +0 -1
  205. package/dist/es2019/plugins/width/index.js +0 -72
  206. package/dist/es2019/ui/ContextPanel/context.js +0 -65
  207. package/dist/esm/plugins/collab-edit/provider/index.js +0 -1
  208. package/dist/esm/plugins/collab-edit/provider/types.js +0 -1
  209. package/dist/esm/plugins/grid/index.js +0 -191
  210. package/dist/esm/plugins/grid/styles.js +0 -7
  211. package/dist/esm/plugins/grid/types.js +0 -1
  212. package/dist/esm/plugins/width/index.js +0 -78
  213. package/dist/esm/ui/ContextPanel/context.js +0 -79
  214. package/dist/types/plugins/collab-edit/provider/index.d.ts +0 -1
  215. package/dist/types/plugins/collab-edit/provider/types.d.ts +0 -1
  216. package/dist/types/plugins/grid/index.d.ts +0 -25
  217. package/dist/types/plugins/grid/styles.d.ts +0 -2
  218. package/dist/types/plugins/grid/types.d.ts +0 -7
  219. package/dist/types/plugins/width/index.d.ts +0 -18
  220. package/dist/types/ui/ContextPanel/context.d.ts +0 -24
  221. package/dist/types-ts4.5/plugins/collab-edit/provider/index.d.ts +0 -1
  222. package/dist/types-ts4.5/plugins/collab-edit/provider/types.d.ts +0 -1
  223. package/dist/types-ts4.5/plugins/grid/index.d.ts +0 -27
  224. package/dist/types-ts4.5/plugins/grid/styles.d.ts +0 -2
  225. package/dist/types-ts4.5/plugins/grid/types.d.ts +0 -7
  226. package/dist/types-ts4.5/plugins/width/index.d.ts +0 -18
  227. package/dist/types-ts4.5/ui/ContextPanel/context.d.ts +0 -24
@@ -8,7 +8,7 @@ import { EventDispatcher } from '../../event-dispatcher';
8
8
  import EditorActions from '../../actions';
9
9
  import { DispatchAnalyticsEvent } from '../../plugins/analytics';
10
10
  export interface Props {
11
- items?: Array<UIComponentFactory>;
11
+ items?: UIComponentFactory[];
12
12
  editorView?: EditorView;
13
13
  editorActions?: EditorActions;
14
14
  eventDispatcher?: EventDispatcher;
@@ -1,10 +1,10 @@
1
1
  import { RichMediaLayout } from '@atlaskit/adf-schema';
2
2
  import type { MediaSingleProps } from '@atlaskit/editor-common/ui';
3
3
  import { MediaClientConfig } from '@atlaskit/media-core';
4
- import { GridType } from '../../plugins/grid/types';
4
+ import type { GridType } from '@atlaskit/editor-common/types';
5
5
  import { EditorView } from 'prosemirror-view';
6
6
  import { getPosHandler } from '../../nodeviews/types';
7
- import { DispatchAnalyticsEvent } from '../../plugins/analytics';
7
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
8
8
  export type EnabledHandles = {
9
9
  left?: boolean;
10
10
  right?: boolean;
@@ -2,3 +2,4 @@ export declare function checkClipboardTypes(type: DOMStringList | ReadonlyArray<
2
2
  export declare function isPastedFile(rawEvent: Event): boolean;
3
3
  export declare const copyToClipboard: (textToCopy: string) => Promise<void>;
4
4
  export declare const copyHTMLToClipboard: (elementToCopy: HTMLElement, plainTextToCopy?: string) => Promise<void>;
5
+ export declare const copyHTMLToClipboardPolyfill: (elementToCopy: HTMLElement, plainTextToCopy?: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "183.1.6",
3
+ "version": "184.0.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/activity-provider": "^2.4.0",
37
- "@atlaskit/adf-schema": "^25.6.0",
37
+ "@atlaskit/adf-schema": "^25.7.0",
38
38
  "@atlaskit/adf-utils": "^18.2.0",
39
39
  "@atlaskit/analytics-gas-types": "^5.1.0",
40
40
  "@atlaskit/analytics-listeners": "^8.7.0",
@@ -48,15 +48,17 @@
48
48
  "@atlaskit/checkbox": "^12.6.0",
49
49
  "@atlaskit/code": "^14.6.0",
50
50
  "@atlaskit/date": "^0.10.0",
51
- "@atlaskit/datetime-picker": "^12.5.0",
52
- "@atlaskit/editor-common": "^74.1.0",
51
+ "@atlaskit/datetime-picker": "^12.6.0",
52
+ "@atlaskit/editor-common": "^74.2.0",
53
53
  "@atlaskit/editor-json-transformer": "^8.9.0",
54
54
  "@atlaskit/editor-markdown-transformer": "^5.2.0",
55
55
  "@atlaskit/editor-palette": "1.4.2",
56
56
  "@atlaskit/editor-plugin-analytics": "^0.0.1",
57
57
  "@atlaskit/editor-plugin-content-insertion": "^0.0.1",
58
58
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
59
- "@atlaskit/editor-plugin-table": "^1.4.0",
59
+ "@atlaskit/editor-plugin-grid": "^0.1.0",
60
+ "@atlaskit/editor-plugin-table": "^1.5.0",
61
+ "@atlaskit/editor-plugin-width": "^0.0.1",
60
62
  "@atlaskit/editor-shared-styles": "^2.4.0",
61
63
  "@atlaskit/editor-tables": "^2.3.0",
62
64
  "@atlaskit/emoji": "^67.4.0",
@@ -65,12 +67,12 @@
65
67
  "@atlaskit/icon": "^21.12.0",
66
68
  "@atlaskit/icon-object": "^6.3.0",
67
69
  "@atlaskit/link-analytics": "^8.0.0",
68
- "@atlaskit/link-picker": "^1.20.0",
70
+ "@atlaskit/link-picker": "^1.21.0",
69
71
  "@atlaskit/locale": "^2.5.0",
70
72
  "@atlaskit/logo": "^13.14.0",
71
- "@atlaskit/media-card": "^75.0.0",
73
+ "@atlaskit/media-card": "^76.0.0",
72
74
  "@atlaskit/media-client": "^22.0.0",
73
- "@atlaskit/media-common": "^4.1.0",
75
+ "@atlaskit/media-common": "^5.0.0",
74
76
  "@atlaskit/media-filmstrip": "^47.0.0",
75
77
  "@atlaskit/media-picker": "^65.1.0",
76
78
  "@atlaskit/media-ui": "^23.0.0",
@@ -83,8 +85,8 @@
83
85
  "@atlaskit/prosemirror-input-rules": "^2.2.0",
84
86
  "@atlaskit/radio": "^5.6.0",
85
87
  "@atlaskit/section-message": "^6.4.0",
86
- "@atlaskit/select": "^16.2.0",
87
- "@atlaskit/smart-card": "^26.2.0",
88
+ "@atlaskit/select": "^16.3.0",
89
+ "@atlaskit/smart-card": "^26.3.0",
88
90
  "@atlaskit/smart-user-picker": "^6.1.0",
89
91
  "@atlaskit/spinner": "^15.5.0",
90
92
  "@atlaskit/status": "^1.3.0",
@@ -144,21 +146,21 @@
144
146
  "devDependencies": {
145
147
  "@af/integration-testing": "*",
146
148
  "@atlaskit/atlassian-navigation": "^2.5.0",
147
- "@atlaskit/breadcrumbs": "11.10.2",
149
+ "@atlaskit/breadcrumbs": "11.10.3",
148
150
  "@atlaskit/code": "^14.6.0",
149
- "@atlaskit/collab-provider": "8.9.1",
151
+ "@atlaskit/collab-provider": "9.0.0",
150
152
  "@atlaskit/docs": "*",
151
153
  "@atlaskit/drawer": "^7.5.0",
152
154
  "@atlaskit/dropdown-menu": "^11.9.0",
153
155
  "@atlaskit/editor-bitbucket-transformer": "^8.1.0",
154
156
  "@atlaskit/editor-card-provider": "^3.0.0",
155
157
  "@atlaskit/editor-extension-dropbox": "^0.4.0",
156
- "@atlaskit/editor-plugin-table": "^1.4.0",
158
+ "@atlaskit/editor-plugin-table": "^1.5.0",
157
159
  "@atlaskit/editor-test-helpers": "^18.4.0",
158
160
  "@atlaskit/flag": "^15.2.0",
159
161
  "@atlaskit/inline-dialog": "^13.6.0",
160
162
  "@atlaskit/link-provider": "^1.6.0",
161
- "@atlaskit/link-test-helpers": "^2.4.0",
163
+ "@atlaskit/link-test-helpers": "^4.0.0",
162
164
  "@atlaskit/lozenge": "^11.4.0",
163
165
  "@atlaskit/media-core": "^34.1.0",
164
166
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
@@ -180,8 +182,8 @@
180
182
  "@atlaskit/visual-regression": "*",
181
183
  "@atlaskit/webdriver-runner": "*",
182
184
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
183
- "@atlassian/link-picker-atlassian-plugin": "^30.1.0",
184
- "@atlassian/link-picker-plugins": "^20.1.0",
185
+ "@atlassian/link-picker-atlassian-plugin": "^31.0.0",
186
+ "@atlassian/link-picker-plugins": "^21.0.0",
185
187
  "@atlassian/search-provider": "2.4.3",
186
188
  "@atlassian/ufo": "^0.2.0",
187
189
  "@emotion/jest": "^11.8.0",
package/report.api.md CHANGED
@@ -26,11 +26,11 @@ import { ActivityProvider } from '@atlaskit/activity-provider';
26
26
  import { AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
27
27
  import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
28
28
  import { AnalyticsEventPayload as AnalyticsEventPayload_2 } from '@atlaskit/analytics-next/AnalyticsEvent';
29
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
29
30
  import { AnnotationTypes } from '@atlaskit/adf-schema';
30
31
  import { BrowserFreezetracking } from '@atlaskit/editor-common/types';
31
32
  import { CardOptions } from '@atlaskit/editor-common/card';
32
33
  import { CardProvider } from '@atlaskit/editor-common/provider-factory';
33
- import { CollabEditProvider } from '@atlaskit/editor-common/collab';
34
34
  import { Color } from '@atlaskit/status/element';
35
35
  import { Command as Command_2 } from '@atlaskit/editor-common/types';
36
36
  import { ComponentType } from 'react';
@@ -48,7 +48,6 @@ import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
48
48
  import { DropdownOptionT } from '@atlaskit/editor-common/types';
49
49
  import { EditorActionsOptions } from '@atlaskit/editor-common/types';
50
50
  import { EditorAppearance } from '@atlaskit/editor-common/types';
51
- import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
52
51
  import { FeatureFlags as EditorFeatureFlags } from '@atlaskit/editor-common/types';
53
52
  import { EditorPlugin } from '@atlaskit/editor-common/types';
54
53
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
@@ -84,6 +83,7 @@ import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
84
83
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
85
84
  import { Side as GapCursorSide } from '@atlaskit/editor-common/selection';
86
85
  import { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
86
+ import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
87
87
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
88
88
  import { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
89
89
  import { InputTracking } from '@atlaskit/editor-common/types';
@@ -111,6 +111,7 @@ import { Node as Node_2 } from 'prosemirror-model';
111
111
  import { NodeConfig } from '@atlaskit/editor-common/types';
112
112
  import { NodeType } from 'prosemirror-model';
113
113
  import { NodeView } from 'prosemirror-view';
114
+ import { OptionalPlugin } from '@atlaskit/editor-common/types';
114
115
  import { PaletteColor } from '@atlaskit/editor-common/ui-color';
115
116
  import { PerformanceTracking } from '@atlaskit/editor-common/types';
116
117
  import { PluginConfig } from '@atlaskit/editor-plugin-table/types';
@@ -131,7 +132,7 @@ import { default as React_2 } from 'react';
131
132
  import { ReactElement } from 'react';
132
133
  import { RefObject } from 'react';
133
134
  import { ReplaceRawValue } from '@atlaskit/editor-common/types';
134
- import { ResolvedEditorState } from '@atlaskit/editor-common/collab';
135
+ import type { ResolvedEditorState } from '@atlaskit/collab-provider';
135
136
  import { RichMediaLayout } from '@atlaskit/adf-schema';
136
137
  import { Schema } from 'prosemirror-model';
137
138
  import type { SearchProvider } from '@atlaskit/editor-common/provider-factory';
@@ -156,6 +157,7 @@ import { UploadEndEventPayload } from '@atlaskit/media-picker/types';
156
157
  import { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
157
158
  import { UploadParams } from '@atlaskit/media-picker/types';
158
159
  import { UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
160
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
159
161
  import { WithIntlProps } from 'react-intl-next';
160
162
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
161
163
  import { WrappedComponentProps } from 'react-intl-next';
@@ -363,8 +365,6 @@ type CollabEditOptions = {
363
365
  } & CollabInviteToEditProps &
364
366
  CollabAnalyticsProps;
365
367
 
366
- export { CollabEditProvider };
367
-
368
368
  // @public (undocumented)
369
369
  interface CollabInviteToEditProps {
370
370
  // (undocumented)
@@ -416,13 +416,7 @@ type Context = {
416
416
  };
417
417
 
418
418
  // @public (undocumented)
419
- export class ContextPanel extends React_2.Component<Props_4> {
420
- // (undocumented)
421
- render(): jsx.JSX.Element;
422
- }
423
-
424
- // @public (undocumented)
425
- type CreateDisplayGrid = (view: EditorView) => DisplayGrid;
419
+ export function ContextPanel(props: Props_4): jsx.JSX.Element;
426
420
 
427
421
  // @public (undocumented)
428
422
  interface CreateEditorStateOptions {
@@ -584,9 +578,6 @@ type DefaultPresetPluginOptions = {
584
578
  // @public
585
579
  export const deleteDate: () => Command;
586
580
 
587
- // @public (undocumented)
588
- type DisplayGrid = (props: Required_2<GridPluginState>) => boolean;
589
-
590
581
  export { DropdownOptionT };
591
582
 
592
583
  // @public (undocumented)
@@ -1280,35 +1271,6 @@ type getPosHandler = boolean | getPosHandlerNode;
1280
1271
  // @public (undocumented)
1281
1272
  type getPosHandlerNode = () => number;
1282
1273
 
1283
- // @public (undocumented)
1284
- const gridPlugin: NextEditorPlugin<
1285
- 'grid',
1286
- {
1287
- pluginConfiguration: GridPluginOptions | undefined;
1288
- dependencies: [typeof widthPlugin];
1289
- sharedState: GridPluginState | null;
1290
- actions: {
1291
- displayGrid: CreateDisplayGrid;
1292
- };
1293
- }
1294
- >;
1295
-
1296
- // @public (undocumented)
1297
- interface GridPluginOptions {
1298
- // (undocumented)
1299
- shouldCalcBreakoutGridLines?: boolean;
1300
- }
1301
-
1302
- // @public (undocumented)
1303
- type GridPluginState = {
1304
- visible: boolean;
1305
- gridType?: GridType;
1306
- highlight: Highlights;
1307
- };
1308
-
1309
- // @public (undocumented)
1310
- type GridType = 'full' | 'wrapped';
1311
-
1312
1274
  // @public
1313
1275
  export function hasVisibleContent(node: Node_2): boolean;
1314
1276
 
@@ -1318,9 +1280,6 @@ type HeadingLevels = 1 | 2 | 3 | 4 | 5 | 6;
1318
1280
  // @public (undocumented)
1319
1281
  type HeadingLevelsAndNormalText = HeadingLevels | NormalTextLevel;
1320
1282
 
1321
- // @public (undocumented)
1322
- type Highlights = Array<'full-width' | 'wide' | number>;
1323
-
1324
1283
  // @public
1325
1284
  export const historyPluginKey: PluginKey<HistoryPluginState, any>;
1326
1285
 
@@ -1694,7 +1653,13 @@ export const mediaPlugin: NextEditorPlugin<
1694
1653
  'media',
1695
1654
  {
1696
1655
  pluginConfiguration: MediaOptions | undefined;
1697
- dependencies: [typeof featureFlagsPlugin, typeof gridPlugin];
1656
+ dependencies: [
1657
+ typeof featureFlagsPlugin,
1658
+ OptionalPlugin<typeof analyticsPlugin>,
1659
+ typeof gridPlugin,
1660
+ typeof widthPlugin,
1661
+ ];
1662
+ sharedState: MediaPluginState | null;
1698
1663
  }
1699
1664
  >;
1700
1665
 
@@ -2365,11 +2330,6 @@ interface RectData {
2365
2330
  // @public (undocumented)
2366
2331
  export const removeStatus: (showStatusPickerAt: number) => Command;
2367
2332
 
2368
- // @public (undocumented)
2369
- type Required_2<T> = {
2370
- [P in keyof T]-?: T[P];
2371
- };
2372
-
2373
2333
  // @public (undocumented)
2374
2334
  type ScrollGutterPluginOptions = {
2375
2335
  getScrollElement?: (view: EditorView) => HTMLElement | null;
@@ -2824,14 +2784,6 @@ export const version: string;
2824
2784
  // @public (undocumented)
2825
2785
  type VisibilityEvent = 'setvisibility';
2826
2786
 
2827
- // @public (undocumented)
2828
- const widthPlugin: NextEditorPlugin<
2829
- 'width',
2830
- {
2831
- sharedState: EditorContainerWidth | undefined;
2832
- }
2833
- >;
2834
-
2835
2787
  // @public (undocumented)
2836
2788
  export class WithEditorActions extends React_2.Component<
2837
2789
  WithEditorActionsProps,
@@ -2892,8 +2844,8 @@ export { WithPluginState };
2892
2844
 
2893
2845
  ```json
2894
2846
  {
2895
- "@atlaskit/link-provider": "^1.6.1",
2896
- "@atlaskit/media-core": "^34.1.1",
2847
+ "@atlaskit/link-provider": "^1.6.2",
2848
+ "@atlaskit/media-core": "^34.1.2",
2897
2849
  "react": "^16.8.0",
2898
2850
  "react-dom": "^16.8.0",
2899
2851
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,207 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "GRID_GUTTER", {
8
- enumerable: true,
9
- get: function get() {
10
- return _styles.GRID_GUTTER;
11
- }
12
- });
13
- exports.gridTypeForLayout = exports.default = exports.GRID_SIZE = void 0;
14
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
20
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
- var _react = _interopRequireDefault(require("react"));
22
- var _classnames = _interopRequireDefault(require("classnames"));
23
- var _react2 = require("@emotion/react");
24
- var _prosemirrorState = require("prosemirror-state");
25
- var _hooks = require("@atlaskit/editor-common/hooks");
26
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
27
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
28
- var _styles = require("./styles");
29
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
- 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; } }
31
- var GRID_SIZE = 12;
32
- exports.GRID_SIZE = GRID_SIZE;
33
- var key = new _prosemirrorState.PluginKey('gridPlugin');
34
- var createDisplayGrid = function createDisplayGrid(view) {
35
- return function (props) {
36
- var dispatch = view.dispatch,
37
- state = view.state;
38
- var tr = state.tr.setMeta(key, props);
39
- dispatch(tr);
40
- return true;
41
- };
42
- };
43
- var gridTypeForLayout = function gridTypeForLayout(layout) {
44
- return layout === 'wrap-left' || layout === 'wrap-right' ? 'wrapped' : 'full';
45
- };
46
- exports.gridTypeForLayout = gridTypeForLayout;
47
- var sides = ['left', 'right'];
48
- var overflowHighlight = function overflowHighlight(highlights, side, start, size) {
49
- if (!highlights.length) {
50
- return false;
51
- }
52
- var minHighlight = highlights.reduce(function (prev, cur) {
53
- return Math.min(prev, cur);
54
- });
55
- var maxHighlight = highlights.reduce(function (prev, cur) {
56
- return Math.max(prev, cur);
57
- });
58
- if (side === 'left') {
59
- return minHighlight < 0 && minHighlight <= -start && (typeof size === 'number' ? minHighlight >= -(start + size) : true);
60
- } else {
61
- return maxHighlight > GRID_SIZE && maxHighlight >= GRID_SIZE + start && (typeof size === 'number' ? maxHighlight <= GRID_SIZE + size : true);
62
- }
63
- };
64
- var gutterGridLines = function gutterGridLines(editorMaxWidth, editorWidth, highlights, shouldCalcBreakoutGridLines) {
65
- var gridLines = [];
66
- if (!shouldCalcBreakoutGridLines) {
67
- return gridLines;
68
- }
69
- var wideSpacing = (editorMaxWidth * _editorSharedStyles.breakoutWideScaleRatio - editorMaxWidth) / 2;
70
- sides.forEach(function (side) {
71
- gridLines.push( /*#__PURE__*/_react.default.createElement("div", {
72
- key: side,
73
- className: (0, _classnames.default)('gridLine', overflowHighlight(highlights, side, 0, 4) ? 'highlight' : ''),
74
- style: (0, _defineProperty2.default)({
75
- position: 'absolute'
76
- }, side, "-".concat(wideSpacing, "px"))
77
- }));
78
- gridLines.push( /*#__PURE__*/_react.default.createElement("div", {
79
- key: side + '-bk',
80
- className: (0, _classnames.default)('gridLine', highlights.indexOf('full-width') > -1 ? 'highlight' : ''),
81
- style: (0, _defineProperty2.default)({
82
- position: 'absolute'
83
- }, side, "-".concat((editorWidth - editorMaxWidth - _editorSharedStyles.akEditorBreakoutPadding) / 2, "px"))
84
- }));
85
- });
86
- return gridLines;
87
- };
88
- var lineLengthGridLines = function lineLengthGridLines(highlights) {
89
- var gridLines = [];
90
- var gridSpacing = 100 / GRID_SIZE;
91
- for (var i = 0; i <= GRID_SIZE; i++) {
92
- var style = {
93
- paddingLeft: "".concat(gridSpacing, "%")
94
- };
95
- gridLines.push( /*#__PURE__*/_react.default.createElement("div", {
96
- key: i,
97
- className: (0, _classnames.default)('gridLine', highlights.indexOf(i) > -1 ? 'highlight' : ''),
98
- style: i < GRID_SIZE ? style : undefined
99
- }));
100
- }
101
- return gridLines;
102
- };
103
- var Grid = /*#__PURE__*/function (_React$Component) {
104
- (0, _inherits2.default)(Grid, _React$Component);
105
- var _super = _createSuper(Grid);
106
- function Grid() {
107
- (0, _classCallCheck2.default)(this, Grid);
108
- return _super.apply(this, arguments);
109
- }
110
- (0, _createClass2.default)(Grid, [{
111
- key: "render",
112
- value: function render() {
113
- var _this$props = this.props,
114
- highlight = _this$props.highlight,
115
- shouldCalcBreakoutGridLines = _this$props.shouldCalcBreakoutGridLines,
116
- theme = _this$props.theme,
117
- containerElement = _this$props.containerElement,
118
- editorWidth = _this$props.editorWidth,
119
- gridType = _this$props.gridType,
120
- visible = _this$props.visible;
121
- var editorMaxWidth = theme.layoutMaxWidth;
122
- var gridLines = [].concat((0, _toConsumableArray2.default)(lineLengthGridLines(highlight)), (0, _toConsumableArray2.default)(gutterGridLines(editorMaxWidth, editorWidth, highlight, shouldCalcBreakoutGridLines)));
123
- return /*#__PURE__*/_react.default.createElement("div", {
124
- className: "gridParent"
125
- }, /*#__PURE__*/_react.default.createElement("div", {
126
- className: (0, _classnames.default)('gridContainer', gridType),
127
- style: {
128
- height: "".concat(containerElement.scrollHeight, "px"),
129
- display: visible ? 'block' : 'none'
130
- }
131
- }, gridLines));
132
- }
133
- }]);
134
- return Grid;
135
- }(_react.default.Component);
136
- var ThemedGrid = (0, _react2.withTheme)(Grid);
137
- var ContentComponent = function ContentComponent(_ref3) {
138
- var _widthState$width, _gridState$gridType;
139
- var api = _ref3.api,
140
- editorView = _ref3.editorView,
141
- options = _ref3.options;
142
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'grid']),
143
- widthState = _useSharedPluginState.widthState,
144
- gridState = _useSharedPluginState.gridState;
145
- if (!gridState) {
146
- return null;
147
- }
148
- return /*#__PURE__*/_react.default.createElement(ThemedGrid, {
149
- shouldCalcBreakoutGridLines: options && options.shouldCalcBreakoutGridLines,
150
- editorWidth: (_widthState$width = widthState === null || widthState === void 0 ? void 0 : widthState.width) !== null && _widthState$width !== void 0 ? _widthState$width : _editorSharedStyles.akEditorFullPageMaxWidth,
151
- containerElement: editorView.dom,
152
- visible: gridState.visible,
153
- gridType: (_gridState$gridType = gridState.gridType) !== null && _gridState$gridType !== void 0 ? _gridState$gridType : 'full',
154
- highlight: gridState.highlight
155
- });
156
- };
157
- var EMPTY_STATE = {
158
- visible: false,
159
- highlight: []
160
- };
161
- var gridPMPlugin = new _safePlugin.SafePlugin({
162
- key: key,
163
- state: {
164
- init: function init() {
165
- return EMPTY_STATE;
166
- },
167
- apply: function apply(tr, currentPluginState) {
168
- var nextPluginState = tr.getMeta(key);
169
- if (nextPluginState) {
170
- return nextPluginState;
171
- }
172
- return currentPluginState;
173
- }
174
- }
175
- });
176
- var gridPlugin = function gridPlugin(options, api) {
177
- return {
178
- name: 'grid',
179
- getSharedState: function getSharedState(editorState) {
180
- if (!editorState) {
181
- return null;
182
- }
183
- return key.getState(editorState);
184
- },
185
- actions: {
186
- displayGrid: createDisplayGrid
187
- },
188
- pmPlugins: function pmPlugins() {
189
- return [{
190
- name: 'grid',
191
- plugin: function plugin() {
192
- return gridPMPlugin;
193
- }
194
- }];
195
- },
196
- contentComponent: function contentComponent(_ref4) {
197
- var editorView = _ref4.editorView;
198
- return /*#__PURE__*/_react.default.createElement(ContentComponent, {
199
- editorView: editorView,
200
- options: options,
201
- api: api
202
- });
203
- }
204
- };
205
- };
206
- var _default = gridPlugin;
207
- exports.default = _default;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.gridStyles = exports.GRID_GUTTER = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = require("@emotion/react");
10
- var _colors = require("@atlaskit/theme/colors");
11
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
- var _templateObject;
13
- var GRID_GUTTER = 12;
14
- exports.GRID_GUTTER = GRID_GUTTER;
15
- var gridStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .gridParent {\n width: calc(100% + ", "px);\n margin-left: -", "px;\n margin-right: -", "px;\n transform: scale(1);\n z-index: ", ";\n }\n\n .gridContainer {\n position: fixed;\n height: 100vh;\n width: 100%;\n pointer-events: none;\n }\n\n // TODO: https://product-fabric.atlassian.net/browse/DSP-4352\n .gridLine {\n border-left: 1px solid ", ";\n display: inline-block;\n box-sizing: border-box;\n height: 100%;\n margin-left: -1px;\n\n transition: border-color 0.15s linear;\n z-index: 0;\n }\n\n .highlight {\n border-left: 1px solid ", ";\n }\n"])), GRID_GUTTER * 2, GRID_GUTTER, GRID_GUTTER, _editorSharedStyles.akEditorGridLineZIndex, "var(--ds-border, ".concat(_colors.N30A, ")"), "var(--ds-border-focused, ".concat(_colors.B200, ")"));
16
- exports.gridStyles = gridStyles;
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createPlugin = createPlugin;
8
- exports.pluginKey = exports.default = void 0;
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
- var _prosemirrorState = require("prosemirror-state");
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
- /**
15
- * @private
16
- * @deprecated
17
- *
18
- * Do not use this plugin key directly. Please use the `sharedState` of this plugin instead.
19
- */
20
- var pluginKey = new _prosemirrorState.PluginKey('widthPlugin');
21
- exports.pluginKey = pluginKey;
22
- function createPlugin(dispatch) {
23
- return new _safePlugin.SafePlugin({
24
- key: pluginKey,
25
- state: {
26
- init: function init() {
27
- return {
28
- width: document.body.offsetWidth,
29
- containerWidth: document.body.offsetWidth
30
- };
31
- },
32
- apply: function apply(tr, pluginState) {
33
- var meta = tr.getMeta(pluginKey);
34
- if (!meta) {
35
- return pluginState;
36
- }
37
- var newPluginState = _objectSpread(_objectSpread({}, pluginState), meta);
38
- if (newPluginState && (pluginState.width !== newPluginState.width || pluginState.lineLength !== newPluginState.lineLength) || pluginState.containerWidth !== newPluginState.containerWidth) {
39
- dispatch(pluginKey, newPluginState);
40
- return newPluginState;
41
- }
42
- return pluginState;
43
- }
44
- }
45
- });
46
- }
47
- var widthPlugin = function widthPlugin() {
48
- return {
49
- name: 'width',
50
- pmPlugins: function pmPlugins() {
51
- return [{
52
- name: 'width',
53
- plugin: function plugin(_ref) {
54
- var dispatch = _ref.dispatch;
55
- return createPlugin(dispatch);
56
- }
57
- }];
58
- },
59
- getSharedState: function getSharedState(editorState) {
60
- if (!editorState) {
61
- return undefined;
62
- }
63
- return pluginKey.getState(editorState);
64
- },
65
- // do this early here, otherwise we have to wait for WidthEmitter to debounce
66
- // which causes anything dependent on lineLength to jump around
67
- contentComponent: function contentComponent(_ref2) {
68
- var editorView = _ref2.editorView,
69
- containerElement = _ref2.containerElement;
70
- var newState = {
71
- lineLength: editorView.dom.clientWidth
72
- };
73
- if (containerElement) {
74
- var _containerElement$par;
75
- newState.width = containerElement.offsetWidth;
76
-
77
- // wrapper width is used by context panel to determine whether there is
78
- // enough space to open without overlapping the editor
79
- newState.containerWidth = (_containerElement$par = containerElement.parentElement) === null || _containerElement$par === void 0 ? void 0 : _containerElement$par.offsetWidth;
80
- }
81
- var tr = editorView.state.tr.setMeta(pluginKey, newState);
82
- editorView.dispatch(tr);
83
- return null;
84
- }
85
- };
86
- };
87
- var _default = widthPlugin;
88
- exports.default = _default;