@atlaskit/editor-plugin-toolbar 19.0.9 → 19.0.11
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/afm-products/tsconfig.json +0 -3
- package/dist/cjs/pm-plugins/experiences/selection-toolbar-open-experience.js +7 -13
- package/dist/cjs/toolbarPlugin.js +3 -4
- package/dist/es2019/pm-plugins/experiences/selection-toolbar-open-experience.js +7 -13
- package/dist/es2019/toolbarPlugin.js +3 -4
- package/dist/esm/pm-plugins/experiences/selection-toolbar-open-experience.js +7 -13
- package/dist/esm/toolbarPlugin.js +3 -4
- package/package.json +1 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 19.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`feeef61c773db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/feeef61c773db) -
|
|
8
|
+
Clean up feature gate `platform_editor_blocks_patch_7`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 19.0.10
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`41f0abe038464`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/41f0abe038464) -
|
|
16
|
+
Clean up feature gate `platform_editor_toolbar_intent_fix`
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 19.0.9
|
|
4
20
|
|
|
5
21
|
### 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;
|
|
@@ -15,7 +15,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
16
|
var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
|
|
17
17
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
18
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
18
|
var _selectionToolbarOpenExperience = require("./pm-plugins/experiences/selection-toolbar-open-experience");
|
|
20
19
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
21
20
|
var _consts = require("./ui/consts");
|
|
@@ -203,8 +202,8 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
203
202
|
// Prevent outside clicks from reopening a blurred editor's toolbar.
|
|
204
203
|
var _editorViewModePlugin = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
|
|
205
204
|
var _isViewModeEnabled = (_editorViewModePlugin === null || _editorViewModePlugin === void 0 ? void 0 : _editorViewModePlugin.mode) === 'view';
|
|
206
|
-
// Include focus in nested editable islands
|
|
207
|
-
var _hasEditorFocus =
|
|
205
|
+
// Include focus in nested editable islands.
|
|
206
|
+
var _hasEditorFocus = _view.hasFocus() || _view.dom.contains(_view.root.activeElement);
|
|
208
207
|
var shouldShowToolbar = _isViewModeEnabled ? isMouseUpInEditor || isMouseUpInOwnedToolbar : _hasEditorFocus || isMouseUpInOwnedToolbar;
|
|
209
208
|
var currentShouldShowToolbar = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || (_api$toolbar = _api$toolbar.sharedState.currentState()) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.shouldShowToolbar;
|
|
210
209
|
if (currentShouldShowToolbar !== shouldShowToolbar) {
|
|
@@ -225,7 +224,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
225
224
|
// Focus can sit inside a nested editable region ProseMirror does not own -
|
|
226
225
|
// such as a reference synced block's island - where `view.hasFocus()` is
|
|
227
226
|
// false but the user is still interacting with the editor.
|
|
228
|
-
var hasEditorFocus =
|
|
227
|
+
var hasEditorFocus = _view.hasFocus() || _view.dom.contains(_view.root.activeElement);
|
|
229
228
|
_view.dispatch(_view.state.tr.setMeta(_pluginKey.editorToolbarPluginKey, {
|
|
230
229
|
shouldShowToolbar: !isViewModeEnabled ? hasEditorFocus || isInToolbar || isInPortal : true
|
|
231
230
|
}));
|
|
@@ -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;
|
|
@@ -5,7 +5,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
8
|
import { getSelectionToolbarOpenExperiencePlugin } from './pm-plugins/experiences/selection-toolbar-open-experience';
|
|
10
9
|
import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
11
10
|
import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
|
|
@@ -195,8 +194,8 @@ export const toolbarPlugin = ({
|
|
|
195
194
|
// Prevent outside clicks from reopening a blurred editor's toolbar.
|
|
196
195
|
const editorViewModePlugin = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
|
|
197
196
|
const isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
198
|
-
// Include focus in nested editable islands
|
|
199
|
-
const hasEditorFocus =
|
|
197
|
+
// Include focus in nested editable islands.
|
|
198
|
+
const hasEditorFocus = view.hasFocus() || view.dom.contains(view.root.activeElement);
|
|
200
199
|
const shouldShowToolbar = isViewModeEnabled ? isMouseUpInEditor || isMouseUpInOwnedToolbar : hasEditorFocus || isMouseUpInOwnedToolbar;
|
|
201
200
|
const currentShouldShowToolbar = api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : (_api$toolbar$sharedSt = _api$toolbar.sharedState.currentState()) === null || _api$toolbar$sharedSt === void 0 ? void 0 : _api$toolbar$sharedSt.shouldShowToolbar;
|
|
202
201
|
if (currentShouldShowToolbar !== shouldShowToolbar) {
|
|
@@ -217,7 +216,7 @@ export const toolbarPlugin = ({
|
|
|
217
216
|
// Focus can sit inside a nested editable region ProseMirror does not own -
|
|
218
217
|
// such as a reference synced block's island - where `view.hasFocus()` is
|
|
219
218
|
// false but the user is still interacting with the editor.
|
|
220
|
-
const hasEditorFocus =
|
|
219
|
+
const hasEditorFocus = view.hasFocus() || view.dom.contains(view.root.activeElement);
|
|
221
220
|
view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
|
|
222
221
|
shouldShowToolbar: !isViewModeEnabled ? hasEditorFocus || isInToolbar || isInPortal : true
|
|
223
222
|
}));
|
|
@@ -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;
|
|
@@ -11,7 +11,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
11
11
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
13
13
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
14
|
import { getSelectionToolbarOpenExperiencePlugin } from './pm-plugins/experiences/selection-toolbar-open-experience';
|
|
16
15
|
import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
17
16
|
import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
|
|
@@ -196,8 +195,8 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
196
195
|
// Prevent outside clicks from reopening a blurred editor's toolbar.
|
|
197
196
|
var _editorViewModePlugin = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
|
|
198
197
|
var _isViewModeEnabled = (_editorViewModePlugin === null || _editorViewModePlugin === void 0 ? void 0 : _editorViewModePlugin.mode) === 'view';
|
|
199
|
-
// Include focus in nested editable islands
|
|
200
|
-
var _hasEditorFocus =
|
|
198
|
+
// Include focus in nested editable islands.
|
|
199
|
+
var _hasEditorFocus = _view.hasFocus() || _view.dom.contains(_view.root.activeElement);
|
|
201
200
|
var shouldShowToolbar = _isViewModeEnabled ? isMouseUpInEditor || isMouseUpInOwnedToolbar : _hasEditorFocus || isMouseUpInOwnedToolbar;
|
|
202
201
|
var currentShouldShowToolbar = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || (_api$toolbar = _api$toolbar.sharedState.currentState()) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.shouldShowToolbar;
|
|
203
202
|
if (currentShouldShowToolbar !== shouldShowToolbar) {
|
|
@@ -218,7 +217,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
218
217
|
// Focus can sit inside a nested editable region ProseMirror does not own -
|
|
219
218
|
// such as a reference synced block's island - where `view.hasFocus()` is
|
|
220
219
|
// false but the user is still interacting with the editor.
|
|
221
|
-
var hasEditorFocus =
|
|
220
|
+
var hasEditorFocus = _view.hasFocus() || _view.dom.contains(_view.root.activeElement);
|
|
222
221
|
_view.dispatch(_view.state.tr.setMeta(editorToolbarPluginKey, {
|
|
223
222
|
shouldShowToolbar: !isViewModeEnabled ? hasEditorFocus || isInToolbar || isInPortal : true
|
|
224
223
|
}));
|
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.11",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
33
33
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
34
34
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
35
|
-
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
36
35
|
"@atlaskit/tmp-editor-statsig": "^218.0.0",
|
|
37
36
|
"@babel/runtime": "^7.0.0",
|
|
38
37
|
"bind-event-listener": "^3.0.0"
|
|
@@ -42,15 +41,6 @@
|
|
|
42
41
|
"react": "^18.2.0 || ^19.2.0",
|
|
43
42
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
44
43
|
},
|
|
45
|
-
"platform-feature-flags": {
|
|
46
|
-
"platform_editor_toolbar_intent_fix": {
|
|
47
|
-
"type": "boolean"
|
|
48
|
-
},
|
|
49
|
-
"platform_editor_blocks_patch_7": {
|
|
50
|
-
"type": "boolean",
|
|
51
|
-
"referenceOnly": true
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
44
|
"devDependencies": {
|
|
55
45
|
"react": "^19.2.0",
|
|
56
46
|
"react-intl": "^7.0.0"
|