@atlaskit/editor-common 87.6.0 → 87.6.2

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 (49) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/extensibility/Extension/Extension/index.js +2 -1
  3. package/dist/cjs/extensibility/Extension/Extension/styles.js +4 -0
  4. package/dist/cjs/extensibility/MultiBodiedExtension/styles.js +1 -1
  5. package/dist/cjs/extensibility/extensionNodeView.js +13 -0
  6. package/dist/cjs/keymaps/index.js +7 -4
  7. package/dist/cjs/lazy-node-view/index.js +10 -3
  8. package/dist/cjs/lazy-node-view/node-view.js +32 -20
  9. package/dist/cjs/lazy-node-view/replace-node-views.js +94 -25
  10. package/dist/cjs/monitoring/error.js +1 -1
  11. package/dist/cjs/styles/shared/code-block.js +3 -4
  12. package/dist/cjs/ui/DropList/index.js +1 -1
  13. package/dist/es2019/extensibility/Extension/Extension/index.js +2 -1
  14. package/dist/es2019/extensibility/Extension/Extension/styles.js +4 -0
  15. package/dist/es2019/extensibility/MultiBodiedExtension/styles.js +1 -1
  16. package/dist/es2019/extensibility/extensionNodeView.js +11 -0
  17. package/dist/es2019/keymaps/index.js +2 -1
  18. package/dist/es2019/lazy-node-view/index.js +10 -3
  19. package/dist/es2019/lazy-node-view/node-view.js +6 -1
  20. package/dist/es2019/lazy-node-view/replace-node-views.js +94 -28
  21. package/dist/es2019/monitoring/error.js +1 -1
  22. package/dist/es2019/styles/shared/code-block.js +15 -3
  23. package/dist/es2019/ui/DropList/index.js +1 -1
  24. package/dist/esm/extensibility/Extension/Extension/index.js +2 -1
  25. package/dist/esm/extensibility/Extension/Extension/styles.js +4 -0
  26. package/dist/esm/extensibility/MultiBodiedExtension/styles.js +1 -1
  27. package/dist/esm/extensibility/extensionNodeView.js +13 -0
  28. package/dist/esm/keymaps/index.js +2 -1
  29. package/dist/esm/lazy-node-view/index.js +10 -3
  30. package/dist/esm/lazy-node-view/node-view.js +32 -20
  31. package/dist/esm/lazy-node-view/replace-node-views.js +94 -25
  32. package/dist/esm/monitoring/error.js +1 -1
  33. package/dist/esm/styles/shared/code-block.js +3 -4
  34. package/dist/esm/ui/DropList/index.js +1 -1
  35. package/dist/types/extensibility/extensionNodeView.d.ts +1 -0
  36. package/dist/types/keymaps/index.d.ts +2 -0
  37. package/dist/types/lazy-node-view/index.d.ts +5 -2
  38. package/dist/types/lazy-node-view/node-view.d.ts +6 -1
  39. package/dist/types/lazy-node-view/replace-node-views.d.ts +15 -25
  40. package/dist/types/lazy-node-view/types.d.ts +7 -0
  41. package/dist/types/styles/shared/code-block.d.ts +1 -0
  42. package/dist/types-ts4.5/extensibility/extensionNodeView.d.ts +1 -0
  43. package/dist/types-ts4.5/keymaps/index.d.ts +2 -0
  44. package/dist/types-ts4.5/lazy-node-view/index.d.ts +5 -2
  45. package/dist/types-ts4.5/lazy-node-view/node-view.d.ts +6 -1
  46. package/dist/types-ts4.5/lazy-node-view/replace-node-views.d.ts +15 -25
  47. package/dist/types-ts4.5/lazy-node-view/types.d.ts +7 -0
  48. package/dist/types-ts4.5/styles/shared/code-block.d.ts +1 -0
  49. package/package.json +6 -3
@@ -1,7 +1,7 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { DispatchAnalyticsEvent } from '../analytics';
4
- import type { NodeViewConstructor } from './types';
4
+ import type { IgnoreMutationParam, NodeViewConstructor } from './types';
5
5
  export { convertToInlineCss } from './css-helper';
6
6
  export type { NodeViewConstructor };
