@atlaskit/editor-plugin-expand 1.6.2 → 1.6.3

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,13 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 1.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#95226](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95226) [`35450b170a19`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35450b170a19) - [ux] [ED-23152] Expands no longer change state (open/closed) when the page width is toggled by a user (live pages/ single player expands)
8
+ - [#94901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94901) [`da964fcdc828`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/da964fcdc828) - [ED-23097] Bump ADF schema to version 35.12.1
9
+ - [#94398](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94398) [`4df808e35fda`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4df808e35fda) - [ux] [ED-23108] Solve bug where single player expands would lose their expanded state when adding breakout marks. Single player expands are only used when `platform.editor.single-player-expand` FF AND live page are both enabled.
10
+
3
11
  ## 1.6.2
4
12
 
5
13
  ### Patch Changes
@@ -83,7 +83,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
83
83
  pos: pos,
84
84
  node: _this.node
85
85
  })(_this.view.state, _this.view.dispatch);
86
- _this.updateExpandToggleIcon();
86
+ _this.updateExpandToggleIcon(_this.node);
87
87
  return;
88
88
  }
89
89
  if (target === _this.input) {
@@ -176,7 +176,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
176
176
  pos: pos,
177
177
  node: _this.node
178
178
  })(state, dispatch);
179
- _this.updateExpandToggleIcon();
179
+ _this.updateExpandToggleIcon(_this.node);
180
180
  }
181
181
  });
182
182
  (0, _defineProperty2.default)(this, "moveToOutsideOfTitle", function (event) {
@@ -393,13 +393,23 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
393
393
  _this2.input.value = _this2.node.attrs.title;
394
394
  }
395
395
  });
396
- if (this.node !== node) {
396
+
397
+ // This solves for a bug where the breakout plugin updates the node
398
+ // but by the time it reaches the update, it gives us the expand after
399
+ if (this.node !== node && this.node.attrs.title !== node.attrs.title) {
400
+ var shouldBeExpanded = _expand.expandedState.get(node);
401
+ if (shouldBeExpanded === undefined) {
402
+ _expand.expandedState.set(node, true);
403
+ }
404
+ this.updateExpandToggleIcon(node);
405
+ } else if (this.node !== node) {
406
+ // This checks if the node has been replaced with a different version
407
+ // and updates the state of the new node to match the old one
397
408
  var previousExpandedState = _expand.expandedState.get(this.node);
398
409
  if (previousExpandedState === undefined) {
399
410
  previousExpandedState = true;
400
411
  }
401
412
  _expand.expandedState.set(node, previousExpandedState);
402
- _expand.expandedState.delete(this.node);
403
413
  }
404
414
  this.node = node;
405
415
  return true;
@@ -408,13 +418,13 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
408
418
  }
409
419
  }, {
410
420
  key: "updateExpandToggleIcon",
411
- value: function updateExpandToggleIcon() {
412
- var expanded = _expand.expandedState.get(this.node) ? _expand.expandedState.get(this.node) : false;
421
+ value: function updateExpandToggleIcon(node) {
422
+ var expanded = _expand.expandedState.get(node) ? _expand.expandedState.get(node) : false;
413
423
  if (this.dom && expanded !== undefined) {
414
424
  var _expandedState$get2;
415
- this.dom.className = (0, _NodeView.buildExpandClassName)(this.node.type.name, expanded);
425
+ this.dom.className = (0, _NodeView.buildExpandClassName)(node.type.name, expanded);
416
426
  // Re-render the icon to update the aria-expanded attribute
417
- (0, _NodeView.renderIcon)(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = _expand.expandedState.get(this.node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
427
+ (0, _NodeView.renderIcon)(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = _expand.expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
418
428
  }
419
429
  this.updateExpandBodyContentEditable();
420
430
  }
@@ -442,7 +452,6 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
442
452
  this.icon.removeEventListener('keydown', this.handleIconKeyDown);
443
453
  (_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
444
454
  _reactDom.default.unmountComponentAtNode(this.icon);
445
- _expand.expandedState.delete(this.node);
446
455
  }
447
456
  }]);
448
457
  return ExpandNodeView;
@@ -70,7 +70,7 @@ export class ExpandNodeView {
70
70
  pos,
71
71
  node: this.node
72
72
  })(this.view.state, this.view.dispatch);
73
- this.updateExpandToggleIcon();
73
+ this.updateExpandToggleIcon(this.node);
74
74
  return;
75
75
  }
