@atlaskit/editor-plugin-block-controls 3.8.5 → 3.8.7

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/blockControlsPlugin.js +19 -3
  3. package/dist/cjs/pm-plugins/decorations-anchor.js +1 -3
  4. package/dist/cjs/pm-plugins/decorations-drag-handle.js +3 -3
  5. package/dist/cjs/pm-plugins/first-node-dec-plugin.js +46 -0
  6. package/dist/cjs/pm-plugins/interaction-tracking/commands.js +17 -0
  7. package/dist/cjs/pm-plugins/interaction-tracking/handle-key-down.js +32 -0
  8. package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +16 -0
  9. package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +46 -0
  10. package/dist/cjs/ui/visibility-container.js +4 -3
  11. package/dist/es2019/blockControlsPlugin.js +19 -3
  12. package/dist/es2019/pm-plugins/decorations-anchor.js +1 -4
  13. package/dist/es2019/pm-plugins/decorations-drag-handle.js +3 -3
  14. package/dist/es2019/pm-plugins/first-node-dec-plugin.js +36 -0
  15. package/dist/es2019/pm-plugins/interaction-tracking/commands.js +11 -0
  16. package/dist/es2019/pm-plugins/interaction-tracking/handle-key-down.js +26 -0
  17. package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +10 -0
  18. package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +40 -0
  19. package/dist/es2019/ui/visibility-container.js +4 -3
  20. package/dist/esm/blockControlsPlugin.js +19 -3
  21. package/dist/esm/pm-plugins/decorations-anchor.js +1 -3
  22. package/dist/esm/pm-plugins/decorations-drag-handle.js +3 -3
  23. package/dist/esm/pm-plugins/first-node-dec-plugin.js +40 -0
  24. package/dist/esm/pm-plugins/interaction-tracking/commands.js +11 -0
  25. package/dist/esm/pm-plugins/interaction-tracking/handle-key-down.js +26 -0
  26. package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +10 -0
  27. package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +40 -0
  28. package/dist/esm/ui/visibility-container.js +4 -3
  29. package/dist/types/blockControlsPluginType.d.ts +1 -0
  30. package/dist/types/pm-plugins/first-node-dec-plugin.d.ts +5 -0
  31. package/dist/types/pm-plugins/interaction-tracking/commands.d.ts +3 -0
  32. package/dist/types/pm-plugins/interaction-tracking/handle-key-down.d.ts +2 -0
  33. package/dist/types/pm-plugins/interaction-tracking/handle-mouse-move.d.ts +2 -0
  34. package/dist/types/pm-plugins/interaction-tracking/pm-plugin.d.ts +12 -0
  35. package/dist/types-ts4.5/blockControlsPluginType.d.ts +1 -0
  36. package/dist/types-ts4.5/pm-plugins/first-node-dec-plugin.d.ts +5 -0
  37. package/dist/types-ts4.5/pm-plugins/interaction-tracking/commands.d.ts +3 -0
  38. package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-key-down.d.ts +2 -0
  39. package/dist/types-ts4.5/pm-plugins/interaction-tracking/handle-mouse-move.d.ts +2 -0
  40. package/dist/types-ts4.5/pm-plugins/interaction-tracking/pm-plugin.d.ts +12 -0
  41. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.8.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#138396](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138396)
8
+ [`6a11423e1442f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6a11423e1442f) -
9
+ Add new plugin which tracks user typing, add typing check to visibility container of widgets
10
+
11
+ ## 3.8.6
12
+
13
+ ### Patch Changes
14
+
15
+ - [#137780](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137780)
16
+ [`6940941e679c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6940941e679c5) -
17
+ Move style decoration to own plugin
18
+ - Updated dependencies
19
+
3
20
  ## 3.8.5
4
21
 
5
22
  ### Patch Changes
@@ -13,6 +13,8 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
13
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
14
14
  var _moveNode = require("./editor-commands/move-node");
