@atlaskit/editor-plugin-block-controls 3.8.6 → 3.8.8
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 +16 -0
- package/dist/cjs/blockControlsPlugin.js +17 -10
- package/dist/cjs/editor-commands/move-node.js +10 -18
- package/dist/cjs/pm-plugins/first-node-dec-plugin.js +0 -1
- package/dist/cjs/pm-plugins/interaction-tracking/commands.js +17 -0
- package/dist/cjs/pm-plugins/interaction-tracking/handle-key-down.js +32 -0
- package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +16 -0
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +46 -0
- package/dist/cjs/pm-plugins/utils/validation.js +29 -19
- package/dist/cjs/ui/quick-insert-button.js +32 -12
- package/dist/cjs/ui/visibility-container.js +4 -3
- package/dist/es2019/blockControlsPlugin.js +18 -8
- package/dist/es2019/editor-commands/move-node.js +10 -18
- package/dist/es2019/pm-plugins/first-node-dec-plugin.js +0 -1
- package/dist/es2019/pm-plugins/interaction-tracking/commands.js +11 -0
- package/dist/es2019/pm-plugins/interaction-tracking/handle-key-down.js +26 -0
- package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +10 -0
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +40 -0
- package/dist/es2019/pm-plugins/utils/validation.js +29 -21
- package/dist/es2019/ui/quick-insert-button.js +23 -2
- package/dist/es2019/ui/visibility-container.js +4 -3
- package/dist/esm/blockControlsPlugin.js +17 -10
- package/dist/esm/editor-commands/move-node.js +10 -18
- package/dist/esm/pm-plugins/first-node-dec-plugin.js +0 -1
- package/dist/esm/pm-plugins/interaction-tracking/commands.js +11 -0
- package/dist/esm/pm-plugins/interaction-tracking/handle-key-down.js +26 -0
- package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +10 -0
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +40 -0
- package/dist/esm/pm-plugins/utils/validation.js +29 -19
- package/dist/esm/ui/quick-insert-button.js +32 -12
- package/dist/esm/ui/visibility-container.js +4 -3
- package/dist/types/blockControlsPluginType.d.ts +1 -0
- package/dist/types/pm-plugins/interaction-tracking/commands.d.ts +3 -0
- package/dist/types/pm-plugins/interaction-tracking/handle-key-down.d.ts +2 -0
- package/dist/types/pm-plugins/interaction-tracking/handle-mouse-move.d.ts +2 -0
- package/dist/types/pm-plugins/interaction-tracking/pm-plugin.d.ts +12 -0
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/interaction-tracking/commands.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-key-down.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-mouse-move.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/interaction-tracking/pm-plugin.d.ts +12 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.8.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#138622](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138622)
|
|
8
|
+
[`09f425c925d38`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/09f425c925d38) -
|
|
9
|
+
Add support for quick insert in cell selection
|
|
10
|
+
|
|
11
|
+
## 3.8.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#138396](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138396)
|
|
16
|
+
[`6a11423e1442f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6a11423e1442f) -
|
|
17
|
+
Add new plugin which tracks user typing, add typing check to visibility container of widgets
|
|
18
|
+
|
|
3
19
|
## 3.8.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.blockControlsPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
9
|
var _react = _interopRequireDefault(require("react"));
|
|
11
10
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -15,6 +14,7 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
|
15
14
|
var _moveNode = require("./editor-commands/move-node");
|
|
16
15
|
var _moveToLayout = require("./editor-commands/move-to-layout");
|
|
17
16
|
var _firstNodeDecPlugin = require("./pm-plugins/first-node-dec-plugin");
|
|
17
|
+
var _pmPlugin = require("./pm-plugins/interaction-tracking/pm-plugin");
|
|
18
18
|
var _main = require("./pm-plugins/main");
|
|
19
19
|
var _getSelection = require("./pm-plugins/utils/getSelection");
|
|
20
20
|
var _blockMenu = _interopRequireDefault(require("./ui/block-menu"));
|
|
@@ -27,7 +27,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
27
27
|
return {
|
|
28
28
|
name: 'blockControls',
|
|
29
29
|
pmPlugins: function pmPlugins() {
|
|
30
|
-
var
|
|
30
|
+
var pmPlugins = [{
|
|
31
31
|
name: 'blockControlsPmPlugin',
|
|
32
32
|
plugin: function plugin(_ref2) {
|
|
33
33
|
var getIntl = _ref2.getIntl,
|
|
@@ -35,13 +35,19 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
35
35
|
return (0, _main.createPlugin)(api, getIntl, nodeViewPortalProviderAPI);
|
|
36
36
|
}
|
|
37
37
|
}];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
39
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility')) {
|
|
40
|
+
pmPlugins.push({
|
|
41
|
+
name: 'blockControlsInteractionTrackingPlugin',
|
|
42
|
+
plugin: _pmPlugin.createInteractionTrackingPlugin
|
|
43
|
+
});
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
pmPlugins.push({
|
|
46
|
+
name: 'firstNodeDec',
|
|
47
|
+
plugin: _firstNodeDecPlugin.firstNodeDecPlugin
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return pmPlugins;
|
|
45
51
|
},
|
|
46
52
|
commands: {
|
|
47
53
|
moveNode: (0, _moveNode.moveNode)(api),
|
|
@@ -161,7 +167,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
161
167
|
}
|
|
162
168
|
},
|
|
163
169
|
getSharedState: function getSharedState(editorState) {
|
|
164
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$activeN, _key$getState3, _key$getState$isDragg, _key$getState4, _key$getState$isPMDra, _key$getState5, _key$getState$multiSe, _key$getState6, _key$getState$isShift, _key$getState7, _key$getState$lastDra, _key$getState8;
|
|
170
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$activeN, _key$getState3, _key$getState$isDragg, _key$getState4, _key$getState$isPMDra, _key$getState5, _key$getState$multiSe, _key$getState6, _key$getState$isShift, _key$getState7, _key$getState$lastDra, _key$getState8, _interactionTrackingP;
|
|
165
171
|
if (!editorState) {
|
|
166
172
|
return undefined;
|
|
167
173
|
}
|
|
@@ -173,7 +179,8 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
173
179
|
isPMDragging: (_key$getState$isPMDra = (_key$getState5 = _main.key.getState(editorState)) === null || _key$getState5 === void 0 ? void 0 : _key$getState5.isPMDragging) !== null && _key$getState$isPMDra !== void 0 ? _key$getState$isPMDra : false,
|
|
174
180
|
multiSelectDnD: (_key$getState$multiSe = (_key$getState6 = _main.key.getState(editorState)) === null || _key$getState6 === void 0 ? void 0 : _key$getState6.multiSelectDnD) !== null && _key$getState$multiSe !== void 0 ? _key$getState$multiSe : undefined,
|
|
175
181
|
isShiftDown: (_key$getState$isShift = (_key$getState7 = _main.key.getState(editorState)) === null || _key$getState7 === void 0 ? void 0 : _key$getState7.isShiftDown) !== null && _key$getState$isShift !== void 0 ? _key$getState$isShift : undefined,
|
|
176
|
-
lastDragCancelled: (_key$getState$lastDra = (_key$getState8 = _main.key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false
|
|
182
|
+
lastDragCancelled: (_key$getState$lastDra = (_key$getState8 = _main.key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false,
|
|
183
|
+
isEditing: (_interactionTrackingP = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing
|
|
177
184
|
};
|
|
178
185
|
},
|
|
179
186
|
contentComponent: function contentComponent(_ref7) {
|
|
@@ -84,17 +84,13 @@ function transformSourceSlice(nodeCopy, destType) {
|
|
|
84
84
|
}
|
|
85
85
|
return nodeCopy;
|
|
86
86
|
}
|
|
87
|
-
var
|
|
87
|
+
var nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', 'expand', 'nestedExpand'];
|
|
88
|
+
var isDragLayoutColumnIntoSupportedNodes = function isDragLayoutColumnIntoSupportedNodes($from, $to) {
|
|
88
89
|
var _$from$nodeAfter;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
return ((_$from$nodeAfter2 = $from.nodeAfter) === null || _$from$nodeAfter2 === void 0 ? void 0 : _$from$nodeAfter2.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && ($to.parent.type.name === 'tableCell' || $to.parent.type.name === 'tableHeader');
|
|
94
|
-
};
|
|
95
|
-
var isDragLayoutColumnIntoPanel = function isDragLayoutColumnIntoPanel($from, $to) {
|
|
96
|
-
var _$from$nodeAfter3;
|
|
97
|
-
return ((_$from$nodeAfter3 = $from.nodeAfter) === null || _$from$nodeAfter3 === void 0 ? void 0 : _$from$nodeAfter3.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && $to.parent.type.name === 'panel';
|
|
90
|
+
var isTopLevel = $to.depth === 0;
|
|
91
|
+
var isDragIntoNodes = nodesSupportDragLayoutColumnInto.includes($to.parent.type.name);
|
|
92
|
+
var supportedCondition = (0, _platformFeatureFlags.fg)('platform_editor_drag_layout_column_into_nodes') ? isDragIntoNodes || isTopLevel : isTopLevel;
|
|
93
|
+
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && supportedCondition;
|
|
98
94
|
};
|
|
99
95
|
|
|
100
96
|
/**
|
|
@@ -383,19 +379,15 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
383
379
|
var destType = $to.node().type;
|
|
384
380
|
var destParent = $to.node($to.depth);
|
|
385
381
|
var sourceNode = $handlePos.nodeAfter;
|
|
386
|
-
var dragLayoutColumnToTopLevel = isDragLayoutColumnToTopLevel($handlePos, $to);
|
|
387
|
-
var dragLayoutColumnIntoTable = isDragLayoutColumnIntoTable($handlePos, $to);
|
|
388
|
-
var dragLayoutColumnIntoPanel = isDragLayoutColumnIntoPanel($handlePos, $to);
|
|
389
382
|
|
|
390
383
|
//TODO: ED-26959 - Does this need to be updated with new selection logic above? ^
|
|
391
|
-
// Move a layout column to top level
|
|
392
|
-
|
|
393
|
-
// Move a layout column into a panel, only moves the content into the panel
|
|
394
|
-
if (sourceNode && (dragLayoutColumnToTopLevel || dragLayoutColumnIntoTable || dragLayoutColumnIntoPanel)) {
|
|
384
|
+
// Move a layout column to top level, or table cell, or panel, or expand, only moves the content into them
|
|
385
|
+
if (sourceNode && isDragLayoutColumnIntoSupportedNodes($handlePos, $to)) {
|
|
395
386
|
// need update after we support single column layout.
|
|
396
387
|
var layoutColumnContent = sourceNode.content;
|
|
397
388
|
var fragment;
|
|
398
|
-
if
|
|
389
|
+
// if drop into table, and layout column contains expand, transform it to nestedExpand
|
|
390
|
+
if (['tableCell', 'tableHeader'].includes($to.parent.type.name)) {
|
|
399
391
|
var contentContainsExpand = (0, _utils2.findChildrenByType)(sourceNode, expand).length > 0;
|
|
400
392
|
fragment = contentContainsExpand ? (0, _validation.transformFragmentExpandToNestedExpand)(_model.Fragment.from(layoutColumnContent)) : _model.Fragment.from(layoutColumnContent);
|
|
401
393
|
if (!fragment) {
|
|
@@ -10,7 +10,6 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
11
|
var firstNodeDecPluginKey = exports.firstNodeDecPluginKey = new _state.PluginKey('firstNodeDec');
|
|
12
12
|
var createFirstNodeDecSet = function createFirstNodeDecSet(state) {
|
|
13
|
-
;
|
|
14
13
|
var firstNode = state.doc.firstChild;
|
|
15
14
|
if (!firstNode) {
|
|
16
15
|
return _view.DecorationSet.empty;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stopEditing = exports.startEditing = void 0;
|
|
7
|
+
var _pmPlugin = require("./pm-plugin");
|
|
8
|
+
var stopEditing = exports.stopEditing = function stopEditing(view) {
|
|
9
|
+
view.dispatch(view.state.tr.setMeta(_pmPlugin.interactionTrackingPluginKey, {
|
|
10
|
+
type: 'stopEditing'
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
var startEditing = exports.startEditing = function startEditing(view) {
|
|
14
|
+
view.dispatch(view.state.tr.setMeta(_pmPlugin.interactionTrackingPluginKey, {
|
|
15
|
+
type: 'startEditing'
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleKeyDown = void 0;
|
|
7
|
+
var _commands = require("./commands");
|
|
8
|
+
var _pmPlugin = require("./pm-plugin");
|
|
9
|
+
var handleKeyDown = exports.handleKeyDown = function handleKeyDown(view, event) {
|
|
10
|
+
// Check if this is a keyboard shortcut (Ctrl/Cmd + key)
|
|
11
|
+
var isShortcut = event.ctrlKey || event.metaKey || event.altKey;
|
|
12
|
+
if (isShortcut) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Only consider actual typing keys (not shortcuts)
|
|
17
|
+
// We need to check if it's a single character key or a deletion key
|
|
18
|
+
// and ensure it's not part of a shortcut
|
|
19
|
+
var isTypingKey =
|
|
20
|
+
// Single character keys (letters, numbers, symbols)
|
|
21
|
+
event.key.length === 1 || event.key === 'Backspace' || event.key === 'Delete' || event.key === ' ' || event.key === 'Enter';
|
|
22
|
+
if (!isTypingKey) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
var state = (0, _pmPlugin.getInteractionTrackingState)(view.state);
|
|
26
|
+
|
|
27
|
+
// if user hasnt started typing yet, start timer
|
|
28
|
+
if (!(state !== null && state !== void 0 && state.isEditing)) {
|
|
29
|
+
(0, _commands.startEditing)(view);
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleMouseMove = void 0;
|
|
7
|
+
var _commands = require("./commands");
|
|
8
|
+
var _pmPlugin = require("./pm-plugin");
|
|
9
|
+
var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view) {
|
|
10
|
+
var state = (0, _pmPlugin.getInteractionTrackingState)(view.state);
|
|
11
|
+
// if user has stopped editing and moved their mouse, show block controls again
|
|
12
|
+
if (state !== null && state !== void 0 && state.isEditing) {
|
|
13
|
+
(0, _commands.stopEditing)(view);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.interactionTrackingPluginKey = exports.getInteractionTrackingState = exports.createInteractionTrackingPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var _handleKeyDown = require("./handle-key-down");
|
|
10
|
+
var _handleMouseMove = require("./handle-mouse-move");
|
|
11
|
+
var interactionTrackingPluginKey = exports.interactionTrackingPluginKey = new _state.PluginKey('interactionTrackingPlugin');
|
|
12
|
+
var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin = function createInteractionTrackingPlugin() {
|
|
13
|
+
return new _safePlugin.SafePlugin({
|
|
14
|
+
key: interactionTrackingPluginKey,
|
|
15
|
+
state: {
|
|
16
|
+
init: function init() {
|
|
17
|
+
return {
|
|
18
|
+
isEditing: false
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
apply: function apply(tr, pluginState) {
|
|
22
|
+
var meta = tr.getMeta(interactionTrackingPluginKey);
|
|
23
|
+
switch (meta === null || meta === void 0 ? void 0 : meta.type) {
|
|
24
|
+
case 'startEditing':
|
|
25
|
+
return {
|
|
26
|
+
isEditing: true
|
|
27
|
+
};
|
|
28
|
+
case 'stopEditing':
|
|
29
|
+
return {
|
|
30
|
+
isEditing: false
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return pluginState;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
props: {
|
|
37
|
+
handleKeyDown: _handleKeyDown.handleKeyDown,
|
|
38
|
+
handleDOMEvents: {
|
|
39
|
+
mousemove: _handleMouseMove.handleMouseMove
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var getInteractionTrackingState = exports.getInteractionTrackingState = function getInteractionTrackingState(state) {
|
|
45
|
+
return interactionTrackingPluginKey.getState(state);
|
|
46
|
+
};
|
|
@@ -90,8 +90,8 @@ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNes
|
|
|
90
90
|
});
|
|
91
91
|
var canCreateNodeWithContentInsideAnotherNode = exports.canCreateNodeWithContentInsideAnotherNode = function canCreateNodeWithContentInsideAnotherNode(nodeTypesToCreate, nodeWithTargetFragment) {
|
|
92
92
|
try {
|
|
93
|
-
return !!nodeTypesToCreate.every(function (
|
|
94
|
-
return
|
|
93
|
+
return !!nodeTypesToCreate.every(function (nodeTypeToCreate) {
|
|
94
|
+
return nodeTypeToCreate.createChecked({}, nodeWithTargetFragment);
|
|
95
95
|
});
|
|
96
96
|
} catch (e) {
|
|
97
97
|
return false;
|
|
@@ -100,24 +100,29 @@ var canCreateNodeWithContentInsideAnotherNode = exports.canCreateNodeWithContent
|
|
|
100
100
|
function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
101
101
|
var srcNodeType = srcNode.type;
|
|
102
102
|
var schema = srcNodeType.schema;
|
|
103
|
-
var
|
|
104
|
-
|
|
103
|
+
var _schema$nodes = schema.nodes,
|
|
104
|
+
table = _schema$nodes.table,
|
|
105
|
+
tableCell = _schema$nodes.tableCell,
|
|
106
|
+
tableHeader = _schema$nodes.tableHeader,
|
|
107
|
+
expand = _schema$nodes.expand,
|
|
108
|
+
nestedExpand = _schema$nodes.nestedExpand,
|
|
109
|
+
doc = _schema$nodes.doc,
|
|
110
|
+
panel = _schema$nodes.panel,
|
|
111
|
+
layoutColumn = _schema$nodes.layoutColumn,
|
|
112
|
+
layoutSection = _schema$nodes.layoutSection;
|
|
113
|
+
var destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type;
|
|
114
|
+
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type;
|
|
105
115
|
var layoutColumnContent = srcNode.content;
|
|
106
116
|
var isNestingTablesSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
|
|
107
117
|
exposure: true
|
|
108
118
|
});
|
|
109
|
-
|
|
110
|
-
if (activeNodeType === 'layoutColumn' && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
119
|
+
if (activeNodeType === layoutColumn && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
111
120
|
// Allow drag layout column and drop into layout section
|
|
112
|
-
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type
|
|
121
|
+
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type) === layoutSection || destParentNodeType === doc) {
|
|
113
122
|
return true;
|
|
114
123
|
}
|
|
115
124
|
if ((0, _platformFeatureFlags.fg)('platform_editor_drag_layout_column_into_nodes')) {
|
|
116
|
-
if (destParentNodeType ===
|
|
117
|
-
var _schema$nodes = schema.nodes,
|
|
118
|
-
tableCell = _schema$nodes.tableCell,
|
|
119
|
-
tableHeader = _schema$nodes.tableHeader,
|
|
120
|
-
expand = _schema$nodes.expand;
|
|
125
|
+
if (destParentNodeType === tableCell || destParentNodeType === tableHeader) {
|
|
121
126
|
var contentContainsExpand = (0, _utils.findChildrenByType)(srcNode, expand).length > 0;
|
|
122
127
|
//convert expand to nestedExpand if there are expands inside the layout column
|
|
123
128
|
// otherwise, the createChecked will fail as expand is not a valid child of tableCell/tableHeader, but nestedExpand is
|
|
@@ -127,36 +132,41 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos,
|
|
|
127
132
|
}
|
|
128
133
|
return canCreateNodeWithContentInsideAnotherNode([tableCell, tableHeader], convertedFragment);
|
|
129
134
|
}
|
|
130
|
-
if (destParentNodeType ===
|
|
131
|
-
var panel = schema.nodes.panel;
|
|
135
|
+
if (destParentNodeType === panel) {
|
|
132
136
|
return canCreateNodeWithContentInsideAnotherNode([panel], layoutColumnContent);
|
|
133
137
|
}
|
|
138
|
+
if (destParentNodeType === expand) {
|
|
139
|
+
return canCreateNodeWithContentInsideAnotherNode([expand], layoutColumnContent);
|
|
140
|
+
}
|
|
141
|
+
if (destParentNodeType === nestedExpand) {
|
|
142
|
+
return canCreateNodeWithContentInsideAnotherNode([nestedExpand], layoutColumnContent);
|
|
143
|
+
}
|
|
134
144
|
}
|
|
135
145
|
}
|
|
136
146
|
|
|
137
147
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
138
148
|
if ((0, _experiments.editorExperiment)('nested-expand-in-expand', false)) {
|
|
139
|
-
if (destParentNodeType ===
|
|
149
|
+
if (destParentNodeType === expand && (activeNodeType === expand || activeNodeType === nestedExpand)) {
|
|
140
150
|
return false;
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
// NOTE: this will block drop targets from showing for dragging a table into another table
|
|
145
155
|
// unless nested tables are supported and the nesting depth does not exceed 1
|
|
146
|
-
if ((destParentNodeType ===
|
|
147
|
-
var nestingDepth = (0, _nesting.getParentOfTypeCount)(
|
|
156
|
+
if ((destParentNodeType === tableCell || destParentNodeType === tableHeader) && activeNodeType === table) {
|
|
157
|
+
var nestingDepth = (0, _nesting.getParentOfTypeCount)(table)($destNodePos);
|
|
148
158
|
if (!isNestingTablesSupported || isNestingTablesSupported && nestingDepth > 1) {
|
|
149
159
|
return false;
|
|
150
160
|
}
|
|
151
161
|
}
|
|
152
162
|
if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
|
|
153
163
|
if (memoizedTransformExpandToNestedExpand(srcNode)) {
|
|
154
|
-
srcNodeType =
|
|
164
|
+
srcNodeType = nestedExpand;
|
|
155
165
|
} else {
|
|
156
166
|
return false;
|
|
157
167
|
}
|
|
158
168
|
} else if ((isDoc(destParent.type) || isLayoutColumn(destParent.type)) && isNestedExpand(srcNodeType)) {
|
|
159
|
-
srcNodeType =
|
|
169
|
+
srcNodeType = expand;
|
|
160
170
|
}
|
|
161
171
|
return destParent.canReplaceWith(indexIntoParent, indexIntoParent, srcNodeType);
|
|
162
172
|
}
|
|
@@ -15,6 +15,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
15
15
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
16
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
18
|
+
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
18
19
|
var _add = _interopRequireDefault(require("@atlaskit/icon/utility/add"));
|
|
19
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _primitives = require("@atlaskit/primitives");
|
|
@@ -206,10 +207,11 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
206
207
|
if (start !== undefined) {
|
|
207
208
|
// if the selection is not within the node this decoration is rendered at
|
|
208
209
|
// or the node is non-editable, then insert a newline and trigger quick insert
|
|
209
|
-
|
|
210
|
+
var isSelectionInsideNode = (0, _documentChecks.isSelectionInNode)(start, view);
|
|
211
|
+
if (!isSelectionInsideNode || (0, _documentChecks.isNonEditableBlock)(start, view)) {
|
|
210
212
|
api.core.actions.execute((0, _editorCommands.createNewLine)(start));
|
|
211
213
|
}
|
|
212
|
-
if (
|
|
214
|
+
if (isSelectionInsideNode) {
|
|
213
215
|
// text or element with be deselected and the / added immediately after the paragraph
|
|
214
216
|
// unless the selection is empty
|
|
215
217
|
var currentSelection = view.state.selection;
|
|
@@ -246,6 +248,24 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
246
248
|
});
|
|
247
249
|
}
|
|
248
250
|
}
|
|
251
|
+
if (currentSelection instanceof _cellSelection.CellSelection && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4')) {
|
|
252
|
+
// find the last inline position in the selection
|
|
253
|
+
var lastInlinePosition = _state.TextSelection.near(view.state.selection.$to, -1);
|
|
254
|
+
lastInlinePosition && api.core.actions.execute(function (_ref4) {
|
|
255
|
+
var tr = _ref4.tr;
|
|
256
|
+
if (!(lastInlinePosition instanceof _state.TextSelection)) {
|
|
257
|
+
// this will create a new line after the node
|
|
258
|
+
(0, _editorCommands.createNewLine)(lastInlinePosition.from)({
|
|
259
|
+
tr: tr
|
|
260
|
+
});
|
|
261
|
+
// this will find the next valid text position after the node
|
|
262
|
+
tr.setSelection(_state.TextSelection.create(tr.doc, lastInlinePosition.to));
|
|
263
|
+
} else {
|
|
264
|
+
tr.setSelection(lastInlinePosition);
|
|
265
|
+
}
|
|
266
|
+
return tr;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
249
269
|
}
|
|
250
270
|
}
|
|
251
271
|
(_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.actions.openTypeAhead('blockControl', true);
|
|
@@ -293,16 +313,16 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
293
313
|
xcss: [tooltipContainerStyles]
|
|
294
314
|
}, tooltipPressable()) : tooltipPressable());
|
|
295
315
|
};
|
|
296
|
-
var QuickInsertWithVisibility = exports.QuickInsertWithVisibility = function QuickInsertWithVisibility(
|
|
297
|
-
var view =
|
|
298
|
-
api =
|
|
299
|
-
formatMessage =
|
|
300
|
-
getPos =
|
|
301
|
-
nodeType =
|
|
302
|
-
anchorName =
|
|
303
|
-
rootAnchorName =
|
|
304
|
-
rootNodeType =
|
|
305
|
-
anchorRectCache =
|
|
316
|
+
var QuickInsertWithVisibility = exports.QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref5) {
|
|
317
|
+
var view = _ref5.view,
|
|
318
|
+
api = _ref5.api,
|
|
319
|
+
formatMessage = _ref5.formatMessage,
|
|
320
|
+
getPos = _ref5.getPos,
|
|
321
|
+
nodeType = _ref5.nodeType,
|
|
322
|
+
anchorName = _ref5.anchorName,
|
|
323
|
+
rootAnchorName = _ref5.rootAnchorName,
|
|
324
|
+
rootNodeType = _ref5.rootNodeType,
|
|
325
|
+
anchorRectCache = _ref5.anchorRectCache;
|
|
306
326
|
return /*#__PURE__*/_react.default.createElement(_visibilityContainer.VisibilityContainer, {
|
|
307
327
|
api: api
|
|
308
328
|
}, /*#__PURE__*/_react.default.createElement(TypeAheadControl, {
|
|
@@ -17,14 +17,15 @@ var visibleStyles = (0, _primitives.xcss)({
|
|
|
17
17
|
});
|
|
18
18
|
var hiddenStyles = (0, _primitives.xcss)({
|
|
19
19
|
opacity: 0,
|
|
20
|
-
// CONFIRM this change doesnt cause this issue to regress https://product-fabric.atlassian.net/browse/ED-24136
|
|
21
20
|
visibility: 'hidden'
|
|
22
21
|
});
|
|
23
22
|
var VisibilityContainer = exports.VisibilityContainer = function VisibilityContainer(_ref) {
|
|
24
23
|
var api = _ref.api,
|
|
25
24
|
children = _ref.children;
|
|
26
|
-
var
|
|
25
|
+
var isTypeAheadOpen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'typeAhead.isOpen');
|
|
26
|
+
var isEditing = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isEditing');
|
|
27
|
+
var shouldHide = isTypeAheadOpen || isEditing;
|
|
27
28
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
28
|
-
xcss: [baseStyles,
|
|
29
|
+
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
|
|
29
30
|
}, children);
|
|
30
31
|
};
|
|
@@ -6,6 +6,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
6
6
|
import { moveNode } from './editor-commands/move-node';
|
|
7
7
|
import { moveToLayout } from './editor-commands/move-to-layout';
|
|
8
8
|
import { firstNodeDecPlugin } from './pm-plugins/first-node-dec-plugin';
|
|
9
|
+
import { createInteractionTrackingPlugin, interactionTrackingPluginKey } from './pm-plugins/interaction-tracking/pm-plugin';
|
|
9
10
|
import { createPlugin, key } from './pm-plugins/main';
|
|
10
11
|
import { selectNode } from './pm-plugins/utils/getSelection';
|
|
11
12
|
import BlockMenu from './ui/block-menu';
|
|
@@ -16,18 +17,26 @@ export const blockControlsPlugin = ({
|
|
|
16
17
|
}) => ({
|
|
17
18
|
name: 'blockControls',
|
|
18
19
|
pmPlugins() {
|
|
19
|
-
const
|
|
20
|
+
const pmPlugins = [{
|
|
20
21
|
name: 'blockControlsPmPlugin',
|
|
21
22
|
plugin: ({
|
|
22
23
|
getIntl,
|
|
23
24
|
nodeViewPortalProviderAPI
|
|
24
25
|
}) => createPlugin(api, getIntl, nodeViewPortalProviderAPI)
|
|
25
26
|
}];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
28
|
+
if (fg('platform_editor_controls_widget_visibility')) {
|
|
29
|
+
pmPlugins.push({
|
|
30
|
+
name: 'blockControlsInteractionTrackingPlugin',
|
|
31
|
+
plugin: createInteractionTrackingPlugin
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
pmPlugins.push({
|
|
35
|
+
name: 'firstNodeDec',
|
|
36
|
+
plugin: firstNodeDecPlugin
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return pmPlugins;
|
|
31
40
|
},
|
|
32
41
|
commands: {
|
|
33
42
|
moveNode: moveNode(api),
|
|
@@ -149,7 +158,7 @@ export const blockControlsPlugin = ({
|
|
|
149
158
|
}
|
|
150
159
|
},
|
|
151
160
|
getSharedState(editorState) {
|
|
152
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$activeN, _key$getState3, _key$getState$isDragg, _key$getState4, _key$getState$isPMDra, _key$getState5, _key$getState$multiSe, _key$getState6, _key$getState$isShift, _key$getState7, _key$getState$lastDra, _key$getState8;
|
|
161
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$activeN, _key$getState3, _key$getState$isDragg, _key$getState4, _key$getState$isPMDra, _key$getState5, _key$getState$multiSe, _key$getState6, _key$getState$isShift, _key$getState7, _key$getState$lastDra, _key$getState8, _interactionTrackingP;
|
|
153
162
|
if (!editorState) {
|
|
154
163
|
return undefined;
|
|
155
164
|
}
|
|
@@ -161,7 +170,8 @@ export const blockControlsPlugin = ({
|
|
|
161
170
|
isPMDragging: (_key$getState$isPMDra = (_key$getState5 = key.getState(editorState)) === null || _key$getState5 === void 0 ? void 0 : _key$getState5.isPMDragging) !== null && _key$getState$isPMDra !== void 0 ? _key$getState$isPMDra : false,
|
|
162
171
|
multiSelectDnD: (_key$getState$multiSe = (_key$getState6 = key.getState(editorState)) === null || _key$getState6 === void 0 ? void 0 : _key$getState6.multiSelectDnD) !== null && _key$getState$multiSe !== void 0 ? _key$getState$multiSe : undefined,
|
|
163
172
|
isShiftDown: (_key$getState$isShift = (_key$getState7 = key.getState(editorState)) === null || _key$getState7 === void 0 ? void 0 : _key$getState7.isShiftDown) !== null && _key$getState$isShift !== void 0 ? _key$getState$isShift : undefined,
|
|
164
|
-
lastDragCancelled: (_key$getState$lastDra = (_key$getState8 = key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false
|
|
173
|
+
lastDragCancelled: (_key$getState$lastDra = (_key$getState8 = key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false,
|
|
174
|
+
isEditing: (_interactionTrackingP = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing
|
|
165
175
|
};
|
|
166
176
|
},
|
|
167
177
|
contentComponent({
|
|
@@ -77,17 +77,13 @@ function transformSourceSlice(nodeCopy, destType) {
|
|
|
77
77
|
}
|
|
78
78
|
return nodeCopy;
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', 'expand', 'nestedExpand'];
|
|
81
|
+
const isDragLayoutColumnIntoSupportedNodes = ($from, $to) => {
|
|
81
82
|
var _$from$nodeAfter;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
return ((_$from$nodeAfter2 = $from.nodeAfter) === null || _$from$nodeAfter2 === void 0 ? void 0 : _$from$nodeAfter2.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && ($to.parent.type.name === 'tableCell' || $to.parent.type.name === 'tableHeader');
|
|
87
|
-
};
|
|
88
|
-
const isDragLayoutColumnIntoPanel = ($from, $to) => {
|
|
89
|
-
var _$from$nodeAfter3;
|
|
90
|
-
return ((_$from$nodeAfter3 = $from.nodeAfter) === null || _$from$nodeAfter3 === void 0 ? void 0 : _$from$nodeAfter3.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && $to.parent.type.name === 'panel';
|
|
83
|
+
const isTopLevel = $to.depth === 0;
|
|
84
|
+
const isDragIntoNodes = nodesSupportDragLayoutColumnInto.includes($to.parent.type.name);
|
|
85
|
+
const supportedCondition = fg('platform_editor_drag_layout_column_into_nodes') ? isDragIntoNodes || isTopLevel : isTopLevel;
|
|
86
|
+
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && supportedCondition;
|
|
91
87
|
};
|
|
92
88
|
|
|
93
89
|
/**
|
|
@@ -386,19 +382,15 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
386
382
|
const destType = $to.node().type;
|
|
387
383
|
const destParent = $to.node($to.depth);
|
|
388
384
|
const sourceNode = $handlePos.nodeAfter;
|
|
389
|
-
const dragLayoutColumnToTopLevel = isDragLayoutColumnToTopLevel($handlePos, $to);
|
|
390
|
-
const dragLayoutColumnIntoTable = isDragLayoutColumnIntoTable($handlePos, $to);
|
|
391
|
-
const dragLayoutColumnIntoPanel = isDragLayoutColumnIntoPanel($handlePos, $to);
|
|
392
385
|
|
|
393
386
|
//TODO: ED-26959 - Does this need to be updated with new selection logic above? ^
|
|
394
|
-
// Move a layout column to top level
|
|
395
|
-
|
|
396
|
-
// Move a layout column into a panel, only moves the content into the panel
|
|
397
|
-
if (sourceNode && (dragLayoutColumnToTopLevel || dragLayoutColumnIntoTable || dragLayoutColumnIntoPanel)) {
|
|
387
|
+
// Move a layout column to top level, or table cell, or panel, or expand, only moves the content into them
|
|
388
|
+
if (sourceNode && isDragLayoutColumnIntoSupportedNodes($handlePos, $to)) {
|
|
398
389
|
// need update after we support single column layout.
|
|
399
390
|
const layoutColumnContent = sourceNode.content;
|
|
400
391
|
let fragment;
|
|
401
|
-
if
|
|
392
|
+
// if drop into table, and layout column contains expand, transform it to nestedExpand
|
|
393
|
+
if (['tableCell', 'tableHeader'].includes($to.parent.type.name)) {
|
|
402
394
|
const contentContainsExpand = findChildrenByType(sourceNode, expand).length > 0;
|
|
403
395
|
fragment = contentContainsExpand ? transformFragmentExpandToNestedExpand(Fragment.from(layoutColumnContent)) : Fragment.from(layoutColumnContent);
|
|
404
396
|
if (!fragment) {
|
|
@@ -4,7 +4,6 @@ import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/tra
|
|
|
4
4
|
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
export const firstNodeDecPluginKey = new PluginKey('firstNodeDec');
|
|
6
6
|
const createFirstNodeDecSet = state => {
|
|
7
|
-
;
|
|
8
7
|
const firstNode = state.doc.firstChild;
|
|
9
8
|
if (!firstNode) {
|
|
10
9
|
return DecorationSet.empty;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { interactionTrackingPluginKey } from './pm-plugin';
|
|
2
|
+
export const stopEditing = view => {
|
|
3
|
+
view.dispatch(view.state.tr.setMeta(interactionTrackingPluginKey, {
|
|
4
|
+
type: 'stopEditing'
|
|
5
|
+
}));
|
|
6
|
+
};
|
|
7
|
+
export const startEditing = view => {
|
|
8
|
+
view.dispatch(view.state.tr.setMeta(interactionTrackingPluginKey, {
|
|
9
|
+
type: 'startEditing'
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { startEditing } from './commands';
|
|
2
|
+
import { getInteractionTrackingState } from './pm-plugin';
|
|
3
|
+
export const handleKeyDown = (view, event) => {
|
|
4
|
+
// Check if this is a keyboard shortcut (Ctrl/Cmd + key)
|
|
5
|
+
const isShortcut = event.ctrlKey || event.metaKey || event.altKey;
|
|
6
|
+
if (isShortcut) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Only consider actual typing keys (not shortcuts)
|
|
11
|
+
// We need to check if it's a single character key or a deletion key
|
|
12
|
+
// and ensure it's not part of a shortcut
|
|
13
|
+
const isTypingKey =
|
|
14
|
+
// Single character keys (letters, numbers, symbols)
|
|
15
|
+
event.key.length === 1 || event.key === 'Backspace' || event.key === 'Delete' || event.key === ' ' || event.key === 'Enter';
|
|
16
|
+
if (!isTypingKey) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const state = getInteractionTrackingState(view.state);
|
|
20
|
+
|
|
21
|
+
// if user hasnt started typing yet, start timer
|
|
22
|
+
if (!(state !== null && state !== void 0 && state.isEditing)) {
|
|
23
|
+
startEditing(view);
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { stopEditing } from './commands';
|
|
2
|
+
import { getInteractionTrackingState } from './pm-plugin';
|
|
3
|
+
export const handleMouseMove = view => {
|
|
4
|
+
const state = getInteractionTrackingState(view.state);
|
|
5
|
+
// if user has stopped editing and moved their mouse, show block controls again
|
|
6
|
+
if (state !== null && state !== void 0 && state.isEditing) {
|
|
7
|
+
stopEditing(view);
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
};
|