@atlaskit/editor-core 150.0.3 → 151.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 (195) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cjs/actions/index.js +5 -23
  3. package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
  4. package/dist/cjs/create-editor/ReactEditorView.js +145 -31
  5. package/dist/cjs/create-editor/create-plugins-list.js +4 -2
  6. package/dist/cjs/editor.js +101 -40
  7. package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
  8. package/dist/cjs/plugins/analytics/types/enums.js +3 -1
  9. package/dist/cjs/plugins/base/index.js +4 -3
  10. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
  11. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  12. package/dist/cjs/plugins/card/index.js +13 -2
  13. package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
  14. package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
  15. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
  16. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  17. package/dist/cjs/plugins/emoji/styles.js +1 -1
  18. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  19. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  20. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +8 -3
  21. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  22. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  23. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  24. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  25. package/dist/cjs/plugins/media/index.js +14 -3
  26. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  27. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  28. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  29. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  30. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  31. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  32. package/dist/cjs/plugins/panel/index.js +2 -3
  33. package/dist/cjs/plugins/panel/message.js +47 -0
  34. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  35. package/dist/cjs/plugins/panel/utils.js +2 -2
  36. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  37. package/dist/cjs/plugins/status/styles.js +1 -1
  38. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  39. package/dist/cjs/profiler/render-count.js +82 -0
  40. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  41. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  42. package/dist/cjs/version-wrapper.js +1 -1
  43. package/dist/cjs/version.json +1 -1
  44. package/dist/es2019/actions/index.js +6 -28
  45. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  46. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  47. package/dist/es2019/create-editor/create-plugins-list.js +4 -2
  48. package/dist/es2019/editor.js +74 -35
  49. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  50. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  51. package/dist/es2019/plugins/base/index.js +4 -3
  52. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  53. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  54. package/dist/es2019/plugins/card/index.js +7 -2
  55. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  56. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  57. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  58. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  59. package/dist/es2019/plugins/emoji/styles.js +2 -0
  60. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  61. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  62. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  63. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  64. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  65. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  66. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  67. package/dist/es2019/plugins/media/index.js +13 -4
  68. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  69. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  70. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  71. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  72. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  73. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  74. package/dist/es2019/plugins/panel/index.js +3 -4
  75. package/dist/es2019/plugins/panel/message.js +38 -0
  76. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  77. package/dist/es2019/plugins/panel/utils.js +2 -2
  78. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  79. package/dist/es2019/plugins/status/styles.js +2 -0
  80. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  81. package/dist/es2019/profiler/render-count.js +60 -0
  82. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  83. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  84. package/dist/es2019/version-wrapper.js +1 -1
  85. package/dist/es2019/version.json +1 -1
  86. package/dist/esm/actions/index.js +6 -24
  87. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  88. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  89. package/dist/esm/create-editor/create-plugins-list.js +4 -2
  90. package/dist/esm/editor.js +100 -40
  91. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  92. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  93. package/dist/esm/plugins/base/index.js +4 -3
  94. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  95. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  96. package/dist/esm/plugins/card/index.js +13 -2
  97. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  98. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  99. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  100. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  101. package/dist/esm/plugins/emoji/styles.js +1 -1
  102. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  103. package/dist/esm/plugins/extension/toolbar.js +28 -23
  104. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  105. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  106. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  107. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  108. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  109. package/dist/esm/plugins/media/index.js +14 -4
  110. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  111. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  112. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  113. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  114. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  115. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  116. package/dist/esm/plugins/panel/index.js +3 -4
  117. package/dist/esm/plugins/panel/message.js +38 -0
  118. package/dist/esm/plugins/panel/toolbar.js +57 -77
  119. package/dist/esm/plugins/panel/utils.js +2 -2
  120. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  121. package/dist/esm/plugins/status/styles.js +1 -1
  122. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  123. package/dist/esm/profiler/render-count.js +57 -0
  124. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  125. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  126. package/dist/esm/version-wrapper.js +1 -1
  127. package/dist/esm/version.json +1 -1
  128. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  129. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  130. package/dist/types/editor.d.ts +2 -0
  131. package/dist/types/plugins/analytics/index.d.ts +1 -1
  132. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  133. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  134. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  135. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  136. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  137. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  138. package/dist/types/plugins/base/index.d.ts +1 -0
  139. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  140. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  141. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  142. package/dist/types/plugins/card/types.d.ts +6 -0
  143. package/dist/types/plugins/extension/types.d.ts +0 -2
  144. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  145. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  146. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  147. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  148. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  149. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  150. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  151. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  152. package/dist/types/plugins/panel/message.d.ts +37 -0
  153. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  154. package/dist/types/plugins/panel/types.d.ts +1 -0
  155. package/dist/types/profiler/render-count.d.ts +14 -0
  156. package/dist/types/types/feature-flags.d.ts +8 -0
  157. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  158. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  159. package/package.json +19 -16
  160. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  161. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  162. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  163. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  164. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  165. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  166. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  167. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  168. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  169. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  170. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  171. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  172. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  173. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  174. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  175. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  176. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  177. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  178. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  179. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  180. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  181. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  182. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  183. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  184. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  185. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  186. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  187. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  188. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  189. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  190. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  191. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  192. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  193. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  194. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  195. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -76,6 +76,11 @@ declare type InsertMediaGroupAEP = InsertAEP<ACTION_SUBJECT_ID.MEDIA, {
76
76
  fileExtension?: string;
77
77
  type: ACTION_SUBJECT_ID.MEDIA_SINGLE | ACTION_SUBJECT_ID.MEDIA_GROUP;
78
78
  }, undefined>;
