@atlaskit/editor-plugin-selection-toolbar 4.3.3 → 4.3.5
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 +12 -0
- package/dist/cjs/selectionToolbarPlugin.js +18 -4
- package/dist/es2019/selectionToolbarPlugin.js +19 -4
- package/dist/esm/selectionToolbarPlugin.js +18 -4
- package/dist/types/selectionToolbarPluginType.d.ts +3 -1
- package/dist/types-ts4.5/selectionToolbarPluginType.d.ts +3 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
18
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
20
|
var _commands = require("./pm-plugins/commands");
|
|
20
21
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
@@ -139,8 +140,16 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
139
140
|
},
|
|
140
141
|
apply: function apply(tr, pluginState) {
|
|
141
142
|
var meta = tr.getMeta(_pluginKey.selectionToolbarPluginKey);
|
|
143
|
+
var newPluginState = pluginState;
|
|
142
144
|
if (meta) {
|
|
143
|
-
return _objectSpread(_objectSpread({},
|
|
145
|
+
return _objectSpread(_objectSpread({}, newPluginState), meta);
|
|
146
|
+
}
|
|
147
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
148
|
+
var _api$userIntent;
|
|
149
|
+
var isBlockMenuOpen = (api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'blockMenuOpen';
|
|
150
|
+
newPluginState = _objectSpread(_objectSpread({}, newPluginState), {}, {
|
|
151
|
+
isBlockMenuOpen: isBlockMenuOpen
|
|
152
|
+
});
|
|
144
153
|
}
|
|
145
154
|
|
|
146
155
|
// if the toolbarDockingInitialPosition preference has changed
|
|
@@ -152,13 +161,13 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
152
161
|
previousToolbarDocking = toolbarDockingPreference;
|
|
153
162
|
var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
|
|
154
163
|
if (pluginState.toolbarDocking !== userToolbarDockingPref) {
|
|
155
|
-
return _objectSpread(_objectSpread({},
|
|
164
|
+
return _objectSpread(_objectSpread({}, newPluginState), {}, {
|
|
156
165
|
toolbarDocking: userToolbarDockingPref
|
|
157
166
|
});
|
|
158
167
|
}
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
|
-
return
|
|
170
|
+
return newPluginState;
|
|
162
171
|
}
|
|
163
172
|
},
|
|
164
173
|
view: function view(_view) {
|
|
@@ -236,7 +245,8 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
236
245
|
var _ref3 = _pluginKey.selectionToolbarPluginKey.getState(state),
|
|
237
246
|
selectionStable = _ref3.selectionStable,
|
|
238
247
|
hide = _ref3.hide,
|
|
239
|
-
toolbarDocking = _ref3.toolbarDocking
|
|
248
|
+
toolbarDocking = _ref3.toolbarDocking,
|
|
249
|
+
isBlockMenuOpen = _ref3.isBlockMenuOpen;
|
|
240
250
|
var isCellSelection = ('$anchorCell' in state.selection);
|
|
241
251
|
var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
|
|
242
252
|
if (state.selection.empty || !selectionStable || hide || state.selection instanceof _state.NodeSelection ||
|
|
@@ -255,6 +265,10 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
255
265
|
return;
|
|
256
266
|
}
|
|
257
267
|
}
|
|
268
|
+
if (isBlockMenuOpen && isEditorControlsEnabled && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
269
|
+
// If the block menu is open, do not show the selection toolbar.
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
258
272
|
|
|
259
273
|
// Resolve the selectionToolbarHandlers to a list of SelectionToolbarGroups
|
|
260
274
|
// and filter out any handlers which returned undefined
|
|
@@ -6,6 +6,7 @@ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellS
|
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { setToolbarDocking, toggleToolbar, updateToolbarDocking, forceToolbarDockingWithoutAnalytics } from './pm-plugins/commands';
|
|
11
12
|
import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
@@ -132,12 +133,21 @@ export const selectionToolbarPlugin = ({
|
|
|
132
133
|
},
|
|
133
134
|
apply(tr, pluginState) {
|
|
134
135
|
const meta = tr.getMeta(selectionToolbarPluginKey);
|
|
136
|
+
let newPluginState = pluginState;
|
|
135
137
|
if (meta) {
|
|
136
138
|
return {
|
|
137
|
-
...
|
|
139
|
+
...newPluginState,
|
|
138
140
|
...meta
|
|
139
141
|
};
|
|
140
142
|
}
|
|
143
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
144
|
+
var _api$userIntent, _api$userIntent$share;
|
|
145
|
+
const isBlockMenuOpen = (api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) === 'blockMenuOpen';
|
|
146
|
+
newPluginState = {
|
|
147
|
+
...newPluginState,
|
|
148
|
+
isBlockMenuOpen
|
|
149
|
+
};
|
|
150
|
+
}
|
|
141
151
|
|
|
142
152
|
// if the toolbarDockingInitialPosition preference has changed
|
|
143
153
|
// update the toolbarDocking state
|
|
@@ -149,13 +159,13 @@ export const selectionToolbarPlugin = ({
|
|
|
149
159
|
const userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
|
|
150
160
|
if (pluginState.toolbarDocking !== userToolbarDockingPref) {
|
|
151
161
|
return {
|
|
152
|
-
...
|
|
162
|
+
...newPluginState,
|
|
153
163
|
toolbarDocking: userToolbarDockingPref
|
|
154
164
|
};
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
|
-
return
|
|
168
|
+
return newPluginState;
|
|
159
169
|
}
|
|
160
170
|
},
|
|
161
171
|
view(view) {
|
|
@@ -233,7 +243,8 @@ export const selectionToolbarPlugin = ({
|
|
|
233
243
|
const {
|
|
234
244
|
selectionStable,
|
|
235
245
|
hide,
|
|
236
|
-
toolbarDocking
|
|
246
|
+
toolbarDocking,
|
|
247
|
+
isBlockMenuOpen
|
|
237
248
|
} = selectionToolbarPluginKey.getState(state);
|
|
238
249
|
const isCellSelection = ('$anchorCell' in state.selection);
|
|
239
250
|
const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
@@ -253,6 +264,10 @@ export const selectionToolbarPlugin = ({
|
|
|
253
264
|
return;
|
|
254
265
|
}
|
|
255
266
|
}
|
|
267
|
+
if (isBlockMenuOpen && isEditorControlsEnabled && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
268
|
+
// If the block menu is open, do not show the selection toolbar.
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
256
271
|
|
|
257
272
|
// Resolve the selectionToolbarHandlers to a list of SelectionToolbarGroups
|
|
258
273
|
// and filter out any handlers which returned undefined
|
|
@@ -10,6 +10,7 @@ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellS
|
|
|
10
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
13
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import { setToolbarDocking as _setToolbarDocking, toggleToolbar, updateToolbarDocking, forceToolbarDockingWithoutAnalytics as _forceToolbarDockingWithoutAnalytics } from './pm-plugins/commands';
|
|
15
16
|
import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
@@ -132,8 +133,16 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
132
133
|
},
|
|
133
134
|
apply: function apply(tr, pluginState) {
|
|
134
135
|
var meta = tr.getMeta(selectionToolbarPluginKey);
|
|
136
|
+
var newPluginState = pluginState;
|
|
135
137
|
if (meta) {
|
|
136
|
-
return _objectSpread(_objectSpread({},
|
|
138
|
+
return _objectSpread(_objectSpread({}, newPluginState), meta);
|
|
139
|
+
}
|
|
140
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
141
|
+
var _api$userIntent;
|
|
142
|
+
var isBlockMenuOpen = (api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'blockMenuOpen';
|
|
143
|
+
newPluginState = _objectSpread(_objectSpread({}, newPluginState), {}, {
|
|
144
|
+
isBlockMenuOpen: isBlockMenuOpen
|
|
145
|
+
});
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
// if the toolbarDockingInitialPosition preference has changed
|
|
@@ -145,13 +154,13 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
145
154
|
previousToolbarDocking = toolbarDockingPreference;
|
|
146
155
|
var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
|
|
147
156
|
if (pluginState.toolbarDocking !== userToolbarDockingPref) {
|
|
148
|
-
return _objectSpread(_objectSpread({},
|
|
157
|
+
return _objectSpread(_objectSpread({}, newPluginState), {}, {
|
|
149
158
|
toolbarDocking: userToolbarDockingPref
|
|
150
159
|
});
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
}
|
|
154
|
-
return
|
|
163
|
+
return newPluginState;
|
|
155
164
|
}
|
|
156
165
|
},
|
|
157
166
|
view: function view(_view) {
|
|
@@ -229,7 +238,8 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
229
238
|
var _ref3 = selectionToolbarPluginKey.getState(state),
|
|
230
239
|
selectionStable = _ref3.selectionStable,
|
|
231
240
|
hide = _ref3.hide,
|
|
232
|
-
toolbarDocking = _ref3.toolbarDocking
|
|
241
|
+
toolbarDocking = _ref3.toolbarDocking,
|
|
242
|
+
isBlockMenuOpen = _ref3.isBlockMenuOpen;
|
|
233
243
|
var isCellSelection = ('$anchorCell' in state.selection);
|
|
234
244
|
var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
235
245
|
if (state.selection.empty || !selectionStable || hide || state.selection instanceof NodeSelection ||
|
|
@@ -248,6 +258,10 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
248
258
|
return;
|
|
249
259
|
}
|
|
250
260
|
}
|
|
261
|
+
if (isBlockMenuOpen && isEditorControlsEnabled && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
262
|
+
// If the block menu is open, do not show the selection toolbar.
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
251
265
|
|
|
252
266
|
// Resolve the selectionToolbarHandlers to a list of SelectionToolbarGroups
|
|
253
267
|
// and filter out any handlers which returned undefined
|
|
@@ -5,6 +5,7 @@ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
|
5
5
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
6
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
7
7
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
8
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
8
9
|
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
9
10
|
import type { ToolbarDocking } from './types';
|
|
10
11
|
export type SelectionToolbarPluginOptions = {
|
|
@@ -25,7 +26,8 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
|
|
|
25
26
|
OptionalPlugin<BlockControlsPlugin>,
|
|
26
27
|
OptionalPlugin<ConnectivityPlugin>,
|
|
27
28
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
28
|
-
OptionalPlugin<ToolbarPlugin
|
|
29
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
30
|
+
OptionalPlugin<UserIntentPlugin>
|
|
29
31
|
];
|
|
30
32
|
actions?: {
|
|
31
33
|
suppressToolbar?: () => boolean;
|
|
@@ -5,6 +5,7 @@ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
|
5
5
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
6
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
7
7
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
8
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
8
9
|
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
9
10
|
import type { ToolbarDocking } from './types';
|
|
10
11
|
export type SelectionToolbarPluginOptions = {
|
|
@@ -25,7 +26,8 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
|
|
|
25
26
|
OptionalPlugin<BlockControlsPlugin>,
|
|
26
27
|
OptionalPlugin<ConnectivityPlugin>,
|
|
27
28
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
28
|
-
OptionalPlugin<ToolbarPlugin
|
|
29
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
30
|
+
OptionalPlugin<UserIntentPlugin>
|
|
29
31
|
];
|
|
30
32
|
actions?: {
|
|
31
33
|
suppressToolbar?: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.5",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-toolbar": "^0.2.0",
|
|
42
|
+
"@atlaskit/editor-plugin-user-intent": "^1.1.0",
|
|
42
43
|
"@atlaskit/editor-plugin-user-preferences": "^1.2.0",
|
|
43
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
45
|
"@atlaskit/editor-toolbar": "^0.3.0",
|
|
@@ -47,13 +48,13 @@
|
|
|
47
48
|
"@atlaskit/icon-lab": "^5.6.0",
|
|
48
49
|
"@atlaskit/menu": "^8.3.0",
|
|
49
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^11.0.0",
|
|
51
52
|
"@atlaskit/tokens": "^6.0.0",
|
|
52
53
|
"@babel/runtime": "^7.0.0",
|
|
53
54
|
"bind-event-listener": "^3.0.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^107.
|
|
57
|
+
"@atlaskit/editor-common": "^107.25.0",
|
|
57
58
|
"react": "^18.2.0",
|
|
58
59
|
"react-dom": "^18.2.0",
|
|
59
60
|
"react-intl-next": "npm:react-intl@^5.18.1"
|