@atlaskit/editor-plugin-expand 2.7.5 → 2.7.7
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 +15 -0
- package/dist/cjs/legacyExpand/commands.js +9 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +8 -8
- package/dist/cjs/singlePlayerExpand/commands.js +9 -0
- package/dist/cjs/singlePlayerExpand/node-views/index.js +2 -2
- package/dist/es2019/legacyExpand/commands.js +9 -0
- package/dist/es2019/legacyExpand/nodeviews/index.js +9 -9
- package/dist/es2019/singlePlayerExpand/commands.js +9 -0
- package/dist/es2019/singlePlayerExpand/node-views/index.js +3 -3
- package/dist/esm/legacyExpand/commands.js +9 -0
- package/dist/esm/legacyExpand/nodeviews/index.js +9 -9
- package/dist/esm/singlePlayerExpand/commands.js +9 -0
- package/dist/esm/singlePlayerExpand/node-views/index.js +3 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 2.7.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.7.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#144606](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144606)
|
|
14
|
+
[`20ab1284d9880`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/20ab1284d9880) -
|
|
15
|
+
ED-24990 - Bugfix: cursor was going outside of parent expand and table cell when nested expand was
|
|
16
|
+
deleted.
|
|
17
|
+
|
|
3
18
|
## 2.7.5
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -15,6 +15,7 @@ var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
|
15
15
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
16
16
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
19
|
var _utils4 = require("../utils");
|
|
19
20
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
20
21
|
var _utils5 = require("./utils");
|
|
@@ -48,6 +49,14 @@ var deleteExpandAtPos = exports.deleteExpandAtPos = function deleteExpandAtPos(e
|
|
|
48
49
|
var tr = state.tr;
|
|
49
50
|
tr.delete(expandNodePos, expandNodePos + expandNode.nodeSize);
|
|
50
51
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
52
|
+
if ((0, _experiments.editorExperiment)('nested-expand-in-expand', true)) {
|
|
53
|
+
if (expandNode.type === state.schema.nodes.nestedExpand) {
|
|
54
|
+
var resolvedPos = tr.doc.resolve(expandNodePos + 1);
|
|
55
|
+
if (resolvedPos) {
|
|
56
|
+
tr.setSelection(_state2.Selection.near(resolvedPos, -1));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
51
60
|
dispatch(tr);
|
|
52
61
|
}
|
|
53
62
|
return true;
|
|
@@ -28,7 +28,7 @@ function buildExpandClassName(type, expanded) {
|
|
|
28
28
|
var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
29
29
|
return ['div', {
|
|
30
30
|
// prettier-ignore
|
|
31
|
-
'class': buildExpandClassName(node.type.name, (0, _platformFeatureFlags.
|
|
31
|
+
'class': buildExpandClassName(node.type.name, __livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
32
32
|
'data-node-type': node.type.name,
|
|
33
33
|
'data-title': node.attrs.title
|
|
34
34
|
}, ['div', {
|
|
@@ -52,11 +52,11 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
52
52
|
value: node.attrs.title,
|
|
53
53
|
placeholder: intl && intl.formatMessage(_ui.expandMessages.expandPlaceholderText) || _ui.expandMessages.expandPlaceholderText.defaultMessage,
|
|
54
54
|
type: 'text',
|
|
55
|
-
readonly: (0, _platformFeatureFlags.
|
|
55
|
+
readonly: titleReadOnly && (0, _platformFeatureFlags.fg)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') ? 'true' : undefined
|
|
56
56
|
}]]], ['div', {
|
|
57
57
|
// prettier-ignore
|
|
58
58
|
class: _styles.expandClassNames.content,
|
|
59
|
-
contenteditable: (0, _platformFeatureFlags.
|
|
59
|
+
contenteditable: contentEditable && (0, _platformFeatureFlags.fg)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') ? contentEditable ? 'true' : 'false' : undefined
|
|
60
60
|
}, 0]];
|
|
61
61
|
};
|
|
62
62
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -267,7 +267,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
(0, _defineProperty2.default)(this, "isCollapsed", function () {
|
|
270
|
-
if ((0, _platformFeatureFlags.
|
|
270
|
+
if (_this.__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence')) {
|
|
271
271
|
return _this.node.attrs.__expanded;
|
|
272
272
|
}
|
|
273
273
|
return !_this.node.attrs.__expanded;
|
|
@@ -397,8 +397,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
397
397
|
return;
|
|
398
398
|
});
|
|
399
399
|
(0, _defineProperty2.default)(this, "getContentEditable", function (node) {
|
|
400
|
-
var contentEditable = (0, _platformFeatureFlags.
|
|
401
|
-
if ((0, _platformFeatureFlags.
|
|
400
|
+
var contentEditable = _this.__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded;
|
|
401
|
+
if (_this.api && _this.api.editorDisabled && (0, _platformFeatureFlags.fg)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
402
402
|
var _this$api$editorDisab;
|
|
403
403
|
return !((_this$api$editorDisab = _this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
|
|
404
404
|
}
|
|
@@ -455,7 +455,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
455
455
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
456
456
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
457
457
|
}
|
|
458
|
-
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && (0, _platformFeatureFlags.
|
|
458
|
+
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && (0, _platformFeatureFlags.fg)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
459
459
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
460
460
|
var editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
461
461
|
if (_this2.input) {
|
|
@@ -482,7 +482,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
482
482
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_ExpandIconButton.ExpandIconButton, {
|
|
483
483
|
intl: intl,
|
|
484
484
|
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
485
|
-
expanded: (0, _platformFeatureFlags.
|
|
485
|
+
expanded: this.__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
|
|
486
486
|
}), this.icon);
|
|
487
487
|
}
|
|
488
488
|
}, {
|
|
@@ -16,6 +16,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
16
16
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
18
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
19
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
20
|
var _utils4 = require("../utils");
|
|
20
21
|
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; }
|
|
21
22
|
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; }
|
|
@@ -105,6 +106,14 @@ var deleteExpandAtPos = exports.deleteExpandAtPos = function deleteExpandAtPos(e
|
|
|
105
106
|
var tr = state.tr;
|
|
106
107
|
tr.delete(expandNodePos, expandNodePos + expandNode.nodeSize);
|
|
107
108
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
109
|
+
if ((0, _experiments.editorExperiment)('nested-expand-in-expand', true)) {
|
|
110
|
+
if (expandNode.type === state.schema.nodes.nestedExpand) {
|
|
111
|
+
var resolvedPos = tr.doc.resolve(expandNodePos + 1);
|
|
112
|
+
if (resolvedPos) {
|
|
113
|
+
tr.setSelection(_state2.Selection.near(resolvedPos, -1));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
108
117
|
dispatch(tr);
|
|
109
118
|
}
|
|
110
119
|
return true;
|
|
@@ -354,7 +354,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
354
354
|
});
|
|
355
355
|
(0, _defineProperty2.default)(this, "getContentEditable", function (node) {
|
|
356
356
|
var contentEditable = !(0, _expand.isExpandCollapsed)(node);
|
|
357
|
-
if ((0, _platformFeatureFlags.
|
|
357
|
+
if (_this.api && _this.api.editorDisabled && (0, _platformFeatureFlags.fg)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
358
358
|
var _this$api$editorDisab;
|
|
359
359
|
return !((_this$api$editorDisab = _this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
|
|
360
360
|
}
|
|
@@ -398,7 +398,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
398
398
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
399
399
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
400
400
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
401
|
-
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && (0, _platformFeatureFlags.
|
|
401
|
+
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && (0, _platformFeatureFlags.fg)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
402
402
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
403
403
|
var editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
404
404
|
if (_this.input) {
|
|
@@ -7,6 +7,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { isNestedInExpand } from '../utils';
|
|
11
12
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
12
13
|
import { findExpand } from './utils';
|
|
@@ -34,6 +35,14 @@ export const deleteExpandAtPos = editorAnalyticsAPI => (expandNodePos, expandNod
|
|
|
34
35
|
} = state;
|
|
35
36
|
tr.delete(expandNodePos, expandNodePos + expandNode.nodeSize);
|
|
36
37
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
38
|
+
if (editorExperiment('nested-expand-in-expand', true)) {
|
|
39
|
+
if (expandNode.type === state.schema.nodes.nestedExpand) {
|
|
40
|
+
const resolvedPos = tr.doc.resolve(expandNodePos + 1);
|
|
41
|
+
if (resolvedPos) {
|
|
42
|
+
tr.setSelection(Selection.near(resolvedPos, -1));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
dispatch(tr);
|
|
38
47
|
}
|
|
39
48
|
return true;
|
|
@@ -9,7 +9,7 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
|
9
9
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
10
10
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
11
11
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
-
import {
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
14
14
|
import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
15
15
|
function buildExpandClassName(type, expanded) {
|
|
@@ -17,7 +17,7 @@ function buildExpandClassName(type, expanded) {
|
|
|
17
17
|
}
|
|
18
18
|
const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => ['div', {
|
|
19
19
|
// prettier-ignore
|
|
20
|
-
'class': buildExpandClassName(node.type.name,
|
|
20
|
+
'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
21
21
|
'data-node-type': node.type.name,
|
|
22
22
|
'data-title': node.attrs.title
|
|
23
23
|
}, ['div', {
|
|
@@ -41,11 +41,11 @@ const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => ['div'
|
|
|
41
41
|
value: node.attrs.title,
|
|
42
42
|
placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
|
|
43
43
|
type: 'text',
|
|
44
|
-
readonly:
|
|
44
|
+
readonly: titleReadOnly && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') ? 'true' : undefined
|
|
45
45
|
}]]], ['div', {
|
|
46
46
|
// prettier-ignore
|
|
47
47
|
class: expandClassNames.content,
|
|
48
|
-
contenteditable:
|
|
48
|
+
contenteditable: contentEditable && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') ? contentEditable ? 'true' : 'false' : undefined
|
|
49
49
|
}, 0]];
|
|
50
50
|
export class ExpandNodeView {
|
|
51
51
|
constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange) {
|
|
@@ -258,7 +258,7 @@ export class ExpandNodeView {
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
_defineProperty(this, "isCollapsed", () => {
|
|
261
|
-
if (
|
|
261
|
+
if (this.__livePage && fg('platform.editor.live-pages-expand-divergence')) {
|
|
262
262
|
return this.node.attrs.__expanded;
|
|
263
263
|
}
|
|
264
264
|
return !this.node.attrs.__expanded;
|
|
@@ -398,8 +398,8 @@ export class ExpandNodeView {
|
|
|
398
398
|
return;
|
|
399
399
|
});
|
|
400
400
|
_defineProperty(this, "getContentEditable", node => {
|
|
401
|
-
const contentEditable =
|
|
402
|
-
if (
|
|
401
|
+
const contentEditable = this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded;
|
|
402
|
+
if (this.api && this.api.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
403
403
|
var _this$api$editorDisab;
|
|
404
404
|
return !((_this$api$editorDisab = this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
|
|
405
405
|
}
|
|
@@ -454,7 +454,7 @@ export class ExpandNodeView {
|
|
|
454
454
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
455
455
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
456
456
|
}
|
|
457
|
-
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled &&
|
|
457
|
+
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
458
458
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(sharedState => {
|
|
459
459
|
const editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
460
460
|
if (this.input) {
|
|
@@ -480,7 +480,7 @@ export class ExpandNodeView {
|
|
|
480
480
|
ReactDOM.render( /*#__PURE__*/React.createElement(ExpandIconButton, {
|
|
481
481
|
intl: intl,
|
|
482
482
|
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
483
|
-
expanded:
|
|
483
|
+
expanded: this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
|
|
484
484
|
}), this.icon);
|
|
485
485
|
}
|
|
486
486
|
stopEvent(event) {
|
|
@@ -8,6 +8,7 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
|
8
8
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { isNestedInExpand } from '../utils';
|
|
12
13
|
|
|
13
14
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
@@ -87,6 +88,14 @@ export const deleteExpandAtPos = editorAnalyticsAPI => (expandNodePos, expandNod
|
|
|
87
88
|
} = state;
|
|
88
89
|
tr.delete(expandNodePos, expandNodePos + expandNode.nodeSize);
|
|
89
90
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
91
|
+
if (editorExperiment('nested-expand-in-expand', true)) {
|
|
92
|
+
if (expandNode.type === state.schema.nodes.nestedExpand) {
|
|
93
|
+
const resolvedPos = tr.doc.resolve(expandNodePos + 1);
|
|
94
|
+
if (resolvedPos) {
|
|
95
|
+
tr.setSelection(Selection.near(resolvedPos, -1));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
90
99
|
dispatch(tr);
|
|
91
100
|
}
|
|
92
101
|
return true;
|
|
@@ -8,7 +8,7 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
|
8
8
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
9
9
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
-
import {
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
13
13
|
import { buildExpandClassName, renderIcon, toDOM } from '../ui/NodeView';
|
|
14
14
|
export class ExpandNodeView {
|
|
@@ -355,7 +355,7 @@ export class ExpandNodeView {
|
|
|
355
355
|
});
|
|
356
356
|
_defineProperty(this, "getContentEditable", node => {
|
|
357
357
|
const contentEditable = !isExpandCollapsed(node);
|
|
358
|
-
if (
|
|
358
|
+
if (this.api && this.api.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
359
359
|
var _this$api$editorDisab;
|
|
360
360
|
return !((_this$api$editorDisab = this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
|
|
361
361
|
}
|
|
@@ -400,7 +400,7 @@ export class ExpandNodeView {
|
|
|
400
400
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
401
401
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
402
402
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
403
|
-
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled &&
|
|
403
|
+
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
404
404
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(sharedState => {
|
|
405
405
|
const editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
406
406
|
if (this.input) {
|
|
@@ -10,6 +10,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
11
11
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import { isNestedInExpand } from '../utils';
|
|
14
15
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
15
16
|
import { findExpand } from './utils';
|
|
@@ -41,6 +42,14 @@ export var deleteExpandAtPos = function deleteExpandAtPos(editorAnalyticsAPI) {
|
|
|
41
42
|
var tr = state.tr;
|
|
42
43
|
tr.delete(expandNodePos, expandNodePos + expandNode.nodeSize);
|
|
43
44
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
45
|
+
if (editorExperiment('nested-expand-in-expand', true)) {
|
|
46
|
+
if (expandNode.type === state.schema.nodes.nestedExpand) {
|
|
47
|
+
var resolvedPos = tr.doc.resolve(expandNodePos + 1);
|
|
48
|
+
if (resolvedPos) {
|
|
49
|
+
tr.setSelection(Selection.near(resolvedPos, -1));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
44
53
|
dispatch(tr);
|
|
45
54
|
}
|
|
46
55
|
return true;
|
|
@@ -11,7 +11,7 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
|
11
11
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
12
12
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
13
13
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
14
|
-
import {
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
16
16
|
import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
17
17
|
function buildExpandClassName(type, expanded) {
|
|
@@ -20,7 +20,7 @@ function buildExpandClassName(type, expanded) {
|
|
|
20
20
|
var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
21
21
|
return ['div', {
|
|
22
22
|
// prettier-ignore
|
|
23
|
-
'class': buildExpandClassName(node.type.name,
|
|
23
|
+
'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
24
24
|
'data-node-type': node.type.name,
|
|
25
25
|
'data-title': node.attrs.title
|
|
26
26
|
}, ['div', {
|
|
@@ -44,11 +44,11 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
44
44
|
value: node.attrs.title,
|
|
45
45
|
placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
|
|
46
46
|
type: 'text',
|
|
47
|
-
readonly:
|
|
47
|
+
readonly: titleReadOnly && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') ? 'true' : undefined
|
|
48
48
|
}]]], ['div', {
|
|
49
49
|
// prettier-ignore
|
|
50
50
|
class: expandClassNames.content,
|
|
51
|
-
contenteditable:
|
|
51
|
+
contenteditable: contentEditable && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') ? contentEditable ? 'true' : 'false' : undefined
|
|
52
52
|
}, 0]];
|
|
53
53
|
};
|
|
54
54
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -259,7 +259,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
_defineProperty(this, "isCollapsed", function () {
|
|
262
|
-
if (
|
|
262
|
+
if (_this.__livePage && fg('platform.editor.live-pages-expand-divergence')) {
|
|
263
263
|
return _this.node.attrs.__expanded;
|
|
264
264
|
}
|
|
265
265
|
return !_this.node.attrs.__expanded;
|
|
@@ -389,8 +389,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
389
389
|
return;
|
|
390
390
|
});
|
|
391
391
|
_defineProperty(this, "getContentEditable", function (node) {
|
|
392
|
-
var contentEditable =
|
|
393
|
-
if (
|
|
392
|
+
var contentEditable = _this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded;
|
|
393
|
+
if (_this.api && _this.api.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
394
394
|
var _this$api$editorDisab;
|
|
395
395
|
return !((_this$api$editorDisab = _this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
|
|
396
396
|
}
|
|
@@ -447,7 +447,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
447
447
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
448
448
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
449
449
|
}
|
|
450
|
-
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled &&
|
|
450
|
+
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
451
451
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
452
452
|
var editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
453
453
|
if (_this2.input) {
|
|
@@ -474,7 +474,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
474
474
|
ReactDOM.render( /*#__PURE__*/React.createElement(ExpandIconButton, {
|
|
475
475
|
intl: intl,
|
|
476
476
|
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
477
|
-
expanded:
|
|
477
|
+
expanded: this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
|
|
478
478
|
}), this.icon);
|
|
479
479
|
}
|
|
480
480
|
}, {
|
|
@@ -11,6 +11,7 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
|
11
11
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import { isNestedInExpand } from '../utils';
|
|
15
16
|
|
|
16
17
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
@@ -99,6 +100,14 @@ export var deleteExpandAtPos = function deleteExpandAtPos(editorAnalyticsAPI) {
|
|
|
99
100
|
var tr = state.tr;
|
|
100
101
|
tr.delete(expandNodePos, expandNodePos + expandNode.nodeSize);
|
|
101
102
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
103
|
+
if (editorExperiment('nested-expand-in-expand', true)) {
|
|
104
|
+
if (expandNode.type === state.schema.nodes.nestedExpand) {
|
|
105
|
+
var resolvedPos = tr.doc.resolve(expandNodePos + 1);
|
|
106
|
+
if (resolvedPos) {
|
|
107
|
+
tr.setSelection(Selection.near(resolvedPos, -1));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
102
111
|
dispatch(tr);
|
|
103
112
|
}
|
|
104
113
|
return true;
|
|
@@ -10,7 +10,7 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
|
10
10
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
11
11
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
12
12
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
13
|
-
import {
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
15
15
|
import { buildExpandClassName, renderIcon, toDOM } from '../ui/NodeView';
|
|
16
16
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -346,7 +346,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
346
346
|
});
|
|
347
347
|
_defineProperty(this, "getContentEditable", function (node) {
|
|
348
348
|
var contentEditable = !isExpandCollapsed(node);
|
|
349
|
-
if (
|
|
349
|
+
if (_this.api && _this.api.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
350
350
|
var _this$api$editorDisab;
|
|
351
351
|
return !((_this$api$editorDisab = _this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
|
|
352
352
|
}
|
|
@@ -390,7 +390,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
390
390
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
391
391
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
392
392
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
393
|
-
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled &&
|
|
393
|
+
if ((_this$api6 = this.api) !== null && _this$api6 !== void 0 && _this$api6.editorDisabled && fg('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
394
394
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
395
395
|
var editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
396
396
|
if (_this.input) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.7",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
35
|
-
"@atlaskit/button": "^20.
|
|
36
|
-
"@atlaskit/editor-common": "^91.
|
|
35
|
+
"@atlaskit/button": "^20.2.0",
|
|
36
|
+
"@atlaskit/editor-common": "^91.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
38
38
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^1.4.0",
|
|
41
41
|
"@atlaskit/editor-plugin-selection-marker": "^1.5.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
43
|
-
"@atlaskit/editor-shared-styles": "^
|
|
43
|
+
"@atlaskit/editor-shared-styles": "^3.0.0",
|
|
44
44
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
45
45
|
"@atlaskit/icon": "^22.18.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@atlaskit/editor-plugin-content-insertion": "^1.8.0",
|
|
61
61
|
"@atlaskit/editor-plugin-guideline": "^1.2.0",
|
|
62
62
|
"@atlaskit/editor-plugin-quick-insert": "^1.4.0",
|
|
63
|
-
"@atlaskit/editor-plugin-table": "^7.
|
|
63
|
+
"@atlaskit/editor-plugin-table": "^7.28.0",
|
|
64
64
|
"@atlaskit/editor-plugin-type-ahead": "^1.8.0",
|
|
65
65
|
"@atlaskit/editor-plugin-width": "^1.3.0",
|
|
66
66
|
"@testing-library/react": "^12.1.5",
|