@atlaskit/editor-plugin-expand 2.10.8 → 2.10.9
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 +8 -0
- package/dist/cjs/legacyExpand/commands.js +3 -3
- package/dist/cjs/legacyExpand/plugin.js +0 -7
- package/dist/cjs/legacyExpand/pm-plugins/keymap.js +6 -6
- package/dist/cjs/legacyExpand/pm-plugins/main.js +4 -4
- package/dist/cjs/singlePlayerExpand/commands.js +4 -0
- package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +3 -3
- package/dist/cjs/singlePlayerExpand/utils.js +0 -31
- package/dist/es2019/legacyExpand/commands.js +1 -1
- package/dist/es2019/legacyExpand/plugin.js +0 -1
- package/dist/es2019/legacyExpand/pm-plugins/keymap.js +1 -1
- package/dist/es2019/legacyExpand/pm-plugins/main.js +1 -1
- package/dist/es2019/singlePlayerExpand/commands.js +4 -0
- package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +1 -1
- package/dist/es2019/singlePlayerExpand/utils.js +0 -1
- package/dist/esm/legacyExpand/commands.js +1 -1
- package/dist/esm/legacyExpand/plugin.js +0 -1
- package/dist/esm/legacyExpand/pm-plugins/keymap.js +1 -1
- package/dist/esm/legacyExpand/pm-plugins/main.js +1 -1
- package/dist/esm/singlePlayerExpand/commands.js +4 -0
- package/dist/esm/singlePlayerExpand/pm-plugins/main.js +1 -1
- package/dist/esm/singlePlayerExpand/utils.js +0 -1
- package/dist/types/legacyExpand/plugin.d.ts +0 -1
- package/dist/types/singlePlayerExpand/utils.d.ts +0 -1
- package/dist/types-ts4.5/legacyExpand/plugin.d.ts +0 -1
- package/dist/types-ts4.5/singlePlayerExpand/utils.d.ts +0 -1
- package/package.json +7 -3
- package/dist/cjs/legacyExpand/utils.js +0 -36
- package/dist/es2019/legacyExpand/utils.js +0 -1
- package/dist/esm/legacyExpand/utils.js +0 -1
- package/dist/types/legacyExpand/utils.d.ts +0 -1
- package/dist/types-ts4.5/legacyExpand/utils.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 2.10.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#180080](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/180080)
|
|
8
|
+
[`2c21ba8914848`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2c21ba8914848) -
|
|
9
|
+
[ux] ED-26013 fix expand on auto scoll for long node
|
|
10
|
+
|
|
3
11
|
## 2.10.8
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -10,6 +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 _styles = require("@atlaskit/editor-common/styles");
|
|
13
|
+
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
13
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
15
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
15
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -18,7 +19,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
18
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
20
|
var _utils4 = require("../utils");
|
|
20
21
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
21
|
-
var _utils5 = require("./utils");
|
|
22
22
|
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; }
|
|
23
23
|
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; }
|
|
24
24
|
var setExpandRef = exports.setExpandRef = function setExpandRef(ref) {
|
|
@@ -65,7 +65,7 @@ var deleteExpandAtPos = exports.deleteExpandAtPos = function deleteExpandAtPos(e
|
|
|
65
65
|
};
|
|
66
66
|
var deleteExpand = exports.deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
67
67
|
return function (state, dispatch) {
|
|
68
|
-
var expandNode = (0,
|
|
68
|
+
var expandNode = (0, _transforms.findExpand)(state);
|
|
69
69
|
if (!expandNode) {
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
@@ -118,7 +118,7 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
|
|
|
118
118
|
// If we're going to collapse the expand and our cursor is currently inside
|
|
119
119
|
// Move to a right gap cursor, if the toolbar is interacted (or an API),
|
|
120
120
|
// it will insert below rather than inside (which will be invisible).
|
|
121
|
-
if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && (0,
|
|
121
|
+
if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && (0, _transforms.findExpand)(state)) {
|
|
122
122
|
tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), _selection.Side.RIGHT));
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.expandPlugin = void 0;
|
|
8
|
-
Object.defineProperty(exports, "pluginKey", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _pluginFactory.pluginKey;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
8
|
var _react = _interopRequireDefault(require("react"));
|
|
15
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -22,7 +16,6 @@ var _commands = require("./commands");
|
|
|
22
16
|
var _keymap = require("./pm-plugins/keymap");
|
|
23
17
|
var _main = require("./pm-plugins/main");
|
|
24
18
|
var _toolbar = require("./toolbar");
|
|
25
|
-
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
26
19
|
var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
27
20
|
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
28
21
|
var _ref$config = _ref.config,
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.expandKeymap = expandKeymap;
|
|
7
7
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
8
8
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
9
|
+
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
9
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
11
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
11
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
13
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
13
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _commands = require("../commands");
|
|
15
|
-
var _utils3 = require("../utils");
|
|
16
16
|
var isExpandNode = function isExpandNode(node) {
|
|
17
17
|
return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
|
|
18
18
|
};
|
|
@@ -62,7 +62,7 @@ function expandKeymap(api, options) {
|
|
|
62
62
|
|
|
63
63
|
// if the text selection is inside an expand
|
|
64
64
|
else if (state.selection instanceof _state.TextSelection && !(0, _utils2.isInTable)(state)) {
|
|
65
|
-
var _expand = (0,
|
|
65
|
+
var _expand = (0, _transforms.findExpand)(state);
|
|
66
66
|
if (_expand) {
|
|
67
67
|
var expandNode = editorView.nodeDOM(_expand.pos);
|
|
68
68
|
if (expandNode) {
|
|
@@ -88,7 +88,7 @@ function expandKeymap(api, options) {
|
|
|
88
88
|
}
|
|
89
89
|
var $from = state.selection.$from;
|
|
90
90
|
if (editorView.endOfTextblock('up')) {
|
|
91
|
-
var expand = (0,
|
|
91
|
+
var expand = (0, _transforms.findExpand)(state);
|
|
92
92
|
|
|
93
93
|
// Moving UP in a table should move the cursor to the row above
|
|
94
94
|
// however when an expand is in a table cell to the left of the
|
|
@@ -103,7 +103,7 @@ function expandKeymap(api, options) {
|
|
|
103
103
|
return (0, _commands.focusTitle)(expand.start)(state, dispatch, editorView);
|
|
104
104
|
}
|
|
105
105
|
var sel = _state.Selection.findFrom(state.doc.resolve(prevCursorPos), -1);
|
|
106
|
-
var expandBefore = (0,
|
|
106
|
+
var expandBefore = (0, _transforms.findExpand)(state, sel);
|
|
107
107
|
if (sel && expandBefore) {
|
|
108
108
|
// moving cursor from outside of an expand to the title when it is collapsed
|
|
109
109
|
if (
|
|
@@ -156,11 +156,11 @@ function expandKeymap(api, options) {
|
|
|
156
156
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
157
157
|
expand = _state$schema$nodes2.expand,
|
|
158
158
|
nestedExpand = _state$schema$nodes2.nestedExpand;
|
|
159
|
-
var expandNode = (0,
|
|
159
|
+
var expandNode = (0, _transforms.findExpand)(state);
|
|
160
160
|
if (!expandNode) {
|
|
161
161
|
// @see ED-7977
|
|
162
162
|
var sel = _state.Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
|
|
163
|
-
var expandBefore = (0,
|
|
163
|
+
var expandBefore = (0, _transforms.findExpand)(state, sel);
|
|
164
164
|
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
|
|
165
165
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
166
166
|
(0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
|
|
@@ -10,12 +10,12 @@ exports.handleExpandDrag = handleExpandDrag;
|
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
11
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
|
+
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
13
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _commands = require("../commands");
|
|
17
18
|
var _nodeviews = _interopRequireDefault(require("../nodeviews"));
|
|
18
|
-
var _utils2 = require("../utils");
|
|
19
19
|
var _pluginFactory = require("./plugin-factory");
|
|
20
20
|
function containsClass(element, className) {
|
|
21
21
|
var _element$classList;
|
|
@@ -86,7 +86,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
86
86
|
update: function update(view) {
|
|
87
87
|
var state = view.state,
|
|
88
88
|
dispatch = view.dispatch;
|
|
89
|
-
var node = (0,
|
|
89
|
+
var node = (0, _transforms.findExpand)(state);
|
|
90
90
|
if (node) {
|
|
91
91
|
var expandRef = (0, _utils.findDomRefAtPos)(node.pos, domAtPos);
|
|
92
92
|
if ((0, _pluginFactory.getPluginState)(state).expandRef !== expandRef) {
|
|
@@ -145,9 +145,9 @@ function handleExpandDrag(view, event, slice) {
|
|
|
145
145
|
}
|
|
146
146
|
var updatedSlice = slice;
|
|
147
147
|
if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
|
|
148
|
-
updatedSlice = (0,
|
|
148
|
+
updatedSlice = (0, _transforms.transformSliceExpandToNestedExpand)(slice);
|
|
149
149
|
} else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport && !isNodeBeingDroppedInsideNestedExpand) {
|
|
150
|
-
updatedSlice = (0,
|
|
150
|
+
updatedSlice = (0, _transforms.transformSliceNestedExpandToExpand)(slice, state.schema);
|
|
151
151
|
}
|
|
152
152
|
if (!updatedSlice || updatedSlice.eq(slice)) {
|
|
153
153
|
return false;
|
|
@@ -16,6 +16,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
16
16
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
18
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
21
|
var _utils4 = require("../utils");
|
|
21
22
|
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; }
|
|
@@ -168,6 +169,9 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
|
|
|
168
169
|
},
|
|
169
170
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
170
171
|
};
|
|
172
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_long_node_expand')) {
|
|
173
|
+
tr.setMeta('scrollIntoView', false);
|
|
174
|
+
}
|
|
171
175
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
172
176
|
dispatch(tr);
|
|
173
177
|
}
|
|
@@ -11,11 +11,11 @@ exports.pluginKey = void 0;
|
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
12
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
|
+
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
14
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
18
|
var _nodeViews = _interopRequireDefault(require("../node-views"));
|
|
18
|
-
var _utils = require("../utils");
|
|
19
19
|
var pluginKey = exports.pluginKey = new _state.PluginKey('expandPlugin');
|
|
20
20
|
function containsClass(element, className) {
|
|
21
21
|
var _element$classList;
|
|
@@ -127,9 +127,9 @@ function handleExpandDrag(view, event, slice) {
|
|
|
127
127
|
}
|
|
128
128
|
var updatedSlice = slice;
|
|
129
129
|
if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
|
|
130
|
-
updatedSlice = (0,
|
|
130
|
+
updatedSlice = (0, _transforms.transformSliceExpandToNestedExpand)(slice);
|
|
131
131
|
} else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport && !isNodeBeingDroppedInsideNestedExpand) {
|
|
132
|
-
updatedSlice = (0,
|
|
132
|
+
updatedSlice = (0, _transforms.transformSliceNestedExpandToExpand)(slice, state.schema);
|
|
133
133
|
}
|
|
134
134
|
if (!updatedSlice || updatedSlice.eq(slice)) {
|
|
135
135
|
return false;
|
|
@@ -3,39 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "findExpand", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _transforms.findExpand;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
exports.findParentExpandNode = void 0;
|
|
13
|
-
Object.defineProperty(exports, "transformSliceExpandToNestedExpand", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _transforms.transformSliceExpandToNestedExpand;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "transformSliceNestedExpandToExpand", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _transforms.transformSliceNestedExpandToExpand;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "transformSliceToRemoveOpenExpand", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _transforms.transformSliceToRemoveOpenExpand;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "transformSliceToRemoveOpenNestedExpand", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function get() {
|
|
34
|
-
return _transforms.transformSliceToRemoveOpenNestedExpand;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
38
|
-
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
39
8
|
var findParentExpandNode = exports.findParentExpandNode = function findParentExpandNode(state) {
|
|
40
9
|
return (0, _utils.findParentNodeOfType)(state.schema.nodes.nestedExpand)(state.selection) || (0, _utils.findParentNodeOfType)(state.schema.nodes.expand)(state.selection);
|
|
41
10
|
};
|
|
@@ -2,6 +2,7 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
5
|
+
import { findExpand } from '@atlaskit/editor-common/transforms';
|
|
5
6
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -10,7 +11,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { isNestedInExpand } from '../utils';
|
|
12
13
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
13
|
-
import { findExpand } from './utils';
|
|
14
14
|
export const setExpandRef = ref => createCommand({
|
|
15
15
|
type: 'SET_EXPAND_REF',
|
|
16
16
|
data: {
|
|
@@ -9,7 +9,6 @@ import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './c
|
|
|
9
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
10
10
|
import { createPlugin } from './pm-plugins/main';
|
|
11
11
|
import { getToolbarConfig } from './toolbar';
|
|
12
|
-
export { pluginKey } from './pm-plugins/plugin-factory';
|
|
13
12
|
export const expandPlugin = ({
|
|
14
13
|
config: options = {},
|
|
15
14
|
api
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { backspace, bindKeymapWithCommand, moveDown, moveLeft, moveRight, moveUp, tab } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { findExpand } from '@atlaskit/editor-common/transforms';
|
|
3
4
|
import { isEmptyNode, isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
6
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { isInTable } from '@atlaskit/editor-tables/utils';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { deleteExpand, focusIcon, focusTitle } from '../commands';
|
|
9
|
-
import { findExpand } from '../utils';
|
|
10
10
|
const isExpandNode = node => {
|
|
11
11
|
return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
|
|
12
12
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { findExpand, transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
4
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { setExpandRef } from '../commands';
|
|
8
9
|
import ExpandNodeView from '../nodeviews';
|
|
9
|
-
import { findExpand, transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
|
|
10
10
|
import { createPluginState, getPluginState, pluginKey } from './plugin-factory';
|
|
11
11
|
export function containsClass(element, className) {
|
|
12
12
|
var _element$classList;
|
|
@@ -8,6 +8,7 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
|
8
8
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
13
|
import { isNestedInExpand } from '../utils';
|
|
13
14
|
|
|
@@ -148,6 +149,9 @@ export const toggleExpandExpanded = ({
|
|
|
148
149
|
},
|
|
149
150
|
eventType: EVENT_TYPE.TRACK
|
|
150
151
|
};
|
|
152
|
+
if (fg('platform_editor_long_node_expand')) {
|
|
153
|
+
tr.setMeta('scrollIntoView', false);
|
|
154
|
+
}
|
|
151
155
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
152
156
|
dispatch(tr);
|
|
153
157
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
4
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import ExpandNodeView from '../node-views';
|
|
8
|
-
import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
|
|
9
9
|
export const pluginKey = new PluginKey('expandPlugin');
|
|
10
10
|
export function containsClass(element, className) {
|
|
11
11
|
var _element$classList;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
3
2
|
export const findParentExpandNode = state => {
|
|
4
3
|
return findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
|
|
5
4
|
};
|
|
@@ -5,6 +5,7 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
8
|
+
import { findExpand } from '@atlaskit/editor-common/transforms';
|
|
8
9
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
9
10
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -13,7 +14,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
13
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import { isNestedInExpand } from '../utils';
|
|
15
16
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
16
|
-
import { findExpand } from './utils';
|
|
17
17
|
export var setExpandRef = function setExpandRef(ref) {
|
|
18
18
|
return createCommand({
|
|
19
19
|
type: 'SET_EXPAND_REF',
|
|
@@ -9,7 +9,6 @@ import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './c
|
|
|
9
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
10
10
|
import { createPlugin } from './pm-plugins/main';
|
|
11
11
|
import { getToolbarConfig } from './toolbar';
|
|
12
|
-
export { pluginKey } from './pm-plugins/plugin-factory';
|
|
13
12
|
export var expandPlugin = function expandPlugin(_ref) {
|
|
14
13
|
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
15
14
|
var _ref$config = _ref.config,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { backspace, bindKeymapWithCommand, moveDown, moveLeft, moveRight, moveUp, tab } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { findExpand } from '@atlaskit/editor-common/transforms';
|
|
3
4
|
import { isEmptyNode, isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
6
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { isInTable } from '@atlaskit/editor-tables/utils';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { deleteExpand, focusIcon, focusTitle } from '../commands';
|
|
9
|
-
import { findExpand } from '../utils';
|
|
10
10
|
var isExpandNode = function isExpandNode(node) {
|
|
11
11
|
return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
|
|
12
12
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { findExpand, transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
4
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { setExpandRef } from '../commands';
|
|
8
9
|
import ExpandNodeView from '../nodeviews';
|
|
9
|
-
import { findExpand, transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
|
|
10
10
|
import { createPluginState, getPluginState, pluginKey } from './plugin-factory';
|
|
11
11
|
export function containsClass(element, className) {
|
|
12
12
|
var _element$classList;
|
|
@@ -11,6 +11,7 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
|
11
11
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { isNestedInExpand } from '../utils';
|
|
16
17
|
|
|
@@ -162,6 +163,9 @@ export var toggleExpandExpanded = function toggleExpandExpanded(_ref) {
|
|
|
162
163
|
},
|
|
163
164
|
eventType: EVENT_TYPE.TRACK
|
|
164
165
|
};
|
|
166
|
+
if (fg('platform_editor_long_node_expand')) {
|
|
167
|
+
tr.setMeta('scrollIntoView', false);
|
|
168
|
+
}
|
|
165
169
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
166
170
|
dispatch(tr);
|
|
167
171
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
4
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import ExpandNodeView from '../node-views';
|
|
8
|
-
import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
|
|
9
9
|
export var pluginKey = new PluginKey('expandPlugin');
|
|
10
10
|
export function containsClass(element, className) {
|
|
11
11
|
var _element$classList;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
3
2
|
export var findParentExpandNode = function findParentExpandNode(state) {
|
|
4
3
|
return findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
|
|
5
4
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
|
|
4
3
|
export declare const findParentExpandNode: (state: EditorState) => ReturnType<ReturnType<typeof findParentNodeOfType>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
|
|
4
3
|
export declare const findParentExpandNode: (state: EditorState) => ReturnType<ReturnType<typeof findParentNodeOfType>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.9",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
45
45
|
"@atlaskit/icon": "^23.1.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
48
|
-
"@atlaskit/tokens": "^2.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^2.27.0",
|
|
48
|
+
"@atlaskit/tokens": "^2.5.0",
|
|
49
49
|
"@atlaskit/tooltip": "^19.0.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
@@ -123,6 +123,10 @@
|
|
|
123
123
|
},
|
|
124
124
|
"platform_editor_react18_plugin_portalprovider": {
|
|
125
125
|
"type": "boolean"
|
|
126
|
+
},
|
|
127
|
+
"platform_editor_long_node_expand": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"referenceOnly": true
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "findExpand", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _transforms.findExpand;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "transformSliceExpandToNestedExpand", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _transforms.transformSliceExpandToNestedExpand;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "transformSliceNestedExpandToExpand", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _transforms.transformSliceNestedExpandToExpand;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "transformSliceToRemoveOpenExpand", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _transforms.transformSliceToRemoveOpenExpand;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "transformSliceToRemoveOpenNestedExpand", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _transforms.transformSliceToRemoveOpenNestedExpand;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
|