@atlaskit/editor-plugin-expand 8.4.3 → 8.5.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 +12 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +8 -9
- package/dist/cjs/singlePlayerExpand/node-views/index.js +8 -10
- package/dist/cjs/singlePlayerExpand/ui/NodeView.js +1 -3
- package/dist/cjs/singlePlayerExpand/utils.js +9 -11
- package/dist/es2019/legacyExpand/nodeviews/index.js +8 -9
- package/dist/es2019/singlePlayerExpand/node-views/index.js +8 -10
- package/dist/es2019/singlePlayerExpand/ui/NodeView.js +1 -3
- package/dist/es2019/singlePlayerExpand/utils.js +9 -11
- package/dist/esm/legacyExpand/nodeviews/index.js +8 -9
- package/dist/esm/singlePlayerExpand/node-views/index.js +8 -10
- package/dist/esm/singlePlayerExpand/ui/NodeView.js +1 -3
- package/dist/esm/singlePlayerExpand/utils.js +9 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 8.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`00ae34886b5f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/00ae34886b5f7) -
|
|
8
|
+
[EDITOR-5796](https://hello.jira.atlassian.cloud/browse/EDITOR-5796) - clean up
|
|
9
|
+
platform_editor_display_none_to_expand experiment
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 8.4.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -63,8 +63,7 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
63
63
|
readonly: titleReadOnly ? 'true' : undefined
|
|
64
64
|
}]]], ['div', {
|
|
65
65
|
// prettier-ignore
|
|
66
|
-
class: _styles.expandClassNames.content,
|
|
67
|
-
style: (0, _expValEquals.expValEquals)('platform_editor_display_none_to_expand', 'isEnabled', true) ? "display: ".concat(__livePage ? !node.attrs.__expanded : node.attrs.__expanded ? 'flow-root' : 'none') : undefined,
|
|
66
|
+
class: "".concat(_styles.expandClassNames.content, " ").concat((__livePage ? !node.attrs.__expanded : node.attrs.__expanded) ? '' : _styles.expandClassNames.contentCollapsed),
|
|
68
67
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
69
68
|
}, 0]];
|
|
70
69
|
};
|
|
@@ -537,9 +536,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
537
536
|
if (_this2.content) {
|
|
538
537
|
_this2.content.setAttribute('contenteditable', _this2.getContentEditable(_this2.node) ? 'true' : 'false');
|
|
539
538
|
}
|
|
540
|
-
|
|
541
|
-
_this2.updateDisplayStyle(_this2.node);
|
|
542
|
-
}
|
|
539
|
+
_this2.updateDisplayStyle(_this2.node);
|
|
543
540
|
});
|
|
544
541
|
}
|
|
545
542
|
}
|
|
@@ -578,7 +575,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
578
575
|
value: function updateDisplayStyle(node) {
|
|
579
576
|
if (this.content) {
|
|
580
577
|
var isCollapsed = this.__livePage ? node.attrs.__expanded : !node.attrs.__expanded;
|
|
581
|
-
|
|
578
|
+
if (isCollapsed) {
|
|
579
|
+
this.content.classList.add(_styles.expandClassNames.contentCollapsed);
|
|
580
|
+
} else {
|
|
581
|
+
this.content.classList.remove(_styles.expandClassNames.contentCollapsed);
|
|
582
|
+
}
|
|
582
583
|
}
|
|
583
584
|
}
|
|
584
585
|
}, {
|
|
@@ -622,9 +623,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
622
623
|
// Disallow interaction/selection inside when collapsed.
|
|
623
624
|
this.content.setAttribute('contenteditable', this.getContentEditable(node) ? 'true' : 'false');
|
|
624
625
|
}
|
|
625
|
-
|
|
626
|
-
this.updateDisplayStyle(node);
|
|
627
|
-
}
|
|
626
|
+
this.updateDisplayStyle(node);
|
|
628
627
|
}
|
|
629
628
|
|
|
630
629
|
// During a collab session the title doesn't sync with other users
|
|
@@ -100,9 +100,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
100
100
|
node: _this.node
|
|
101
101
|
})(_this.view.state, _this.view.dispatch);
|
|
102
102
|
_this.updateExpandToggleIcon(_this.node);
|
|
103
|
-
|
|
104
|
-
_this.updateDisplayStyle(_this.node);
|
|
105
|
-
}
|
|
103
|
+
_this.updateDisplayStyle(_this.node);
|
|
106
104
|
return;
|
|
107
105
|
}
|
|
108
106
|
if (target === _this.input) {
|
|
@@ -221,9 +219,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
221
219
|
node: _this.node
|
|
222
220
|
})(state, dispatch);
|
|
223
221
|
_this.updateExpandToggleIcon(_this.node);
|
|
224
|
-
|
|
225
|
-
_this.updateDisplayStyle(_this.node);
|
|
226
|
-
}
|
|
222
|
+
_this.updateDisplayStyle(_this.node);
|
|
227
223
|
}
|
|
228
224
|
});
|
|
229
225
|
(0, _defineProperty2.default)(this, "moveToOutsideOfTitle", function (event) {
|
|
@@ -559,9 +555,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
559
555
|
var hasChanged = (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_3') ? this.isExpanded.expanded !== currentExpanded && this.isExpanded.localId === node.attrs.localId : this.isExpanded.expanded !== currentExpanded;
|
|
560
556
|
if (hasChanged) {
|
|
561
557
|
this.updateExpandToggleIcon(node);
|
|
562
|
-
|
|
563
|
-
this.updateDisplayStyle(node);
|
|
564
|
-
}
|
|
558
|
+
this.updateDisplayStyle(node);
|
|
565
559
|
}
|
|
566
560
|
} else {
|
|
567
561
|
this.node = node;
|
|
@@ -607,7 +601,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
607
601
|
key: "updateDisplayStyle",
|
|
608
602
|
value: function updateDisplayStyle(node) {
|
|
609
603
|
if (this.content) {
|
|
610
|
-
|
|
604
|
+
if ((0, _expand.isExpandCollapsed)(node)) {
|
|
605
|
+
this.content.classList.add(_styles.expandClassNames.contentCollapsed);
|
|
606
|
+
} else {
|
|
607
|
+
this.content.classList.remove(_styles.expandClassNames.contentCollapsed);
|
|
608
|
+
}
|
|
611
609
|
}
|
|
612
610
|
}
|
|
613
611
|
}, {
|
|
@@ -10,7 +10,6 @@ var _expand = require("@atlaskit/editor-common/expand");
|
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
15
|
var buildExpandClassName = exports.buildExpandClassName = function buildExpandClassName(type, expanded) {
|
|
@@ -51,8 +50,7 @@ var toDOM = exports.toDOM = function toDOM(node, __livePage, intl, titleReadOnly
|
|
|
51
50
|
readonly: titleReadOnly ? 'true' : undefined
|
|
52
51
|
}]]], ['div', {
|
|
53
52
|
// prettier-ignore
|
|
54
|
-
class: _styles.expandClassNames.content,
|
|
55
|
-
style: (0, _expValEquals.expValEquals)('platform_editor_display_none_to_expand', 'isEnabled', true) ? "display: ".concat(_expand.expandedState.get(node) ? 'flow-root' : 'none') : undefined,
|
|
53
|
+
class: "".concat(_styles.expandClassNames.content, " ").concat(_expand.expandedState.get(node) ? '' : _styles.expandClassNames.contentCollapsed),
|
|
56
54
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
57
55
|
}, 0]];
|
|
58
56
|
};
|
|
@@ -6,23 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.findSelectedParentExpandNode = exports.findReplaceExpandDecorations = void 0;
|
|
7
7
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
8
8
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
9
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
9
|
// from platform/packages/editor/editor-plugin-find-replace/src/ui/styles.ts
|
|
11
10
|
var darkModeSearchMatchClass = 'search-match-dark';
|
|
12
11
|
var searchMatchExpandTitleClass = 'search-match-expand-title';
|
|
13
12
|
var selectedSearchMatchClass = 'selected-search-match';
|
|
14
13
|
var findSelectedParentExpandNode = exports.findSelectedParentExpandNode = function findSelectedParentExpandNode(state) {
|
|
15
14
|
var nestedOrParentExpand = (0, _utils.findParentNodeOfType)(state.schema.nodes.nestedExpand)(state.selection) || (0, _utils.findParentNodeOfType)(state.schema.nodes.expand)(state.selection);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
15
|
+
|
|
16
|
+
// If it's nested expand, we should check if its parent expand is collapsed.
|
|
17
|
+
// If the parent expand is collapsed, the nested expand is not visible,
|
|
18
|
+
// so it could not be selected.
|
|
19
|
+
// In this case, we return the parent expand node instead of the nested expand node.
|
|
20
|
+
if ((nestedOrParentExpand === null || nestedOrParentExpand === void 0 ? void 0 : nestedOrParentExpand.node.type) === state.schema.nodes.nestedExpand) {
|
|
21
|
+
var parentExpand = (0, _utils.findParentNodeOfType)(state.schema.nodes.expand)(state.selection);
|
|
22
|
+
if (parentExpand && (0, _expand.isExpandCollapsed)(parentExpand.node)) {
|
|
23
|
+
return parentExpand;
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
return nestedOrParentExpand;
|
|
@@ -52,8 +52,7 @@ const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => ['div'
|
|
|
52
52
|
readonly: titleReadOnly ? 'true' : undefined
|
|
53
53
|
}]]], ['div', {
|
|
54
54
|
// prettier-ignore
|
|
55
|
-
class: expandClassNames.content
|
|
56
|
-
style: expValEquals('platform_editor_display_none_to_expand', 'isEnabled', true) ? `display: ${__livePage ? !node.attrs.__expanded : node.attrs.__expanded ? 'flow-root' : 'none'}` : undefined,
|
|
55
|
+
class: `${expandClassNames.content} ${(__livePage ? !node.attrs.__expanded : node.attrs.__expanded) ? '' : expandClassNames.contentCollapsed}`,
|
|
57
56
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
58
57
|
}, 0]];
|
|
59
58
|
export class ExpandNodeView {
|
|
@@ -538,9 +537,7 @@ export class ExpandNodeView {
|
|
|
538
537
|
if (this.content) {
|
|
539
538
|
this.content.setAttribute('contenteditable', this.getContentEditable(this.node) ? 'true' : 'false');
|
|
540
539
|
}
|
|
541
|
-
|
|
542
|
-
this.updateDisplayStyle(this.node);
|
|
543
|
-
}
|
|
540
|
+
this.updateDisplayStyle(this.node);
|
|
544
541
|
});
|
|
545
542
|
}
|
|
546
543
|
}
|
|
@@ -573,7 +570,11 @@ export class ExpandNodeView {
|
|
|
573
570
|
updateDisplayStyle(node) {
|
|
574
571
|
if (this.content) {
|
|
575
572
|
const isCollapsed = this.__livePage ? node.attrs.__expanded : !node.attrs.__expanded;
|
|
576
|
-
|
|
573
|
+
if (isCollapsed) {
|
|
574
|
+
this.content.classList.add(expandClassNames.contentCollapsed);
|
|
575
|
+
} else {
|
|
576
|
+
this.content.classList.remove(expandClassNames.contentCollapsed);
|
|
577
|
+
}
|
|
577
578
|
}
|
|
578
579
|
}
|
|
579
580
|
stopEvent(event) {
|
|
@@ -610,9 +611,7 @@ export class ExpandNodeView {
|
|
|
610
611
|
// Disallow interaction/selection inside when collapsed.
|
|
611
612
|
this.content.setAttribute('contenteditable', this.getContentEditable(node) ? 'true' : 'false');
|
|
612
613
|
}
|
|
613
|
-
|
|
614
|
-
this.updateDisplayStyle(node);
|
|
615
|
-
}
|
|
614
|
+
this.updateDisplayStyle(node);
|
|
616
615
|
}
|
|
617
616
|
|
|
618
617
|
// During a collab session the title doesn't sync with other users
|
|
@@ -84,9 +84,7 @@ export class ExpandNodeView {
|
|
|
84
84
|
node: this.node
|
|
85
85
|
})(this.view.state, this.view.dispatch);
|
|
86
86
|
this.updateExpandToggleIcon(this.node);
|
|
87
|
-
|
|
88
|
-
this.updateDisplayStyle(this.node);
|
|
89
|
-
}
|
|
87
|
+
this.updateDisplayStyle(this.node);
|
|
90
88
|
return;
|
|
91
89
|
}
|
|
92
90
|
if (target === this.input) {
|
|
@@ -210,9 +208,7 @@ export class ExpandNodeView {
|
|
|
210
208
|
node: this.node
|
|
211
209
|
})(state, dispatch);
|
|
212
210
|
this.updateExpandToggleIcon(this.node);
|
|
213
|
-
|
|
214
|
-
this.updateDisplayStyle(this.node);
|
|
215
|
-
}
|
|
211
|
+
this.updateDisplayStyle(this.node);
|
|
216
212
|
}
|
|
217
213
|
});
|
|
218
214
|
_defineProperty(this, "moveToOutsideOfTitle", event => {
|
|
@@ -553,9 +549,7 @@ export class ExpandNodeView {
|
|
|
553
549
|
const hasChanged = expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3') ? this.isExpanded.expanded !== currentExpanded && this.isExpanded.localId === node.attrs.localId : this.isExpanded.expanded !== currentExpanded;
|
|
554
550
|
if (hasChanged) {
|
|
555
551
|
this.updateExpandToggleIcon(node);
|
|
556
|
-
|
|
557
|
-
this.updateDisplayStyle(node);
|
|
558
|
-
}
|
|
552
|
+
this.updateDisplayStyle(node);
|
|
559
553
|
}
|
|
560
554
|
} else {
|
|
561
555
|
this.node = node;
|
|
@@ -595,7 +589,11 @@ export class ExpandNodeView {
|
|
|
595
589
|
}
|
|
596
590
|
updateDisplayStyle(node) {
|
|
597
591
|
if (this.content) {
|
|
598
|
-
|
|
592
|
+
if (isExpandCollapsed(node)) {
|
|
593
|
+
this.content.classList.add(expandClassNames.contentCollapsed);
|
|
594
|
+
} else {
|
|
595
|
+
this.content.classList.remove(expandClassNames.contentCollapsed);
|
|
596
|
+
}
|
|
599
597
|
}
|
|
600
598
|
}
|
|
601
599
|
updateExpandBodyContentEditable() {
|
|
@@ -2,7 +2,6 @@ import { expandedState } from '@atlaskit/editor-common/expand';
|
|
|
2
2
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { expandMessages } from '@atlaskit/editor-common/ui';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
export const buildExpandClassName = (type, expanded) => {
|
|
7
6
|
return `${expandClassNames.prefix} ${expandClassNames.type(type)} ${expanded ? expandClassNames.expanded : ''}`;
|
|
8
7
|
};
|
|
@@ -42,8 +41,7 @@ export const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) =>
|
|
|
42
41
|
readonly: titleReadOnly ? 'true' : undefined
|
|
43
42
|
}]]], ['div', {
|
|
44
43
|
// prettier-ignore
|
|
45
|
-
class: expandClassNames.content
|
|
46
|
-
style: expValEquals('platform_editor_display_none_to_expand', 'isEnabled', true) ? `display: ${expandedState.get(node) ? 'flow-root' : 'none'}` : undefined,
|
|
44
|
+
class: `${expandClassNames.content} ${expandedState.get(node) ? '' : expandClassNames.contentCollapsed}`,
|
|
47
45
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
48
46
|
}, 0]];
|
|
49
47
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isExpandCollapsed } from '@atlaskit/editor-common/expand';
|
|
2
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
|
|
5
4
|
// from platform/packages/editor/editor-plugin-find-replace/src/ui/styles.ts
|
|
6
5
|
const darkModeSearchMatchClass = 'search-match-dark';
|
|
@@ -8,16 +7,15 @@ const searchMatchExpandTitleClass = 'search-match-expand-title';
|
|
|
8
7
|
const selectedSearchMatchClass = 'selected-search-match';
|
|
9
8
|
export const findSelectedParentExpandNode = state => {
|
|
10
9
|
const nestedOrParentExpand = findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
10
|
+
|
|
11
|
+
// If it's nested expand, we should check if its parent expand is collapsed.
|
|
12
|
+
// If the parent expand is collapsed, the nested expand is not visible,
|
|
13
|
+
// so it could not be selected.
|
|
14
|
+
// In this case, we return the parent expand node instead of the nested expand node.
|
|
15
|
+
if ((nestedOrParentExpand === null || nestedOrParentExpand === void 0 ? void 0 : nestedOrParentExpand.node.type) === state.schema.nodes.nestedExpand) {
|
|
16
|
+
const parentExpand = findParentNodeOfType(state.schema.nodes.expand)(state.selection);
|
|
17
|
+
if (parentExpand && isExpandCollapsed(parentExpand.node)) {
|
|
18
|
+
return parentExpand;
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
return nestedOrParentExpand;
|
|
@@ -56,8 +56,7 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
56
56
|
readonly: titleReadOnly ? 'true' : undefined
|
|
57
57
|
}]]], ['div', {
|
|
58
58
|
// prettier-ignore
|
|
59
|
-
class: expandClassNames.content,
|
|
60
|
-
style: expValEquals('platform_editor_display_none_to_expand', 'isEnabled', true) ? "display: ".concat(__livePage ? !node.attrs.__expanded : node.attrs.__expanded ? 'flow-root' : 'none') : undefined,
|
|
59
|
+
class: "".concat(expandClassNames.content, " ").concat((__livePage ? !node.attrs.__expanded : node.attrs.__expanded) ? '' : expandClassNames.contentCollapsed),
|
|
61
60
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
62
61
|
}, 0]];
|
|
63
62
|
};
|
|
@@ -530,9 +529,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
530
529
|
if (_this2.content) {
|
|
531
530
|
_this2.content.setAttribute('contenteditable', _this2.getContentEditable(_this2.node) ? 'true' : 'false');
|
|
532
531
|
}
|
|
533
|
-
|
|
534
|
-
_this2.updateDisplayStyle(_this2.node);
|
|
535
|
-
}
|
|
532
|
+
_this2.updateDisplayStyle(_this2.node);
|
|
536
533
|
});
|
|
537
534
|
}
|
|
538
535
|
}
|
|
@@ -571,7 +568,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
571
568
|
value: function updateDisplayStyle(node) {
|
|
572
569
|
if (this.content) {
|
|
573
570
|
var isCollapsed = this.__livePage ? node.attrs.__expanded : !node.attrs.__expanded;
|
|
574
|
-
|
|
571
|
+
if (isCollapsed) {
|
|
572
|
+
this.content.classList.add(expandClassNames.contentCollapsed);
|
|
573
|
+
} else {
|
|
574
|
+
this.content.classList.remove(expandClassNames.contentCollapsed);
|
|
575
|
+
}
|
|
575
576
|
}
|
|
576
577
|
}
|
|
577
578
|
}, {
|
|
@@ -615,9 +616,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
615
616
|
// Disallow interaction/selection inside when collapsed.
|
|
616
617
|
this.content.setAttribute('contenteditable', this.getContentEditable(node) ? 'true' : 'false');
|
|
617
618
|
}
|
|
618
|
-
|
|
619
|
-
this.updateDisplayStyle(node);
|
|
620
|
-
}
|
|
619
|
+
this.updateDisplayStyle(node);
|
|
621
620
|
}
|
|
622
621
|
|
|
623
622
|
// During a collab session the title doesn't sync with other users
|
|
@@ -92,9 +92,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
92
92
|
node: _this.node
|
|
93
93
|
})(_this.view.state, _this.view.dispatch);
|
|
94
94
|
_this.updateExpandToggleIcon(_this.node);
|
|
95
|
-
|
|
96
|
-
_this.updateDisplayStyle(_this.node);
|
|
97
|
-
}
|
|
95
|
+
_this.updateDisplayStyle(_this.node);
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
98
|
if (target === _this.input) {
|
|
@@ -213,9 +211,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
213
211
|
node: _this.node
|
|
214
212
|
})(state, dispatch);
|
|
215
213
|
_this.updateExpandToggleIcon(_this.node);
|
|
216
|
-
|
|
217
|
-
_this.updateDisplayStyle(_this.node);
|
|
218
|
-
}
|
|
214
|
+
_this.updateDisplayStyle(_this.node);
|
|
219
215
|
}
|
|
220
216
|
});
|
|
221
217
|
_defineProperty(this, "moveToOutsideOfTitle", function (event) {
|
|
@@ -551,9 +547,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
551
547
|
var hasChanged = expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3') ? this.isExpanded.expanded !== currentExpanded && this.isExpanded.localId === node.attrs.localId : this.isExpanded.expanded !== currentExpanded;
|
|
552
548
|
if (hasChanged) {
|
|
553
549
|
this.updateExpandToggleIcon(node);
|
|
554
|
-
|
|
555
|
-
this.updateDisplayStyle(node);
|
|
556
|
-
}
|
|
550
|
+
this.updateDisplayStyle(node);
|
|
557
551
|
}
|
|
558
552
|
} else {
|
|
559
553
|
this.node = node;
|
|
@@ -599,7 +593,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
599
593
|
key: "updateDisplayStyle",
|
|
600
594
|
value: function updateDisplayStyle(node) {
|
|
601
595
|
if (this.content) {
|
|
602
|
-
|
|
596
|
+
if (isExpandCollapsed(node)) {
|
|
597
|
+
this.content.classList.add(expandClassNames.contentCollapsed);
|
|
598
|
+
} else {
|
|
599
|
+
this.content.classList.remove(expandClassNames.contentCollapsed);
|
|
600
|
+
}
|
|
603
601
|
}
|
|
604
602
|
}
|
|
605
603
|
}, {
|
|
@@ -5,7 +5,6 @@ import { expandedState } from '@atlaskit/editor-common/expand';
|
|
|
5
5
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { expandMessages } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
8
|
export var buildExpandClassName = function buildExpandClassName(type, expanded) {
|
|
10
9
|
return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), " ").concat(expanded ? expandClassNames.expanded : '');
|
|
11
10
|
};
|
|
@@ -44,8 +43,7 @@ export var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, content
|
|
|
44
43
|
readonly: titleReadOnly ? 'true' : undefined
|
|
45
44
|
}]]], ['div', {
|
|
46
45
|
// prettier-ignore
|
|
47
|
-
class: expandClassNames.content,
|
|
48
|
-
style: expValEquals('platform_editor_display_none_to_expand', 'isEnabled', true) ? "display: ".concat(expandedState.get(node) ? 'flow-root' : 'none') : undefined,
|
|
46
|
+
class: "".concat(expandClassNames.content, " ").concat(expandedState.get(node) ? '' : expandClassNames.contentCollapsed),
|
|
49
47
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
50
48
|
}, 0]];
|
|
51
49
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isExpandCollapsed } from '@atlaskit/editor-common/expand';
|
|
2
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
|
|
5
4
|
// from platform/packages/editor/editor-plugin-find-replace/src/ui/styles.ts
|
|
6
5
|
var darkModeSearchMatchClass = 'search-match-dark';
|
|
@@ -8,16 +7,15 @@ var searchMatchExpandTitleClass = 'search-match-expand-title';
|
|
|
8
7
|
var selectedSearchMatchClass = 'selected-search-match';
|
|
9
8
|
export var findSelectedParentExpandNode = function findSelectedParentExpandNode(state) {
|
|
10
9
|
var nestedOrParentExpand = findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
10
|
+
|
|
11
|
+
// If it's nested expand, we should check if its parent expand is collapsed.
|
|
12
|
+
// If the parent expand is collapsed, the nested expand is not visible,
|
|
13
|
+
// so it could not be selected.
|
|
14
|
+
// In this case, we return the parent expand node instead of the nested expand node.
|
|
15
|
+
if ((nestedOrParentExpand === null || nestedOrParentExpand === void 0 ? void 0 : nestedOrParentExpand.node.type) === state.schema.nodes.nestedExpand) {
|
|
16
|
+
var parentExpand = findParentNodeOfType(state.schema.nodes.expand)(state.selection);
|
|
17
|
+
if (parentExpand && isExpandCollapsed(parentExpand.node)) {
|
|
18
|
+
return parentExpand;
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
return nestedOrParentExpand;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/icon-lab": "^5.17.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^34.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^34.1.0",
|
|
51
51
|
"@atlaskit/tokens": "^11.0.0",
|
|
52
52
|
"@atlaskit/tooltip": "^20.14.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|