79
+ declare type InsertMediaInlineAEP = InsertAEP<ACTION_SUBJECT_ID.MEDIA, {
80
+ inputMethod?: InputMethodInsertMedia;
81
+ fileExtension?: string;
82
+ type: ACTION_SUBJECT_ID.MEDIA_INLINE;
83
+ }, undefined>;
79
84
  export declare type InputMethodInsertLink = INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.CLIPBOARD | INPUT_METHOD.FORMATTING | INPUT_METHOD.AUTO_DETECT | INPUT_METHOD.MANUAL;
80
85
  declare type InsertLinkAEP = InsertAEP<ACTION_SUBJECT_ID.LINK, {
81
86
  inputMethod: InputMethodInsertLink;
@@ -119,5 +124,5 @@ declare type InsertNodeViaExtensionAPIAEP = InsertAEP<undefined, {
119
124
  declare type InsertPlaceholderTextAEP = InsertAEP<ACTION_SUBJECT_ID.PLACEHOLDER_TEXT, {
120
125
  inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU;
121
126
  }, undefined>;
122
- export declare type InsertEventPayload = InsertDividerAEP | InsertLineBreakAEP | InsertPanelAEP | InsertCodeBlockAEP | InsertTableAEP | InsertExpandAEP | InsertActionDecisionAEP | InsertEmojiAEP | InsertStatusAEP | InsertMediaSingleAEP | InsertMediaGroupAEP | InsertLinkAEP | InsertLinkPreviewAEP | InsertMediaLinkAEP | InsertSmartLinkAEP | InsertLayoutAEP | InsertExtensionAEP | InsertNodeViaExtensionAPIAEP | InsertDateAEP | InsertPlaceholderTextAEP;
127
+ export declare type InsertEventPayload = InsertDividerAEP | InsertLineBreakAEP | InsertPanelAEP | InsertCodeBlockAEP | InsertTableAEP | InsertExpandAEP | InsertActionDecisionAEP | InsertEmojiAEP | InsertStatusAEP | InsertMediaSingleAEP | InsertMediaGroupAEP | InsertMediaInlineAEP | InsertLinkAEP | InsertLinkPreviewAEP | InsertMediaLinkAEP | InsertSmartLinkAEP | InsertLayoutAEP | InsertExtensionAEP | InsertNodeViaExtensionAPIAEP | InsertDateAEP | InsertPlaceholderTextAEP;
123
128
  export {};
@@ -67,6 +67,7 @@ export declare type SelectedSearchResultsAEP = UIAEP<ACTION.SELECTED, ACTION_SUB
67
67
  resultCount: number;
68
68
  selectedResultId: string;
69
69
  selectedRelativePosition: number;
70
+ prefetch: boolean;
70
71
  }, undefined>;
71
72
  export declare type EditLinkToolbarAEP = UIAEP<ACTION.CLICKED, ACTION_SUBJECT.SMART_LINK | ACTION_SUBJECT.HYPERLINK, ACTION_SUBJECT_ID.EDIT_LINK, {}, undefined>;
72
73
  export declare type UnlinkToolbarAEP = UIAEP<ACTION.UNLINK, ACTION_SUBJECT.SMART_LINK | ACTION_SUBJECT.HYPERLINK, ACTION_SUBJECT_ID.CARD_INLINE | undefined, {}, undefined>;
@@ -6,6 +6,7 @@ export interface BasePluginOptions {
6
6
  allowInlineCursorTarget?: boolean;
7
7
  inputTracking?: InputTracking;
8
8
  browserFreezeTracking?: BrowserFreezetracking;
9
+ ufo?: boolean;
9
10
  }
10
11
  export declare const isChromeWithSelectionBug: boolean;
11
12
  declare const basePlugin: (options?: BasePluginOptions | undefined) => EditorPlugin;
@@ -1,10 +1,11 @@
1
- import { Plugin } from 'prosemirror-state';
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { DispatchAnalyticsEvent } from '../../analytics';
3
3
  import { InputTracking, BrowserFreezetracking } from '../../../types/performance-tracking';
4
+ export declare const frozenEditorPluginKey: PluginKey<any, any>;
4
5
  export declare const DEFAULT_FREEZE_THRESHOLD = 600;
5
6
  export declare const NORMAL_SEVERITY_THRESHOLD = 2000;
6
7
  export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
7
8
  export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
8
9
  export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
9
- declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking | undefined, browserFreezeTracking?: BrowserFreezetracking | undefined) => Plugin<any, any>;
10
+ declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking | undefined, browserFreezeTracking?: BrowserFreezetracking | undefined, ufo?: boolean | undefined) => Plugin<any, any>;
10
11
  export default _default;
