@atlaskit/editor-plugin-caption 1.6.1 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/editor-plugin-caption
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#122895](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122895)
8
+ [`49b8c7658f3b5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/49b8c7658f3b5) -
9
+ [ED-24173] bump @atlaskit/adf-schema to 40.3.0 and @atlassian/adf-schema-json to 1.18.0
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 1.6.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#121438](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121438)
20
+ [`35e0addb19a19`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35e0addb19a19) -
21
+ [ux] Fixing media caption to stop them infinitely re-rendering in react 18 when using createRoot
22
+
3
23
  ## 1.6.1
4
24
 
5
25
  ### Patch Changes
@@ -55,6 +55,20 @@ var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_Selectio
55
55
  dom: dom
56
56
  };
57
57
  }
58
+
59
+ // ED-24114: We need to ignore mutations that are not related to the caption node
60
+ // since these mutations can cause an infinite loop in React 18 when using createRoot
61
+ }, {
62
+ key: "ignoreMutation",
63
+ value: function ignoreMutation(mutation) {
64
+ if (!(0, _platformFeatureFlags.fg)('react_18_caption_concurrent_mode')) {
65
+ return false;
66
+ }
67
+ if (!this.contentDOM) {
68
+ return true;
69
+ }
70
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
71
+ }
58
72
  }, {
59
73
  key: "handleEditorDisabledChanged",
60
74
  value: function handleEditorDisabledChanged() {
@@ -30,6 +30,18 @@ export class CaptionNodeView extends SelectionBasedNodeView {
30
30
  dom
31
31
  };
32
32
  }
33
+
34
+ // ED-24114: We need to ignore mutations that are not related to the caption node
35
+ // since these mutations can cause an infinite loop in React 18 when using createRoot
36
+ ignoreMutation(mutation) {
37
+ if (!fg('react_18_caption_concurrent_mode')) {
38
+ return false;
39
+ }
40
+ if (!this.contentDOM) {
41
+ return true;
42
+ }
43
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
44
+ }
33
45
  handleEditorDisabledChanged() {
34
46
  var _this$pluginInjection4;
35
47
  if ((_this$pluginInjection4 = this.pluginInjectionApi) !== null && _this$pluginInjection4 !== void 0 && _this$pluginInjection4.editorDisabled) {
@@ -47,6 +47,20 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
47
47
  dom: dom
48
48
  };
49
49
  }
50
+
51
+ // ED-24114: We need to ignore mutations that are not related to the caption node
52
+ // since these mutations can cause an infinite loop in React 18 when using createRoot
53
+ }, {
54
+ key: "ignoreMutation",
55
+ value: function ignoreMutation(mutation) {
56
+ if (!fg('react_18_caption_concurrent_mode')) {
57
+ return false;
58
+ }
59
+ if (!this.contentDOM) {
60
+ return true;
61
+ }
62
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
63
+ }
50
64
  }, {
51
65
  key: "handleEditorDisabledChanged",
52
66
  value: function handleEditorDisabledChanged() {
@@ -16,6 +16,10 @@ export declare class CaptionNodeView extends SelectionBasedNodeView {
16
16
  getContentDOM(): {
17
17
  dom: HTMLDivElement;
18
18
  };
19
+ ignoreMutation(mutation: MutationRecord | {
20
+ type: 'selection';
21
+ target: Element;
22
+ }): boolean;
19
23
  handleEditorDisabledChanged(): void;
20
24
  render(_props: never, forwardRef: ForwardRef): JSX.Element;
21
25
  viewShouldUpdate(nextNode: PMNode): boolean;
@@ -16,6 +16,10 @@ export declare class CaptionNodeView extends SelectionBasedNodeView {
16
16
  getContentDOM(): {
17
17
  dom: HTMLDivElement;
18
18
  };
19
+ ignoreMutation(mutation: MutationRecord | {
20
+ type: 'selection';
21
+ target: Element;
22
+ }): boolean;
19
23
  handleEditorDisabledChanged(): void;
20
24
  render(_props: never, forwardRef: ForwardRef): JSX.Element;
21
25
  viewShouldUpdate(nextNode: PMNode): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-caption",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Caption plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,9 +32,9 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^39.0.3",
36
- "@atlaskit/editor-common": "^86.0.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.4.0",
35
+ "@atlaskit/adf-schema": "^40.3.0",
36
+ "@atlaskit/editor-common": "^86.7.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.5.0",
38
38
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
39
39
  "@atlaskit/editor-prosemirror": "4.0.1",
40
40
  "@atlaskit/platform-feature-flags": "^0.3.0",
@@ -44,13 +44,13 @@
44
44
  "@atlaskit/editor-plugin-copy-button": "^1.1.0",
45
45
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
46
46
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
47
- "@atlaskit/editor-plugin-floating-toolbar": "^1.7.0",
47
+ "@atlaskit/editor-plugin-floating-toolbar": "^1.8.0",
48
48
  "@atlaskit/editor-plugin-focus": "^1.2.0",
49
49
  "@atlaskit/editor-plugin-grid": "^1.1.0",
50
50
  "@atlaskit/editor-plugin-guideline": "^1.1.0",
51
51
  "@atlaskit/editor-plugin-selection": "^1.2.0",
52
52
  "@atlaskit/editor-plugin-width": "^1.1.0",
53
- "@atlaskit/renderer": "^109.42.0"
53
+ "@atlaskit/renderer": "^109.43.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "^16.8.0"
@@ -88,6 +88,9 @@
88
88
  "platform-feature-flags": {
89
89
  "platform.editor.live-view.disable-editing-in-view-mode_fi1rx": {
90
90
  "type": "boolean"
91
+ },
92
+ "react_18_caption_concurrent_mode": {
93
+ "type": "boolean"
91
94
  }
92
95
  }
93
96
  }