76
76
  if (target === this.input) {
@@ -168,7 +168,7 @@ export class ExpandNodeView {
168
168
  pos,
169
169
  node: this.node
170
170
  })(state, dispatch);
171
- this.updateExpandToggleIcon();
171
+ this.updateExpandToggleIcon(this.node);
172
172
  }
173
173
  });
174
174
  _defineProperty(this, "moveToOutsideOfTitle", event => {
@@ -388,26 +388,36 @@ export class ExpandNodeView {
388
388
  this.input.value = this.node.attrs.title;
389
389
  }
390
390
  });
391
- if (this.node !== node) {
391
+
392
+ // This solves for a bug where the breakout plugin updates the node
393
+ // but by the time it reaches the update, it gives us the expand after
394
+ if (this.node !== node && this.node.attrs.title !== node.attrs.title) {
395
+ let shouldBeExpanded = expandedState.get(node);
396
+ if (shouldBeExpanded === undefined) {
397
+ expandedState.set(node, true);
398
+ }
399
+ this.updateExpandToggleIcon(node);
400
+ } else if (this.node !== node) {
401
+ // This checks if the node has been replaced with a different version
402
+ // and updates the state of the new node to match the old one
392
403
  let previousExpandedState = expandedState.get(this.node);
393
404
  if (previousExpandedState === undefined) {
394
405
  previousExpandedState = true;
395
406
  }
396
407
  expandedState.set(node, previousExpandedState);
397
- expandedState.delete(this.node);
398
408
  }
399
409
  this.node = node;
400
410
  return true;
401
411
  }
402
412
  return false;
403
413
  }
404
- updateExpandToggleIcon() {
405
- const expanded = expandedState.get(this.node) ? expandedState.get(this.node) : false;
414
+ updateExpandToggleIcon(node) {
415
+ const expanded = expandedState.get(node) ? expandedState.get(node) : false;
406
416
  if (this.dom && expanded !== undefined) {
407
417
  var _expandedState$get2;
408
- this.dom.className = buildExpandClassName(this.node.type.name, expanded);
418
+ this.dom.className = buildExpandClassName(node.type.name, expanded);
409
419
  // Re-render the icon to update the aria-expanded attribute
410
- renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(this.node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
420
+ renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
411
421
  }
412
422
  this.updateExpandBodyContentEditable();
413
423
  }
@@ -431,7 +441,6 @@ export class ExpandNodeView {
431
441
  this.icon.removeEventListener('keydown', this.handleIconKeyDown);
432
442
  (_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 ? void 0 : _this$decorationClean2.call(this);
433
443
  ReactDOM.unmountComponentAtNode(this.icon);
434
- expandedState.delete(this.node);
435
444
  }
436
445
  }
437
446
  export default function ({
@@ -75,7 +75,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
75
75
  pos: pos,
76
76
  node: _this.node
77
77
  })(_this.view.state, _this.view.dispatch);
78
- _this.updateExpandToggleIcon();
78
+ _this.updateExpandToggleIcon(_this.node);
79
79
  return;
80
80
  }
81
81
  if (target === _this.input) {
@@ -168,7 +168,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
168
168
  pos: pos,
169
169
  node: _this.node
170
170
  })(state, dispatch);
171
- _this.updateExpandToggleIcon();
171
+ _this.updateExpandToggleIcon(_this.node);
172
172
  }
173
173
  });
174
174
  _defineProperty(this, "moveToOutsideOfTitle", function (event) {
@@ -385,13 +385,23 @@ export var ExpandNodeView = /*#__PURE__*/function () {
385
385
  _this2.input.value = _this2.node.attrs.title;
386
386
  }
387
387
  });