7
7
  /**
@@ -20,6 +20,9 @@ export type LazyLoadingProps<NodeViewOptions> = {
20
20
  loader: () => Promise<CreateReactNodeViewProps<NodeViewOptions>>;
21
21
  getNodeViewOptions: () => NodeViewOptions;
22
22
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
23
+ lazyNodeViewOptions?: {
24
+ ignoreMutationDelegate?: (mutation: IgnoreMutationParam) => boolean;
25
+ };
23
26
  };
24
27
  /**
25
28
  * 📢 Public: Any EditorPlugin can use this function
@@ -61,4 +64,4 @@ export type LazyLoadingProps<NodeViewOptions> = {
61
64
  *
62
65
  * // Then, use `lazyTableView` in ProseMirror editor setup to enhance 'table' nodes with lazy loading
63
66
  */
64
- export declare const withLazyLoading: <Options>({ nodeName, loader, getNodeViewOptions, dispatchAnalyticsEvent, }: LazyLoadingProps<Options>) => NodeViewConstructor;
67
+ export declare const withLazyLoading: <Options>({ nodeName, loader, getNodeViewOptions, dispatchAnalyticsEvent, lazyNodeViewOptions: { ignoreMutationDelegate }, }: LazyLoadingProps<Options>) => NodeViewConstructor;
@@ -1,5 +1,6 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { IgnoreMutationParam } from './types';
3
4
  /**
4
5
  * 🧱 Internal: Editor FE Platform
5
6
  *
@@ -8,5 +9,9 @@ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
9
  export declare class LazyNodeView implements NodeView {
9
10
  dom: Node;
10
11
  contentDOM?: HTMLElement;
11
- constructor(node: PMNode, view: EditorView, getPos: () => number | undefined);
12
+ private ignoreMutationDelegate?;
13
+ constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, options?: {
14
+ ignoreMutationDelegate?: (mutation: IgnoreMutationParam) => boolean;
15
+ });
16
+ ignoreMutation(mutation: IgnoreMutationParam): boolean;
12
17
  }
@@ -1,40 +1,30 @@
1
- /// <reference types="lodash" />
2
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
2
  import type { CacheLoadedReactNodeViews, NodeViewConstructor } from './types';
4
3
  /**
5
4
  * 🧱 Internal: Editor FE Platform
6
5
  *
7
- * Debounces and replaces the node views in a ProseMirror editor with lazy-loaded node views.
6
+ * Debounced and memoized version of `replaceNodeViews`.
8
7
  *
9
- * This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
10
- * node views have been loaded. It uses a debounced approach to ensure that the replacement does
11
- * not happen too frequently, which can be performance-intensive.
8
+ * This function is designed to update the `nodeViews` property of an `EditorView` after a
9
+ * period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
10
+ * succession. It uses lodash's `debounce` to handle the debouncing.
12
11
  *
13
- * The function checks if there are any loaded node views in the cache associated with the given
14
- * `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
15
- * loaded node views. The replacement is scheduled using `requestIdleCallback` or
16
- * `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
17
- * `requestIdleCallback` may not be supported.
12
+ * Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
13
+ * to update the node views. Without memoization, if you have multiple `EditorView` instances on
14
+ * the same page, only one instance would potentially call `view.setProps`, which could lead to
15
+ * incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
16
+ * we ensure that each `EditorView` maintains its own debounced update logic.
18
17
  *
19
- * @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
20
- * the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
21
- * is a record of node type names to their corresponding `NodeViewConstructor`.
18
+ * @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
19
+ * `EditorView`. The key is the `EditorView`, and the value is a record of node type names
20
+ * to their corresponding `NodeViewConstructor`.
22
21
  * @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
23
22
  * needs to be updated.
24
23
  *
25
- * @example
26
- * const cache = new WeakMap();
27
- * const view = new EditorView(...);
28
- *
29
- * // Assume some node views have been loaded and stored in the cache
30
- * cache.set(view, {
31
- * 'table': TableViewConstructor,
32
- * 'tableCell': TableCellViewConstructor,
33
- * });
34
- *
35
- * debouncedReplaceNodeviews(cache, view);
24
+ * This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
25
+ * which handles adding node views to the cache and triggering this debounced update.
36
26
  */
37
- export declare const debouncedReplaceNodeviews: import("lodash").DebouncedFunc<(cache: CacheLoadedReactNodeViews, view: EditorView) => void>;
27
+ export declare const debouncedReplaceNodeviews: (cache: CacheLoadedReactNodeViews, view: EditorView) => void | undefined;
38
28
  /**
39
29
  * 🧱 Internal: Editor FE Platform
40
30
  */
@@ -1,5 +1,12 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
+ /**
4
+ * 🧱 Internal: Editor FE Platform
5
+ */
6
+ export type IgnoreMutationParam = MutationRecord | {
7
+ type: 'selection';
8
+ target: Element;
9
+ };
3
10
  /**
4
11
  * 🧱 Internal: Editor FE Platform
5
12
  */
