@atlaskit/editor-plugin-block-controls 3.13.1 → 3.13.2

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#149332](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149332)
8
+ [`592aba2930c2a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/592aba2930c2a) -
9
+ Fix cursor not show issue when tabbing from page title
10
+ - Updated dependencies
11
+
3
12
  ## 3.13.1
4
13
 
5
14
  ### Patch Changes
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _browser = require("@atlaskit/editor-common/browser");
12
12
  var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
13
13
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
14
+ var _ui = require("@atlaskit/editor-common/ui");
14
15
  var _utils = require("@atlaskit/editor-common/utils");
15
16
  var _state = require("@atlaskit/editor-prosemirror/state");
16
17
  var _view2 = require("@atlaskit/editor-prosemirror/view");
@@ -350,6 +351,10 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
350
351
  // Remove handle dec when explicitly hidden, a node is resizing, activeNode pos was deleted, or DnD moved a node
351
352
  shouldRemoveHandle = latestActiveNode && (isResizerResizing || isActiveNodeDeleted || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved));
352
353
  }
354
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7')) {
355
+ // Remove handle dec when editor is blurred
356
+ shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
357
+ }
353
358
  if (shouldRemoveHandle) {
354
359
  var _activeNode5, _activeNode6;
355
360
  var oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
@@ -648,6 +653,26 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
648
653
  isShiftDown: false
649
654
  })));
650
655
  }
656
+ },
657
+ blur: function blur(view, event) {
658
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7')) {
659
+ var _api$core2;
660
+ var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(_ui.EDIT_AREA_ID)) !== null;
661
+
662
+ // don't do anything if the event target is a child of the editor or if the editor has focus
663
+ if (isChildOfEditor || view.hasFocus()) {
664
+ return false;
665
+ }
666
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref6) {
667
+ var tr = _ref6.tr;
668
+ var currMeta = tr.getMeta(key);
669
+ tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
670
+ editorBlurred: true
671
+ }));
672
+ return tr;
673
+ });
674
+ return false;
675
+ }
651
676
  }
652
677
  }
653
678
  },
@@ -3,6 +3,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
3
3
  import { browser } from '@atlaskit/editor-common/browser';
4
4
  import { isMeasuring, startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
+ import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
6
7
  import { isEmptyDocument } from '@atlaskit/editor-common/utils';
7
8
  import { NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
8
9
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -348,6 +349,10 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
348
349
  // Remove handle dec when explicitly hidden, a node is resizing, activeNode pos was deleted, or DnD moved a node
349
350
  shouldRemoveHandle = latestActiveNode && (isResizerResizing || isActiveNodeDeleted || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved));
350
351
  }
352
+ if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
353
+ // Remove handle dec when editor is blurred
354
+ shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
355
+ }
351
356
  if (shouldRemoveHandle) {
352
357
  var _activeNode5, _activeNode6;
353
358
  const oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
@@ -656,6 +661,28 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
656
661
  isShiftDown: false
657
662
  }));
658
663
  }
664
+ },
665
+ blur(view, event) {
666
+ if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
667
+ var _api$core2;
668
+ const isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(`#${EDIT_AREA_ID}`) !== null;
669
+
670
+ // don't do anything if the event target is a child of the editor or if the editor has focus
671
+ if (isChildOfEditor || view.hasFocus()) {
672
+ return false;
673
+ }
674
+ api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
675
+ tr
676
+ }) => {
677
+ const currMeta = tr.getMeta(key);
678
+ tr.setMeta(key, {
679
+ ...currMeta,
680
+ editorBlurred: true
681
+ });
682
+ return tr;
683
+ });
684
+ return false;
685
+ }
659
686
  }
660
687
  }
661
688
  },
@@ -6,6 +6,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
6
6
  import { browser } from '@atlaskit/editor-common/browser';
7
7
  import { isMeasuring, startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
8
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
9
+ import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
9
10
  import { isEmptyDocument } from '@atlaskit/editor-common/utils';
10
11
  import { NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
11
12
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -343,6 +344,10 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
343
344
  // Remove handle dec when explicitly hidden, a node is resizing, activeNode pos was deleted, or DnD moved a node
344
345
  shouldRemoveHandle = latestActiveNode && (isResizerResizing || isActiveNodeDeleted || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved));
345
346
  }
347
+ if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
348
+ // Remove handle dec when editor is blurred
349
+ shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
350
+ }
346
351
  if (shouldRemoveHandle) {
347
352
  var _activeNode5, _activeNode6;
348
353
  var oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
@@ -642,6 +647,26 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
642
647
  isShiftDown: false
643
648
  })));
644
649
  }
650
+ },
651
+ blur: function blur(view, event) {
652
+ if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
653
+ var _api$core2;
654
+ var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(EDIT_AREA_ID)) !== null;
655
+
656
+ // don't do anything if the event target is a child of the editor or if the editor has focus
657
+ if (isChildOfEditor || view.hasFocus()) {
658
+ return false;
659
+ }
660
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref6) {
661
+ var tr = _ref6.tr;
662
+ var currMeta = tr.getMeta(key);
663
+ tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
664
+ editorBlurred: true
665
+ }));
666
+ return tr;
667
+ });
668
+ return false;
669
+ }
645
670
  }
646
671
  }
647
672
  },
@@ -116,5 +116,6 @@ export type BlockControlsMeta = {
116
116
  dom: HTMLElement;
117
117
  editorHeight: number;
118
118
  nodeMoved: boolean;
119
+ editorBlurred: boolean;
119
120
  };
120
121
  export type MoveNodeMethod = INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT;
@@ -116,5 +116,6 @@ export type BlockControlsMeta = {
116
116
  dom: HTMLElement;
117
117
  editorHeight: number;
118
118
  nodeMoved: boolean;
119
+ editorBlurred: boolean;
119
120
  };
120
121
  export type MoveNodeMethod = INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.13.1",
3
+ "version": "3.13.2",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop": "^1.6.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
55
55
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.1.0",
56
- "@atlaskit/primitives": "^14.6.0",
56
+ "@atlaskit/primitives": "^14.7.0",
57
57
  "@atlaskit/theme": "^18.0.0",
58
58
  "@atlaskit/tmp-editor-statsig": "^4.15.0",
59
59
  "@atlaskit/tokens": "^4.8.0",
@@ -172,6 +172,9 @@
172
172
  "platform_editor_controls_patch_5": {
173
173
  "type": "boolean"
174
174
  },
175
+ "platform_editor_controls_patch_7": {
176
+ "type": "boolean"
177
+ },
175
178
  "platform_editor_user_intent_plugin": {
176
179
  "type": "boolean"
177
180
  },