@@ -1,6 +1,5 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
- import { CardPlatform } from '@atlaskit/smart-card';
2
+ import { CardPluginOptions } from '../types';
3
3
  import { PMPluginFactoryParams } from '../../../types';
4
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
4
  export { pluginKey } from './plugin-key';
6
- export declare const createPlugin: (platform: CardPlatform, allowResizing: boolean, useAlternativePreloader: boolean, fullWidthMode?: boolean | undefined, createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined) => ({ portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, }: PMPluginFactoryParams) => Plugin<any, any>;
5
+ export declare const createPlugin: (options: CardPluginOptions) => ({ portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, }: PMPluginFactoryParams) => Plugin<any, any>;
@@ -1,5 +1,6 @@
1
1
  import { CardProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { OutstandingRequests, Request } from '../../types';
4
- export declare const resolveWithProvider: (view: EditorView, outstandingRequests: OutstandingRequests, provider: CardProvider, request: Request) => Promise<void | import("@atlaskit/smart-card").InlineCardAdf | import("@atlaskit/smart-card").BlockCardAdf | import("@atlaskit/smart-card").EmbedCardAdf>;
4
+ import { CardOptions } from '@atlaskit/editor-common';
5
+ export declare const resolveWithProvider: (view: EditorView, outstandingRequests: OutstandingRequests, provider: CardProvider, request: Request, options: CardOptions) => Promise<void | import("@atlaskit/smart-card").InlineCardAdf | import("@atlaskit/smart-card").BlockCardAdf | import("@atlaskit/smart-card").EmbedCardAdf>;
5
6
  export declare const handleProvider: (_: 'cardProvider', provider: Promise<CardProvider> | undefined, view: EditorView) => void;
@@ -2,6 +2,7 @@ import { INPUT_METHOD, ACTION } from '../analytics/types/enums';
2
2
  import { CardProvider, CardAppearance, CardAdf } from '@atlaskit/editor-common/provider-factory';
3
3
  import { SmartLinkEvents } from '@atlaskit/smart-card';
4
4
  import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
+ import { CardOptions } from '@atlaskit/editor-common';
5
6
  export declare type CardInfo = {
6
7
  title?: string;
7
8
  url?: string;
@@ -27,6 +28,11 @@ export declare type CardPluginState = {
27
28
  smartLinkEvents?: SmartLinkEvents;
28
29
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
29
30
  };
31
+ export declare type CardPluginOptions = CardOptions & {
32
+ platform: 'mobile' | 'web';
33
+ fullWidthMode?: boolean;
34
+ createAnalyticsEvent?: CreateUIAnalyticsEvent;
35
+ };
30
36
  export declare type SetProvider = {
31
37
  type: 'SET_PROVIDER';
32
38
  provider: CardProvider | null;
@@ -1,8 +1,6 @@
1
- import { ExtensionLayout } from '@atlaskit/adf-schema';
2
1
  import { ContextIdentifierProvider } from '@atlaskit/editor-common';
3
2
  import { UpdateExtension, ExtensionProvider, Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/extensions';
4
3
  export declare type ExtensionState<T extends Parameters = Parameters> = {
5
- layout: ExtensionLayout;
6
4
  localId?: string;
7
5
  autoSaveResolve?: () => void;
8
6
  showEditButton: boolean;
@@ -4,4 +4,4 @@ import type { FeatureFlags } from '../../types/feature-flags';
4
4
  *
5
5
  * Useful for analytics and analysis purposes.
6
6
  */
7
- export declare function getEnabledFeatureFlagKeys(featureFlags: FeatureFlags): ("newInsertionBehaviour" | "interactiveExpand" | "placeholderBracketHint" | "placeholderHints" | "moreTextColors" | "findReplace" | "findReplaceMatchCase" | "extensionLocalIdGeneration" | "keyboardAccessibleDatepicker" | "addColumnWithCustomStep" | "undoRedoButtons" | "catchAllTracking" | "nextEmojiNodeView" | "stickyHeadersOptimization" | "initialRenderOptimization" | "mouseMoveOptimization" | "tableRenderOptimization" | "tableOverflowShadowsOptimization" | "codeBlockSyntaxHighlighting" | "queueAnalytics" | "extendFloatingToolbar" | "displayInlineBlockForInlineNodes" | "useUnpredictableInputRule" | "showAvatarGroupAsPlugin" | "errorBoundaryDocStructure" | "synchronyErrorDocStructure" | "enableViewUpdateSubscription" | "collabAvatarScroll")[];
7
+ export declare function getEnabledFeatureFlagKeys(featureFlags: FeatureFlags): ("newInsertionBehaviour" | "interactiveExpand" | "placeholderBracketHint" | "placeholderHints" | "moreTextColors" | "findReplace" | "findReplaceMatchCase" | "extensionLocalIdGeneration" | "keyboardAccessibleDatepicker" | "addColumnWithCustomStep" | "undoRedoButtons" | "catchAllTracking" | "nextEmojiNodeView" | "stickyHeadersOptimization" | "initialRenderOptimization" | "mouseMoveOptimization" | "tableRenderOptimization" | "tableOverflowShadowsOptimization" | "codeBlockSyntaxHighlighting" | "queueAnalytics" | "extendFloatingToolbar" | "displayInlineBlockForInlineNodes" | "useUnpredictableInputRule" | "showAvatarGroupAsPlugin" | "errorBoundaryDocStructure" | "synchronyErrorDocStructure" | "enableViewUpdateSubscription" | "collabAvatarScroll" | "ufo")[];
@@ -74,7 +74,7 @@ declare type FloatingToolbarSelectBase<T, V = SelectOption> = {
74
74
  options: V[];
75
75
  hidden?: boolean;
76
76
  hideExpandIcon?: boolean;
77
- defaultValue?: V;
77
+ defaultValue?: V | null;
78
78
  placeholder?: string;
79
79
  onChange: (selected: V) => T;
80
80
  filterOption?: ((option: V, rawInput: string) => boolean) | null;
@@ -18,7 +18,7 @@ export interface Props {
18
18
  mountPoint?: HTMLElement;
19
19
  boundariesElement?: HTMLElement;
20
20
  scrollableElement?: HTMLElement;
21
- defaultValue?: SelectOption;
21
+ defaultValue?: SelectOption | null;
22
22
  placeholder?: string;
23
23
  onChange?: (change: ValueType<SelectOption>) => void;
24
24
  width?: number;
@@ -1,16 +1,4 @@
1
1
  import { Slice, Schema } from 'prosemirror-model';
2
- export declare const LINK_REGEXP: RegExp;
3
- export interface Match {
4
- schema: any;
5
- index: number;
6
- lastIndex: number;
7
- raw: string;
8
- text: string;
9
- url: string;
10
- length?: number;
11
- input?: string;
12
- }
13
- export declare function getLinkMatch(str: string): Match | LinkifyMatch | null;
14
2
  /**
15
3
  * Instance of class LinkMatcher are used in autoformatting in place of Regex.
16
4
  * Hence it has been made similar to regex with an exec method.
@@ -26,12 +14,3 @@ export declare function normalizeUrl(url?: string | null): string;
26
14
  export declare function linkifyContent(schema: Schema): (slice: Slice) => Slice;
27
15
  export declare function getLinkDomain(url: string): string;
28
16
  export declare function isFromCurrentDomain(url: string): boolean;
29
- export interface LinkifyMatch {
30
- index: number;
31
- lastIndex: number;
32
- raw: string;
33
- url: string;
34
- text: string;
35
- schema: string;
36
- }
37
- export declare const linkifyMatch: (text: string) => LinkifyMatch[];
@@ -0,0 +1,27 @@
1
+ import { Node as PMNode } from 'prosemirror-model';
2
+ import { EditorView, NodeView } from 'prosemirror-view';
3
+ import React from 'react';
4
+ import { EventDispatcher } from '../../../event-dispatcher';
5
+ import { getPosHandler, ReactNodeView } from '../../../nodeviews/';
6
+ import { FileIdentifier } from '@atlaskit/media-client';
7
+ import { MediaProvider, ProviderFactory } from '@atlaskit/editor-common';
8
+ import { PortalProviderAPI } from '../../../../src/ui/PortalProvider';
9
+ export interface MediaInlineProps {
10
+ mediaProvider: Promise<MediaProvider>;
11
+ identifier: FileIdentifier;
12
+ node: PMNode;
13
+ }
14
+ export declare const MediaInline: React.FC<MediaInlineProps>;
15
+ export interface MediaInlineNodeViewProps {
16
+ providerFactory: ProviderFactory;
17
+ }
18
+ export declare class MediaInlineNodeView extends ReactNodeView<MediaInlineNodeViewProps> {
19
+ createDomRef(): HTMLSpanElement;
20
+ getContentDOM(): {
21
+ dom: HTMLSpanElement;
22
+ };
23
+ ignoreMutation(): boolean;
24
+ viewShouldUpdate(nextNode: PMNode): boolean;
25
+ render(props: MediaInlineNodeViewProps): JSX.Element;
26
+ }
27
+ export declare const ReactMediaInlineNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -36,7 +36,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
36
36
  private customPicker?;
37
37
  private removeOnCloseListener;
38
38
  private openMediaPickerBrowser?;
39
- private onPopupToogleCallback;
39
+ private onPopupToggleCallback;
40
40
  private reactContext;
41
41
  pickers: PickerFacade[];
42
42
  pickerPromises: Array<Promise<PickerFacade>>;
@@ -64,7 +64,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
64
64
  shouldUseMediaPickerPopup: () => boolean;
65
65
  showMediaPicker: () => void;
66
66
  setBrowseFn: (browseFn: () => void) => void;
67
- onPopupToggle: (onPopupToogleCallback: (isOpen: boolean) => void) => void;
67
+ onPopupToggle: (onPopupToggleCallback: (isOpen: boolean) => void) => void;
68
68
  /**
69
69
  * Returns a promise that is resolved after all pending operations have been finished.
70
70
  * An optional timeout will cause the promise to reject if the operation takes too long
@@ -1,4 +1,6 @@
1
1
  import { MediaBaseAttributes } from '@atlaskit/adf-schema';
2
+ import { EditorState } from 'prosemirror-state';
2
3
  import { MediaPluginState } from '../pm-plugins/types';
3
4
  export declare const getSelectedMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
4
5
  export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Promise<boolean>;
6
+ export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction<any>;
@@ -5,6 +5,14 @@ export interface Range {
5
5
  start: number;
6
6
  end: number;
7
7
  }
8
+ export declare const canInsertMediaInline: (state: EditorState) => boolean;
9
+ /**
10
+ * Create a new media inline to insert the new media.
11
+ * @param view Editor view
12
+ * @param mediaState Media file to be added to the editor
13
+ * @param collection Collection for the media to be added
14
+ */
15
+ export declare const insertMediaInlineNode: (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: import("../../analytics").INPUT_METHOD.CLIPBOARD | import("../../analytics").INPUT_METHOD.DRAG_AND_DROP | import("../../analytics").INPUT_METHOD.PICKER_CLOUD | undefined) => boolean;
8
16
  /**
9
17
  * Insert a media into an existing media group
10
18
  * or create a new media group to insert the new media.
@@ -0,0 +1,37 @@
1
+ export declare const messages: {
2
+ info: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ note: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ success: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ warning: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
22
+ error: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ emoji: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
32
+ backgroundColor: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
37
+ };
@@ -6,42 +6,9 @@ import { NodeType } from 'prosemirror-model';
6
6
  import { Command } from '../../types';
7
7
  import { ProviderFactory } from '@atlaskit/editor-common';
8
8
  import { FormattedMessage } from 'react-intl';
9
- export declare const messages: {
10
- info: {
11
- id: string;
12
- defaultMessage: string;
13
- description: string;
14
- };
15
- note: {
16
- id: string;
17
- defaultMessage: string;
18
- description: string;
19
- };
20
- success: {
21
- id: string;
22
- defaultMessage: string;
23
- description: string;
24
- };
25
- warning: {
26
- id: string;
27
- defaultMessage: string;
28
- description: string;
29
- };
30
- error: {
31
- id: string;
32
- defaultMessage: string;
33
- description: string;
34
- };
35
- emoji: {
36
- id: string;
37
- defaultMessage: string;
38
- description: string;
39
- };
40
- backgroundColor: {
41
- id: string;
42
- defaultMessage: string;
43
- description: string;
44
- };
9
+ import { PanelType } from '@atlaskit/adf-schema';
10
+ export declare const panelIconMap: {
11
+ [key in Exclude<PanelType, PanelType.CUSTOM>]: string;
45
12
  };
46
- export declare const getToolbarItems: (formatMessage: (messageDescriptor: FormattedMessage.MessageDescriptor) => string, panelNodeType: NodeType, isCustomPanelEnabled: boolean, providerFactory: ProviderFactory, activePanelType?: string | undefined, activePanelColor?: string | undefined, activePanelIcon?: string | undefined) => FloatingToolbarItem<Command>[];
13
+ export declare const getToolbarItems: (formatMessage: (messageDescriptor: FormattedMessage.MessageDescriptor) => string, panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, activePanelType?: string | undefined, activePanelColor?: string | undefined, activePanelIcon?: string | undefined) => FloatingToolbarItem<Command>[];
47
14
  export declare const getToolbarConfig: (state: EditorState, intl: InjectedIntl, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory) => FloatingToolbarConfig | undefined;
@@ -5,4 +5,5 @@ export interface PanelPluginOptions extends LongPressSelectionPluginOptions, Pan
5
5
  }
6
6
  export interface PanelPluginConfig {
7
7
  UNSAFE_allowCustomPanel?: boolean;
8
+ UNSAFE_allowCustomPanelEdit?: boolean;
8
9
  }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export declare enum ProfiledComponentIds {
3
+ editor = "Editor",
4
+ appearance = "FullPageEditor",
5
+ reactEditorView = "ReactEditorView",
6
+ contentArea = "FullPageContentArea",
7
+ toolbar = "FullPageToolbar",
8
+ mention = "MentionNodeView"
9
+ }
10
+ declare type RenderCountProfilerProps = {
11
+ componentId: keyof typeof ProfiledComponentIds;
12
+ };
13
+ export declare const RenderCountProfiler: React.FC<RenderCountProfilerProps>;
14
+ export {};
@@ -242,5 +242,13 @@ export declare type FeatureFlags = {
242
242
  * @default false
243
243
  */
244
244
  collabAvatarScroll?: boolean;
245
+ /**
246
+ * @description
247
+ * Enable UFO experiences
248
+ *
249
+ * @see https://product-fabric.atlassian.net/browse/ED-13059
250
+ * @default false
251
+ */
252
+ ufo?: boolean;
245
253
  };
246
254
  export declare type FeatureFlagKey = keyof FeatureFlags;
@@ -41,6 +41,7 @@ export declare type LinkSearchListItemData = {
41
41
  icon?: React.ReactChild | never;
42
42
  lastViewedDate?: Date;
43
43
  lastUpdatedDate?: Date;
44
+ prefetch?: boolean;
44
45
  } & ({
45
46
  iconUrl: string;
46
47
  } | {
@@ -1,7 +1,23 @@
1
+ import { ShallowPropsDifference, PropsDifference } from '../../compare';
1
2
  import { ACTION_SUBJECT, ACTION, FireAnalyticsCallback } from '../../../plugins/analytics';
2
3
  declare type RenderActions = ACTION.RE_RENDERED;
3
4
  declare type RenderActionSubjects = ACTION_SUBJECT.EDITOR | ACTION_SUBJECT.REACT_EDITOR_VIEW;
4
- export declare function useComponentRenderTracking<Props>(props: Props, action: RenderActions, actionSubject: RenderActionSubjects, handleAnalyticsEvent: FireAnalyticsCallback, propsToIgnore?: Array<keyof Props>, useShallow?: boolean): void;
5
+ declare type PropsDiff<Props> = ShallowPropsDifference<Props> | PropsDifference<Props>;
6
+ declare type OnRenderCb<Props = undefined> = ({ renderCount, propsDifference, }: {
7
+ renderCount: number;
8
+ propsDifference: PropsDiff<Props> | undefined;
9
+ }) => void;
10
+ export declare type UseComponentRenderTrackingArgs<Props = undefined> = {
11
+ onRender: OnRenderCb<Props>;
12
+ propsDiffingOptions?: {
13
+ enabled: boolean;
14
+ props?: Props;
15
+ propsToIgnore?: Array<keyof Props>;
16
+ useShallow?: boolean;
17
+ };
18
+ zeroBasedCount?: boolean;
19
+ };
20
+ export declare function useComponentRenderTracking<Props = undefined>({ onRender, propsDiffingOptions, zeroBasedCount, }: UseComponentRenderTrackingArgs<Props>): void;
5
21
  export declare type RenderTrackingProps<ComponentProps> = {
6
22
  componentProps: ComponentProps;
7
23
  action: RenderActions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "150.0.3",
3
+ "version": "151.0.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@atlaskit/activity": "^1.0.1",
28
28
  "@atlaskit/activity-provider": "^2.3.0",
29
- "@atlaskit/adf-schema": "^19.2.0",
29
+ "@atlaskit/adf-schema": "^19.3.0",
30
30
  "@atlaskit/adf-utils": "^14.3.0",
31
31
  "@atlaskit/analytics-gas-types": "^5.0.0",
32
32
  "@atlaskit/analytics-listeners": "^8.0.0",
@@ -40,9 +40,9 @@
40
40
  "@atlaskit/checkbox": "^12.3.0",
41
41
  "@atlaskit/code": "^14.1.0",
42
42
  "@atlaskit/date": "^0.8.0",
43
- "@atlaskit/datetime-picker": "^11.0.0",
43
+ "@atlaskit/datetime-picker": "^11.1.0",
44
44
  "@atlaskit/droplist": "^11.0.0",
45
- "@atlaskit/editor-common": "^60.1.0",
45
+ "@atlaskit/editor-common": "^60.2.0",
46
46
  "@atlaskit/editor-json-transformer": "^8.6.0",
47
47
  "@atlaskit/editor-markdown-transformer": "^4.1.0",
48
48
  "@atlaskit/editor-shared-styles": "^1.6.0",
@@ -55,16 +55,16 @@
55
55
  "@atlaskit/item": "^12.0.0",
56
56
  "@atlaskit/locale": "^2.3.0",
57
57
  "@atlaskit/logo": "^13.5.0",
58
- "@atlaskit/media-card": "^71.0.0",
59
- "@atlaskit/media-client": "^14.2.0",
58
+ "@atlaskit/media-card": "^72.0.0",
59
+ "@atlaskit/media-client": "^14.3.0",
60
60
  "@atlaskit/media-common": "^2.9.0",
61
61
  "@atlaskit/media-editor": "^38.2.0",
62
62
  "@atlaskit/media-filmstrip": "^42.1.0",
63
63
  "@atlaskit/media-picker": "^58.1.0",
64
- "@atlaskit/media-ui": "^17.0.0",
64
+ "@atlaskit/media-ui": "^17.1.0",
65
65
  "@atlaskit/media-viewer": "^45.8.1",
66
66
  "@atlaskit/mention": "^19.7.0",
67
- "@atlaskit/modal-dialog": "^12.0.0",
67
+ "@atlaskit/modal-dialog": "^12.1.0",
68
68
  "@atlaskit/prosemirror-input-rules": "^2.0.0",
69
69
  "@atlaskit/radio": "^5.3.0",
70
70
  "@atlaskit/section-message": "^6.1.0",
@@ -128,15 +128,15 @@
128
128
  },
129
129
  "peerDependencies": {
130
130
  "@atlaskit/media-core": "^32.2.0",
131
- "@atlaskit/smart-card": "^16.1.1",
131
+ "@atlaskit/smart-card": "^16.2.0",
132
132
  "react": "^16.8.0",
133
133
  "react-dom": "^16.8.0",
134
134
  "react-intl": "^2.6.0",
135
135
  "styled-components": "^3.2.6"
136
136
  },
137
137
  "devDependencies": {
138
- "@atlaskit/atlassian-navigation": "^1.1.0",
139
- "@atlaskit/breadcrumbs": "11.3.4",
138
+ "@atlaskit/atlassian-navigation": "^1.2.0",
139
+ "@atlaskit/breadcrumbs": "11.4.0",
140
140
  "@atlaskit/code": "^14.1.0",
141
141
  "@atlaskit/collab-provider": "7.1.0",
142
142
  "@atlaskit/docs": "*",
@@ -144,30 +144,32 @@
144
144
  "@atlaskit/dropdown-menu": "^10.1.0",
145
145
  "@atlaskit/editor-bitbucket-transformer": "^7.1.0",
146
146
  "@atlaskit/editor-extension-dropbox": "^0.2.0",
147
- "@atlaskit/editor-test-helpers": "^15.4.0",
147
+ "@atlaskit/editor-test-helpers": "^15.5.0",
148
148
  "@atlaskit/flag": "^14.4.0",
149
149
  "@atlaskit/inline-dialog": "^13.0.0",
150
150
  "@atlaskit/lozenge": "^11.1.0",
151
151
  "@atlaskit/media-core": "^32.2.0",
152
152
  "@atlaskit/media-integration-test-helpers": "^2.5.0",
153
153
  "@atlaskit/media-test-helpers": "^28.8.0",
154
- "@atlaskit/menu": "^1.1.0",
154
+ "@atlaskit/menu": "^1.2.0",
155
155
  "@atlaskit/page-layout": "^1.0.1",
156
- "@atlaskit/profilecard": "^15.0.0",
156
+ "@atlaskit/profilecard": "^15.8.0",
157
157
  "@atlaskit/pubsub": "^6.0.0",
158
- "@atlaskit/renderer": "^81.1.0",
158
+ "@atlaskit/renderer": "^82.0.0",
159
159
  "@atlaskit/section-message": "^6.1.0",
160
160
  "@atlaskit/share": "*",
161
- "@atlaskit/smart-card": "^16.1.0",
161
+ "@atlaskit/smart-card": "^16.2.0",
162
162
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
163
163
  "@atlaskit/textarea": "^4.2.0",
164
164
  "@atlaskit/toggle": "^12.3.0",
165
+ "@atlaskit/ufo": "^0.0.6",
165
166
  "@atlaskit/user-picker": "^7.3.0",
166
167
  "@atlaskit/util-data-test": "^16.0.0",
167
168
  "@atlaskit/visual-regression": "*",
168
169
  "@atlaskit/webdriver-runner": "*",
169
170
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
170
171
  "@atlassian/search-provider": "2.1.15",
172
+ "@atlassian/ufo": "^0.0.28",
171
173
  "@testing-library/react": "^8.0.1",
172
174
  "@testing-library/react-hooks": "^1.0.4",
173
175
  "@types/jscodeshift": "^0.11.0",
@@ -183,6 +185,7 @@
183
185
  "fetch-mock": "^8.0.0",
184
186
  "jscodeshift": "^0.13.0",
185
187
  "lz-string": "^1.4.4",
188
+ "mockdate": "^3.0.2",
186
189
  "node-fetch": "^2.6.1",
187
190
  "prettier": "^2.1.1",
188
191
  "prosemirror-dev-tools": "^3.0.0",
@@ -1,135 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _createEditor = require("@atlaskit/editor-test-helpers/create-editor");
6
-
7
- var _docBuilder = require("@atlaskit/editor-test-helpers/doc-builder");
8
-
9
- var _utils = require("../../../utils");
10
-
11
- var _react = require("@testing-library/react");
12
-
13
- var _adfSchema = require("@atlaskit/adf-schema");
14
-
15
- var _ = _interopRequireDefault(require("."));
16
-
17
- jest.mock('../../base/pm-plugins/react-nodeview', function () {
18
- return {
19
- stateKey: {
20
- getState: function getState() {
21
- return {
22
- subscribe: jest.fn(),
23
- unsubscribe: jest.fn()
24
- };
25
- }
26
- }
27
- };
28
- });
29
- var createEditorTestingLibrary = (0, _createEditor.createEditorFactory)(_react.render);
30
-
31
- var editor = function editor(doc) {
32
- return createEditorTestingLibrary({
33
- doc: doc,
34
- editorProps: {
35
- media: {
36
- allowMediaSingle: true,
37
- featureFlags: {
38
- captions: true
39
- }
40
- }
41
- }
42
- });
43
- };
44
-
45
- var mediaNodeAttrs = {
46
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
47
- type: 'file',
48
- collection: 'MediaServicesSample',
49
- width: 250,
50
- height: 250
51
- };
52
- describe('caption', function () {
53
- it('should render caption children', function () {
54
- var CAPTION_TEXT = 'this is a very cool caption';
55
-
56
- var _editor = editor((0, _docBuilder.doc)((0, _docBuilder.mediaSingle)()((0, _docBuilder.media)(mediaNodeAttrs)(), (0, _docBuilder.caption)(CAPTION_TEXT)))),
57
- getByText = _editor.wrapper.getByText;
58
-
59
- expect(getByText(CAPTION_TEXT)).not.toBeNull();
60
- });
61
- it("should show a placeholder if there's no children", function () {
62
- var _editor2 = editor((0, _docBuilder.doc)('{<node>}', // node selection
63
- (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)(mediaNodeAttrs)()))),
64
- getByText = _editor2.wrapper.getByText;
65
-
66
- expect(getByText('Add a caption')).not.toBeNull();
67
- });
68
- it('should not show a placeholder when selecting away from media single', function () {
69
- var _editor3 = editor((0, _docBuilder.doc)('{<node>}', // node selection
70
- (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)(mediaNodeAttrs)()), (0, _docBuilder.p)('this is a random piece of text'))),
71
- _editor3$wrapper = _editor3.wrapper,
72
- queryByText = _editor3$wrapper.queryByText,
73
- getByText = _editor3$wrapper.getByText,
74
- editorView = _editor3.editorView;
75
-
76
- expect(getByText('Add a caption')).not.toBeNull();
77
- (0, _utils.setTextSelection)(editorView, 13, 14);
78
- expect(queryByText('Add a caption')).toBeNull();
79
- });
80
- it('should show a placeholder when selecting a media single', function () {
81
- var _editor4 = editor((0, _docBuilder.doc)('{node}', // node selection
82
- (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)(mediaNodeAttrs)()), (0, _docBuilder.p)('this is a random p{<>}iece of text'))),
83
- _editor4$wrapper = _editor4.wrapper,
84
- queryByText = _editor4$wrapper.queryByText,
85
- getByText = _editor4$wrapper.getByText,
86
- editorView = _editor4.editorView;
87
-
88
- expect(queryByText('Add a caption')).toBeNull();
89
- (0, _utils.setNodeSelection)(editorView, 0);
90
- expect(getByText('Add a caption')).not.toBeNull();
91
- });
92
- });
93
- describe('nodeview updating based on child count', function () {
94
- var portalProviderAPI = {
95
- render: function render(component) {
96
- component();
97
- },
98
- remove: function remove() {}
99
- };
100
- var eventDispatcher = {};
101
- var node = (0, _docBuilder.caption)('hi')((0, _adfSchema.getSchemaBasedOnStage)('stage0'));
102
- var view = {
103
- state: {
104
- selection: {
105
- from: 0,
106
- to: 0,
107
- $anchor: {
108
- pos: 0
109
- },
110
- $head: {
111
- pos: 20
112
- }
113
- }
114
- }
115
- };
116
- var getPos = jest.fn();
117
- it('does not update if the childCount has not changed', function () {
118
- var nodeView = (0, _.default)(portalProviderAPI, eventDispatcher)(node, view, getPos); // ensure that if it falls through to the default it returns false
119
-
120
- nodeView['_viewShouldUpdate'] = jest.fn(function (_node) {
121
- return false;
122
- });
123
- expect(nodeView.viewShouldUpdate(node)).toBeFalsy();
124
- });
125
- it('updates if the childCount has changed', function () {
126
- var nodeView = (0, _.default)(portalProviderAPI, eventDispatcher)(node, view, getPos); // when captions is in full schema, use defaultSchema
127
-
128
- var newNode = (0, _docBuilder.caption)()((0, _adfSchema.getSchemaBasedOnStage)('stage0')); // ensure that if it falls through to the default it returns false
129
-
130
- nodeView['_viewShouldUpdate'] = jest.fn(function (_node) {
131
- return false;
132
- });
133
- expect(nodeView.viewShouldUpdate(newNode)).toBeTruthy();
134
- });
135
- });