@atlaskit/editor-plugin-toolbar 4.1.24 → 4.1.26

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,19 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 4.1.26
4
+
5
+ ### Patch Changes
6
+
7
+ - [`56b1e9c2172d0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/56b1e9c2172d0) -
8
+ Fixes toolbar open experience that tracks a failure when block menu opens and closes quickly.
9
+ - Updated dependencies
10
+
11
+ ## 4.1.25
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 4.1.24
4
18
 
5
19
  ### Patch Changes
@@ -10,6 +10,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _experiences = require("@atlaskit/editor-common/experiences");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var pluginKey = new _state.PluginKey('selectionToolbarOpenExperience');
14
15
  var START_METHOD = {
15
16
  MOUSE_UP: 'mouseUp',
@@ -82,6 +83,13 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
82
83
  }
83
84
  })]
84
85
  });
86
+ var shouldSkipExperienceStart = function shouldSkipExperienceStart(selection) {
87
+ if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection)) {
88
+ return true;
89
+ }
90
+ var target = getTarget();
91
+ return isSelectionToolbarWithinNode(target) || isBlockMenuWithinNode(target) && (0, _platformFeatureFlags.fg)('platform_editor_toolbar_open_experience_fix');
92
+ };
85
93
  return new _safePlugin.SafePlugin({
86
94
  key: pluginKey,
87
95
  state: {
@@ -112,7 +120,7 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
112
120
  };
113
121
  },
114
122
  mouseup: function mouseup(view, e) {
115
- if (!mouseDownPos || isSelectionWithoutTextContent(view.state.selection) || isSelectionWithinCodeBlock(view.state.selection) || isSelectionToolbarWithinNode(getTarget())) {
123
+ if (!mouseDownPos || shouldSkipExperienceStart(view.state.selection)) {
116
124
  return;
117
125
  }
118
126
  if (e.clientX !== mouseDownPos.x || e.clientY !== mouseDownPos.y) {
@@ -122,7 +130,7 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
122
130
  }
123
131
  },
124
132
  dblclick: function dblclick(view) {
125
- if (isSelectionWithoutTextContent(view.state.selection) || isSelectionWithinCodeBlock(view.state.selection) || isSelectionToolbarWithinNode(getTarget())) {
133
+ if (shouldSkipExperienceStart(view.state.selection)) {
126
134
  return;
127
135
  }
128
136
  experience.start({
@@ -2,6 +2,7 @@ import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
2
2
  import { containsPopupWithNestedElement, Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckTimeout, getPopupContainerFromEditorView } from '@atlaskit/editor-common/experiences';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  const pluginKey = new PluginKey('selectionToolbarOpenExperience');
6
7
  const START_METHOD = {
7
8
  MOUSE_UP: 'mouseUp',
@@ -74,6 +75,13 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
74
75
  })
75
76
  })]
76
77
  });
78
+ const shouldSkipExperienceStart = selection => {
79
+ if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection)) {
80
+ return true;
81
+ }
82
+ const target = getTarget();
83
+ return isSelectionToolbarWithinNode(target) || isBlockMenuWithinNode(target) && fg('platform_editor_toolbar_open_experience_fix');
84
+ };
77
85
  return new SafePlugin({
78
86
  key: pluginKey,
79
87
  state: {
@@ -102,7 +110,7 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
102
110
  };
103
111
  },
104
112
  mouseup: (view, e) => {
105
- if (!mouseDownPos || isSelectionWithoutTextContent(view.state.selection) || isSelectionWithinCodeBlock(view.state.selection) || isSelectionToolbarWithinNode(getTarget())) {
113
+ if (!mouseDownPos || shouldSkipExperienceStart(view.state.selection)) {
106
114
  return;
107
115
  }
108
116
  if (e.clientX !== mouseDownPos.x || e.clientY !== mouseDownPos.y) {
@@ -112,7 +120,7 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
112
120
  }
113
121
  },
114
122
  dblclick: view => {
115
- if (isSelectionWithoutTextContent(view.state.selection) || isSelectionWithinCodeBlock(view.state.selection) || isSelectionToolbarWithinNode(getTarget())) {
123
+ if (shouldSkipExperienceStart(view.state.selection)) {
116
124
  return;
117
125
  }
118
126
  experience.start({
@@ -3,6 +3,7 @@ import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
3
3
  import { containsPopupWithNestedElement, Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckTimeout, getPopupContainerFromEditorView } from '@atlaskit/editor-common/experiences';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  var pluginKey = new PluginKey('selectionToolbarOpenExperience');
7
8
  var START_METHOD = {
8
9
  MOUSE_UP: 'mouseUp',
@@ -75,6 +76,13 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
75
76
  }
76
77
  })]
77
78
  });
79
+ var shouldSkipExperienceStart = function shouldSkipExperienceStart(selection) {
80
+ if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection)) {
81
+ return true;
82
+ }
83
+ var target = getTarget();
84
+ return isSelectionToolbarWithinNode(target) || isBlockMenuWithinNode(target) && fg('platform_editor_toolbar_open_experience_fix');
85
+ };
78
86
  return new SafePlugin({
79
87
  key: pluginKey,
80
88
  state: {
@@ -105,7 +113,7 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
105
113
  };
106
114
  },
107
115
  mouseup: function mouseup(view, e) {
108
- if (!mouseDownPos || isSelectionWithoutTextContent(view.state.selection) || isSelectionWithinCodeBlock(view.state.selection) || isSelectionToolbarWithinNode(getTarget())) {
116
+ if (!mouseDownPos || shouldSkipExperienceStart(view.state.selection)) {
109
117
  return;
110
118
  }
111
119
  if (e.clientX !== mouseDownPos.x || e.clientY !== mouseDownPos.y) {
@@ -115,7 +123,7 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
115
123
  }
116
124
  },
117
125
  dblclick: function dblclick(view) {
118
- if (isSelectionWithoutTextContent(view.state.selection) || isSelectionWithinCodeBlock(view.state.selection) || isSelectionToolbarWithinNode(getTarget())) {
126
+ if (shouldSkipExperienceStart(view.state.selection)) {
119
127
  return;
120
128
  }
121
129
  experience.start({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "4.1.24",
3
+ "version": "4.1.26",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-toolbar": "^0.19.0",
40
40
  "@atlaskit/editor-toolbar-model": "^0.4.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^31.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^32.3.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "bind-event-listener": "^3.0.0",
45
45
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -51,6 +51,9 @@
51
51
  "platform-feature-flags": {
52
52
  "platform_editor_toolbar_aifc_placement_overridden": {
53
53
  "type": "boolean"
54
+ },
55
+ "platform_editor_toolbar_open_experience_fix": {
56
+ "type": "boolean"
54
57
  }
55
58
  },
56
59
  "techstack": {