@atlaskit/editor-core 187.46.0 → 187.47.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 +17 -0
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +0 -6
- package/dist/cjs/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +7 -7
- package/dist/cjs/plugins/expand/commands.js +2 -2
- package/dist/cjs/plugins/expand/index.js +6 -2
- package/dist/cjs/plugins/expand/nodeviews/index.js +26 -23
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +10 -12
- package/dist/cjs/plugins/expand/pm-plugins/main.js +9 -6
- package/dist/cjs/plugins/extension/pm-plugins/main.js +8 -9
- package/dist/cjs/plugins/layout/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/media/toolbar/commands.js +1 -1
- package/dist/cjs/plugins/panel/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/paste/handlers.js +3 -3
- package/dist/cjs/plugins/selection/commands.js +27 -14
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +1 -1
- package/dist/cjs/plugins/selection/index.js +13 -1
- package/dist/cjs/plugins/selection/utils.js +11 -25
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -3
- package/dist/cjs/test-utils.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +0 -6
- package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/expand/commands.js +1 -1
- package/dist/es2019/plugins/expand/index.js +4 -2
- package/dist/es2019/plugins/expand/nodeviews/index.js +24 -19
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +6 -6
- package/dist/es2019/plugins/expand/pm-plugins/main.js +6 -4
- package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/media/toolbar/commands.js +1 -1
- package/dist/es2019/plugins/panel/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +1 -1
- package/dist/es2019/plugins/selection/commands.js +17 -6
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +1 -1
- package/dist/es2019/plugins/selection/index.js +13 -1
- package/dist/es2019/plugins/selection/utils.js +2 -21
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +1 -1
- package/dist/es2019/test-utils.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +0 -6
- package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/expand/commands.js +1 -1
- package/dist/esm/plugins/expand/index.js +6 -2
- package/dist/esm/plugins/expand/nodeviews/index.js +24 -21
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +6 -8
- package/dist/esm/plugins/expand/pm-plugins/main.js +6 -3
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/media/toolbar/commands.js +1 -1
- package/dist/esm/plugins/panel/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +1 -1
- package/dist/esm/plugins/selection/commands.js +18 -6
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +1 -1
- package/dist/esm/plugins/selection/index.js +13 -1
- package/dist/esm/plugins/selection/utils.js +2 -21
- package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +1 -1
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +9 -5
- package/dist/types/plugins/expand/index.d.ts +6 -1
- package/dist/types/plugins/expand/nodeviews/index.d.ts +7 -3
- package/dist/types/plugins/expand/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/plugins/expand/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/panel/pm-plugins/main.d.ts +3 -3
- package/dist/types/plugins/selection/commands.d.ts +4 -2
- package/dist/types/plugins/selection/index.d.ts +5 -2
- package/dist/types/plugins/selection/utils.d.ts +2 -7
- package/dist/types/test-utils.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +9 -5
- package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/nodeviews/index.d.ts +7 -3
- package/dist/types-ts4.5/plugins/expand/pm-plugins/keymap.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/plugins/panel/pm-plugins/main.d.ts +3 -3
- package/dist/types-ts4.5/plugins/selection/commands.d.ts +4 -2
- package/dist/types-ts4.5/plugins/selection/index.d.ts +5 -2
- package/dist/types-ts4.5/plugins/selection/utils.d.ts +2 -7
- package/dist/types-ts4.5/test-utils.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +6 -2
- package/report.api.md +1 -3
- package/tmp/api-report-tmp.d.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.47.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`8cb8dafa05a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cb8dafa05a) - [ED-19774] Removing ../selection imports where possible. selectionPlugin imports still exist until we have an extracted package for selection.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`6a4f206b435`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6a4f206b435) - [ux] MEX-2598 Bug fix: Fixed the bug that caused certain nodes from disappearing when it was located beneath a media group node that got switched to a media inline node. This bug fix ensures that switching from media group to media inline should not affect the surrounding nodes.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 187.46.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`bb4caba1310`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bb4caba1310) - Remove participants count metric from frozen analytics event
|
|
19
|
+
|
|
3
20
|
## 187.46.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -98,13 +98,13 @@ Object.defineProperty(exports, "EventDispatcher", {
|
|
|
98
98
|
Object.defineProperty(exports, "GapCursorSelection", {
|
|
99
99
|
enumerable: true,
|
|
100
100
|
get: function get() {
|
|
101
|
-
return
|
|
101
|
+
return _selection.GapCursorSelection;
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "GapCursorSide", {
|
|
105
105
|
enumerable: true,
|
|
106
106
|
get: function get() {
|
|
107
|
-
return
|
|
107
|
+
return _selection.Side;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "INPUT_METHOD", {
|
|
@@ -469,7 +469,7 @@ var _utils2 = require("@atlaskit/editor-common/utils");
|
|
|
469
469
|
var _createEditor = require("./create-editor");
|
|
470
470
|
var _actions3 = _interopRequireDefault(require("./actions"));
|
|
471
471
|
var _portalProvider = require("@atlaskit/editor-common/portal-provider");
|
|
472
|
-
var
|
|
472
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
473
473
|
var _mobileSelection = require("./plugins/mobile-selection");
|
|
474
474
|
var _commands6 = require("./plugins/expand/commands");
|
|
475
475
|
var _WithPluginState = _interopRequireDefault(require("./ui/WithPluginState"));
|
|
@@ -11,7 +11,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
12
|
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
|
-
var _getParticipantsCount = require("../../collab-edit/get-participants-count");
|
|
15
14
|
var _contextIdentifier = require("./context-identifier");
|
|
16
15
|
var _frozenEditor = require("../utils/frozen-editor");
|
|
17
16
|
var _inputLatencyTracking = _interopRequireDefault(require("../utils/input-latency-tracking"));
|
|
@@ -44,7 +43,6 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEven
|
|
|
44
43
|
freezeTime: time,
|
|
45
44
|
nodeSize: state.doc.nodeSize
|
|
46
45
|
}, nodesCount), {}, {
|
|
47
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(view.state),
|
|
48
46
|
interactionType: interactionType,
|
|
49
47
|
severity: severity
|
|
50
48
|
}),
|
|
@@ -91,7 +89,6 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
91
89
|
time: time,
|
|
92
90
|
nodeSize: state.doc.nodeSize
|
|
93
91
|
}, nodesCount), {}, {
|
|
94
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
95
92
|
objectId: (_getContextIdentifier2 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId,
|
|
96
93
|
severity: shouldTrackSeverity ? severity : undefined
|
|
97
94
|
}),
|
|
@@ -118,7 +115,6 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
118
115
|
}, nodeCount), {}, {
|
|
119
116
|
nodeSize: state.doc.nodeSize,
|
|
120
117
|
severity: shouldTrackSeverity ? severity : undefined,
|
|
121
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
122
118
|
objectId: (_getContextIdentifier3 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId
|
|
123
119
|
}),
|
|
124
120
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
@@ -194,7 +190,6 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
194
190
|
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
|
|
195
191
|
nodeSize: state.doc.nodeSize
|
|
196
192
|
}, nodesCount), {}, {
|
|
197
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
198
193
|
objectId: (_getContextIdentifier4 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
|
|
199
194
|
time: time,
|
|
200
195
|
severity: shouldTrackSeverity ? severity : undefined
|
|
@@ -213,7 +208,6 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
213
208
|
time: time,
|
|
214
209
|
nodeSize: state.doc.nodeSize
|
|
215
210
|
}, nodesCount), {}, {
|
|
216
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
217
211
|
objectId: (_getContextIdentifier5 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier5 === void 0 ? void 0 : _getContextIdentifier5.objectId
|
|
218
212
|
}),
|
|
219
213
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
@@ -9,7 +9,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
9
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
12
|
-
var _selection = require("
|
|
12
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
13
|
function captionKeymap() {
|
|
14
14
|
var list = {};
|
|
15
15
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveDown.common, createNewParagraphBelowCaption, list);
|
|
@@ -10,11 +10,11 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
12
|
var _codeBlock = require("../nodeviews/code-block");
|
|
13
|
-
var
|
|
13
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
14
14
|
var _pluginKey = require("../plugin-key");
|
|
15
15
|
var _actions = require("./actions");
|
|
16
16
|
var _actions2 = require("../actions");
|
|
17
|
-
var
|
|
17
|
+
var _utils2 = require("../utils");
|
|
18
18
|
var _classNames = require("../ui/class-names");
|
|
19
19
|
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
20
|
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; }
|
|
@@ -36,10 +36,10 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
36
36
|
var eventText = keyEvent.data;
|
|
37
37
|
if (_utils.browser.ios && event.composed &&
|
|
38
38
|
// insertParagraph will be the input type when the enter key is pressed.
|
|
39
|
-
eventInputType === 'insertParagraph' && (0,
|
|
39
|
+
eventInputType === 'insertParagraph' && (0, _utils2.findCodeBlock)(view.state, view.state.selection)) {
|
|
40
40
|
event.preventDefault();
|
|
41
41
|
return true;
|
|
42
|
-
} else if (_utils.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0,
|
|
42
|
+
} else if (_utils.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _utils2.findCodeBlock)(view.state, view.state.selection)) {
|
|
43
43
|
var resultingText = event.target.outerText + '\n';
|
|
44
44
|
if (resultingText.endsWith(eventText)) {
|
|
45
45
|
// End of paragraph
|
|
@@ -68,7 +68,7 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
68
68
|
return new _safePlugin.SafePlugin({
|
|
69
69
|
state: {
|
|
70
70
|
init: function init(_, state) {
|
|
71
|
-
var node = (0,
|
|
71
|
+
var node = (0, _utils2.findCodeBlock)(state, state.selection);
|
|
72
72
|
return {
|
|
73
73
|
pos: node ? node.pos : null,
|
|
74
74
|
contentCopied: false,
|
|
@@ -78,7 +78,7 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
78
78
|
},
|
|
79
79
|
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
80
80
|
if (tr.docChanged || tr.selectionSet) {
|
|
81
|
-
var node = (0,
|
|
81
|
+
var node = (0, _utils2.findCodeBlock)(newState, tr.selection);
|
|
82
82
|
var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
83
83
|
pos: node ? node.pos : null,
|
|
84
84
|
isNodeSelected: tr.selection instanceof _state.NodeSelection
|
|
@@ -103,7 +103,7 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
103
103
|
nodeViews: {
|
|
104
104
|
codeBlock: _codeBlock.codeBlockNodeView
|
|
105
105
|
},
|
|
106
|
-
handleClickOn: (0,
|
|
106
|
+
handleClickOn: (0, _selection.createSelectionClickHandler)(['codeBlock'], function (target) {
|
|
107
107
|
return !!(target.closest(".".concat(_classNames.codeBlockClassNames.gutter)) || target.classList.contains(_classNames.codeBlockClassNames.content));
|
|
108
108
|
}, {
|
|
109
109
|
useLongPressSelection: useLongPressSelection
|
|
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
11
11
|
var _analytics = require("../analytics");
|
|
12
|
-
var
|
|
12
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
13
|
var _utils2 = require("./utils");
|
|
14
14
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
15
15
|
var _utils3 = require("@atlaskit/editor-common/utils");
|
|
@@ -85,7 +85,7 @@ var toggleExpandExpanded = function toggleExpandExpanded(pos, nodeType) {
|
|
|
85
85
|
// Move to a right gap cursor, if the toolbar is interacted (or an API),
|
|
86
86
|
// it will insert below rather than inside (which will be invisible).
|
|
87
87
|
if (isExpandedNext === false && (0, _utils2.findExpand)(state)) {
|
|
88
|
-
tr.setSelection(new
|
|
88
|
+
tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), _selection.Side.RIGHT));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// log when people open/close expands
|
|
@@ -24,6 +24,8 @@ var _commands = require("./commands");
|
|
|
24
24
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
25
25
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
26
26
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
27
|
+
// TO-DO: replace with editor-plugin-selection
|
|
28
|
+
|
|
27
29
|
var expandPlugin = function expandPlugin(_ref) {
|
|
28
30
|
var _api$featureFlags;
|
|
29
31
|
var _ref$config = _ref.config,
|
|
@@ -47,11 +49,13 @@ var expandPlugin = function expandPlugin(_ref) {
|
|
|
47
49
|
plugin: function plugin(_ref2) {
|
|
48
50
|
var dispatch = _ref2.dispatch,
|
|
49
51
|
getIntl = _ref2.getIntl;
|
|
50
|
-
return (0, _main.createPlugin)(dispatch, getIntl, options.appearance, options.useLongPressSelection, featureFlags);
|
|
52
|
+
return (0, _main.createPlugin)(dispatch, getIntl, options.appearance, options.useLongPressSelection, featureFlags, api);
|
|
51
53
|
}
|
|
52
54
|
}, {
|
|
53
55
|
name: 'expandKeymap',
|
|
54
|
-
plugin:
|
|
56
|
+
plugin: function plugin() {
|
|
57
|
+
return (0, _keymap.expandKeymap)(api);
|
|
58
|
+
}
|
|
55
59
|
}];
|
|
56
60
|
},
|
|
57
61
|
pluginsOptions: {
|
|
@@ -19,11 +19,8 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
19
19
|
var _utils = require("../../../utils");
|
|
20
20
|
var _commands = require("../commands");
|
|
21
21
|
var _classNames = require("../ui/class-names");
|
|
22
|
-
var
|
|
22
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
23
23
|
var _dom = require("../../../utils/dom");
|
|
24
|
-
var _types = require("../../selection/types");
|
|
25
|
-
var _commands2 = require("../../selection/commands");
|
|
26
|
-
var _pluginFactory = require("../../selection/plugin-factory");
|
|
27
24
|
function buildExpandClassName(type, expanded) {
|
|
28
25
|
return "".concat(_classNames.expandClassNames.prefix, " ").concat(_classNames.expandClassNames.type(type), " ").concat(expanded ? _classNames.expandClassNames.expanded : '');
|
|
29
26
|
}
|
|
@@ -61,7 +58,7 @@ var toDOM = function toDOM(node, intl) {
|
|
|
61
58
|
}, 0]];
|
|
62
59
|
};
|
|
63
60
|
var ExpandNodeView = /*#__PURE__*/function () {
|
|
64
|
-
function ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags) {
|
|
61
|
+
function ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags, selectNearNode, api) {
|
|
65
62
|
var _this = this;
|
|
66
63
|
(0, _classCallCheck2.default)(this, ExpandNodeView);
|
|
67
64
|
(0, _defineProperty2.default)(this, "allowInteractiveExpand", true);
|
|
@@ -71,7 +68,10 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
71
68
|
var _this$view = _this.view,
|
|
72
69
|
state = _this$view.state,
|
|
73
70
|
dispatch = _this$view.dispatch;
|
|
74
|
-
|
|
71
|
+
if (_this.selectNearNode) {
|
|
72
|
+
var _this$api;
|
|
73
|
+
(_this$api = _this.api) === null || _this$api === void 0 ? void 0 : _this$api.core.actions.execute(_this.selectNearNode(_selection.RelativeSelectionPos.Start));
|
|
74
|
+
}
|
|
75
75
|
var pos = _this.getPos();
|
|
76
76
|
if (typeof pos === 'number') {
|
|
77
77
|
(0, _commands.setSelectionInsideExpand)(pos)(state, dispatch, _this.view);
|
|
@@ -244,7 +244,7 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
244
244
|
dispatch = _this$view6.dispatch;
|
|
245
245
|
event.preventDefault();
|
|
246
246
|
_this.view.focus();
|
|
247
|
-
dispatch(state.tr.setSelection(new
|
|
247
|
+
dispatch(state.tr.setSelection(new _selection.GapCursorSelection(state.doc.resolve(_this.node.nodeSize + pos), _selection.Side.RIGHT)));
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
(0, _defineProperty2.default)(this, "setLeftGapCursor", function (event) {
|
|
@@ -264,11 +264,11 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
264
264
|
state = _this$view7.state,
|
|
265
265
|
dispatch = _this$view7.dispatch;
|
|
266
266
|
_this.view.focus();
|
|
267
|
-
dispatch(state.tr.setSelection(new
|
|
267
|
+
dispatch(state.tr.setSelection(new _selection.GapCursorSelection(state.doc.resolve(pos), _selection.Side.LEFT)));
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
270
|
(0, _defineProperty2.default)(this, "handleArrowRightFromTitle", function (event) {
|
|
271
|
-
if (!_this.input) {
|
|
271
|
+
if (!_this.input || !_this.selectNearNode) {
|
|
272
272
|
return;
|
|
273
273
|
}
|
|
274
274
|
var pos = _this.getPos();
|
|
@@ -280,16 +280,15 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
280
280
|
selectionStart = _this$input4.selectionStart,
|
|
281
281
|
selectionEnd = _this$input4.selectionEnd;
|
|
282
282
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
283
|
+
var _this$api2;
|
|
283
284
|
event.preventDefault();
|
|
284
|
-
var
|
|
285
|
-
state = _this$view8.state,
|
|
286
|
-
dispatch = _this$view8.dispatch;
|
|
285
|
+
var state = _this.view.state;
|
|
287
286
|
_this.view.focus();
|
|
288
|
-
(0
|
|
287
|
+
(_this$api2 = _this.api) === null || _this$api2 === void 0 ? void 0 : _this$api2.core.actions.execute(_this.selectNearNode(_selection.RelativeSelectionPos.End, _state.NodeSelection.create(state.doc, pos)));
|
|
289
288
|
}
|
|
290
289
|
});
|
|
291
290
|
(0, _defineProperty2.default)(this, "handleArrowLeftFromTitle", function (event) {
|
|
292
|
-
if (!_this.input) {
|
|
291
|
+
if (!_this.input || !_this.selectNearNode) {
|
|
293
292
|
return;
|
|
294
293
|
}
|
|
295
294
|
var pos = _this.getPos();
|
|
@@ -300,21 +299,23 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
300
299
|
selectionStart = _this$input5.selectionStart,
|
|
301
300
|
selectionEnd = _this$input5.selectionEnd;
|
|
302
301
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
302
|
+
var _this$api3;
|
|
303
303
|
event.preventDefault();
|
|
304
|
-
var
|
|
305
|
-
state = _this$view9.state,
|
|
306
|
-
dispatch = _this$view9.dispatch;
|
|
304
|
+
var state = _this.view.state;
|
|
307
305
|
_this.view.focus();
|
|
308
|
-
|
|
306
|
+
var selectionSharedState = ((_this$api3 = _this.api) === null || _this$api3 === void 0 ? void 0 : _this$api3.selection.sharedState.currentState()) || {};
|
|
309
307
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
310
308
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
311
|
-
if ((0
|
|
312
|
-
|
|
309
|
+
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
310
|
+
var _this$api4;
|
|
311
|
+
(_this$api4 = _this.api) === null || _this$api4 === void 0 ? void 0 : _this$api4.core.actions.execute(_this.selectNearNode(undefined, new _selection.GapCursorSelection(state.doc.resolve(pos), _selection.Side.LEFT)));
|
|
313
312
|
} else {
|
|
314
|
-
|
|
313
|
+
var _this$api5;
|
|
314
|
+
(_this$api5 = _this.api) === null || _this$api5 === void 0 ? void 0 : _this$api5.core.actions.execute(_this.selectNearNode(_selection.RelativeSelectionPos.Start, _state.NodeSelection.create(state.doc, pos)));
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
|
+
this.selectNearNode = selectNearNode;
|
|
318
319
|
this.intl = getIntl();
|
|
319
320
|
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.intl)),
|
|
320
321
|
dom = _DOMSerializer$render.dom,
|
|
@@ -326,6 +327,7 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
326
327
|
this.contentDOM = contentDOM;
|
|
327
328
|
this.isMobile = isMobile;
|
|
328
329
|
this.featureFlags = featureFlags;
|
|
330
|
+
this.api = api;
|
|
329
331
|
this.icon = this.dom.querySelector(".".concat(_classNames.expandClassNames.icon));
|
|
330
332
|
this.input = this.dom.querySelector(".".concat(_classNames.expandClassNames.titleInput));
|
|
331
333
|
this.titleContainer = this.dom.querySelector(".".concat(_classNames.expandClassNames.titleContainer));
|
|
@@ -449,8 +451,9 @@ exports.ExpandNodeView = ExpandNodeView;
|
|
|
449
451
|
function _default(_ref2) {
|
|
450
452
|
var getIntl = _ref2.getIntl,
|
|
451
453
|
isMobile = _ref2.isMobile,
|
|
452
|
-
featureFlags = _ref2.featureFlags
|
|
454
|
+
featureFlags = _ref2.featureFlags,
|
|
455
|
+
api = _ref2.api;
|
|
453
456
|
return function (node, view, getPos) {
|
|
454
|
-
return new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags);
|
|
457
|
+
return new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags, api === null || api === void 0 ? void 0 : api.selection.commands.selectNearNode, api);
|
|
455
458
|
};
|
|
456
459
|
}
|
|
@@ -7,13 +7,11 @@ exports.expandKeymap = expandKeymap;
|
|
|
7
7
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
|
-
var
|
|
10
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
11
11
|
var _utils = require("../utils");
|
|
12
12
|
var _utils2 = require("../../../utils");
|
|
13
13
|
var _classNames = require("../ui/class-names");
|
|
14
14
|
var _commands = require("../commands");
|
|
15
|
-
var _pluginFactory = require("../../selection/plugin-factory");
|
|
16
|
-
var _types = require("../../selection/types");
|
|
17
15
|
var _utils3 = require("@atlaskit/editor-common/utils");
|
|
18
16
|
var isExpandNode = function isExpandNode(node) {
|
|
19
17
|
return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
|
|
@@ -21,16 +19,16 @@ var isExpandNode = function isExpandNode(node) {
|
|
|
21
19
|
var isExpandSelected = function isExpandSelected(selection) {
|
|
22
20
|
return selection instanceof _state.NodeSelection && isExpandNode(selection.node);
|
|
23
21
|
};
|
|
24
|
-
function expandKeymap() {
|
|
22
|
+
function expandKeymap(api) {
|
|
25
23
|
var list = {};
|
|
26
24
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, function (state, dispatch, editorView) {
|
|
27
25
|
if (!editorView) {
|
|
28
26
|
return false;
|
|
29
27
|
}
|
|
30
28
|
var selection = state.selection;
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
if (isExpandSelected(selection) && selectionRelativeToNode ===
|
|
29
|
+
var selectionSharedState = (api === null || api === void 0 ? void 0 : api.selection.sharedState.currentState()) || {};
|
|
30
|
+
var selectionRelativeToNode = selectionSharedState.selectionRelativeToNode;
|
|
31
|
+
if (isExpandSelected(selection) && selectionRelativeToNode === _selection.RelativeSelectionPos.Start) {
|
|
34
32
|
return (0, _commands.focusTitle)(selection.from + 1)(state, dispatch, editorView);
|
|
35
33
|
}
|
|
36
34
|
return false;
|
|
@@ -40,9 +38,9 @@ function expandKeymap() {
|
|
|
40
38
|
return false;
|
|
41
39
|
}
|
|
42
40
|
var selection = state.selection;
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
if (isExpandSelected(selection) && (selectionRelativeToNode === undefined || selectionRelativeToNode ===
|
|
41
|
+
var selectionSharedState = (api === null || api === void 0 ? void 0 : api.selection.sharedState.currentState()) || {};
|
|
42
|
+
var selectionRelativeToNode = selectionSharedState.selectionRelativeToNode;
|
|
43
|
+
if (isExpandSelected(selection) && (selectionRelativeToNode === undefined || selectionRelativeToNode === _selection.RelativeSelectionPos.End)) {
|
|
46
44
|
return (0, _commands.focusTitle)(selection.from + 1)(state, dispatch, editorView);
|
|
47
45
|
}
|
|
48
46
|
return false;
|
|
@@ -76,7 +74,7 @@ function expandKeymap() {
|
|
|
76
74
|
var selection = state.selection,
|
|
77
75
|
schema = state.schema;
|
|
78
76
|
var nodeBefore = selection.$from.nodeBefore;
|
|
79
|
-
if (selection instanceof
|
|
77
|
+
if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && !nodeBefore.attrs.__expanded) {
|
|
80
78
|
var _$from = selection.$from;
|
|
81
79
|
return (0, _commands.focusTitle)(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
|
|
82
80
|
}
|
|
@@ -121,7 +119,7 @@ function expandKeymap() {
|
|
|
121
119
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
122
120
|
var selection = state.selection;
|
|
123
121
|
var nodeAfter = selection.$from.nodeAfter;
|
|
124
|
-
if (selection instanceof
|
|
122
|
+
if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && !nodeAfter.attrs.__expanded) {
|
|
125
123
|
var $from = selection.$from;
|
|
126
124
|
return (0, _commands.focusTitle)($from.pos + 1)(state, dispatch, editorView);
|
|
127
125
|
}
|
|
@@ -8,10 +8,10 @@ exports.containsClass = containsClass;
|
|
|
8
8
|
exports.createPlugin = void 0;
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var
|
|
11
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _nodeviews = _interopRequireDefault(require("../nodeviews"));
|
|
13
13
|
var _commands = require("../commands");
|
|
14
|
-
var
|
|
14
|
+
var _utils2 = require("../utils");
|
|
15
15
|
var _classNames = require("../ui/class-names");
|
|
16
16
|
var _pluginFactory = require("./plugin-factory");
|
|
17
17
|
function containsClass(element, className) {
|
|
@@ -22,6 +22,7 @@ var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
22
22
|
var appearance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'full-page';
|
|
23
23
|
var useLongPressSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
24
24
|
var featureFlags = arguments.length > 4 ? arguments[4] : undefined;
|
|
25
|
+
var api = arguments.length > 5 ? arguments[5] : undefined;
|
|
25
26
|
var state = (0, _pluginFactory.createPluginState)(dispatch, {});
|
|
26
27
|
var isMobile = appearance === 'mobile';
|
|
27
28
|
return new _safePlugin.SafePlugin({
|
|
@@ -32,12 +33,14 @@ var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
32
33
|
expand: (0, _nodeviews.default)({
|
|
33
34
|
getIntl: getIntl,
|
|
34
35
|
isMobile: isMobile,
|
|
35
|
-
featureFlags: featureFlags
|
|
36
|
+
featureFlags: featureFlags,
|
|
37
|
+
api: api
|
|
36
38
|
}),
|
|
37
39
|
nestedExpand: (0, _nodeviews.default)({
|
|
38
40
|
getIntl: getIntl,
|
|
39
41
|
isMobile: isMobile,
|
|
40
|
-
featureFlags: featureFlags
|
|
42
|
+
featureFlags: featureFlags,
|
|
43
|
+
api: api
|
|
41
44
|
})
|
|
42
45
|
},
|
|
43
46
|
handleKeyDown: function handleKeyDown(_view, event) {
|
|
@@ -49,7 +52,7 @@ var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
49
52
|
handleScrollToSelection: function handleScrollToSelection() {
|
|
50
53
|
return containsClass(document.activeElement, _classNames.expandClassNames.titleInput);
|
|
51
54
|
},
|
|
52
|
-
handleClickOn: (0,
|
|
55
|
+
handleClickOn: (0, _selection.createSelectionClickHandler)(['expand', 'nestedExpand'], function (target) {
|
|
53
56
|
return target.classList.contains(_classNames.expandClassNames.prefix);
|
|
54
57
|
}, {
|
|
55
58
|
useLongPressSelection: useLongPressSelection
|
|
@@ -68,7 +71,7 @@ var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
68
71
|
update: function update(view) {
|
|
69
72
|
var state = view.state,
|
|
70
73
|
dispatch = view.dispatch;
|
|
71
|
-
var node = (0,
|
|
74
|
+
var node = (0, _utils2.findExpand)(state);
|
|
72
75
|
if (node) {
|
|
73
76
|
var expandRef = (0, _utils.findDomRefAtPos)(node.pos, domAtPos);
|
|
74
77
|
if ((0, _pluginFactory.getPluginState)(state).expandRef !== expandRef) {
|
|
@@ -31,13 +31,12 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
31
31
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
32
32
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
33
33
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
34
|
-
var _utils2 = require("../../selection/utils");
|
|
35
34
|
var _extension = _interopRequireDefault(require("../nodeviews/extension"));
|
|
36
35
|
var _commands = require("../commands");
|
|
37
|
-
var
|
|
36
|
+
var _utils2 = require("../utils");
|
|
38
37
|
var _pluginFactory = require("../plugin-factory");
|
|
39
38
|
var _pluginKey = require("../plugin-key");
|
|
40
|
-
var
|
|
39
|
+
var _utils3 = require("./utils");
|
|
41
40
|
var shouldShowEditButton = function shouldShowEditButton(extensionHandler, extensionProvider) {
|
|
42
41
|
var usesLegacyMacroBrowser = !extensionHandler && !extensionProvider || typeof extensionHandler === 'function';
|
|
43
42
|
var usesModernUpdateMethod = (0, _typeof2.default)(extensionHandler) === 'object' && typeof extensionHandler.update === 'function';
|
|
@@ -63,7 +62,7 @@ var getUpdateExtensionPromise = /*#__PURE__*/function () {
|
|
|
63
62
|
break;
|
|
64
63
|
}
|
|
65
64
|
_context.next = 7;
|
|
66
|
-
return (0,
|
|
65
|
+
return (0, _utils3.updateEditButton)(view, extensionProvider);
|
|
67
66
|
case 7:
|
|
68
67
|
updateMethod = _context.sent;
|
|
69
68
|
if (!updateMethod) {
|
|
@@ -103,7 +102,7 @@ var createExtensionProviderHandler = function createExtensionProviderHandler(vie
|
|
|
103
102
|
extensionProvider: extensionProvider
|
|
104
103
|
})(view.state, view.dispatch);
|
|
105
104
|
_context2.next = 8;
|
|
106
|
-
return (0,
|
|
105
|
+
return (0, _utils3.updateEditButton)(view, extensionProvider);
|
|
107
106
|
case 8:
|
|
108
107
|
_context2.next = 13;
|
|
109
108
|
break;
|
|
@@ -180,7 +179,7 @@ var handleUpdate = function handleUpdate(_ref4) {
|
|
|
180
179
|
showEditButton = _getPluginState.showEditButton;
|
|
181
180
|
|
|
182
181
|
// This fetches the selected extension node, either by keyboard selection or click for all types of extensions
|
|
183
|
-
var selectedExtension = (0,
|
|
182
|
+
var selectedExtension = (0, _utils2.getSelectedExtension)(state, true);
|
|
184
183
|
if (!selectedExtension) {
|
|
185
184
|
if (showContextPanel) {
|
|
186
185
|
(0, _commands.clearEditingContext)(applyChange)(state, dispatch);
|
|
@@ -188,11 +187,11 @@ var handleUpdate = function handleUpdate(_ref4) {
|
|
|
188
187
|
return;
|
|
189
188
|
}
|
|
190
189
|
var node = selectedExtension.node;
|
|
191
|
-
var newElement = (0,
|
|
190
|
+
var newElement = (0, _utils2.getSelectedDomElement)(state.schema, domAtPos, selectedExtension);
|
|
192
191
|
|
|
193
192
|
// In some cases, showEditButton can be stale and the edit button doesn't show - @see ED-15285
|
|
194
193
|
// To be safe, we update the showEditButton state here
|
|
195
|
-
var shouldUpdateEditButton = !showEditButton && extensionProvider && element === newElement && !(0,
|
|
194
|
+
var shouldUpdateEditButton = !showEditButton && extensionProvider && element === newElement && !(0, _utils2.getSelectedExtension)(prevState, true);
|
|
196
195
|
var isNewNodeSelected = node.attrs.localId ? localId !== node.attrs.localId :
|
|
197
196
|
// This is the current assumption and it's wrong but we are keeping it
|
|
198
197
|
// as fallback in case we need to turn off `allowLocalIdGeneration`
|
|
@@ -316,7 +315,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
316
315
|
// WARNING: referentiality-plugin also creates these nodeviews
|
|
317
316
|
inlineExtension: (0, _extension.default)(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi)
|
|
318
317
|
},
|
|
319
|
-
handleClickOn: (0,
|
|
318
|
+
handleClickOn: (0, _selection.createSelectionClickHandler)(['extension', 'bodiedExtension'], function (target) {
|
|
320
319
|
return !target.closest('.extension-content');
|
|
321
320
|
}, {
|
|
322
321
|
useLongPressSelection: useLongPressSelection
|
|
@@ -12,7 +12,7 @@ var _view = require("@atlaskit/editor-prosemirror/view");
|
|
|
12
12
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
13
13
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
14
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
15
|
-
var
|
|
15
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
16
16
|
var _actions = require("../actions");
|
|
17
17
|
var _pluginKey = require("./plugin-key");
|
|
18
18
|
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; }
|
|
@@ -98,7 +98,7 @@ var _default = function _default(options) {
|
|
|
98
98
|
handleKeyDown: (0, _keymap.keydownHandler)({
|
|
99
99
|
Tab: (0, _utils2.filterCommand)(isWholeSelectionInsideLayoutColumn, moveCursorToNextColumn)
|
|
100
100
|
}),
|
|
101
|
-
handleClickOn: (0,
|
|
101
|
+
handleClickOn: (0, _selection.createSelectionClickHandler)(['layoutColumn'], function (target) {
|
|
102
102
|
return target.hasAttribute('data-layout-section') || target.hasAttribute('data-layout-column');
|
|
103
103
|
}, {
|
|
104
104
|
useLongPressSelection: options.useLongPressSelection || false,
|
|
@@ -80,7 +80,7 @@ var changeMediaCardToInline = function changeMediaCardToInline(editorAnalyticsAP
|
|
|
80
80
|
var node = paragraph.createChecked({}, content);
|
|
81
81
|
var nodePos = state.tr.doc.resolve(state.selection.from).start() - 1;
|
|
82
82
|
var tr = (0, _utils2.removeMediaGroupNode)(state);
|
|
83
|
-
tr = (0, _utils.safeInsert)(node, nodePos,
|
|
83
|
+
tr = (0, _utils.safeInsert)(node, nodePos, false)(tr);
|
|
84
84
|
if (dispatch) {
|
|
85
85
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
86
86
|
action: _analytics2.ACTION.CHANGED_TYPE,
|
|
@@ -8,7 +8,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
8
8
|
var _panel = require("@atlaskit/editor-common/panel");
|
|
9
9
|
var _panel2 = require("../nodeviews/panel");
|
|
10
10
|
var _types = require("../types");
|
|
11
|
-
var
|
|
11
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var createPlugin = function createPlugin(dispatch, providerFactory, pluginOptions) {
|
|
13
13
|
var _pluginOptions$useLon = pluginOptions.useLongPressSelection,
|
|
14
14
|
useLongPressSelection = _pluginOptions$useLon === void 0 ? false : _pluginOptions$useLon;
|
|
@@ -18,7 +18,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, pluginOption
|
|
|
18
18
|
nodeViews: {
|
|
19
19
|
panel: (0, _panel2.getPanelNodeView)(pluginOptions, providerFactory)
|
|
20
20
|
},
|
|
21
|
-
handleClickOn: (0,
|
|
21
|
+
handleClickOn: (0, _selection.createSelectionClickHandler)(['panel'], function (target) {
|
|
22
22
|
return !!target.closest(".".concat(_panel.PanelSharedCssClassName.prefix));
|
|
23
23
|
}, {
|
|
24
24
|
useLongPressSelection: useLongPressSelection
|
|
@@ -34,7 +34,7 @@ var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
|
34
34
|
var _utils3 = require("../../utils");
|
|
35
35
|
var _slice = require("../../utils/slice");
|
|
36
36
|
var _analytics = require("../analytics");
|
|
37
|
-
var
|
|
37
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
38
38
|
var _macro = require("../macro");
|
|
39
39
|
var _mediaSingle = require("../media/utils/media-single");
|
|
40
40
|
var _util = require("./util");
|
|
@@ -579,7 +579,7 @@ function handleMediaSingle(inputMethod, editorAnalyticsAPI) {
|
|
|
579
579
|
var tr = state.tr.replaceSelection(slice);
|
|
580
580
|
var nextPos = tr.doc.resolve(tr.mapping.map(state.selection.$from.pos));
|
|
581
581
|
if (dispatch) {
|
|
582
|
-
dispatch(tr.setSelection(new
|
|
582
|
+
dispatch(tr.setSelection(new _selection.GapCursorSelection(nextPos, _selection.Side.RIGHT)));
|
|
583
583
|
}
|
|
584
584
|
return true;
|
|
585
585
|
}
|
|
@@ -852,7 +852,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
852
852
|
var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : (_slice$content$lastCh2 = _slice$content$lastCh.type) === null || _slice$content$lastCh2 === void 0 ? void 0 : _slice$content$lastCh2.name) || '');
|
|
853
853
|
if ((0, _utils3.insideTableCell)(state) && shouldUpdateCursorPosAfterPaste) {
|
|
854
854
|
var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
855
|
-
tr.setSelection(new
|
|
855
|
+
tr.setSelection(new _selection.GapCursorSelection(nextPos, _selection.Side.RIGHT));
|
|
856
856
|
}
|
|
857
857
|
} else {
|
|
858
858
|
// need to scan the slice if there's a block node or list items inside it
|