@atlaskit/editor-plugin-expand 2.4.0 → 2.5.1
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 +21 -0
- package/dist/cjs/legacyExpand/commands.js +13 -12
- package/dist/cjs/legacyExpand/plugin.js +8 -5
- package/dist/cjs/legacyExpand/pm-plugins/keymap.js +12 -4
- package/dist/cjs/singlePlayerExpand/commands.js +10 -9
- package/dist/cjs/singlePlayerExpand/plugin.js +8 -5
- package/dist/cjs/utils.js +12 -0
- package/dist/es2019/legacyExpand/commands.js +8 -7
- package/dist/es2019/legacyExpand/plugin.js +9 -6
- package/dist/es2019/legacyExpand/pm-plugins/keymap.js +13 -5
- package/dist/es2019/singlePlayerExpand/commands.js +9 -7
- package/dist/es2019/singlePlayerExpand/plugin.js +9 -6
- package/dist/es2019/utils.js +2 -0
- package/dist/esm/legacyExpand/commands.js +8 -7
- package/dist/esm/legacyExpand/plugin.js +8 -5
- package/dist/esm/legacyExpand/pm-plugins/keymap.js +13 -5
- package/dist/esm/singlePlayerExpand/commands.js +9 -7
- package/dist/esm/singlePlayerExpand/plugin.js +8 -5
- package/dist/esm/utils.js +6 -0
- package/dist/types/legacyExpand/commands.d.ts +5 -5
- package/dist/types/singlePlayerExpand/commands.d.ts +5 -5
- package/dist/types/utils.d.ts +2 -0
- package/dist/types-ts4.5/legacyExpand/commands.d.ts +5 -5
- package/dist/types-ts4.5/singlePlayerExpand/commands.d.ts +5 -5
- package/dist/types-ts4.5/utils.d.ts +2 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 2.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#129932](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/129932)
|
|
8
|
+
[`d6a093f919beb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d6a093f919beb) -
|
|
9
|
+
[ED-24588] When inserting an expand with an existing expand selected, insert expand below the
|
|
10
|
+
expand
|
|
11
|
+
|
|
12
|
+
## 2.5.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#130725](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130725)
|
|
17
|
+
[`87a6f9ef9fecf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/87a6f9ef9fecf) -
|
|
18
|
+
[ED-24279] Add Jira feature flag for the nesting nestedExpand in Expand change
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 2.4.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -10,12 +10,13 @@ var _steps = require("@atlaskit/adf-schema/steps");
|
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
|
-
var
|
|
13
|
+
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
15
15
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
+
var _utils4 = require("../utils");
|
|
17
18
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
18
|
-
var
|
|
19
|
+
var _utils5 = require("./utils");
|
|
19
20
|
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; }
|
|
20
21
|
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; }
|
|
21
22
|
var setExpandRef = exports.setExpandRef = function setExpandRef(ref) {
|
|
@@ -54,7 +55,7 @@ var deleteExpandAtPos = exports.deleteExpandAtPos = function deleteExpandAtPos(e
|
|
|
54
55
|
};
|
|
55
56
|
var deleteExpand = exports.deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
56
57
|
return function (state, dispatch) {
|
|
57
|
-
var expandNode = (0,
|
|
58
|
+
var expandNode = (0, _utils5.findExpand)(state);
|
|
58
59
|
if (!expandNode) {
|
|
59
60
|
return false;
|
|
60
61
|
}
|
|
@@ -107,7 +108,7 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
|
|
|
107
108
|
// If we're going to collapse the expand and our cursor is currently inside
|
|
108
109
|
// Move to a right gap cursor, if the toolbar is interacted (or an API),
|
|
109
110
|
// it will insert below rather than inside (which will be invisible).
|
|
110
|
-
if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && (0,
|
|
111
|
+
if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && (0, _utils5.findExpand)(state)) {
|
|
111
112
|
tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), _selection.Side.RIGHT));
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -135,19 +136,19 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
|
|
|
135
136
|
};
|
|
136
137
|
|
|
137
138
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
138
|
-
var createExpandNode = exports.createExpandNode = function createExpandNode(state,
|
|
139
|
+
var createExpandNode = exports.createExpandNode = function createExpandNode(state, isNestingExpandsSupported) {
|
|
139
140
|
var _state$schema$nodes = state.schema.nodes,
|
|
140
141
|
expand = _state$schema$nodes.expand,
|
|
141
142
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
142
143
|
var isSelectionInTable = !!(0, _utils3.findTable)(state.selection);
|
|
143
|
-
var isSelectionInExpand =
|
|
144
|
+
var isSelectionInExpand = isNestingExpandsSupported && (0, _utils4.isNestedInExpand)(state);
|
|
144
145
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
145
146
|
return expandType.createAndFill({});
|
|
146
147
|
};
|
|
147
|
-
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
148
|
+
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
148
149
|
return function (inputMethod) {
|
|
149
150
|
return function (state, dispatch) {
|
|
150
|
-
var expandNode = createExpandNode(state,
|
|
151
|
+
var expandNode = createExpandNode(state, isNestingExpandsSupported);
|
|
151
152
|
if (!expandNode) {
|
|
152
153
|
return false;
|
|
153
154
|
}
|
|
@@ -172,9 +173,9 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
172
173
|
};
|
|
173
174
|
};
|
|
174
175
|
};
|
|
175
|
-
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI,
|
|
176
|
+
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
176
177
|
return function (state, dispatch) {
|
|
177
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
178
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(_analytics.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
178
179
|
};
|
|
179
180
|
};
|
|
180
181
|
var focusTitle = exports.focusTitle = function focusTitle(pos) {
|
|
@@ -197,12 +198,12 @@ var focusTitle = exports.focusTitle = function focusTitle(pos) {
|
|
|
197
198
|
|
|
198
199
|
// Used to clear any node or cell selection when expand title is focused
|
|
199
200
|
var setSelectionInsideExpand = exports.setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
200
|
-
return function (
|
|
201
|
+
return function (_state, dispatch, editorView) {
|
|
201
202
|
if (editorView) {
|
|
202
203
|
if (!editorView.hasFocus()) {
|
|
203
204
|
editorView.focus();
|
|
204
205
|
}
|
|
205
|
-
var sel =
|
|
206
|
+
var sel = _state2.Selection.findFrom(editorView.state.doc.resolve(expandPos), 1, true);
|
|
206
207
|
if (sel && dispatch) {
|
|
207
208
|
dispatch(editorView.state.tr.setSelection(sel));
|
|
208
209
|
}
|
|
@@ -17,6 +17,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
17
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
18
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
19
19
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _commands = require("./commands");
|
|
21
22
|
var _keymap = require("./pm-plugins/keymap");
|
|
22
23
|
var _main = require("./pm-plugins/main");
|
|
@@ -27,21 +28,23 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
27
28
|
var _ref$config = _ref.config,
|
|
28
29
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
29
30
|
api = _ref.api;
|
|
30
|
-
|
|
31
|
+
// Confluence is injecting the FF through editor props, from an experiment
|
|
32
|
+
// Jira is pulling it in through platform feature flags, from a feature gate
|
|
33
|
+
var isNestingExpandsSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestedExpandInExpandEx) || (0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_in_expand_jira');
|
|
31
34
|
return {
|
|
32
35
|
name: 'expand',
|
|
33
36
|
nodes: function nodes() {
|
|
34
37
|
return [{
|
|
35
38
|
name: 'expand',
|
|
36
|
-
node:
|
|
39
|
+
node: isNestingExpandsSupported ? _adfSchema.expandWithNestedExpand : _adfSchema.expand
|
|
37
40
|
}, {
|
|
38
41
|
name: 'nestedExpand',
|
|
39
42
|
node: _adfSchema.nestedExpand
|
|
40
43
|
}];
|
|
41
44
|
},
|
|
42
45
|
actions: {
|
|
43
|
-
insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
44
|
-
insertExpandWithInputMethod: (0, _commands.insertExpandWithInputMethod)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
46
|
+
insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingExpandsSupported),
|
|
47
|
+
insertExpandWithInputMethod: (0, _commands.insertExpandWithInputMethod)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingExpandsSupported)
|
|
45
48
|
},
|
|
46
49
|
pmPlugins: function pmPlugins() {
|
|
47
50
|
return [{
|
|
@@ -79,7 +82,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
79
82
|
},
|
|
80
83
|
action: function action(insert, state) {
|
|
81
84
|
var _api$analytics3;
|
|
82
|
-
var node = (0, _commands.createExpandNode)(state,
|
|
85
|
+
var node = (0, _commands.createExpandNode)(state, isNestingExpandsSupported);
|
|
83
86
|
if (!node) {
|
|
84
87
|
return false;
|
|
85
88
|
}
|
|
@@ -76,7 +76,9 @@ function expandKeymap(api, options) {
|
|
|
76
76
|
var selection = state.selection,
|
|
77
77
|
schema = state.schema;
|
|
78
78
|
var nodeBefore = selection.$from.nodeBefore;
|
|
79
|
-
if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
|
|
79
|
+
if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
|
|
80
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
81
|
+
(0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
|
|
80
82
|
var _$from = selection.$from;
|
|
81
83
|
return (0, _commands.focusTitle)(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
|
|
82
84
|
}
|
|
@@ -100,7 +102,9 @@ function expandKeymap(api, options) {
|
|
|
100
102
|
var expandBefore = (0, _utils2.findExpand)(state, sel);
|
|
101
103
|
if (sel && expandBefore) {
|
|
102
104
|
// moving cursor from outside of an expand to the title when it is collapsed
|
|
103
|
-
if (
|
|
105
|
+
if (
|
|
106
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
107
|
+
(0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
|
|
104
108
|
return (0, _commands.focusTitle)(expandBefore.start)(state, dispatch, editorView);
|
|
105
109
|
}
|
|
106
110
|
// moving cursor from outside of an expand to the content when it is expanded
|
|
@@ -121,7 +125,9 @@ function expandKeymap(api, options) {
|
|
|
121
125
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
122
126
|
var selection = state.selection;
|
|
123
127
|
var nodeAfter = selection.$from.nodeAfter;
|
|
124
|
-
if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
|
|
128
|
+
if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
|
|
129
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
130
|
+
(0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
|
|
125
131
|
var $from = selection.$from;
|
|
126
132
|
return (0, _commands.focusTitle)($from.pos + 1)(state, dispatch, editorView);
|
|
127
133
|
}
|
|
@@ -151,7 +157,9 @@ function expandKeymap(api, options) {
|
|
|
151
157
|
// @see ED-7977
|
|
152
158
|
var sel = _state.Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
|
|
153
159
|
var expandBefore = (0, _utils2.findExpand)(state, sel);
|
|
154
|
-
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
160
|
+
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
161
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
162
|
+
(0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
|
|
155
163
|
return (0, _commands.focusTitle)(expandBefore.start)(state, dispatch, editorView);
|
|
156
164
|
}
|
|
157
165
|
return false;
|
|
@@ -12,21 +12,22 @@ var _expand = require("@atlaskit/editor-common/expand");
|
|
|
12
12
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
13
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
14
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
-
var
|
|
15
|
+
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
17
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
18
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _utils4 = require("../utils");
|
|
19
20
|
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; }
|
|
20
21
|
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; }
|
|
21
22
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
22
23
|
var createExpandNode = exports.createExpandNode = function createExpandNode(state) {
|
|
23
24
|
var setExpandedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
24
|
-
var
|
|
25
|
+
var isNestingExpandsSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
25
26
|
var _state$schema$nodes = state.schema.nodes,
|
|
26
27
|
expand = _state$schema$nodes.expand,
|
|
27
28
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
28
29
|
var isSelectionInTable = !!(0, _utils3.findTable)(state.selection);
|
|
29
|
-
var isSelectionInExpand =
|
|
30
|
+
var isSelectionInExpand = isNestingExpandsSupported && (0, _utils4.isNestedInExpand)(state);
|
|
30
31
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
31
32
|
var expandNode = expandType.createAndFill({});
|
|
32
33
|
if (setExpandedState) {
|
|
@@ -34,10 +35,10 @@ var createExpandNode = exports.createExpandNode = function createExpandNode(stat
|
|
|
34
35
|
}
|
|
35
36
|
return expandNode;
|
|
36
37
|
};
|
|
37
|
-
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
38
|
+
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
38
39
|
return function (inputMethod) {
|
|
39
40
|
return function (state, dispatch) {
|
|
40
|
-
var expandNode = (0, _platformFeatureFlags.fg)('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false,
|
|
41
|
+
var expandNode = (0, _platformFeatureFlags.fg)('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false, isNestingExpandsSupported) : createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
41
42
|
if (!expandNode) {
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
@@ -79,9 +80,9 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI,
|
|
83
|
+
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
83
84
|
return function (state, dispatch) {
|
|
84
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
85
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(_analytics.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
85
86
|
};
|
|
86
87
|
};
|
|
87
88
|
var deleteExpand = exports.deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
@@ -120,12 +121,12 @@ var deleteExpandAtPos = exports.deleteExpandAtPos = function deleteExpandAtPos(e
|
|
|
120
121
|
|
|
121
122
|
// Used to clear any node or cell selection when expand title is focused
|
|
122
123
|
var setSelectionInsideExpand = exports.setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
123
|
-
return function (
|
|
124
|
+
return function (_state, dispatch, editorView) {
|
|
124
125
|
if (editorView) {
|
|
125
126
|
if (!editorView.hasFocus()) {
|
|
126
127
|
editorView.focus();
|
|
127
128
|
}
|
|
128
|
-
var sel =
|
|
129
|
+
var sel = _state2.Selection.findFrom(editorView.state.doc.resolve(expandPos), 1, true);
|
|
129
130
|
if (sel && dispatch) {
|
|
130
131
|
dispatch(editorView.state.tr.setSelection(sel));
|
|
131
132
|
}
|
|
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _commands = require("./commands");
|
|
15
16
|
var _keymap = require("./pm-plugins/keymap");
|
|
16
17
|
var _main = require("./pm-plugins/main");
|
|
@@ -20,21 +21,23 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
20
21
|
var _ref$config = _ref.config,
|
|
21
22
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
22
23
|
api = _ref.api;
|
|
23
|
-
|
|
24
|
+
// Confluence is injecting the FF through editor props, from an experiment
|
|
25
|
+
// Jira is pulling it in through platform feature flags, from a feature gate
|
|
26
|
+
var isNestingExpandsSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestedExpandInExpandEx) || (0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_in_expand_jira');
|
|
24
27
|
return {
|
|
25
28
|
name: 'expand',
|
|
26
29
|
nodes: function nodes() {
|
|
27
30
|
return [{
|
|
28
31
|
name: 'expand',
|
|
29
|
-
node:
|
|
32
|
+
node: isNestingExpandsSupported ? _adfSchema.expandWithNestedExpand : _adfSchema.expand
|
|
30
33
|
}, {
|
|
31
34
|
name: 'nestedExpand',
|
|
32
35
|
node: _adfSchema.nestedExpand
|
|
33
36
|
}];
|
|
34
37
|
},
|
|
35
38
|
actions: {
|
|
36
|
-
insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
37
|
-
insertExpandWithInputMethod: (0, _commands.insertExpandWithInputMethod)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
39
|
+
insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingExpandsSupported),
|
|
40
|
+
insertExpandWithInputMethod: (0, _commands.insertExpandWithInputMethod)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingExpandsSupported)
|
|
38
41
|
},
|
|
39
42
|
pmPlugins: function pmPlugins() {
|
|
40
43
|
return [{
|
|
@@ -72,7 +75,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
72
75
|
},
|
|
73
76
|
action: function action(insert, state) {
|
|
74
77
|
var _api$analytics3;
|
|
75
|
-
var node = (0, _commands.createExpandNode)(state, undefined,
|
|
78
|
+
var node = (0, _commands.createExpandNode)(state, undefined, isNestingExpandsSupported);
|
|
76
79
|
if (!node) {
|
|
77
80
|
return false;
|
|
78
81
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isNestedInExpand = void 0;
|
|
7
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var isNestedInExpand = exports.isNestedInExpand = function isNestedInExpand(state) {
|
|
9
|
+
return (0, _utils.hasParentNode)(function (node) {
|
|
10
|
+
return node.type === state.schema.nodes.expand || node.type === state.schema.nodes.nestedExpand;
|
|
11
|
+
})(state.selection);
|
|
12
|
+
};
|
|
@@ -6,6 +6,7 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { isNestedInExpand } from '../utils';
|
|
9
10
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
10
11
|
import { findExpand } from './utils';
|
|
11
12
|
export const setExpandRef = ref => createCommand({
|
|
@@ -123,18 +124,18 @@ export const toggleExpandExpanded = ({
|
|
|
123
124
|
};
|
|
124
125
|
|
|
125
126
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
126
|
-
export const createExpandNode = (state,
|
|
127
|
+
export const createExpandNode = (state, isNestingExpandsSupported) => {
|
|
127
128
|
const {
|
|
128
129
|
expand,
|
|
129
130
|
nestedExpand
|
|
130
131
|
} = state.schema.nodes;
|
|
131
132
|
const isSelectionInTable = !!findTable(state.selection);
|
|
132
|
-
const isSelectionInExpand =
|
|
133
|
+
const isSelectionInExpand = isNestingExpandsSupported && isNestedInExpand(state);
|
|
133
134
|
const expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
134
135
|
return expandType.createAndFill({});
|
|
135
136
|
};
|
|
136
|
-
export const insertExpandWithInputMethod = (editorAnalyticsAPI,
|
|
137
|
-
const expandNode = createExpandNode(state,
|
|
137
|
+
export const insertExpandWithInputMethod = (editorAnalyticsAPI, isNestingExpandsSupported) => inputMethod => (state, dispatch) => {
|
|
138
|
+
const expandNode = createExpandNode(state, isNestingExpandsSupported);
|
|
138
139
|
if (!expandNode) {
|
|
139
140
|
return false;
|
|
140
141
|
}
|
|
@@ -157,8 +158,8 @@ export const insertExpandWithInputMethod = (editorAnalyticsAPI, featureFlags) =>
|
|
|
157
158
|
}
|
|
158
159
|
return true;
|
|
159
160
|
};
|
|
160
|
-
export const insertExpand = (editorAnalyticsAPI,
|
|
161
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
161
|
+
export const insertExpand = (editorAnalyticsAPI, isNestingExpandsSupported) => (state, dispatch) => {
|
|
162
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
162
163
|
};
|
|
163
164
|
export const focusTitle = pos => (state, dispatch, editorView) => {
|
|
164
165
|
if (editorView) {
|
|
@@ -177,7 +178,7 @@ export const focusTitle = pos => (state, dispatch, editorView) => {
|
|
|
177
178
|
};
|
|
178
179
|
|
|
179
180
|
// Used to clear any node or cell selection when expand title is focused
|
|
180
|
-
export const setSelectionInsideExpand = expandPos => (
|
|
181
|
+
export const setSelectionInsideExpand = expandPos => (_state, dispatch, editorView) => {
|
|
181
182
|
if (editorView) {
|
|
182
183
|
if (!editorView.hasFocus()) {
|
|
183
184
|
editorView.focus();
|
|
@@ -4,6 +4,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './commands';
|
|
8
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
9
10
|
import { createPlugin } from './pm-plugins/main';
|
|
@@ -13,22 +14,24 @@ export const expandPlugin = ({
|
|
|
13
14
|
config: options = {},
|
|
14
15
|
api
|
|
15
16
|
}) => {
|
|
16
|
-
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
17
|
-
|
|
17
|
+
var _api$featureFlags, _api$featureFlags$sha, _api$analytics, _api$analytics2;
|
|
18
|
+
// Confluence is injecting the FF through editor props, from an experiment
|
|
19
|
+
// Jira is pulling it in through platform feature flags, from a feature gate
|
|
20
|
+
const isNestingExpandsSupported = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags$sha === void 0 ? void 0 : _api$featureFlags$sha.nestedExpandInExpandEx) || fg('platform_editor_nest_nested_expand_in_expand_jira');
|
|
18
21
|
return {
|
|
19
22
|
name: 'expand',
|
|
20
23
|
nodes() {
|
|
21
24
|
return [{
|
|
22
25
|
name: 'expand',
|
|
23
|
-
node:
|
|
26
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
24
27
|
}, {
|
|
25
28
|
name: 'nestedExpand',
|
|
26
29
|
node: nestedExpand
|
|
27
30
|
}];
|
|
28
31
|
},
|
|
29
32
|
actions: {
|
|
30
|
-
insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
31
|
-
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
33
|
+
insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingExpandsSupported),
|
|
34
|
+
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingExpandsSupported)
|
|
32
35
|
},
|
|
33
36
|
pmPlugins() {
|
|
34
37
|
return [{
|
|
@@ -64,7 +67,7 @@ export const expandPlugin = ({
|
|
|
64
67
|
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
65
68
|
action(insert, state) {
|
|
66
69
|
var _api$analytics3;
|
|
67
|
-
const node = createExpandNode(state,
|
|
70
|
+
const node = createExpandNode(state, isNestingExpandsSupported);
|
|
68
71
|
if (!node) {
|
|
69
72
|
return false;
|
|
70
73
|
}
|
|
@@ -4,7 +4,7 @@ import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
|
4
4
|
import { isEmptyNode, isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
6
6
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { deleteExpand, focusTitle } from '../commands';
|
|
9
9
|
import { findExpand } from '../utils';
|
|
10
10
|
const isExpandNode = node => {
|
|
@@ -84,7 +84,9 @@ export function expandKeymap(api, options) {
|
|
|
84
84
|
const {
|
|
85
85
|
nodeBefore
|
|
86
86
|
} = selection.$from;
|
|
87
|
-
if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
|
|
87
|
+
if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
|
|
88
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
89
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
|
|
88
90
|
const {
|
|
89
91
|
$from
|
|
90
92
|
} = selection;
|
|
@@ -112,7 +114,9 @@ export function expandKeymap(api, options) {
|
|
|
112
114
|
const expandBefore = findExpand(state, sel);
|
|
113
115
|
if (sel && expandBefore) {
|
|
114
116
|
// moving cursor from outside of an expand to the title when it is collapsed
|
|
115
|
-
if (
|
|
117
|
+
if (
|
|
118
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
119
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
|
|
116
120
|
return focusTitle(expandBefore.start)(state, dispatch, editorView);
|
|
117
121
|
}
|
|
118
122
|
// moving cursor from outside of an expand to the content when it is expanded
|
|
@@ -138,7 +142,9 @@ export function expandKeymap(api, options) {
|
|
|
138
142
|
const {
|
|
139
143
|
nodeAfter
|
|
140
144
|
} = selection.$from;
|
|
141
|
-
if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
|
|
145
|
+
if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
|
|
146
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
147
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
|
|
142
148
|
const {
|
|
143
149
|
$from
|
|
144
150
|
} = selection;
|
|
@@ -177,7 +183,9 @@ export function expandKeymap(api, options) {
|
|
|
177
183
|
// @see ED-7977
|
|
178
184
|
const sel = Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
|
|
179
185
|
const expandBefore = findExpand(state, sel);
|
|
180
|
-
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
186
|
+
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
187
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
188
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
|
|
181
189
|
return focusTitle(expandBefore.start)(state, dispatch, editorView);
|
|
182
190
|
}
|
|
183
191
|
return false;
|
|
@@ -8,14 +8,16 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
8
8
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { isNestedInExpand } from '../utils';
|
|
12
|
+
|
|
11
13
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
12
|
-
export const createExpandNode = (state, setExpandedState = true,
|
|
14
|
+
export const createExpandNode = (state, setExpandedState = true, isNestingExpandsSupported) => {
|
|
13
15
|
const {
|
|
14
16
|
expand,
|
|
15
17
|
nestedExpand
|
|
16
18
|
} = state.schema.nodes;
|
|
17
19
|
const isSelectionInTable = !!findTable(state.selection);
|
|
18
|
-
const isSelectionInExpand =
|
|
20
|
+
const isSelectionInExpand = isNestingExpandsSupported && isNestedInExpand(state);
|
|
19
21
|
const expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
20
22
|
const expandNode = expandType.createAndFill({});
|
|
21
23
|
if (setExpandedState) {
|
|
@@ -23,8 +25,8 @@ export const createExpandNode = (state, setExpandedState = true, featureFlags) =
|
|
|
23
25
|
}
|
|
24
26
|
return expandNode;
|
|
25
27
|
};
|
|
26
|
-
export const insertExpandWithInputMethod = (editorAnalyticsAPI,
|
|
27
|
-
const expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false,
|
|
28
|
+
export const insertExpandWithInputMethod = (editorAnalyticsAPI, isNestingExpandsSupported) => inputMethod => (state, dispatch) => {
|
|
29
|
+
const expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false, isNestingExpandsSupported) : createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
28
30
|
if (!expandNode) {
|
|
29
31
|
return false;
|
|
30
32
|
}
|
|
@@ -64,8 +66,8 @@ export const insertExpandWithInputMethod = (editorAnalyticsAPI, featureFlags) =>
|
|
|
64
66
|
}
|
|
65
67
|
return true;
|
|
66
68
|
};
|
|
67
|
-
export const insertExpand = (editorAnalyticsAPI,
|
|
68
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
69
|
+
export const insertExpand = (editorAnalyticsAPI, isNestingExpandsSupported) => (state, dispatch) => {
|
|
70
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
69
71
|
};
|
|
70
72
|
export const deleteExpand = editorAnalyticsAPI => (state, dispatch) => {
|
|
71
73
|
const expandNode = findExpand(state);
|
|
@@ -98,7 +100,7 @@ export const deleteExpandAtPos = editorAnalyticsAPI => (expandNodePos, expandNod
|
|
|
98
100
|
};
|
|
99
101
|
|
|
100
102
|
// Used to clear any node or cell selection when expand title is focused
|
|
101
|
-
export const setSelectionInsideExpand = expandPos => (
|
|
103
|
+
export const setSelectionInsideExpand = expandPos => (_state, dispatch, editorView) => {
|
|
102
104
|
if (editorView) {
|
|
103
105
|
if (!editorView.hasFocus()) {
|
|
104
106
|
editorView.focus();
|
|
@@ -4,6 +4,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './commands';
|
|
8
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
9
10
|
import { createPlugin } from './pm-plugins/main';
|
|
@@ -12,22 +13,24 @@ export const expandPlugin = ({
|
|
|
12
13
|
config: options = {},
|
|
13
14
|
api
|
|
14
15
|
}) => {
|
|
15
|
-
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
16
|
-
|
|
16
|
+
var _api$featureFlags, _api$featureFlags$sha, _api$analytics, _api$analytics2;
|
|
17
|
+
// Confluence is injecting the FF through editor props, from an experiment
|
|
18
|
+
// Jira is pulling it in through platform feature flags, from a feature gate
|
|
19
|
+
const isNestingExpandsSupported = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags$sha === void 0 ? void 0 : _api$featureFlags$sha.nestedExpandInExpandEx) || fg('platform_editor_nest_nested_expand_in_expand_jira');
|
|
17
20
|
return {
|
|
18
21
|
name: 'expand',
|
|
19
22
|
nodes() {
|
|
20
23
|
return [{
|
|
21
24
|
name: 'expand',
|
|
22
|
-
node:
|
|
25
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
23
26
|
}, {
|
|
24
27
|
name: 'nestedExpand',
|
|
25
28
|
node: nestedExpand
|
|
26
29
|
}];
|
|
27
30
|
},
|
|
28
31
|
actions: {
|
|
29
|
-
insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
30
|
-
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
32
|
+
insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingExpandsSupported),
|
|
33
|
+
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingExpandsSupported)
|
|
31
34
|
},
|
|
32
35
|
pmPlugins() {
|
|
33
36
|
return [{
|
|
@@ -63,7 +66,7 @@ export const expandPlugin = ({
|
|
|
63
66
|
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
64
67
|
action(insert, state) {
|
|
65
68
|
var _api$analytics3;
|
|
66
|
-
const node = createExpandNode(state, undefined,
|
|
69
|
+
const node = createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
67
70
|
if (!node) {
|
|
68
71
|
return false;
|
|
69
72
|
}
|
|
@@ -9,6 +9,7 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
9
9
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { isNestedInExpand } from '../utils';
|
|
12
13
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
13
14
|
import { findExpand } from './utils';
|
|
14
15
|
export var setExpandRef = function setExpandRef(ref) {
|
|
@@ -128,19 +129,19 @@ export var toggleExpandExpanded = function toggleExpandExpanded(_ref2) {
|
|
|
128
129
|
};
|
|
129
130
|
|
|
130
131
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
131
|
-
export var createExpandNode = function createExpandNode(state,
|
|
132
|
+
export var createExpandNode = function createExpandNode(state, isNestingExpandsSupported) {
|
|
132
133
|
var _state$schema$nodes = state.schema.nodes,
|
|
133
134
|
expand = _state$schema$nodes.expand,
|
|
134
135
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
135
136
|
var isSelectionInTable = !!findTable(state.selection);
|
|
136
|
-
var isSelectionInExpand =
|
|
137
|
+
var isSelectionInExpand = isNestingExpandsSupported && isNestedInExpand(state);
|
|
137
138
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
138
139
|
return expandType.createAndFill({});
|
|
139
140
|
};
|
|
140
|
-
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
141
|
+
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
141
142
|
return function (inputMethod) {
|
|
142
143
|
return function (state, dispatch) {
|
|
143
|
-
var expandNode = createExpandNode(state,
|
|
144
|
+
var expandNode = createExpandNode(state, isNestingExpandsSupported);
|
|
144
145
|
if (!expandNode) {
|
|
145
146
|
return false;
|
|
146
147
|
}
|
|
@@ -165,9 +166,9 @@ export var insertExpandWithInputMethod = function insertExpandWithInputMethod(ed
|
|
|
165
166
|
};
|
|
166
167
|
};
|
|
167
168
|
};
|
|
168
|
-
export var insertExpand = function insertExpand(editorAnalyticsAPI,
|
|
169
|
+
export var insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
169
170
|
return function (state, dispatch) {
|
|
170
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
171
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
171
172
|
};
|
|
172
173
|
};
|
|
173
174
|
export var focusTitle = function focusTitle(pos) {
|
|
@@ -190,7 +191,7 @@ export var focusTitle = function focusTitle(pos) {
|
|
|
190
191
|
|
|
191
192
|
// Used to clear any node or cell selection when expand title is focused
|
|
192
193
|
export var setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
193
|
-
return function (
|
|
194
|
+
return function (_state, dispatch, editorView) {
|
|
194
195
|
if (editorView) {
|
|
195
196
|
if (!editorView.hasFocus()) {
|
|
196
197
|
editorView.focus();
|
|
@@ -4,6 +4,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './commands';
|
|
8
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
9
10
|
import { createPlugin } from './pm-plugins/main';
|
|
@@ -14,21 +15,23 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
14
15
|
var _ref$config = _ref.config,
|
|
15
16
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
16
17
|
api = _ref.api;
|
|
17
|
-
|
|
18
|
+
// Confluence is injecting the FF through editor props, from an experiment
|
|
19
|
+
// Jira is pulling it in through platform feature flags, from a feature gate
|
|
20
|
+
var isNestingExpandsSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestedExpandInExpandEx) || fg('platform_editor_nest_nested_expand_in_expand_jira');
|
|
18
21
|
return {
|
|
19
22
|
name: 'expand',
|
|
20
23
|
nodes: function nodes() {
|
|
21
24
|
return [{
|
|
22
25
|
name: 'expand',
|
|
23
|
-
node:
|
|
26
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
24
27
|
}, {
|
|
25
28
|
name: 'nestedExpand',
|
|
26
29
|
node: nestedExpand
|
|
27
30
|
}];
|
|
28
31
|
},
|
|
29
32
|
actions: {
|
|
30
|
-
insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
31
|
-
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
33
|
+
insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingExpandsSupported),
|
|
34
|
+
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingExpandsSupported)
|
|
32
35
|
},
|
|
33
36
|
pmPlugins: function pmPlugins() {
|
|
34
37
|
return [{
|
|
@@ -66,7 +69,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
66
69
|
},
|
|
67
70
|
action: function action(insert, state) {
|
|
68
71
|
var _api$analytics3;
|
|
69
|
-
var node = createExpandNode(state,
|
|
72
|
+
var node = createExpandNode(state, isNestingExpandsSupported);
|
|
70
73
|
if (!node) {
|
|
71
74
|
return false;
|
|
72
75
|
}
|
|
@@ -4,7 +4,7 @@ import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
|
4
4
|
import { isEmptyNode, isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
6
6
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { deleteExpand, focusTitle } from '../commands';
|
|
9
9
|
import { findExpand } from '../utils';
|
|
10
10
|
var isExpandNode = function isExpandNode(node) {
|
|
@@ -70,7 +70,9 @@ export function expandKeymap(api, options) {
|
|
|
70
70
|
var selection = state.selection,
|
|
71
71
|
schema = state.schema;
|
|
72
72
|
var nodeBefore = selection.$from.nodeBefore;
|
|
73
|
-
if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
|
|
73
|
+
if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
|
|
74
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
75
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
|
|
74
76
|
var _$from = selection.$from;
|
|
75
77
|
return focusTitle(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
|
|
76
78
|
}
|
|
@@ -94,7 +96,9 @@ export function expandKeymap(api, options) {
|
|
|
94
96
|
var expandBefore = findExpand(state, sel);
|
|
95
97
|
if (sel && expandBefore) {
|
|
96
98
|
// moving cursor from outside of an expand to the title when it is collapsed
|
|
97
|
-
if (
|
|
99
|
+
if (
|
|
100
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
101
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
|
|
98
102
|
return focusTitle(expandBefore.start)(state, dispatch, editorView);
|
|
99
103
|
}
|
|
100
104
|
// moving cursor from outside of an expand to the content when it is expanded
|
|
@@ -115,7 +119,9 @@ export function expandKeymap(api, options) {
|
|
|
115
119
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
116
120
|
var selection = state.selection;
|
|
117
121
|
var nodeAfter = selection.$from.nodeAfter;
|
|
118
|
-
if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
|
|
122
|
+
if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
|
|
123
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
124
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
|
|
119
125
|
var $from = selection.$from;
|
|
120
126
|
return focusTitle($from.pos + 1)(state, dispatch, editorView);
|
|
121
127
|
}
|
|
@@ -145,7 +151,9 @@ export function expandKeymap(api, options) {
|
|
|
145
151
|
// @see ED-7977
|
|
146
152
|
var sel = Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
|
|
147
153
|
var expandBefore = findExpand(state, sel);
|
|
148
|
-
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
154
|
+
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
155
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
156
|
+
fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
|
|
149
157
|
return focusTitle(expandBefore.start)(state, dispatch, editorView);
|
|
150
158
|
}
|
|
151
159
|
return false;
|
|
@@ -11,15 +11,17 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
11
11
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { isNestedInExpand } from '../utils';
|
|
15
|
+
|
|
14
16
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
15
17
|
export var createExpandNode = function createExpandNode(state) {
|
|
16
18
|
var setExpandedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
17
|
-
var
|
|
19
|
+
var isNestingExpandsSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
18
20
|
var _state$schema$nodes = state.schema.nodes,
|
|
19
21
|
expand = _state$schema$nodes.expand,
|
|
20
22
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
21
23
|
var isSelectionInTable = !!findTable(state.selection);
|
|
22
|
-
var isSelectionInExpand =
|
|
24
|
+
var isSelectionInExpand = isNestingExpandsSupported && isNestedInExpand(state);
|
|
23
25
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
24
26
|
var expandNode = expandType.createAndFill({});
|
|
25
27
|
if (setExpandedState) {
|
|
@@ -27,10 +29,10 @@ export var createExpandNode = function createExpandNode(state) {
|
|
|
27
29
|
}
|
|
28
30
|
return expandNode;
|
|
29
31
|
};
|
|
30
|
-
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
32
|
+
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
31
33
|
return function (inputMethod) {
|
|
32
34
|
return function (state, dispatch) {
|
|
33
|
-
var expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false,
|
|
35
|
+
var expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false, isNestingExpandsSupported) : createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
34
36
|
if (!expandNode) {
|
|
35
37
|
return false;
|
|
36
38
|
}
|
|
@@ -72,9 +74,9 @@ export var insertExpandWithInputMethod = function insertExpandWithInputMethod(ed
|
|
|
72
74
|
};
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
|
-
export var insertExpand = function insertExpand(editorAnalyticsAPI,
|
|
77
|
+
export var insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
76
78
|
return function (state, dispatch) {
|
|
77
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI,
|
|
79
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
78
80
|
};
|
|
79
81
|
};
|
|
80
82
|
export var deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
@@ -113,7 +115,7 @@ export var deleteExpandAtPos = function deleteExpandAtPos(editorAnalyticsAPI) {
|
|
|
113
115
|
|
|
114
116
|
// Used to clear any node or cell selection when expand title is focused
|
|
115
117
|
export var setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
116
|
-
return function (
|
|
118
|
+
return function (_state, dispatch, editorView) {
|
|
117
119
|
if (editorView) {
|
|
118
120
|
if (!editorView.hasFocus()) {
|
|
119
121
|
editorView.focus();
|
|
@@ -4,6 +4,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './commands';
|
|
8
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
9
10
|
import { createPlugin } from './pm-plugins/main';
|
|
@@ -13,21 +14,23 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
13
14
|
var _ref$config = _ref.config,
|
|
14
15
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
15
16
|
api = _ref.api;
|
|
16
|
-
|
|
17
|
+
// Confluence is injecting the FF through editor props, from an experiment
|
|
18
|
+
// Jira is pulling it in through platform feature flags, from a feature gate
|
|
19
|
+
var isNestingExpandsSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestedExpandInExpandEx) || fg('platform_editor_nest_nested_expand_in_expand_jira');
|
|
17
20
|
return {
|
|
18
21
|
name: 'expand',
|
|
19
22
|
nodes: function nodes() {
|
|
20
23
|
return [{
|
|
21
24
|
name: 'expand',
|
|
22
|
-
node:
|
|
25
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
23
26
|
}, {
|
|
24
27
|
name: 'nestedExpand',
|
|
25
28
|
node: nestedExpand
|
|
26
29
|
}];
|
|
27
30
|
},
|
|
28
31
|
actions: {
|
|
29
|
-
insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
30
|
-
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
32
|
+
insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingExpandsSupported),
|
|
33
|
+
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingExpandsSupported)
|
|
31
34
|
},
|
|
32
35
|
pmPlugins: function pmPlugins() {
|
|
33
36
|
return [{
|
|
@@ -65,7 +68,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
65
68
|
},
|
|
66
69
|
action: function action(insert, state) {
|
|
67
70
|
var _api$analytics3;
|
|
68
|
-
var node = createExpandNode(state, undefined,
|
|
71
|
+
var node = createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
69
72
|
if (!node) {
|
|
70
73
|
return false;
|
|
71
74
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
export var isNestedInExpand = function isNestedInExpand(state) {
|
|
3
|
+
return hasParentNode(function (node) {
|
|
4
|
+
return node.type === state.schema.nodes.expand || node.type === state.schema.nodes.nestedExpand;
|
|
5
|
+
})(state.selection);
|
|
6
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
5
|
+
import type { InsertMethod } from '../types';
|
|
6
6
|
export declare const setExpandRef: (ref?: HTMLDivElement | null) => Command;
|
|
7
7
|
export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
|
|
8
8
|
export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -18,8 +18,8 @@ export declare const toggleExpandExpanded: ({ editorAnalyticsAPI, pos, nodeType,
|
|
|
18
18
|
nodeType: NodeType;
|
|
19
19
|
__livePage: boolean;
|
|
20
20
|
}) => Command;
|
|
21
|
-
export declare const createExpandNode: (state: EditorState,
|
|
22
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
23
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
21
|
+
export declare const createExpandNode: (state: EditorState, isNestingExpandsSupported?: boolean) => PMNode | null;
|
|
22
|
+
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => (inputMethod: InsertMethod) => Command;
|
|
23
|
+
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => Command;
|
|
24
24
|
export declare const focusTitle: (pos: number) => Command;
|
|
25
25
|
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
6
|
-
export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean,
|
|
7
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
8
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
5
|
+
import type { InsertMethod } from '../types';
|
|
6
|
+
export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean, isNestingExpandsSupported?: boolean) => PMNode | null;
|
|
7
|
+
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => (inputMethod: InsertMethod) => Command;
|
|
8
|
+
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => Command;
|
|
9
9
|
export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
10
10
|
export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
|
|
11
11
|
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
5
|
+
import type { InsertMethod } from '../types';
|
|
6
6
|
export declare const setExpandRef: (ref?: HTMLDivElement | null) => Command;
|
|
7
7
|
export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
|
|
8
8
|
export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -18,8 +18,8 @@ export declare const toggleExpandExpanded: ({ editorAnalyticsAPI, pos, nodeType,
|
|
|
18
18
|
nodeType: NodeType;
|
|
19
19
|
__livePage: boolean;
|
|
20
20
|
}) => Command;
|
|
21
|
-
export declare const createExpandNode: (state: EditorState,
|
|
22
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
23
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
21
|
+
export declare const createExpandNode: (state: EditorState, isNestingExpandsSupported?: boolean) => PMNode | null;
|
|
22
|
+
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => (inputMethod: InsertMethod) => Command;
|
|
23
|
+
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => Command;
|
|
24
24
|
export declare const focusTitle: (pos: number) => Command;
|
|
25
25
|
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
6
|
-
export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean,
|
|
7
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
8
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
5
|
+
import type { InsertMethod } from '../types';
|
|
6
|
+
export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean, isNestingExpandsSupported?: boolean) => PMNode | null;
|
|
7
|
+
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => (inputMethod: InsertMethod) => Command;
|
|
8
|
+
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported?: boolean) => Command;
|
|
9
9
|
export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
10
10
|
export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
|
|
11
11
|
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
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": "^40.8.1",
|
|
37
37
|
"@atlaskit/button": "^20.0.0",
|
|
38
|
-
"@atlaskit/editor-common": "^87.
|
|
38
|
+
"@atlaskit/editor-common": "^87.12.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.7.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-disabled": "^1.2.0",
|
|
@@ -113,6 +113,9 @@
|
|
|
113
113
|
},
|
|
114
114
|
"platform_editor_single_player_expand_ed_24536": {
|
|
115
115
|
"type": "boolean"
|
|
116
|
+
},
|
|
117
|
+
"platform_editor_nest_nested_expand_in_expand_jira": {
|
|
118
|
+
"type": "boolean"
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
}
|