@atlaskit/editor-plugin-expand 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/cjs/legacyExpand/commands.js +11 -9
- package/dist/cjs/legacyExpand/plugin.js +9 -5
- package/dist/cjs/singlePlayerExpand/commands.js +8 -5
- package/dist/cjs/singlePlayerExpand/plugin.js +9 -5
- package/dist/es2019/legacyExpand/commands.js +9 -7
- package/dist/es2019/legacyExpand/plugin.js +10 -6
- package/dist/es2019/singlePlayerExpand/commands.js +8 -6
- package/dist/es2019/singlePlayerExpand/plugin.js +10 -6
- package/dist/esm/legacyExpand/commands.js +9 -7
- package/dist/esm/legacyExpand/plugin.js +10 -6
- package/dist/esm/singlePlayerExpand/commands.js +8 -5
- package/dist/esm/singlePlayerExpand/plugin.js +10 -6
- package/dist/types/legacyExpand/commands.d.ts +3 -3
- package/dist/types/singlePlayerExpand/commands.d.ts +3 -3
- package/dist/types/types.d.ts +3 -1
- package/dist/types-ts4.5/legacyExpand/commands.d.ts +3 -3
- package/dist/types-ts4.5/singlePlayerExpand/commands.d.ts +3 -3
- package/dist/types-ts4.5/types.d.ts +3 -1
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 2.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#130725](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130725)
|
|
8
|
+
[`87a6f9ef9fecf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/87a6f9ef9fecf) -
|
|
9
|
+
[ED-24279] Add Jira feature flag for the nesting nestedExpand in Expand change
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 2.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#129865](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/129865)
|
|
20
|
+
[`dcf004629249a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf004629249a) -
|
|
21
|
+
[ED-24280] Added the capability to nest nestedExpands in expands
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 2.3.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ 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");
|
|
@@ -135,17 +135,19 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
138
|
-
var createExpandNode = exports.createExpandNode = function createExpandNode(state) {
|
|
138
|
+
var createExpandNode = exports.createExpandNode = function createExpandNode(state, isNestingExpandsSupported) {
|
|
139
139
|
var _state$schema$nodes = state.schema.nodes,
|
|
140
140
|
expand = _state$schema$nodes.expand,
|
|
141
141
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
142
|
-
var
|
|
142
|
+
var isSelectionInTable = !!(0, _utils3.findTable)(state.selection);
|
|
143
|
+
var isSelectionInExpand = isNestingExpandsSupported && !!(0, _utils4.findExpand)(state, state.selection);
|
|
144
|
+
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
143
145
|
return expandType.createAndFill({});
|
|
144
146
|
};
|
|
145
|
-
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI) {
|
|
147
|
+
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
146
148
|
return function (inputMethod) {
|
|
147
149
|
return function (state, dispatch) {
|
|
148
|
-
var expandNode = createExpandNode(state);
|
|
150
|
+
var expandNode = createExpandNode(state, isNestingExpandsSupported);
|
|
149
151
|
if (!expandNode) {
|
|
150
152
|
return false;
|
|
151
153
|
}
|
|
@@ -170,9 +172,9 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
170
172
|
};
|
|
171
173
|
};
|
|
172
174
|
};
|
|
173
|
-
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI) {
|
|
175
|
+
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
174
176
|
return function (state, dispatch) {
|
|
175
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI)(_analytics.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
177
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(_analytics.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
176
178
|
};
|
|
177
179
|
};
|
|
178
180
|
var focusTitle = exports.focusTitle = function focusTitle(pos) {
|
|
@@ -195,12 +197,12 @@ var focusTitle = exports.focusTitle = function focusTitle(pos) {
|
|
|
195
197
|
|
|
196
198
|
// Used to clear any node or cell selection when expand title is focused
|
|
197
199
|
var setSelectionInsideExpand = exports.setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
198
|
-
return function (
|
|
200
|
+
return function (_state, dispatch, editorView) {
|
|
199
201
|
if (editorView) {
|
|
200
202
|
if (!editorView.hasFocus()) {
|
|
201
203
|
editorView.focus();
|
|
202
204
|
}
|
|
203
|
-
var sel =
|
|
205
|
+
var sel = _state2.Selection.findFrom(editorView.state.doc.resolve(expandPos), 1, true);
|
|
204
206
|
if (sel && dispatch) {
|
|
205
207
|
dispatch(editorView.state.tr.setSelection(sel));
|
|
206
208
|
}
|
|
@@ -17,30 +17,34 @@ 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");
|
|
23
24
|
var _toolbar = require("./toolbar");
|
|
24
25
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
25
26
|
var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
26
|
-
var _api$analytics, _api$analytics2;
|
|
27
|
+
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
27
28
|
var _ref$config = _ref.config,
|
|
28
29
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
29
30
|
api = _ref.api;
|
|
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');
|
|
30
34
|
return {
|
|
31
35
|
name: 'expand',
|
|
32
36
|
nodes: function nodes() {
|
|
33
37
|
return [{
|
|
34
38
|
name: 'expand',
|
|
35
|
-
node: _adfSchema.expand
|
|
39
|
+
node: isNestingExpandsSupported ? _adfSchema.expandWithNestedExpand : _adfSchema.expand
|
|
36
40
|
}, {
|
|
37
41
|
name: 'nestedExpand',
|
|
38
42
|
node: _adfSchema.nestedExpand
|
|
39
43
|
}];
|
|
40
44
|
},
|
|
41
45
|
actions: {
|
|
42
|
-
insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
43
|
-
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)
|
|
44
48
|
},
|
|
45
49
|
pmPlugins: function pmPlugins() {
|
|
46
50
|
return [{
|
|
@@ -78,7 +82,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
78
82
|
},
|
|
79
83
|
action: function action(insert, state) {
|
|
80
84
|
var _api$analytics3;
|
|
81
|
-
var node = (0, _commands.createExpandNode)(state);
|
|
85
|
+
var node = (0, _commands.createExpandNode)(state, isNestingExpandsSupported);
|
|
82
86
|
if (!node) {
|
|
83
87
|
return false;
|
|
84
88
|
}
|
|
@@ -21,20 +21,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
21
21
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
22
22
|
var createExpandNode = exports.createExpandNode = function createExpandNode(state) {
|
|
23
23
|
var setExpandedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
24
|
+
var isNestingExpandsSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
24
25
|
var _state$schema$nodes = state.schema.nodes,
|
|
25
26
|
expand = _state$schema$nodes.expand,
|
|
26
27
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
27
|
-
var
|
|
28
|
+
var isSelectionInTable = !!(0, _utils3.findTable)(state.selection);
|
|
29
|
+
var isSelectionInExpand = isNestingExpandsSupported && !!(0, _transforms.findExpand)(state, state.selection);
|
|
30
|
+
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
28
31
|
var expandNode = expandType.createAndFill({});
|
|
29
32
|
if (setExpandedState) {
|
|
30
33
|
_expand.expandedState.set(expandNode, true);
|
|
31
34
|
}
|
|
32
35
|
return expandNode;
|
|
33
36
|
};
|
|
34
|
-
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI) {
|
|
37
|
+
var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
35
38
|
return function (inputMethod) {
|
|
36
39
|
return function (state, dispatch) {
|
|
37
|
-
var expandNode = (0, _platformFeatureFlags.fg)('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false) : createExpandNode(state);
|
|
40
|
+
var expandNode = (0, _platformFeatureFlags.fg)('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false, isNestingExpandsSupported) : createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
38
41
|
if (!expandNode) {
|
|
39
42
|
return false;
|
|
40
43
|
}
|
|
@@ -76,9 +79,9 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
76
79
|
};
|
|
77
80
|
};
|
|
78
81
|
};
|
|
79
|
-
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI) {
|
|
82
|
+
var insertExpand = exports.insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
80
83
|
return function (state, dispatch) {
|
|
81
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI)(_analytics.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
84
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(_analytics.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
82
85
|
};
|
|
83
86
|
};
|
|
84
87
|
var deleteExpand = exports.deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
@@ -11,29 +11,33 @@ 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");
|
|
17
18
|
var _toolbar = require("./toolbar");
|
|
18
19
|
var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
19
|
-
var _api$analytics, _api$analytics2;
|
|
20
|
+
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
20
21
|
var _ref$config = _ref.config,
|
|
21
22
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
22
23
|
api = _ref.api;
|
|
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');
|
|
23
27
|
return {
|
|
24
28
|
name: 'expand',
|
|
25
29
|
nodes: function nodes() {
|
|
26
30
|
return [{
|
|
27
31
|
name: 'expand',
|
|
28
|
-
node: _adfSchema.expand
|
|
32
|
+
node: isNestingExpandsSupported ? _adfSchema.expandWithNestedExpand : _adfSchema.expand
|
|
29
33
|
}, {
|
|
30
34
|
name: 'nestedExpand',
|
|
31
35
|
node: _adfSchema.nestedExpand
|
|
32
36
|
}];
|
|
33
37
|
},
|
|
34
38
|
actions: {
|
|
35
|
-
insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
36
|
-
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)
|
|
37
41
|
},
|
|
38
42
|
pmPlugins: function pmPlugins() {
|
|
39
43
|
return [{
|
|
@@ -71,7 +75,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
71
75
|
},
|
|
72
76
|
action: function action(insert, state) {
|
|
73
77
|
var _api$analytics3;
|
|
74
|
-
var node = (0, _commands.createExpandNode)(state);
|
|
78
|
+
var node = (0, _commands.createExpandNode)(state, undefined, isNestingExpandsSupported);
|
|
75
79
|
if (!node) {
|
|
76
80
|
return false;
|
|
77
81
|
}
|
|
@@ -123,16 +123,18 @@ export const toggleExpandExpanded = ({
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
126
|
-
export const createExpandNode = state => {
|
|
126
|
+
export const createExpandNode = (state, isNestingExpandsSupported) => {
|
|
127
127
|
const {
|
|
128
128
|
expand,
|
|
129
129
|
nestedExpand
|
|
130
130
|
} = state.schema.nodes;
|
|
131
|
-
const
|
|
131
|
+
const isSelectionInTable = !!findTable(state.selection);
|
|
132
|
+
const isSelectionInExpand = isNestingExpandsSupported && !!findExpand(state, state.selection);
|
|
133
|
+
const expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
132
134
|
return expandType.createAndFill({});
|
|
133
135
|
};
|
|
134
|
-
export const insertExpandWithInputMethod = editorAnalyticsAPI => inputMethod => (state, dispatch) => {
|
|
135
|
-
const expandNode = createExpandNode(state);
|
|
136
|
+
export const insertExpandWithInputMethod = (editorAnalyticsAPI, isNestingExpandsSupported) => inputMethod => (state, dispatch) => {
|
|
137
|
+
const expandNode = createExpandNode(state, isNestingExpandsSupported);
|
|
136
138
|
if (!expandNode) {
|
|
137
139
|
return false;
|
|
138
140
|
}
|
|
@@ -155,8 +157,8 @@ export const insertExpandWithInputMethod = editorAnalyticsAPI => inputMethod =>
|
|
|
155
157
|
}
|
|
156
158
|
return true;
|
|
157
159
|
};
|
|
158
|
-
export const insertExpand = editorAnalyticsAPI => (state, dispatch) => {
|
|
159
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
160
|
+
export const insertExpand = (editorAnalyticsAPI, isNestingExpandsSupported) => (state, dispatch) => {
|
|
161
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
160
162
|
};
|
|
161
163
|
export const focusTitle = pos => (state, dispatch, editorView) => {
|
|
162
164
|
if (editorView) {
|
|
@@ -175,7 +177,7 @@ export const focusTitle = pos => (state, dispatch, editorView) => {
|
|
|
175
177
|
};
|
|
176
178
|
|
|
177
179
|
// Used to clear any node or cell selection when expand title is focused
|
|
178
|
-
export const setSelectionInsideExpand = expandPos => (
|
|
180
|
+
export const setSelectionInsideExpand = expandPos => (_state, dispatch, editorView) => {
|
|
179
181
|
if (editorView) {
|
|
180
182
|
if (!editorView.hasFocus()) {
|
|
181
183
|
editorView.focus();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { expand, nestedExpand } from '@atlaskit/adf-schema';
|
|
2
|
+
import { expand, expandWithNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
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,24 @@ export const expandPlugin = ({
|
|
|
13
14
|
config: options = {},
|
|
14
15
|
api
|
|
15
16
|
}) => {
|
|
16
|
-
var _api$analytics, _api$analytics2;
|
|
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');
|
|
17
21
|
return {
|
|
18
22
|
name: 'expand',
|
|
19
23
|
nodes() {
|
|
20
24
|
return [{
|
|
21
25
|
name: 'expand',
|
|
22
|
-
node: expand
|
|
26
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
23
27
|
}, {
|
|
24
28
|
name: 'nestedExpand',
|
|
25
29
|
node: nestedExpand
|
|
26
30
|
}];
|
|
27
31
|
},
|
|
28
32
|
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)
|
|
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)
|
|
31
35
|
},
|
|
32
36
|
pmPlugins() {
|
|
33
37
|
return [{
|
|
@@ -63,7 +67,7 @@ export const expandPlugin = ({
|
|
|
63
67
|
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
64
68
|
action(insert, state) {
|
|
65
69
|
var _api$analytics3;
|
|
66
|
-
const node = createExpandNode(state);
|
|
70
|
+
const node = createExpandNode(state, isNestingExpandsSupported);
|
|
67
71
|
if (!node) {
|
|
68
72
|
return false;
|
|
69
73
|
}
|
|
@@ -9,20 +9,22 @@ import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/u
|
|
|
9
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
12
|
-
export const createExpandNode = (state, setExpandedState = true) => {
|
|
12
|
+
export const createExpandNode = (state, setExpandedState = true, isNestingExpandsSupported) => {
|
|
13
13
|
const {
|
|
14
14
|
expand,
|
|
15
15
|
nestedExpand
|
|
16
16
|
} = state.schema.nodes;
|
|
17
|
-
const
|
|
17
|
+
const isSelectionInTable = !!findTable(state.selection);
|
|
18
|
+
const isSelectionInExpand = isNestingExpandsSupported && !!findExpand(state, state.selection);
|
|
19
|
+
const expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
18
20
|
const expandNode = expandType.createAndFill({});
|
|
19
21
|
if (setExpandedState) {
|
|
20
22
|
expandedState.set(expandNode, true);
|
|
21
23
|
}
|
|
22
24
|
return expandNode;
|
|
23
25
|
};
|
|
24
|
-
export const insertExpandWithInputMethod = editorAnalyticsAPI => inputMethod => (state, dispatch) => {
|
|
25
|
-
const expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false) : createExpandNode(state);
|
|
26
|
+
export const insertExpandWithInputMethod = (editorAnalyticsAPI, isNestingExpandsSupported) => inputMethod => (state, dispatch) => {
|
|
27
|
+
const expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false, isNestingExpandsSupported) : createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
26
28
|
if (!expandNode) {
|
|
27
29
|
return false;
|
|
28
30
|
}
|
|
@@ -62,8 +64,8 @@ export const insertExpandWithInputMethod = editorAnalyticsAPI => inputMethod =>
|
|
|
62
64
|
}
|
|
63
65
|
return true;
|
|
64
66
|
};
|
|
65
|
-
export const insertExpand = editorAnalyticsAPI => (state, dispatch) => {
|
|
66
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
67
|
+
export const insertExpand = (editorAnalyticsAPI, isNestingExpandsSupported) => (state, dispatch) => {
|
|
68
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
67
69
|
};
|
|
68
70
|
export const deleteExpand = editorAnalyticsAPI => (state, dispatch) => {
|
|
69
71
|
const expandNode = findExpand(state);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { expand, nestedExpand } from '@atlaskit/adf-schema';
|
|
2
|
+
import { expand, expandWithNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
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,21 +13,24 @@ export const expandPlugin = ({
|
|
|
12
13
|
config: options = {},
|
|
13
14
|
api
|
|
14
15
|
}) => {
|
|
15
|
-
var _api$analytics, _api$analytics2;
|
|
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');
|
|
16
20
|
return {
|
|
17
21
|
name: 'expand',
|
|
18
22
|
nodes() {
|
|
19
23
|
return [{
|
|
20
24
|
name: 'expand',
|
|
21
|
-
node: expand
|
|
25
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
22
26
|
}, {
|
|
23
27
|
name: 'nestedExpand',
|
|
24
28
|
node: nestedExpand
|
|
25
29
|
}];
|
|
26
30
|
},
|
|
27
31
|
actions: {
|
|
28
|
-
insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
29
|
-
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)
|
|
30
34
|
},
|
|
31
35
|
pmPlugins() {
|
|
32
36
|
return [{
|
|
@@ -62,7 +66,7 @@ export const expandPlugin = ({
|
|
|
62
66
|
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
63
67
|
action(insert, state) {
|
|
64
68
|
var _api$analytics3;
|
|
65
|
-
const node = createExpandNode(state);
|
|
69
|
+
const node = createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
66
70
|
if (!node) {
|
|
67
71
|
return false;
|
|
68
72
|
}
|
|
@@ -128,17 +128,19 @@ export var toggleExpandExpanded = function toggleExpandExpanded(_ref2) {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
131
|
-
export var createExpandNode = function createExpandNode(state) {
|
|
131
|
+
export var createExpandNode = function createExpandNode(state, isNestingExpandsSupported) {
|
|
132
132
|
var _state$schema$nodes = state.schema.nodes,
|
|
133
133
|
expand = _state$schema$nodes.expand,
|
|
134
134
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
135
|
-
var
|
|
135
|
+
var isSelectionInTable = !!findTable(state.selection);
|
|
136
|
+
var isSelectionInExpand = isNestingExpandsSupported && !!findExpand(state, state.selection);
|
|
137
|
+
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
136
138
|
return expandType.createAndFill({});
|
|
137
139
|
};
|
|
138
|
-
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI) {
|
|
140
|
+
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
139
141
|
return function (inputMethod) {
|
|
140
142
|
return function (state, dispatch) {
|
|
141
|
-
var expandNode = createExpandNode(state);
|
|
143
|
+
var expandNode = createExpandNode(state, isNestingExpandsSupported);
|
|
142
144
|
if (!expandNode) {
|
|
143
145
|
return false;
|
|
144
146
|
}
|
|
@@ -163,9 +165,9 @@ export var insertExpandWithInputMethod = function insertExpandWithInputMethod(ed
|
|
|
163
165
|
};
|
|
164
166
|
};
|
|
165
167
|
};
|
|
166
|
-
export var insertExpand = function insertExpand(editorAnalyticsAPI) {
|
|
168
|
+
export var insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
167
169
|
return function (state, dispatch) {
|
|
168
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
170
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
169
171
|
};
|
|
170
172
|
};
|
|
171
173
|
export var focusTitle = function focusTitle(pos) {
|
|
@@ -188,7 +190,7 @@ export var focusTitle = function focusTitle(pos) {
|
|
|
188
190
|
|
|
189
191
|
// Used to clear any node or cell selection when expand title is focused
|
|
190
192
|
export var setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
191
|
-
return function (
|
|
193
|
+
return function (_state, dispatch, editorView) {
|
|
192
194
|
if (editorView) {
|
|
193
195
|
if (!editorView.hasFocus()) {
|
|
194
196
|
editorView.focus();
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { expand, nestedExpand } from '@atlaskit/adf-schema';
|
|
2
|
+
import { expand, expandWithNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
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';
|
|
10
11
|
import { getToolbarConfig } from './toolbar';
|
|
11
12
|
export { pluginKey } from './pm-plugins/plugin-factory';
|
|
12
13
|
export var expandPlugin = function expandPlugin(_ref) {
|
|
13
|
-
var _api$analytics, _api$analytics2;
|
|
14
|
+
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
14
15
|
var _ref$config = _ref.config,
|
|
15
16
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
16
17
|
api = _ref.api;
|
|
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');
|
|
17
21
|
return {
|
|
18
22
|
name: 'expand',
|
|
19
23
|
nodes: function nodes() {
|
|
20
24
|
return [{
|
|
21
25
|
name: 'expand',
|
|
22
|
-
node: expand
|
|
26
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
23
27
|
}, {
|
|
24
28
|
name: 'nestedExpand',
|
|
25
29
|
node: nestedExpand
|
|
26
30
|
}];
|
|
27
31
|
},
|
|
28
32
|
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)
|
|
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)
|
|
31
35
|
},
|
|
32
36
|
pmPlugins: function pmPlugins() {
|
|
33
37
|
return [{
|
|
@@ -65,7 +69,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
65
69
|
},
|
|
66
70
|
action: function action(insert, state) {
|
|
67
71
|
var _api$analytics3;
|
|
68
|
-
var node = createExpandNode(state);
|
|
72
|
+
var node = createExpandNode(state, isNestingExpandsSupported);
|
|
69
73
|
if (!node) {
|
|
70
74
|
return false;
|
|
71
75
|
}
|
|
@@ -14,20 +14,23 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
14
14
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
15
15
|
export var createExpandNode = function createExpandNode(state) {
|
|
16
16
|
var setExpandedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
17
|
+
var isNestingExpandsSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
17
18
|
var _state$schema$nodes = state.schema.nodes,
|
|
18
19
|
expand = _state$schema$nodes.expand,
|
|
19
20
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
20
|
-
var
|
|
21
|
+
var isSelectionInTable = !!findTable(state.selection);
|
|
22
|
+
var isSelectionInExpand = isNestingExpandsSupported && !!findExpand(state, state.selection);
|
|
23
|
+
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
21
24
|
var expandNode = expandType.createAndFill({});
|
|
22
25
|
if (setExpandedState) {
|
|
23
26
|
expandedState.set(expandNode, true);
|
|
24
27
|
}
|
|
25
28
|
return expandNode;
|
|
26
29
|
};
|
|
27
|
-
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI) {
|
|
30
|
+
export var insertExpandWithInputMethod = function insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
28
31
|
return function (inputMethod) {
|
|
29
32
|
return function (state, dispatch) {
|
|
30
|
-
var expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false) : createExpandNode(state);
|
|
33
|
+
var expandNode = fg('platform_editor_single_player_expand_ed_24536') ? createExpandNode(state, false, isNestingExpandsSupported) : createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
31
34
|
if (!expandNode) {
|
|
32
35
|
return false;
|
|
33
36
|
}
|
|
@@ -69,9 +72,9 @@ export var insertExpandWithInputMethod = function insertExpandWithInputMethod(ed
|
|
|
69
72
|
};
|
|
70
73
|
};
|
|
71
74
|
};
|
|
72
|
-
export var insertExpand = function insertExpand(editorAnalyticsAPI) {
|
|
75
|
+
export var insertExpand = function insertExpand(editorAnalyticsAPI, isNestingExpandsSupported) {
|
|
73
76
|
return function (state, dispatch) {
|
|
74
|
-
return insertExpandWithInputMethod(editorAnalyticsAPI)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
77
|
+
return insertExpandWithInputMethod(editorAnalyticsAPI, isNestingExpandsSupported)(INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
75
78
|
};
|
|
76
79
|
};
|
|
77
80
|
export var deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { expand, nestedExpand } from '@atlaskit/adf-schema';
|
|
2
|
+
import { expand, expandWithNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
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';
|
|
10
11
|
import { getToolbarConfig } from './toolbar';
|
|
11
12
|
export var expandPlugin = function expandPlugin(_ref) {
|
|
12
|
-
var _api$analytics, _api$analytics2;
|
|
13
|
+
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
13
14
|
var _ref$config = _ref.config,
|
|
14
15
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
15
16
|
api = _ref.api;
|
|
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');
|
|
16
20
|
return {
|
|
17
21
|
name: 'expand',
|
|
18
22
|
nodes: function nodes() {
|
|
19
23
|
return [{
|
|
20
24
|
name: 'expand',
|
|
21
|
-
node: expand
|
|
25
|
+
node: isNestingExpandsSupported ? expandWithNestedExpand : expand
|
|
22
26
|
}, {
|
|
23
27
|
name: 'nestedExpand',
|
|
24
28
|
node: nestedExpand
|
|
25
29
|
}];
|
|
26
30
|
},
|
|
27
31
|
actions: {
|
|
28
|
-
insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
29
|
-
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)
|
|
30
34
|
},
|
|
31
35
|
pmPlugins: function pmPlugins() {
|
|
32
36
|
return [{
|
|
@@ -64,7 +68,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
64
68
|
},
|
|
65
69
|
action: function action(insert, state) {
|
|
66
70
|
var _api$analytics3;
|
|
67
|
-
var node = createExpandNode(state);
|
|
71
|
+
var node = createExpandNode(state, undefined, isNestingExpandsSupported);
|
|
68
72
|
if (!node) {
|
|
69
73
|
return false;
|
|
70
74
|
}
|
|
@@ -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) => PMNode | null;
|
|
22
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InsertMethod) => Command;
|
|
23
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
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;
|
|
@@ -3,9 +3,9 @@ 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
5
|
import { type InsertMethod } from '../types';
|
|
6
|
-
export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean) => PMNode | null;
|
|
7
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InsertMethod) => Command;
|
|
8
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
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/dist/types/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
6
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
7
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
7
8
|
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
8
9
|
import type { insertExpand, insertExpandWithInputMethod } from './legacyExpand/commands';
|
|
@@ -43,7 +44,8 @@ export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
|
43
44
|
SelectionPlugin,
|
|
44
45
|
OptionalPlugin<AnalyticsPlugin>,
|
|
45
46
|
OptionalPlugin<SelectionMarkerPlugin>,
|
|
46
|
-
OptionalPlugin<EditorDisabledPlugin
|
|
47
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
48
|
+
OptionalPlugin<FeatureFlagsPlugin>
|
|
47
49
|
];
|
|
48
50
|
actions: {
|
|
49
51
|
/**
|
|
@@ -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) => PMNode | null;
|
|
22
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InsertMethod) => Command;
|
|
23
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
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;
|
|
@@ -3,9 +3,9 @@ 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
5
|
import { type InsertMethod } from '../types';
|
|
6
|
-
export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean) => PMNode | null;
|
|
7
|
-
export declare const insertExpandWithInputMethod: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InsertMethod) => Command;
|
|
8
|
-
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
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;
|
|
@@ -3,6 +3,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
6
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
7
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
7
8
|
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
8
9
|
import type { insertExpand, insertExpandWithInputMethod } from './legacyExpand/commands';
|
|
@@ -43,7 +44,8 @@ export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
|
43
44
|
SelectionPlugin,
|
|
44
45
|
OptionalPlugin<AnalyticsPlugin>,
|
|
45
46
|
OptionalPlugin<SelectionMarkerPlugin>,
|
|
46
|
-
OptionalPlugin<EditorDisabledPlugin
|
|
47
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
48
|
+
OptionalPlugin<FeatureFlagsPlugin>
|
|
47
49
|
];
|
|
48
50
|
actions: {
|
|
49
51
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^40.8.1",
|
|
37
|
-
"@atlaskit/button": "^
|
|
38
|
-
"@atlaskit/editor-common": "^87.
|
|
37
|
+
"@atlaskit/button": "^20.0.0",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
46
46
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
47
|
-
"@atlaskit/icon": "^22.
|
|
47
|
+
"@atlaskit/icon": "^22.13.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
49
|
"@atlaskit/tooltip": "^18.7.0",
|
|
50
50
|
"@babel/runtime": "^7.0.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
|
}
|