15
15
  var _moveToLayout = require("./editor-commands/move-to-layout");
16
+ var _firstNodeDecPlugin = require("./pm-plugins/first-node-dec-plugin");
17
+ var _pmPlugin = require("./pm-plugins/interaction-tracking/pm-plugin");
16
18
  var _main = require("./pm-plugins/main");
17
19
  var _getSelection = require("./pm-plugins/utils/getSelection");
18
20
  var _blockMenu = _interopRequireDefault(require("./ui/block-menu"));
@@ -25,7 +27,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
25
27
  return {
26
28
  name: 'blockControls',
27
29
  pmPlugins: function pmPlugins() {
28
- return [{
30
+ var pmPlugins = [{
29
31
  name: 'blockControlsPmPlugin',
30
32
  plugin: function plugin(_ref2) {
31
33
  var getIntl = _ref2.getIntl,
@@ -33,6 +35,19 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
33
35
  return (0, _main.createPlugin)(api, getIntl, nodeViewPortalProviderAPI);
34
36
  }
35
37
  }];
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
+ });
44
+ }
45
+ pmPlugins.push({
46
+ name: 'firstNodeDec',
47
+ plugin: _firstNodeDecPlugin.firstNodeDecPlugin
48
+ });
49
+ }
50
+ return pmPlugins;
36
51
  },
37
52
  commands: {
38
53
  moveNode: (0, _moveNode.moveNode)(api),
@@ -152,7 +167,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
152
167
  }
153
168
  },
154
169
  getSharedState: function getSharedState(editorState) {
155
- 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;
156
171
  if (!editorState) {
157
172
  return undefined;
158
173
  }
@@ -164,7 +179,8 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
164
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,
165
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,
166
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,
167
- 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
168
184
  };
169
185
  },
170
186
  contentComponent: function contentComponent(_ref7) {
@@ -97,9 +97,7 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
97
97
  if (shouldIgnoreNode(node, ignore_nodes, depth, parent)) {
98
98
  return shouldDescend; //skip over, don't consider it a valid depth
99
99
  }
100
- var anchorStyles = pos === 0 && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? // why margin-top:0? well it's not possible using CSS to select the first node in the document while excluding n number of nodes, in this case
101
- // we're rendering quick insert button and drag handle. For now override margin-top to 0
102
- "anchor-name: ".concat(anchorName, ";margin-top:0px;") : "anchor-name: ".concat(anchorName, ";");
100
+ var anchorStyles = "anchor-name: ".concat(anchorName, ";");
103
101
  decs.push(_view.Decoration.node(pos, pos + node.nodeSize, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
104
102
  style: anchorStyles
105
103
  }, 'data-drag-handler-anchor-name', anchorName), 'data-drag-handler-node-type', nodeTypeWithLevel), 'data-drag-handler-anchor-depth', "".concat(depth)), {
@@ -54,9 +54,9 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
54
54
  isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
55
55
  }
