@atlaskit/editor-plugin-floating-toolbar 3.6.1 → 4.0.0
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 +15 -0
- package/dist/cjs/floatingToolbarPlugin.js +20 -6
- package/dist/es2019/floatingToolbarPlugin.js +21 -6
- package/dist/esm/floatingToolbarPlugin.js +20 -6
- package/dist/types/floatingToolbarPluginType.d.ts +3 -3
- package/dist/types-ts4.5/floatingToolbarPluginType.d.ts +3 -3
- package/package.json +11 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#141095](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/141095)
|
|
8
|
+
[`c12941b65dc2a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c12941b65dc2a) -
|
|
9
|
+
**WHAT**: Remove `@atlaskit/editor-plugin-block-controls` as a dependency from
|
|
10
|
+
`@atlaskit/editor-plugin-floating-toolbar`. Add `@atlaskit/editor-plugin-user-intent` as a
|
|
11
|
+
dependency and replace isDragging check from block controls with this user intention current
|
|
12
|
+
intention check.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.6.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -212,10 +212,13 @@ function ContentComponent(_ref5) {
|
|
|
212
212
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
213
213
|
providerFactory = _ref5.providerFactory,
|
|
214
214
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
215
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', '
|
|
215
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
216
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
217
|
+
'blockControls']),
|
|
216
218
|
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
217
219
|
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
218
220
|
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
221
|
+
userIntentState = _useSharedPluginState.userIntentState,
|
|
219
222
|
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
220
223
|
var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
221
224
|
configWithNodeInfo = _ref6.configWithNodeInfo,
|
|
@@ -223,11 +226,22 @@ function ContentComponent(_ref5) {
|
|
|
223
226
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
224
227
|
return null;
|
|
225
228
|
}
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_user_intent_plugin')) {
|
|
230
|
+
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging') {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// TODO: ED-27539 - This feature is unreleased and rendering logic needs to be move userIntentState which is not ready yet
|
|
235
|
+
// if (blockControlsState?.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
236
|
+
// return null;
|
|
237
|
+
// }
|
|
238
|
+
} else {
|
|
239
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
231
245
|
}
|
|
232
246
|
var config = configWithNodeInfo.config,
|
|
233
247
|
node = configWithNodeInfo.node;
|
|
@@ -198,8 +198,12 @@ export function ContentComponent({
|
|
|
198
198
|
floatingToolbarState,
|
|
199
199
|
editorDisabledState,
|
|
200
200
|
editorViewModeState,
|
|
201
|
+
userIntentState,
|
|
202
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
201
203
|
blockControlsState
|
|
202
|
-
} = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', '
|
|
204
|
+
} = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
205
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
206
|
+
'blockControls']);
|
|
203
207
|
const {
|
|
204
208
|
configWithNodeInfo,
|
|
205
209
|
floatingToolbarData
|
|
@@ -207,11 +211,22 @@ export function ContentComponent({
|
|
|
207
211
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
208
212
|
return null;
|
|
209
213
|
}
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
if (fg('platform_editor_user_intent_plugin')) {
|
|
215
|
+
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging') {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// TODO: ED-27539 - This feature is unreleased and rendering logic needs to be move userIntentState which is not ready yet
|
|
220
|
+
// if (blockControlsState?.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
221
|
+
// return null;
|
|
222
|
+
// }
|
|
223
|
+
} else {
|
|
224
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
215
230
|
}
|
|
216
231
|
const {
|
|
217
232
|
config,
|
|
@@ -200,10 +200,13 @@ export function ContentComponent(_ref5) {
|
|
|
200
200
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
201
201
|
providerFactory = _ref5.providerFactory,
|
|
202
202
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
203
|
-
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', '
|
|
203
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
204
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
205
|
+
'blockControls']),
|
|
204
206
|
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
205
207
|
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
206
208
|
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
209
|
+
userIntentState = _useSharedPluginState.userIntentState,
|
|
207
210
|
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
208
211
|
var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
209
212
|
configWithNodeInfo = _ref6.configWithNodeInfo,
|
|
@@ -211,11 +214,22 @@ export function ContentComponent(_ref5) {
|
|
|
211
214
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
212
215
|
return null;
|
|
213
216
|
}
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
if (fg('platform_editor_user_intent_plugin')) {
|
|
218
|
+
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging') {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// TODO: ED-27539 - This feature is unreleased and rendering logic needs to be move userIntentState which is not ready yet
|
|
223
|
+
// if (blockControlsState?.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
224
|
+
// return null;
|
|
225
|
+
// }
|
|
226
|
+
} else {
|
|
227
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
219
233
|
}
|
|
220
234
|
var config = configWithNodeInfo.config,
|
|
221
235
|
node = configWithNodeInfo.node;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { FloatingToolbarConfig, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
2
|
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
4
3
|
import type { CopyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
|
|
5
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -8,6 +7,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
|
|
|
8
7
|
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
9
8
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
10
9
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
11
11
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
12
12
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
export type ConfigWithNodeInfo = {
|
|
@@ -33,9 +33,9 @@ export type FloatingToolbarPluginDependencies = [
|
|
|
33
33
|
CopyButtonPlugin,
|
|
34
34
|
EditorDisabledPlugin,
|
|
35
35
|
OptionalPlugin<EditorViewModePlugin>,
|
|
36
|
-
OptionalPlugin<BlockControlsPlugin>,
|
|
37
36
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
38
|
-
OptionalPlugin<EmojiPlugin
|
|
37
|
+
OptionalPlugin<EmojiPlugin>,
|
|
38
|
+
OptionalPlugin<UserIntentPlugin>
|
|
39
39
|
];
|
|
40
40
|
export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
|
|
41
41
|
dependencies: FloatingToolbarPluginDependencies;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { FloatingToolbarConfig, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
2
|
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
4
3
|
import type { CopyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
|
|
5
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -8,6 +7,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
|
|
|
8
7
|
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
9
8
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
10
9
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
11
11
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
12
12
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
export type ConfigWithNodeInfo = {
|
|
@@ -33,9 +33,9 @@ export type FloatingToolbarPluginDependencies = [
|
|
|
33
33
|
CopyButtonPlugin,
|
|
34
34
|
EditorDisabledPlugin,
|
|
35
35
|
OptionalPlugin<EditorViewModePlugin>,
|
|
36
|
-
OptionalPlugin<BlockControlsPlugin>,
|
|
37
36
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
38
|
-
OptionalPlugin<EmojiPlugin
|
|
37
|
+
OptionalPlugin<EmojiPlugin>,
|
|
38
|
+
OptionalPlugin<UserIntentPlugin>
|
|
39
39
|
];
|
|
40
40
|
export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
|
|
41
41
|
dependencies: FloatingToolbarPluginDependencies;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,28 +28,28 @@
|
|
|
28
28
|
"@atlaskit/adf-utils": "^19.19.0",
|
|
29
29
|
"@atlaskit/button": "^23.0.0",
|
|
30
30
|
"@atlaskit/checkbox": "^17.0.0",
|
|
31
|
-
"@atlaskit/editor-common": "^103.
|
|
31
|
+
"@atlaskit/editor-common": "^103.11.0",
|
|
32
32
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
33
|
-
"@atlaskit/editor-plugin-block-controls": "^3.8.0",
|
|
34
33
|
"@atlaskit/editor-plugin-context-panel": "^4.0.0",
|
|
35
34
|
"@atlaskit/editor-plugin-copy-button": "^2.0.0",
|
|
36
35
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
37
36
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
38
37
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
|
|
39
|
-
"@atlaskit/editor-plugin-emoji": "^3.
|
|
38
|
+
"@atlaskit/editor-plugin-emoji": "^3.6.0",
|
|
40
39
|
"@atlaskit/editor-plugin-extension": "^5.2.0",
|
|
41
|
-
"@atlaskit/editor-plugin-table": "^10.
|
|
40
|
+
"@atlaskit/editor-plugin-table": "^10.8.0",
|
|
41
|
+
"@atlaskit/editor-plugin-user-intent": "^0.1.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/emoji": "^69.0.0",
|
|
44
|
-
"@atlaskit/icon": "^25.
|
|
44
|
+
"@atlaskit/icon": "^25.6.0",
|
|
45
45
|
"@atlaskit/menu": "^3.2.0",
|
|
46
46
|
"@atlaskit/modal-dialog": "^14.1.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
48
|
"@atlaskit/primitives": "^14.4.0",
|
|
49
49
|
"@atlaskit/select": "^20.3.0",
|
|
50
50
|
"@atlaskit/theme": "^18.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
52
|
-
"@atlaskit/tokens": "^4.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^4.12.0",
|
|
52
|
+
"@atlaskit/tokens": "^4.8.0",
|
|
53
53
|
"@atlaskit/tooltip": "^20.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
@@ -137,6 +137,9 @@
|
|
|
137
137
|
},
|
|
138
138
|
"platform_editor_controls_patch_4": {
|
|
139
139
|
"type": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"platform_editor_user_intent_plugin": {
|
|
142
|
+
"type": "boolean"
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
}
|