@atlaskit/editor-plugin-expand 1.6.1 → 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 +14 -0
- package/dist/cjs/singlePlayerExpand/node-views/index.js +23 -10
- package/dist/es2019/singlePlayerExpand/node-views/index.js +23 -10
- package/dist/esm/singlePlayerExpand/node-views/index.js +23 -10
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
11
|
+
## 1.6.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#93962](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93962) [`797e12a40048`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/797e12a40048) - [ED-23107] fix functionality for moving down from the title of an expand with the arrow key down - you can be anywhere inside the single player expand title and move down now. the single player expand is only used when live view is enabled and the platform.editor.single-player-expand FF is enabled.
|
|
16
|
+
|
|
3
17
|
## 1.6.1
|
|
4
18
|
|
|
5
19
|
### 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) {
|
|
@@ -222,7 +222,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
222
222
|
value = _this$input2.value,
|
|
223
223
|
selectionStart = _this$input2.selectionStart,
|
|
224
224
|
selectionEnd = _this$input2.selectionEnd;
|
|
225
|
-
|
|
225
|
+
var selectionStartExists = selectionStart !== null && selectionStart !== undefined;
|
|
226
|
+
var selectionEndExists = selectionEnd !== null && selectionEnd !== undefined;
|
|
227
|
+
var selectionStartInsideTitle = selectionStartExists && selectionStart >= 0 && selectionStart <= value.length;
|
|
228
|
+
var selectionEndInsideTitle = selectionEndExists && selectionEnd >= 0 && selectionEnd <= value.length;
|
|
229
|
+
if (selectionStartInsideTitle && selectionEndInsideTitle) {
|
|
226
230
|
var _this$view5 = _this.view,
|
|
227
231
|
state = _this$view5.state,
|
|
228
232
|
dispatch = _this$view5.dispatch;
|
|
@@ -389,13 +393,23 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
389
393
|
_this2.input.value = _this2.node.attrs.title;
|
|
390
394
|
}
|
|
391
395
|
});
|
|
392
|
-
|
|
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
|
|
393
408
|
var previousExpandedState = _expand.expandedState.get(this.node);
|
|
394
409
|
if (previousExpandedState === undefined) {
|
|
395
410
|
previousExpandedState = true;
|
|
396
411
|
}
|
|
397
412
|
_expand.expandedState.set(node, previousExpandedState);
|
|
398
|
-
_expand.expandedState.delete(this.node);
|
|
399
413
|
}
|
|
400
414
|
this.node = node;
|
|
401
415
|
return true;
|
|
@@ -404,13 +418,13 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
404
418
|
}
|
|
405
419
|
}, {
|
|
406
420
|
key: "updateExpandToggleIcon",
|
|
407
|
-
value: function updateExpandToggleIcon() {
|
|
408
|
-
var expanded = _expand.expandedState.get(
|
|
421
|
+
value: function updateExpandToggleIcon(node) {
|
|
422
|
+
var expanded = _expand.expandedState.get(node) ? _expand.expandedState.get(node) : false;
|
|
409
423
|
if (this.dom && expanded !== undefined) {
|
|
410
424
|
var _expandedState$get2;
|
|
411
|
-
this.dom.className = (0, _NodeView.buildExpandClassName)(
|
|
425
|
+
this.dom.className = (0, _NodeView.buildExpandClassName)(node.type.name, expanded);
|
|
412
426
|
// Re-render the icon to update the aria-expanded attribute
|
|
413
|
-
(0, _NodeView.renderIcon)(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = _expand.expandedState.get(
|
|
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);
|
|
414
428
|
}
|
|
415
429
|
this.updateExpandBodyContentEditable();
|
|
416
430
|
}
|
|
@@ -438,7 +452,6 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
438
452
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
439
453
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
440
454
|
_reactDom.default.unmountComponentAtNode(this.icon);
|
|
441
|
-
_expand.expandedState.delete(this.node);
|
|
442
455
|
}
|
|
443
456
|
}]);
|
|
444
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 => {
|
|
@@ -216,7 +216,11 @@ export class ExpandNodeView {
|
|
|
216
216
|
selectionStart,
|
|
217
217
|
selectionEnd
|
|
218
218
|
} = this.input;
|
|
219
|
-
|
|
219
|
+
const selectionStartExists = selectionStart !== null && selectionStart !== undefined;
|
|
220
|
+
const selectionEndExists = selectionEnd !== null && selectionEnd !== undefined;
|
|
221
|
+
const selectionStartInsideTitle = selectionStartExists && selectionStart >= 0 && selectionStart <= value.length;
|
|
222
|
+
const selectionEndInsideTitle = selectionEndExists && selectionEnd >= 0 && selectionEnd <= value.length;
|
|
223
|
+
if (selectionStartInsideTitle && selectionEndInsideTitle) {
|
|
220
224
|
const {
|
|
221
225
|
state,
|
|
222
226
|
dispatch
|
|
@@ -384,26 +388,36 @@ export class ExpandNodeView {
|
|
|
384
388
|
this.input.value = this.node.attrs.title;
|
|
385
389
|
}
|
|
386
390
|
});
|
|
387
|
-
|
|
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
|
|
388
403
|
let previousExpandedState = expandedState.get(this.node);
|
|
389
404
|
if (previousExpandedState === undefined) {
|
|
390
405
|
previousExpandedState = true;
|
|
391
406
|
}
|
|
392
407
|
expandedState.set(node, previousExpandedState);
|
|
393
|
-
expandedState.delete(this.node);
|
|
394
408
|
}
|
|
395
409
|
this.node = node;
|
|
396
410
|
return true;
|
|
397
411
|
}
|
|
398
412
|
return false;
|
|
399
413
|
}
|
|
400
|
-
updateExpandToggleIcon() {
|
|
401
|
-
const expanded = expandedState.get(
|
|
414
|
+
updateExpandToggleIcon(node) {
|
|
415
|
+
const expanded = expandedState.get(node) ? expandedState.get(node) : false;
|
|
402
416
|
if (this.dom && expanded !== undefined) {
|
|
403
417
|
var _expandedState$get2;
|
|
404
|
-
this.dom.className = buildExpandClassName(
|
|
418
|
+
this.dom.className = buildExpandClassName(node.type.name, expanded);
|
|
405
419
|
// Re-render the icon to update the aria-expanded attribute
|
|
406
|
-
renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(
|
|
420
|
+
renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
|
|
407
421
|
}
|
|
408
422
|
this.updateExpandBodyContentEditable();
|
|
409
423
|
}
|
|
@@ -427,7 +441,6 @@ export class ExpandNodeView {
|
|
|
427
441
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
428
442
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 ? void 0 : _this$decorationClean2.call(this);
|
|
429
443
|
ReactDOM.unmountComponentAtNode(this.icon);
|
|
430
|
-
expandedState.delete(this.node);
|
|
431
444
|
}
|
|
432
445
|
}
|
|
433
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) {
|
|
@@ -214,7 +214,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
214
214
|
value = _this$input2.value,
|
|
215
215
|
selectionStart = _this$input2.selectionStart,
|
|
216
216
|
selectionEnd = _this$input2.selectionEnd;
|
|
217
|
-
|
|
217
|
+
var selectionStartExists = selectionStart !== null && selectionStart !== undefined;
|
|
218
|
+
var selectionEndExists = selectionEnd !== null && selectionEnd !== undefined;
|
|
219
|
+
var selectionStartInsideTitle = selectionStartExists && selectionStart >= 0 && selectionStart <= value.length;
|
|
220
|
+
var selectionEndInsideTitle = selectionEndExists && selectionEnd >= 0 && selectionEnd <= value.length;
|
|
221
|
+
if (selectionStartInsideTitle && selectionEndInsideTitle) {
|
|
218
222
|
var _this$view5 = _this.view,
|
|
219
223
|
state = _this$view5.state,
|
|
220
224
|
dispatch = _this$view5.dispatch;
|
|
@@ -381,13 +385,23 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
381
385
|
_this2.input.value = _this2.node.attrs.title;
|
|
382
386
|
}
|
|
383
387
|
});
|
|
384
|
-
|
|
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
|
|
385
400
|
var previousExpandedState = expandedState.get(this.node);
|
|
386
401
|
if (previousExpandedState === undefined) {
|
|
387
402
|
previousExpandedState = true;
|
|
388
403
|
}
|
|
389
404
|
expandedState.set(node, previousExpandedState);
|
|
390
|
-
expandedState.delete(this.node);
|
|
391
405
|
}
|
|
392
406
|
this.node = node;
|
|
393
407
|
return true;
|
|
@@ -396,13 +410,13 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
396
410
|
}
|
|
397
411
|
}, {
|
|
398
412
|
key: "updateExpandToggleIcon",
|
|
399
|
-
value: function updateExpandToggleIcon() {
|
|
400
|
-
var expanded = expandedState.get(
|
|
413
|
+
value: function updateExpandToggleIcon(node) {
|
|
414
|
+
var expanded = expandedState.get(node) ? expandedState.get(node) : false;
|
|
401
415
|
if (this.dom && expanded !== undefined) {
|
|
402
416
|
var _expandedState$get2;
|
|
403
|
-
this.dom.className = buildExpandClassName(
|
|
417
|
+
this.dom.className = buildExpandClassName(node.type.name, expanded);
|
|
404
418
|
// Re-render the icon to update the aria-expanded attribute
|
|
405
|
-
renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(
|
|
419
|
+
renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
|
|
406
420
|
}
|
|
407
421
|
this.updateExpandBodyContentEditable();
|
|
408
422
|
}
|
|
@@ -430,7 +444,6 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
430
444
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
431
445
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
432
446
|
ReactDOM.unmountComponentAtNode(this.icon);
|
|
433
|
-
expandedState.delete(this.node);
|
|
434
447
|
}
|
|
435
448
|
}]);
|
|
436
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.
|
|
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,16 +33,16 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/adf-schema": "^35.
|
|
36
|
+
"@atlaskit/adf-schema": "^35.12.1",
|
|
37
37
|
"@atlaskit/button": "^17.14.0",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
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",
|
|
42
42
|
"@atlaskit/editor-plugin-selection": "^1.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-selection-marker": "^1.3.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
45
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
45
|
+
"@atlaskit/editor-shared-styles": "^2.10.0",
|
|
46
46
|
"@atlaskit/editor-tables": "^2.7.0",
|
|
47
47
|
"@atlaskit/icon": "^22.1.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.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.
|
|
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",
|