56
56
  /*
57
- * We disable mouseover event to fix flickering issue on hover
58
- * However, the tooltip for nested drag handle is no long working.
59
- */
57
+ * We disable mouseover event to fix flickering issue on hover
58
+ * However, the tooltip for nested drag handle is no long working.
59
+ */
60
60
  if (newPos === undefined || !isTopLevelNode) {
61
61
  // This will also hide the tooltip.
62
62
  unbind = (0, _bindEventListener.bind)(element, {
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.firstNodeDecPluginKey = exports.firstNodeDecPlugin = void 0;
7
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _transform = require("@atlaskit/editor-prosemirror/transform");
10
+ var _view = require("@atlaskit/editor-prosemirror/view");
11
+ var firstNodeDecPluginKey = exports.firstNodeDecPluginKey = new _state.PluginKey('firstNodeDec');
12
+ var createFirstNodeDecSet = function createFirstNodeDecSet(state) {
13
+ ;
14
+ var firstNode = state.doc.firstChild;
15
+ if (!firstNode) {
16
+ return _view.DecorationSet.empty;
17
+ }
18
+ return _view.DecorationSet.create(state.doc, [_view.Decoration.node(0, firstNode.nodeSize, {
19
+ style: 'margin-top: 0'
20
+ })]);
21
+ };
22
+ var firstNodeDecPlugin = exports.firstNodeDecPlugin = function firstNodeDecPlugin() {
23
+ return new _safePlugin.SafePlugin({
24
+ key: firstNodeDecPluginKey,
25
+ state: {
26
+ init: function init(_, state) {
27
+ return createFirstNodeDecSet(state);
28
+ },
29
+ apply: function apply(tr, currentState, _, newState) {
30
+ var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
31
+ return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep;
32
+ });
33
+ // Reapply decorations if there are any steps that modify the document
34
+ if (isDocChanged) {
35
+ return createFirstNodeDecSet(newState);
36
+ }
37
+ return currentState;
38
+ }
39
+ },
40
+ props: {
41
+ decorations: function decorations(state) {
42
+ return firstNodeDecPluginKey.getState(state);
43
+ }
44
+ }
45
+ });
46
+ };
@@ -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
+ };
@@ -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 isOpen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'typeAhead.isOpen');
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, isOpen ? hiddenStyles : visibleStyles]
29
+ xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
29
30
  }, children);
30
31
  };
@@ -5,6 +5,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
5
5
  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
+ import { firstNodeDecPlugin } from './pm-plugins/first-node-dec-plugin';
9
+ import { createInteractionTrackingPlugin, interactionTrackingPluginKey } from './pm-plugins/interaction-tracking/pm-plugin';
8
10
  import { createPlugin, key } from './pm-plugins/main';
9
11
  import { selectNode } from './pm-plugins/utils/getSelection';
10
12
  import BlockMenu from './ui/block-menu';