@@ -9,6 +9,7 @@ export declare const CodeBlockSharedCssClassName: {
9
9
  CODEBLOCK_LINE_NUMBER_GUTTER_FG_WRAP: string;
10
10
  CODEBLOCK_CONTENT_WRAPPED: string;
11
11
  CODEBLOCK_CONTAINER_LINE_NUMBER_WRAPPED: string;
12
+ CODEBLOCK_WRAPPED: string;
12
13
  };
13
14
  export declare const codeBlockSharedStyles: () => import("@emotion/react").SerializedStyles;
14
15
  export declare const codeBlockInListSafariFix: import("@emotion/react").SerializedStyles;
@@ -17,6 +17,7 @@ export declare class ExtensionNode extends ReactNodeView {
17
17
  type: 'selection';
18
18
  target: Element;
19
19
  }): boolean;
20
+ stopEvent(event: Event): boolean;
20
21
  getContentDOM(): {
21
22
  dom: HTMLDivElement;
22
23
  } | undefined;
@@ -97,6 +97,8 @@ export declare const focusToContextMenuTrigger: Keymap;
97
97
  export declare const dragToMoveUp: Keymap;
98
98
  export declare const dragToMoveDown: Keymap;
99
99
  export declare const showElementDragHandle: Keymap;
100
+ export declare const continueInRovoChat: Keymap;
101
+ export declare function formatShortcut(keymap: Keymap): string | undefined;
100
102
  export declare function tooltip(keymap?: Keymap, description?: string): string | undefined;