388
- if (this.node !== node) {
388
+
389
+ // This solves for a bug where the breakout plugin updates the node
390
+ // but by the time it reaches the update, it gives us the expand after
391
+ if (this.node !== node && this.node.attrs.title !== node.attrs.title) {
392
+ var shouldBeExpanded = expandedState.get(node);
393
+ if (shouldBeExpanded === undefined) {
394
+ expandedState.set(node, true);
395
+ }
396
+ this.updateExpandToggleIcon(node);
397
+ } else if (this.node !== node) {
398
+ // This checks if the node has been replaced with a different version
399
+ // and updates the state of the new node to match the old one
389
400
  var previousExpandedState = expandedState.get(this.node);
390
401
  if (previousExpandedState === undefined) {
391
402
  previousExpandedState = true;
392
403
  }
393
404
  expandedState.set(node, previousExpandedState);
394
- expandedState.delete(this.node);
395
405
  }
396
406
  this.node = node;
397
407
  return true;
@@ -400,13 +410,13 @@ export var ExpandNodeView = /*#__PURE__*/function () {
400
410
  }
401
411
  }, {
402
412
  key: "updateExpandToggleIcon",
403
- value: function updateExpandToggleIcon() {
404
- var expanded = expandedState.get(this.node) ? expandedState.get(this.node) : false;
413
+ value: function updateExpandToggleIcon(node) {
414
+ var expanded = expandedState.get(node) ? expandedState.get(node) : false;
405
415
  if (this.dom && expanded !== undefined) {
406
416
  var _expandedState$get2;
407
- this.dom.className = buildExpandClassName(this.node.type.name, expanded);
417
+ this.dom.className = buildExpandClassName(node.type.name, expanded);
408
418
  // Re-render the icon to update the aria-expanded attribute
409
- renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(this.node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
419
+ renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
410
420
  }
411
421
  this.updateExpandBodyContentEditable();
412
422
  }
@@ -434,7 +444,6 @@ export var ExpandNodeView = /*#__PURE__*/function () {
434
444
  this.icon.removeEventListener('keydown', this.handleIconKeyDown);
435
445
  (_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
436
446
  ReactDOM.unmountComponentAtNode(this.icon);
437
- expandedState.delete(this.node);
438
447
  }
439
448
  }]);
440
449
  return ExpandNodeView;
@@ -44,7 +44,7 @@ export declare class ExpandNodeView implements NodeView {
44
44
  target: Element;
45
45
  }): boolean;
46
46
  update(node: PmNode, _decorations: readonly Decoration[]): boolean;
47
- updateExpandToggleIcon(): void;
47
+ updateExpandToggleIcon(node: PmNode): void;
48
48
  updateExpandBodyContentEditable(): void;
49
49
  destroy(): void;
50
50
  }
@@ -44,7 +44,7 @@ export declare class ExpandNodeView implements NodeView {
44
44
  target: Element;
45
45
  }): boolean;
46
46
  update(node: PmNode, _decorations: readonly Decoration[]): boolean;
47
- updateExpandToggleIcon(): void;
47
+ updateExpandToggleIcon(node: PmNode): void;
48
48
  updateExpandBodyContentEditable(): void;
49
49
  destroy(): void;
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,9 +33,9 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/adf-schema": "^35.10.0",
36
+ "@atlaskit/adf-schema": "^35.12.1",
37
37
  "@atlaskit/button": "^17.14.0",
38
- "@atlaskit/editor-common": "^78.33.0",
38
+ "@atlaskit/editor-common": "^78.36.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.1.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
41
41
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
@@ -61,7 +61,7 @@
61
61
  "@atlaskit/editor-plugin-content-insertion": "^1.1.0",
62
62
  "@atlaskit/editor-plugin-guideline": "^1.1.0",
63
63
  "@atlaskit/editor-plugin-quick-insert": "^1.1.0",
64
- "@atlaskit/editor-plugin-table": "^7.10.0",
64
+ "@atlaskit/editor-plugin-table": "^7.11.0",
65
65
  "@atlaskit/editor-plugin-type-ahead": "^1.1.0",
66
66
  "@atlaskit/editor-plugin-width": "^1.1.0",
67
67
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",