@atlaskit/editor-plugin-expand 1.4.2 → 1.4.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 +6 -0
- package/dist/cjs/singlePlayerExpand/node-views/index.js +10 -6
- package/dist/cjs/singlePlayerExpand/ui/NodeView.js +1 -5
- package/dist/es2019/singlePlayerExpand/node-views/index.js +8 -4
- package/dist/es2019/singlePlayerExpand/ui/NodeView.js +1 -5
- package/dist/esm/singlePlayerExpand/node-views/index.js +10 -6
- package/dist/esm/singlePlayerExpand/ui/NodeView.js +1 -5
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +1 -1
- package/dist/types/singlePlayerExpand/ui/NodeView.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/ui/NodeView.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 1.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#92468](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92468) [`515df766c29c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/515df766c29c) - [ux] [ED-23066] Re-render expand toggle icon when the class name is updated so that the aria-expanded attribute gets updated to match.
|
|
8
|
+
|
|
3
9
|
## 1.4.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -21,7 +21,8 @@ var _commands = require("../commands");
|
|
|
21
21
|
var _NodeView = require("../ui/NodeView");
|
|
22
22
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
23
23
|
function ExpandNodeView(node, view, getPos, getIntl, isMobile, selectNearNode, api) {
|
|
24
|
-
var _this = this
|
|
24
|
+
var _this = this,
|
|
25
|
+
_expandedState$get;
|
|
25
26
|
var allowInteractiveExpand = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
26
27
|
var __livePage = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
27
28
|
(0, _classCallCheck2.default)(this, ExpandNodeView);
|
|
@@ -82,7 +83,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
82
83
|
pos: pos,
|
|
83
84
|
node: _this.node
|
|
84
85
|
})(_this.view.state, _this.view.dispatch);
|
|
85
|
-
_this.
|
|
86
|
+
_this.updateExpandToggleIcon();
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
if (target === _this.input) {
|
|
@@ -175,7 +176,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
175
176
|
pos: pos,
|
|
176
177
|
node: _this.node
|
|
177
178
|
})(state, dispatch);
|
|
178
|
-
_this.
|
|
179
|
+
_this.updateExpandToggleIcon();
|
|
179
180
|
}
|
|
180
181
|
});
|
|
181
182
|
(0, _defineProperty2.default)(this, "moveToOutsideOfTitle", function (event) {
|
|
@@ -334,10 +335,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
334
335
|
this.icon = this.dom.querySelector(".".concat(_styles.expandClassNames.icon));
|
|
335
336
|
this.input = this.dom.querySelector(".".concat(_styles.expandClassNames.titleInput));
|
|
336
337
|
this.titleContainer = this.dom.querySelector(".".concat(_styles.expandClassNames.titleContainer));
|
|
337
|
-
(0, _NodeView.renderIcon)(this.icon, this.allowInteractiveExpand, this.intl);
|
|
338
338
|
if (!_expand.expandedState.has(this.node)) {
|
|
339
339
|
_expand.expandedState.set(this.node, false);
|
|
340
340
|
}
|
|
341
|
+
(0, _NodeView.renderIcon)(this.icon, this.allowInteractiveExpand, (_expandedState$get = _expand.expandedState.get(this.node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false, this.intl);
|
|
341
342
|
if (!this.input || !this.titleContainer || !this.icon) {
|
|
342
343
|
return;
|
|
343
344
|
}
|
|
@@ -400,11 +401,14 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
400
401
|
return false;
|
|
401
402
|
}
|
|
402
403
|
}, {
|
|
403
|
-
key: "
|
|
404
|
-
value: function
|
|
404
|
+
key: "updateExpandToggleIcon",
|
|
405
|
+
value: function updateExpandToggleIcon() {
|
|
405
406
|
var expanded = _expand.expandedState.get(this.node) ? _expand.expandedState.get(this.node) : false;
|
|
406
407
|
if (this.dom && expanded !== undefined) {
|
|
408
|
+
var _expandedState$get2;
|
|
407
409
|
this.dom.className = (0, _NodeView.buildExpandClassName)(this.node.type.name, expanded);
|
|
410
|
+
// Re-render the icon to update the aria-expanded attribute
|
|
411
|
+
(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);
|
|
408
412
|
}
|
|
409
413
|
}
|
|
410
414
|
}, {
|
|
@@ -48,14 +48,10 @@ var toDOM = exports.toDOM = function toDOM(node, __livePage, intl) {
|
|
|
48
48
|
'class': _styles.expandClassNames.content
|
|
49
49
|
}, 0]];
|
|
50
50
|
};
|
|
51
|
-
var renderIcon = exports.renderIcon = function renderIcon(icon, allowInteractiveExpand,
|
|
51
|
+
var renderIcon = exports.renderIcon = function renderIcon(icon, allowInteractiveExpand, expanded, intl) {
|
|
52
52
|
if (!icon) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
var expanded = node ? _expand.expandedState.get(node) : true;
|
|
56
|
-
if (expanded === undefined) {
|
|
57
|
-
expanded = false;
|
|
58
|
-
}
|
|
59
55
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_ExpandButton.ExpandButton, {
|
|
60
56
|
intl: intl,
|
|
61
57
|
allowInteractiveExpand: allowInteractiveExpand,
|
|
@@ -11,6 +11,7 @@ import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExp
|
|
|
11
11
|
import { buildExpandClassName, renderIcon, toDOM } from '../ui/NodeView';
|
|
12
12
|
export class ExpandNodeView {
|
|
13
13
|
constructor(node, view, getPos, getIntl, isMobile, selectNearNode, api, allowInteractiveExpand = true, __livePage = false) {
|
|
14
|
+
var _expandedState$get;
|
|
14
15
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
15
16
|
_defineProperty(this, "isMobile", false);
|
|
16
17
|
_defineProperty(this, "focusTitle", () => {
|
|
@@ -69,7 +70,7 @@ export class ExpandNodeView {
|
|
|
69
70
|
pos,
|
|
70
71
|
node: this.node
|
|
71
72
|
})(this.view.state, this.view.dispatch);
|
|
72
|
-
this.
|
|
73
|
+
this.updateExpandToggleIcon();
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
76
|
if (target === this.input) {
|
|
@@ -167,7 +168,7 @@ export class ExpandNodeView {
|
|
|
167
168
|
pos,
|
|
168
169
|
node: this.node
|
|
169
170
|
})(state, dispatch);
|
|
170
|
-
this.
|
|
171
|
+
this.updateExpandToggleIcon();
|
|
171
172
|
}
|
|
172
173
|
});
|
|
173
174
|
_defineProperty(this, "moveToOutsideOfTitle", event => {
|
|
@@ -336,10 +337,10 @@ export class ExpandNodeView {
|
|
|
336
337
|
this.icon = this.dom.querySelector(`.${expandClassNames.icon}`);
|
|
337
338
|
this.input = this.dom.querySelector(`.${expandClassNames.titleInput}`);
|
|
338
339
|
this.titleContainer = this.dom.querySelector(`.${expandClassNames.titleContainer}`);
|
|
339
|
-
renderIcon(this.icon, this.allowInteractiveExpand, this.intl);
|
|
340
340
|
if (!expandedState.has(this.node)) {
|
|
341
341
|
expandedState.set(this.node, false);
|
|
342
342
|
}
|
|
343
|
+
renderIcon(this.icon, this.allowInteractiveExpand, (_expandedState$get = expandedState.get(this.node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false, this.intl);
|
|
343
344
|
if (!this.input || !this.titleContainer || !this.icon) {
|
|
344
345
|
return;
|
|
345
346
|
}
|
|
@@ -394,10 +395,13 @@ export class ExpandNodeView {
|
|
|
394
395
|
}
|
|
395
396
|
return false;
|
|
396
397
|
}
|
|
397
|
-
|
|
398
|
+
updateExpandToggleIcon() {
|
|
398
399
|
const expanded = expandedState.get(this.node) ? expandedState.get(this.node) : false;
|
|
399
400
|
if (this.dom && expanded !== undefined) {
|
|
401
|
+
var _expandedState$get2;
|
|
400
402
|
this.dom.className = buildExpandClassName(this.node.type.name, expanded);
|
|
403
|
+
// Re-render the icon to update the aria-expanded attribute
|
|
404
|
+
renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(this.node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
|
|
401
405
|
}
|
|
402
406
|
}
|
|
403
407
|
destroy() {
|
|
@@ -41,14 +41,10 @@ export const toDOM = (node, __livePage, intl) => {
|
|
|
41
41
|
'class': expandClassNames.content
|
|
42
42
|
}, 0]];
|
|
43
43
|
};
|
|
44
|
-
export const renderIcon = (icon, allowInteractiveExpand,
|
|
44
|
+
export const renderIcon = (icon, allowInteractiveExpand, expanded, intl) => {
|
|
45
45
|
if (!icon) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
let expanded = node ? expandedState.get(node) : true;
|
|
49
|
-
if (expanded === undefined) {
|
|
50
|
-
expanded = false;
|
|
51
|
-
}
|
|
52
48
|
ReactDOM.render( /*#__PURE__*/React.createElement(ExpandButton, {
|
|
53
49
|
intl: intl,
|
|
54
50
|
allowInteractiveExpand: allowInteractiveExpand,
|
|
@@ -13,7 +13,8 @@ import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExp
|
|
|
13
13
|
import { buildExpandClassName, renderIcon, toDOM } from '../ui/NodeView';
|
|
14
14
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
15
15
|
function ExpandNodeView(node, view, getPos, getIntl, isMobile, selectNearNode, api) {
|
|
16
|
-
var _this = this
|
|
16
|
+
var _this = this,
|
|
17
|
+
_expandedState$get;
|
|
17
18
|
var allowInteractiveExpand = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
18
19
|
var __livePage = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
19
20
|
_classCallCheck(this, ExpandNodeView);
|
|
@@ -74,7 +75,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
74
75
|
pos: pos,
|
|
75
76
|
node: _this.node
|
|
76
77
|
})(_this.view.state, _this.view.dispatch);
|
|
77
|
-
_this.
|
|
78
|
+
_this.updateExpandToggleIcon();
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
if (target === _this.input) {
|
|
@@ -167,7 +168,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
167
168
|
pos: pos,
|
|
168
169
|
node: _this.node
|
|
169
170
|
})(state, dispatch);
|
|
170
|
-
_this.
|
|
171
|
+
_this.updateExpandToggleIcon();
|
|
171
172
|
}
|
|
172
173
|
});
|
|
173
174
|
_defineProperty(this, "moveToOutsideOfTitle", function (event) {
|
|
@@ -326,10 +327,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
326
327
|
this.icon = this.dom.querySelector(".".concat(expandClassNames.icon));
|
|
327
328
|
this.input = this.dom.querySelector(".".concat(expandClassNames.titleInput));
|
|
328
329
|
this.titleContainer = this.dom.querySelector(".".concat(expandClassNames.titleContainer));
|
|
329
|
-
renderIcon(this.icon, this.allowInteractiveExpand, this.intl);
|
|
330
330
|
if (!expandedState.has(this.node)) {
|
|
331
331
|
expandedState.set(this.node, false);
|
|
332
332
|
}
|
|
333
|
+
renderIcon(this.icon, this.allowInteractiveExpand, (_expandedState$get = expandedState.get(this.node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false, this.intl);
|
|
333
334
|
if (!this.input || !this.titleContainer || !this.icon) {
|
|
334
335
|
return;
|
|
335
336
|
}
|
|
@@ -392,11 +393,14 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
392
393
|
return false;
|
|
393
394
|
}
|
|
394
395
|
}, {
|
|
395
|
-
key: "
|
|
396
|
-
value: function
|
|
396
|
+
key: "updateExpandToggleIcon",
|
|
397
|
+
value: function updateExpandToggleIcon() {
|
|
397
398
|
var expanded = expandedState.get(this.node) ? expandedState.get(this.node) : false;
|
|
398
399
|
if (this.dom && expanded !== undefined) {
|
|
400
|
+
var _expandedState$get2;
|
|
399
401
|
this.dom.className = buildExpandClassName(this.node.type.name, expanded);
|
|
402
|
+
// Re-render the icon to update the aria-expanded attribute
|
|
403
|
+
renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get2 = expandedState.get(this.node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false, this.intl);
|
|
400
404
|
}
|
|
401
405
|
}
|
|
402
406
|
}, {
|
|
@@ -41,14 +41,10 @@ export var toDOM = function toDOM(node, __livePage, intl) {
|
|
|
41
41
|
'class': expandClassNames.content
|
|
42
42
|
}, 0]];
|
|
43
43
|
};
|
|
44
|
-
export var renderIcon = function renderIcon(icon, allowInteractiveExpand,
|
|
44
|
+
export var renderIcon = function renderIcon(icon, allowInteractiveExpand, expanded, intl) {
|
|
45
45
|
if (!icon) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
var expanded = node ? expandedState.get(node) : true;
|
|
49
|
-
if (expanded === undefined) {
|
|
50
|
-
expanded = false;
|
|
51
|
-
}
|
|
52
48
|
ReactDOM.render( /*#__PURE__*/React.createElement(ExpandButton, {
|
|
53
49
|
intl: intl,
|
|
54
50
|
allowInteractiveExpand: allowInteractiveExpand,
|
|
@@ -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
|
-
|
|
47
|
+
updateExpandToggleIcon(): void;
|
|
48
48
|
destroy(): void;
|
|
49
49
|
}
|
|
50
50
|
export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export declare const buildExpandClassName: (type: string, expanded: boolean) => string;
|
|
4
4
|
export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape) => DOMOutputSpec;
|
|
5
|
-
export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean,
|
|
5
|
+
export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean, expanded: boolean, intl?: IntlShape) => void;
|
|
@@ -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
|
-
|
|
47
|
+
updateExpandToggleIcon(): void;
|
|
48
48
|
destroy(): void;
|
|
49
49
|
}
|
|
50
50
|
export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export declare const buildExpandClassName: (type: string, expanded: boolean) => string;
|
|
4
4
|
export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape) => DOMOutputSpec;
|
|
5
|
-
export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean,
|
|
5
|
+
export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean, expanded: boolean, intl?: IntlShape) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^35.9.0",
|
|
37
37
|
"@atlaskit/button": "^17.12.0",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
+
"@atlaskit/editor-common": "^78.30.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-selection": "^1.1.0",
|