101
103
  export declare const ToolTipContent: React.MemoExoticComponent<({ description, shortcutOverride, keymap, }: {
102
104
  description?: string | React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { DispatchAnalyticsEvent } from '../analytics';
4
- import type { NodeViewConstructor } from './types';
4
+ import type { IgnoreMutationParam, NodeViewConstructor } from './types';
5
5
  export { convertToInlineCss } from './css-helper';
6
6
  export type { NodeViewConstructor };
7
7
  /**
@@ -20,6 +20,9 @@ export type LazyLoadingProps<NodeViewOptions> = {
20
20
  loader: () => Promise<CreateReactNodeViewProps<NodeViewOptions>>;
21
21
  getNodeViewOptions: () => NodeViewOptions;
22
22
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
23
+ lazyNodeViewOptions?: {
24
+ ignoreMutationDelegate?: (mutation: IgnoreMutationParam) => boolean;
25
+ };
23
26
  };
24
27
  /**
25
28
  * 📢 Public: Any EditorPlugin can use this function
@@ -61,4 +64,4 @@ export type LazyLoadingProps<NodeViewOptions> = {
61
64
  *
62
65
  * // Then, use `lazyTableView` in ProseMirror editor setup to enhance 'table' nodes with lazy loading
63
66
  */
64
- export declare const withLazyLoading: <Options>({ nodeName, loader, getNodeViewOptions, dispatchAnalyticsEvent, }: LazyLoadingProps<Options>) => NodeViewConstructor;
67
+ export declare const withLazyLoading: <Options>({ nodeName, loader, getNodeViewOptions, dispatchAnalyticsEvent, lazyNodeViewOptions: { ignoreMutationDelegate }, }: LazyLoadingProps<Options>) => NodeViewConstructor;
@@ -1,5 +1,6 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { IgnoreMutationParam } from './types';
3
4
  /**
4
5
  * 🧱 Internal: Editor FE Platform
5
6
  *
@@ -8,5 +9,9 @@ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
9
  export declare class LazyNodeView implements NodeView {
9
10
  dom: Node;
10
11
  contentDOM?: HTMLElement;
11
- constructor(node: PMNode, view: EditorView, getPos: () => number | undefined);
12
+ private ignoreMutationDelegate?;
13
+ constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, options?: {
14
+ ignoreMutationDelegate?: (mutation: IgnoreMutationParam) => boolean;
15
+ });
16
+ ignoreMutation(mutation: IgnoreMutationParam): boolean;
12
17
  }
@@ -1,40 +1,30 @@
1
- /// <reference types="lodash" />
2
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
2
  import type { CacheLoadedReactNodeViews, NodeViewConstructor } from './types';
4
3
  /**
5
4
  * 🧱 Internal: Editor FE Platform
6
5
  *
7
- * Debounces and replaces the node views in a ProseMirror editor with lazy-loaded node views.
6
+ * Debounced and memoized version of `replaceNodeViews`.
8
7
  *
9
- * This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
10
- * node views have been loaded. It uses a debounced approach to ensure that the replacement does
11
- * not happen too frequently, which can be performance-intensive.
8
+ * This function is designed to update the `nodeViews` property of an `EditorView` after a
9
+ * period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
10
+ * succession. It uses lodash's `debounce` to handle the debouncing.
12
11
  *
13
- * The function checks if there are any loaded node views in the cache associated with the given
14
- * `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
15
- * loaded node views. The replacement is scheduled using `requestIdleCallback` or
16
- * `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
17
- * `requestIdleCallback` may not be supported.
12
+ * Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
13
+ * to update the node views. Without memoization, if you have multiple `EditorView` instances on
14
+ * the same page, only one instance would potentially call `view.setProps`, which could lead to
15
+ * incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
16
+ * we ensure that each `EditorView` maintains its own debounced update logic.
18
17
  *
19
- * @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
20
- * the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
21
- * is a record of node type names to their corresponding `NodeViewConstructor`.
18
+ * @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
19
+ * `EditorView`. The key is the `EditorView`, and the value is a record of node type names
20
+ * to their corresponding `NodeViewConstructor`.
22
21
  * @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
23
22
  * needs to be updated.
24
23
  *
25
- * @example
26
- * const cache = new WeakMap();
27
- * const view = new EditorView(...);
28
- *
29
- * // Assume some node views have been loaded and stored in the cache
30
- * cache.set(view, {
31
- * 'table': TableViewConstructor,
32
- * 'tableCell': TableCellViewConstructor,
33
- * });
34
- *
35
- * debouncedReplaceNodeviews(cache, view);
24
+ * This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
25
+ * which handles adding node views to the cache and triggering this debounced update.
36
26
  */
37
- export declare const debouncedReplaceNodeviews: import("lodash").DebouncedFunc<(cache: CacheLoadedReactNodeViews, view: EditorView) => void>;
27
+ export declare const debouncedReplaceNodeviews: (cache: CacheLoadedReactNodeViews, view: EditorView) => void | undefined;
38
28
  /**
39
29
  * 🧱 Internal: Editor FE Platform
40
30
  */
@@ -1,5 +1,12 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
+ /**
4
+ * 🧱 Internal: Editor FE Platform
5
+ */
6
+ export type IgnoreMutationParam = MutationRecord | {
7
+ type: 'selection';
8
+ target: Element;
9
+ };
3
10
  /**
4
11
  * 🧱 Internal: Editor FE Platform
5
12
  */
@@ -9,6 +9,7 @@ export declare const CodeBlockSharedCssClassName: {
9
9
  CODEBLOCK_LINE_NUMBER_GUTTER_FG_WRAP: string;
10
10
  CODEBLOCK_CONTENT_WRAPPED: string;
11
11
  CODEBLOCK_CONTAINER_LINE_NUMBER_WRAPPED: string;
12
+ CODEBLOCK_WRAPPED: string;
12
13
  };
13
14
  export declare const codeBlockSharedStyles: () => import("@emotion/react").SerializedStyles;
14
15
  export declare const codeBlockInListSafariFix: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "87.6.0",
3
+ "version": "87.6.2",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -127,11 +127,11 @@
127
127
  "@atlaskit/media-file-preview": "^0.6.0",
128
128
  "@atlaskit/media-picker": "^66.4.0",
129
129
  "@atlaskit/media-ui": "^25.10.0",
130
- "@atlaskit/media-viewer": "48.6.15",
130
+ "@atlaskit/media-viewer": "48.6.16",
131
131
  "@atlaskit/mention": "^23.2.0",
132
132
  "@atlaskit/menu": "^2.10.0",
133
133
  "@atlaskit/platform-feature-flags": "^0.3.0",
134
- "@atlaskit/primitives": "^11.1.0",
134
+ "@atlaskit/primitives": "^12.0.0",
135
135
  "@atlaskit/profilecard": "^19.17.0",
136
136
  "@atlaskit/section-message": "^6.5.0",
137
137
  "@atlaskit/smart-card": "^27.13.0",
@@ -268,6 +268,9 @@
268
268
  },
269
269
  "platform_editor_migration_icon_and_typography": {
270
270
  "type": "boolean"
271
+ },
272
+ "cc_page_experiences_live_search_wysiwyg": {
273
+ "type": "boolean"
271
274
  }
272
275
  }
273
276
  }