@@ -15,13 +17,26 @@ export const blockControlsPlugin = ({
15
17
  }) => ({
16
18
  name: 'blockControls',
17
19
  pmPlugins() {
18
- return [{
20
+ const pmPlugins = [{
19
21
  name: 'blockControlsPmPlugin',
20
22
  plugin: ({
21
23
  getIntl,
22
24
  nodeViewPortalProviderAPI
23
25
  }) => createPlugin(api, getIntl, nodeViewPortalProviderAPI)
24
26
  }];
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;
25
40
  },
26
41
  commands: {
27
42
  moveNode: moveNode(api),
@@ -143,7 +158,7 @@ export const blockControlsPlugin = ({
143
158
  }
144
159
  },
145
160
  getSharedState(editorState) {
146
- 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;
147
162
  if (!editorState) {
148
163
  return undefined;
149
164
  }
@@ -155,7 +170,8 @@ export const blockControlsPlugin = ({
155
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,
156
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,
157
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,
158
- 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
159
175
  };
160
176
  },
161
177
  contentComponent({
@@ -87,10 +87,7 @@ export const nodeDecorations = (newState, from, to) => {
87
87
  if (shouldIgnoreNode(node, ignore_nodes, depth, parent)) {
88
88
  return shouldDescend; //skip over, don't consider it a valid depth
89
89
  }
90
- const anchorStyles = pos === 0 && editorExperiment('platform_editor_controls', 'variant1') ?
91
- // why margin-top:0? well it's not possible using CSS to select the first node in the document while excluding n number of nodes, in this case
92
- // we're rendering quick insert button and drag handle. For now override margin-top to 0
93
- `anchor-name: ${anchorName};margin-top:0px;` : `anchor-name: ${anchorName};`;
90
+ const anchorStyles = `anchor-name: ${anchorName};`;
94
91
  decs.push(Decoration.node(pos, pos + node.nodeSize, {
95
92
  style: anchorStyles,
96
93
  ['data-drag-handler-anchor-name']: anchorName,
@@ -45,9 +45,9 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
45
45
  isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
46
46
  }
47
47
  /*
48
- * We disable mouseover event to fix flickering issue on hover
49
- * However, the tooltip for nested drag handle is no long working.
50
- */
48
+ * We disable mouseover event to fix flickering issue on hover
49
+ * However, the tooltip for nested drag handle is no long working.
50
+ */
51
51
  if (newPos === undefined || !isTopLevelNode) {
52
52
  // This will also hide the tooltip.
53
53
  unbind = bind(element, {
@@ -0,0 +1,36 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
+ import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
5
+ export const firstNodeDecPluginKey = new PluginKey('firstNodeDec');
6
+ const createFirstNodeDecSet = state => {
7
+ ;
8
+ const firstNode = state.doc.firstChild;
9
+ if (!firstNode) {
10
+ return DecorationSet.empty;
11
+ }
12
+ return DecorationSet.create(state.doc, [Decoration.node(0, firstNode.nodeSize, {
13
+ style: 'margin-top: 0'
14
+ })]);
15
+ };
16
+ export const firstNodeDecPlugin = () => new SafePlugin({
17
+ key: firstNodeDecPluginKey,
18
+ state: {
19
+ init(_, state) {
20
+ return createFirstNodeDecSet(state);
21
+ },
22
+ apply(tr, currentState, _, newState) {
23
+ const isDocChanged = tr.docChanged && tr.steps.some(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep);
24
+ // Reapply decorations if there are any steps that modify the document
25
+ if (isDocChanged) {
26
+ return createFirstNodeDecSet(newState);
27
+ }
28
+ return currentState;
29
+ }
30
+ },
31
+ props: {
32
+ decorations(state) {
33
+ return firstNodeDecPluginKey.getState(state);
34
+ }
35
+ }
36
+ });
@@ -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
+ };
@@ -0,0 +1,40 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { handleKeyDown } from './handle-key-down';
4
+ import { handleMouseMove } from './handle-mouse-move';
5
+ export const interactionTrackingPluginKey = new PluginKey('interactionTrackingPlugin');
6
+ export const createInteractionTrackingPlugin = () => {
7
+ return new SafePlugin({
8
+ key: interactionTrackingPluginKey,
9
+ state: {
10
+ init() {
11
+ return {
12
+ isEditing: false
13
+ };
14
+ },
15
+ apply(tr, pluginState) {
16
+ const meta = tr.getMeta(interactionTrackingPluginKey);
17
+ switch (meta === null || meta === void 0 ? void 0 : meta.type) {
18
+ case 'startEditing':
19
+ return {
20
+ isEditing: true
21
+ };
22
+ case 'stopEditing':
23
+ return {
24
+ isEditing: false
25
+ };
26
+ }
27
+ return pluginState;
28
+ }
29
+ },
30
+ props: {
31
+ handleKeyDown,
32
+ handleDOMEvents: {
33
+ mousemove: handleMouseMove
34
+ }
35
+ }
36
+ });
37
+ };
38
+ export const getInteractionTrackingState = state => {
39
+ return interactionTrackingPluginKey.getState(state);
40
+ };
@@ -10,15 +10,16 @@ const visibleStyles = xcss({
10
10
  });
11
11
  const hiddenStyles = xcss({
12
12
  opacity: 0,
13
- // CONFIRM this change doesnt cause this issue to regress https://product-fabric.atlassian.net/browse/ED-24136
14
13
  visibility: 'hidden'
15
14
  });
16
15
  export const VisibilityContainer = ({
17
16
  api,
18
17
  children
19
18
  }) => {
20
- const isOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
19
+ const isTypeAheadOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
20
+ const isEditing = useSharedPluginStateSelector(api, 'blockControls.isEditing');
21
+ const shouldHide = isTypeAheadOpen || isEditing;
21
22
  return /*#__PURE__*/React.createElement(Box, {
22
- xcss: [baseStyles, isOpen ? hiddenStyles : visibleStyles]
23
+ xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
23
24
  }, children);
24
25
  };
@@ -8,6 +8,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
9
  import { moveNode } from './editor-commands/move-node';
10
10
  import { moveToLayout } from './editor-commands/move-to-layout';
11
+ import { firstNodeDecPlugin } from './pm-plugins/first-node-dec-plugin';
12
+ import { createInteractionTrackingPlugin, interactionTrackingPluginKey } from './pm-plugins/interaction-tracking/pm-plugin';
11
13
  import { createPlugin, key } from './pm-plugins/main';
12
14
  import { selectNode } from './pm-plugins/utils/getSelection';
13
15
  import BlockMenu from './ui/block-menu';
@@ -18,7 +20,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
18
20
  return {
19
21
  name: 'blockControls',
20
22
  pmPlugins: function pmPlugins() {
21
- return [{
23
+ var pmPlugins = [{
22
24
  name: 'blockControlsPmPlugin',
23
25
  plugin: function plugin(_ref2) {
24
26
  var getIntl = _ref2.getIntl,
@@ -26,6 +28,19 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
26
28
  return createPlugin(api, getIntl, nodeViewPortalProviderAPI);
27
29
  }
28
30
  }];
31
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
32
+ if (fg('platform_editor_controls_widget_visibility')) {
33
+ pmPlugins.push({
34
+ name: 'blockControlsInteractionTrackingPlugin',
35
+ plugin: createInteractionTrackingPlugin
36
+ });
37
+ }
38
+ pmPlugins.push({
39
+ name: 'firstNodeDec',
40
+ plugin: firstNodeDecPlugin
41
+ });
42
+ }
43
+ return pmPlugins;
29
44
  },
30
45
  commands: {
31
46
  moveNode: moveNode(api),
@@ -145,7 +160,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
145
160
  }
146
161
  },
147
162
  getSharedState: function getSharedState(editorState) {
148
- 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;
163
+ 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;
149
164
  if (!editorState) {
150
165
  return undefined;
151
166
  }
@@ -157,7 +172,8 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
157
172
  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,
158
173
  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,
159
174
  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,
160
- 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
175
+ 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,
176
+ isEditing: (_interactionTrackingP = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing
161
177
  };
162
178
  },
163
179
  contentComponent: function contentComponent(_ref7) {
@@ -90,9 +90,7 @@ export var nodeDecorations = function nodeDecorations(newState, from, to) {
90
90
  if (shouldIgnoreNode(node, ignore_nodes, depth, parent)) {
91
91
  return shouldDescend; //skip over, don't consider it a valid depth
92
92
  }
93
- var anchorStyles = pos === 0 && editorExperiment('platform_editor_controls', 'variant1') ? // why margin-top:0? well it's not possible using CSS to select the first node in the document while excluding n number of nodes, in this case
94
- // we're rendering quick insert button and drag handle. For now override margin-top to 0
95
- "anchor-name: ".concat(anchorName, ";margin-top:0px;") : "anchor-name: ".concat(anchorName, ";");
93
+ var anchorStyles = "anchor-name: ".concat(anchorName, ";");
96
94
  decs.push(Decoration.node(pos, pos + node.nodeSize, _defineProperty(_defineProperty(_defineProperty({
97
95
  style: anchorStyles
98
96
  }, 'data-drag-handler-anchor-name', anchorName), 'data-drag-handler-node-type', nodeTypeWithLevel), 'data-drag-handler-anchor-depth', "".concat(depth)), {
@@ -47,9 +47,9 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
47
47
  isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
48
48
  }
49
49
  /*
50
- * We disable mouseover event to fix flickering issue on hover
51
- * However, the tooltip for nested drag handle is no long working.
52
- */
50
+ * We disable mouseover event to fix flickering issue on hover
51
+ * However, the tooltip for nested drag handle is no long working.
52
+ */
53
53
  if (newPos === undefined || !isTopLevelNode) {
54
54
  // This will also hide the tooltip.
55
55
  unbind = bind(element, {
@@ -0,0 +1,40 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
+ import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
5
+ export var firstNodeDecPluginKey = new PluginKey('firstNodeDec');
6
+ var createFirstNodeDecSet = function createFirstNodeDecSet(state) {
7
+ ;
8
+ var firstNode = state.doc.firstChild;
9
+ if (!firstNode) {
10
+ return DecorationSet.empty;
11
+ }
12
+ return DecorationSet.create(state.doc, [Decoration.node(0, firstNode.nodeSize, {
13
+ style: 'margin-top: 0'
14
+ })]);
15
+ };
16
+ export var firstNodeDecPlugin = function firstNodeDecPlugin() {
17
+ return new SafePlugin({
18
+ key: firstNodeDecPluginKey,
19
+ state: {
20
+ init: function init(_, state) {
21
+ return createFirstNodeDecSet(state);
22
+ },
23
+ apply: function apply(tr, currentState, _, newState) {
24
+ var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
25
+ return step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
26
+ });
27
+ // Reapply decorations if there are any steps that modify the document
28
+ if (isDocChanged) {
29
+ return createFirstNodeDecSet(newState);
30
+ }
31
+ return currentState;
32
+ }
33
+ },
34
+ props: {
35
+ decorations: function decorations(state) {
36
+ return firstNodeDecPluginKey.getState(state);
37
+ }
38
+ }
39
+ });
40
+ };
@@ -0,0 +1,11 @@
1
+ import { interactionTrackingPluginKey } from './pm-plugin';
2
+ export var stopEditing = function stopEditing(view) {
3
+ view.dispatch(view.state.tr.setMeta(interactionTrackingPluginKey, {
4
+ type: 'stopEditing'
5
+ }));
6
+ };
7
+ export var startEditing = function 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 var handleKeyDown = function handleKeyDown(view, event) {
4
+ // Check if this is a keyboard shortcut (Ctrl/Cmd + key)
5
+ var 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
+ var 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
+ var 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 var handleMouseMove = function handleMouseMove(view) {
4
+ var 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
+ };
@@ -0,0 +1,40 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { handleKeyDown } from './handle-key-down';
4
+ import { handleMouseMove } from './handle-mouse-move';
5
+ export var interactionTrackingPluginKey = new PluginKey('interactionTrackingPlugin');
6
+ export var createInteractionTrackingPlugin = function createInteractionTrackingPlugin() {
7
+ return new SafePlugin({
8
+ key: interactionTrackingPluginKey,
9
+ state: {
10
+ init: function init() {
11
+ return {
12
+ isEditing: false
13
+ };
14
+ },
15
+ apply: function apply(tr, pluginState) {
16
+ var meta = tr.getMeta(interactionTrackingPluginKey);
17
+ switch (meta === null || meta === void 0 ? void 0 : meta.type) {
18
+ case 'startEditing':
19
+ return {
20
+ isEditing: true
21
+ };
22
+ case 'stopEditing':
23
+ return {
24
+ isEditing: false
25
+ };
26
+ }
27
+ return pluginState;
28
+ }
29
+ },
30
+ props: {
31
+ handleKeyDown: handleKeyDown,
32
+ handleDOMEvents: {
33
+ mousemove: handleMouseMove
34
+ }
35
+ }
36
+ });
37
+ };
38
+ export var getInteractionTrackingState = function getInteractionTrackingState(state) {
39
+ return interactionTrackingPluginKey.getState(state);
40
+ };
@@ -10,14 +10,15 @@ var visibleStyles = xcss({
10
10
  });
11
11
  var hiddenStyles = xcss({
12
12
  opacity: 0,
13
- // CONFIRM this change doesnt cause this issue to regress https://product-fabric.atlassian.net/browse/ED-24136
14
13
  visibility: 'hidden'
15
14
  });
16
15
  export var VisibilityContainer = function VisibilityContainer(_ref) {
17
16
  var api = _ref.api,
18
17
  children = _ref.children;
19
- var isOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
18
+ var isTypeAheadOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
19
+ var isEditing = useSharedPluginStateSelector(api, 'blockControls.isEditing');
20
+ var shouldHide = isTypeAheadOpen || isEditing;
20
21
  return /*#__PURE__*/React.createElement(Box, {
21
- xcss: [baseStyles, isOpen ? hiddenStyles : visibleStyles]
22
+ xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
22
23
  }, children);
23
24
  };
@@ -60,6 +60,7 @@ export type BlockControlsSharedState = {
60
60
  isPMDragging: boolean;
61
61
  multiSelectDnD?: MultiSelectDnD;
62
62
  isShiftDown?: boolean;
63
+ isEditing?: boolean;
63
64
  } | undefined;
64
65
  export type HandleOptions = {
65
66
  isFocused: boolean;
@@ -0,0 +1,5 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ export declare const firstNodeDecPluginKey: PluginKey<DecorationSet>;
5
+ export declare const firstNodeDecPlugin: () => SafePlugin<DecorationSet>;
@@ -0,0 +1,3 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const stopEditing: (view: EditorView) => void;
3
+ export declare const startEditing: (view: EditorView) => void;
@@ -0,0 +1,2 @@
1
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const handleMouseMove: (view: EditorView) => boolean;
@@ -0,0 +1,12 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ export type InteractionTrackingPluginState = {
5
+ /**
6
+ * Tracks if a users intention is to edit the document (e.g. typing, deleting, etc.)
7
+ */
8
+ isEditing: boolean;
9
+ };
10
+ export declare const interactionTrackingPluginKey: PluginKey<InteractionTrackingPluginState>;
11
+ export declare const createInteractionTrackingPlugin: () => SafePlugin<InteractionTrackingPluginState>;
12
+ export declare const getInteractionTrackingState: (state: EditorState) => InteractionTrackingPluginState | undefined;
@@ -60,6 +60,7 @@ export type BlockControlsSharedState = {
60
60
  isPMDragging: boolean;
61
61
  multiSelectDnD?: MultiSelectDnD;
62
62
  isShiftDown?: boolean;
63
+ isEditing?: boolean;
63
64
  } | undefined;
64
65
  export type HandleOptions = {
65
66
  isFocused: boolean;
@@ -0,0 +1,5 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ export declare const firstNodeDecPluginKey: PluginKey<DecorationSet>;
5
+ export declare const firstNodeDecPlugin: () => SafePlugin<DecorationSet>;
@@ -0,0 +1,3 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const stopEditing: (view: EditorView) => void;
3
+ export declare const startEditing: (view: EditorView) => void;
@@ -0,0 +1,2 @@
1
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const handleMouseMove: (view: EditorView) => boolean;
@@ -0,0 +1,12 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ export type InteractionTrackingPluginState = {
5
+ /**
6
+ * Tracks if a users intention is to edit the document (e.g. typing, deleting, etc.)
7
+ */
8
+ isEditing: boolean;
9
+ };
10
+ export declare const interactionTrackingPluginKey: PluginKey<InteractionTrackingPluginState>;
11
+ export declare const createInteractionTrackingPlugin: () => SafePlugin<InteractionTrackingPluginState>;
12
+ export declare const getInteractionTrackingState: (state: EditorState) => InteractionTrackingPluginState | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.8.5",
3
+ "version": "3.8.7",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.0.0",
54
- "@atlaskit/primitives": "^14.3.0",
54
+ "@atlaskit/primitives": "^14.4.0",
55
55
  "@atlaskit/theme": "^18.0.0",
56
56
  "@atlaskit/tmp-editor-statsig": "^4.6.0",
57
57
  "@atlaskit/tokens": "^4.7.0",