@atlaskit/editor-plugin-toolbar 19.0.9 → 19.0.10
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 +8 -0
- package/dist/cjs/pm-plugins/experiences/selection-toolbar-open-experience.js +7 -13
- package/dist/es2019/pm-plugins/experiences/selection-toolbar-open-experience.js +7 -13
- package/dist/esm/pm-plugins/experiences/selection-toolbar-open-experience.js +7 -13
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 19.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`41f0abe038464`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/41f0abe038464) -
|
|
8
|
+
Clean up feature gate `platform_editor_toolbar_intent_fix`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 19.0.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -10,7 +10,6 @@ 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 _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
13
|
var _visibility = require("../../ui/SelectionToolbar/visibility");
|
|
15
14
|
var pluginKey = new _state.PluginKey('selectionToolbarOpenExperience');
|
|
16
15
|
var START_METHOD = {
|
|
@@ -37,7 +36,6 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
37
36
|
var refs = _ref.refs,
|
|
38
37
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
39
38
|
getCurrentUserIntent = _ref.getCurrentUserIntent;
|
|
40
|
-
var isIntentFixEnabled = (0, _fg.fg)('platform_editor_toolbar_intent_fix');
|
|
41
39
|
var editorView;
|
|
42
40
|
var targetEl;
|
|
43
41
|
var shiftArrowKeyPressed = false;
|
|
@@ -64,7 +62,7 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
64
62
|
durationMs: 1000,
|
|
65
63
|
onTimeout: function onTimeout() {
|
|
66
64
|
var _editorView2, _editorView3;
|
|
67
|
-
if (
|
|
65
|
+
if (isCurrentUserIntentSuppressingToolbar((_editorView2 = editorView) === null || _editorView2 === void 0 ? void 0 : _editorView2.state.selection)) {
|
|
68
66
|
return {
|
|
69
67
|
status: 'abort',
|
|
70
68
|
reason: ABORT_REASON.USER_INTENT_SUPPRESSED
|
|
@@ -101,7 +99,7 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
101
99
|
})]
|
|
102
100
|
});
|
|
103
101
|
var shouldSkipExperienceStart = function shouldSkipExperienceStart(selection) {
|
|
104
|
-
if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection) ||
|
|
102
|
+
if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection) || isCurrentUserIntentSuppressingToolbar(selection)) {
|
|
105
103
|
return true;
|
|
106
104
|
}
|
|
107
105
|
var target = getTarget();
|
|
@@ -140,22 +138,18 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
140
138
|
x: e.clientX,
|
|
141
139
|
y: e.clientY
|
|
142
140
|
};
|
|
143
|
-
|
|
144
|
-
mouseDownSelection = view.state.selection;
|
|
145
|
-
}
|
|
141
|
+
mouseDownSelection = view.state.selection;
|
|
146
142
|
},
|
|
147
143
|
mouseup: function mouseup(view, e) {
|
|
148
144
|
var initialMouseDownPos = mouseDownPos;
|
|
149
145
|
var selectionChanged = (0, _visibility.hasSelectionChanged)(mouseDownSelection, view.state.selection);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
mouseDownSelection = undefined;
|
|
153
|
-
}
|
|
146
|
+
mouseDownPos = undefined;
|
|
147
|
+
mouseDownSelection = undefined;
|
|
154
148
|
if (!initialMouseDownPos || shouldSkipExperienceStart(view.state.selection)) {
|
|
155
149
|
return;
|
|
156
150
|
}
|
|
157
151
|
var mouseCoordinatesChanged = e.clientX !== initialMouseDownPos.x || e.clientY !== initialMouseDownPos.y;
|
|
158
|
-
if (mouseCoordinatesChanged &&
|
|
152
|
+
if (mouseCoordinatesChanged && selectionChanged) {
|
|
159
153
|
experience.start({
|
|
160
154
|
method: START_METHOD.MOUSE_UP
|
|
161
155
|
});
|
|
@@ -170,7 +164,7 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
170
164
|
});
|
|
171
165
|
},
|
|
172
166
|
keydown: function keydown(_view, event) {
|
|
173
|
-
shiftArrowKeyPressed = (
|
|
167
|
+
shiftArrowKeyPressed = (0, _visibility.isPlainShiftArrowKey)(event) && !isSelectionToolbarWithinNode(getTarget());
|
|
174
168
|
},
|
|
175
169
|
keyup: function keyup() {
|
|
176
170
|
shiftArrowKeyPressed = false;
|
|
@@ -2,7 +2,6 @@ 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/fg';
|
|
6
5
|
import { hasSelectionChanged, isPlainShiftArrowKey, isSelectionToolbarSuppressedByUserIntent } from '../../ui/SelectionToolbar/visibility';
|
|
7
6
|
const pluginKey = new PluginKey('selectionToolbarOpenExperience');
|
|
8
7
|
const START_METHOD = {
|
|
@@ -31,7 +30,6 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
31
30
|
getCurrentUserIntent
|
|
32
31
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
33
32
|
}) => {
|
|
34
|
-
const isIntentFixEnabled = fg('platform_editor_toolbar_intent_fix');
|
|
35
33
|
let editorView;
|
|
36
34
|
let targetEl;
|
|
37
35
|
let shiftArrowKeyPressed = false;
|
|
@@ -58,7 +56,7 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
58
56
|
durationMs: 1000,
|
|
59
57
|
onTimeout: () => {
|
|
60
58
|
var _editorView2, _editorView3;
|
|
61
|
-
if (
|
|
59
|
+
if (isCurrentUserIntentSuppressingToolbar((_editorView2 = editorView) === null || _editorView2 === void 0 ? void 0 : _editorView2.state.selection)) {
|
|
62
60
|
return {
|
|
63
61
|
status: 'abort',
|
|
64
62
|
reason: ABORT_REASON.USER_INTENT_SUPPRESSED
|
|
@@ -94,7 +92,7 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
94
92
|
})]
|
|
95
93
|
});
|
|
96
94
|
const shouldSkipExperienceStart = selection => {
|
|
97
|
-
if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection) ||
|
|
95
|
+
if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection) || isCurrentUserIntentSuppressingToolbar(selection)) {
|
|
98
96
|
return true;
|
|
99
97
|
}
|
|
100
98
|
const target = getTarget();
|
|
@@ -131,22 +129,18 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
131
129
|
x: e.clientX,
|
|
132
130
|
y: e.clientY
|
|
133
131
|
};
|
|
134
|
-
|
|
135
|
-
mouseDownSelection = view.state.selection;
|
|
136
|
-
}
|
|
132
|
+
mouseDownSelection = view.state.selection;
|
|
137
133
|
},
|
|
138
134
|
mouseup: (view, e) => {
|
|
139
135
|
const initialMouseDownPos = mouseDownPos;
|
|
140
136
|
const selectionChanged = hasSelectionChanged(mouseDownSelection, view.state.selection);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
mouseDownSelection = undefined;
|
|
144
|
-
}
|
|
137
|
+
mouseDownPos = undefined;
|
|
138
|
+
mouseDownSelection = undefined;
|
|
145
139
|
if (!initialMouseDownPos || shouldSkipExperienceStart(view.state.selection)) {
|
|
146
140
|
return;
|
|
147
141
|
}
|
|
148
142
|
const mouseCoordinatesChanged = e.clientX !== initialMouseDownPos.x || e.clientY !== initialMouseDownPos.y;
|
|
149
|
-
if (mouseCoordinatesChanged &&
|
|
143
|
+
if (mouseCoordinatesChanged && selectionChanged) {
|
|
150
144
|
experience.start({
|
|
151
145
|
method: START_METHOD.MOUSE_UP
|
|
152
146
|
});
|
|
@@ -161,7 +155,7 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
161
155
|
});
|
|
162
156
|
},
|
|
163
157
|
keydown: (_view, event) => {
|
|
164
|
-
shiftArrowKeyPressed =
|
|
158
|
+
shiftArrowKeyPressed = isPlainShiftArrowKey(event) && !isSelectionToolbarWithinNode(getTarget());
|
|
165
159
|
},
|
|
166
160
|
keyup: () => {
|
|
167
161
|
shiftArrowKeyPressed = false;
|
|
@@ -3,7 +3,6 @@ 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/fg';
|
|
7
6
|
import { hasSelectionChanged, isPlainShiftArrowKey, isSelectionToolbarSuppressedByUserIntent } from '../../ui/SelectionToolbar/visibility';
|
|
8
7
|
var pluginKey = new PluginKey('selectionToolbarOpenExperience');
|
|
9
8
|
var START_METHOD = {
|
|
@@ -30,7 +29,6 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
30
29
|
var refs = _ref.refs,
|
|
31
30
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
32
31
|
getCurrentUserIntent = _ref.getCurrentUserIntent;
|
|
33
|
-
var isIntentFixEnabled = fg('platform_editor_toolbar_intent_fix');
|
|
34
32
|
var editorView;
|
|
35
33
|
var targetEl;
|
|
36
34
|
var shiftArrowKeyPressed = false;
|
|
@@ -57,7 +55,7 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
57
55
|
durationMs: 1000,
|
|
58
56
|
onTimeout: function onTimeout() {
|
|
59
57
|
var _editorView2, _editorView3;
|
|
60
|
-
if (
|
|
58
|
+
if (isCurrentUserIntentSuppressingToolbar((_editorView2 = editorView) === null || _editorView2 === void 0 ? void 0 : _editorView2.state.selection)) {
|
|
61
59
|
return {
|
|
62
60
|
status: 'abort',
|
|
63
61
|
reason: ABORT_REASON.USER_INTENT_SUPPRESSED
|
|
@@ -94,7 +92,7 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
94
92
|
})]
|
|
95
93
|
});
|
|
96
94
|
var shouldSkipExperienceStart = function shouldSkipExperienceStart(selection) {
|
|
97
|
-
if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection) ||
|
|
95
|
+
if (isSelectionWithoutTextContent(selection) || isSelectionWithinCodeBlock(selection) || isCurrentUserIntentSuppressingToolbar(selection)) {
|
|
98
96
|
return true;
|
|
99
97
|
}
|
|
100
98
|
var target = getTarget();
|
|
@@ -133,22 +131,18 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
133
131
|
x: e.clientX,
|
|
134
132
|
y: e.clientY
|
|
135
133
|
};
|
|
136
|
-
|
|
137
|
-
mouseDownSelection = view.state.selection;
|
|
138
|
-
}
|
|
134
|
+
mouseDownSelection = view.state.selection;
|
|
139
135
|
},
|
|
140
136
|
mouseup: function mouseup(view, e) {
|
|
141
137
|
var initialMouseDownPos = mouseDownPos;
|
|
142
138
|
var selectionChanged = hasSelectionChanged(mouseDownSelection, view.state.selection);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
mouseDownSelection = undefined;
|
|
146
|
-
}
|
|
139
|
+
mouseDownPos = undefined;
|
|
140
|
+
mouseDownSelection = undefined;
|
|
147
141
|
if (!initialMouseDownPos || shouldSkipExperienceStart(view.state.selection)) {
|
|
148
142
|
return;
|
|
149
143
|
}
|
|
150
144
|
var mouseCoordinatesChanged = e.clientX !== initialMouseDownPos.x || e.clientY !== initialMouseDownPos.y;
|
|
151
|
-
if (mouseCoordinatesChanged &&
|
|
145
|
+
if (mouseCoordinatesChanged && selectionChanged) {
|
|
152
146
|
experience.start({
|
|
153
147
|
method: START_METHOD.MOUSE_UP
|
|
154
148
|
});
|
|
@@ -163,7 +157,7 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
163
157
|
});
|
|
164
158
|
},
|
|
165
159
|
keydown: function keydown(_view, event) {
|
|
166
|
-
shiftArrowKeyPressed =
|
|
160
|
+
shiftArrowKeyPressed = isPlainShiftArrowKey(event) && !isSelectionToolbarWithinNode(getTarget());
|
|
167
161
|
},
|
|
168
162
|
keyup: function keyup() {
|
|
169
163
|
shiftArrowKeyPressed = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.10",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,9 +43,6 @@
|
|
|
43
43
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
44
44
|
},
|
|
45
45
|
"platform-feature-flags": {
|
|
46
|
-
"platform_editor_toolbar_intent_fix": {
|
|
47
|
-
"type": "boolean"
|
|
48
|
-
},
|
|
49
46
|
"platform_editor_blocks_patch_7": {
|
|
50
47
|
"type": "boolean",
|
|
51
48
|
"referenceOnly": true
|