@atlaskit/editor-plugin-toolbar 3.3.0 → 3.3.1
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 +11 -3
- package/dist/cjs/pm-plugins/experiences/ContextualToolbarOpenExperience.js +73 -0
- package/dist/cjs/toolbarPlugin.js +8 -1
- package/dist/cjs/ui/SelectionToolbar/index.js +3 -1
- package/dist/es2019/pm-plugins/experiences/ContextualToolbarOpenExperience.js +61 -0
- package/dist/es2019/toolbarPlugin.js +6 -2
- package/dist/es2019/ui/SelectionToolbar/index.js +3 -1
- package/dist/esm/pm-plugins/experiences/ContextualToolbarOpenExperience.js +66 -0
- package/dist/esm/toolbarPlugin.js +9 -2
- package/dist/esm/ui/SelectionToolbar/index.js +3 -1
- package/dist/types/pm-plugins/experiences/ContextualToolbarOpenExperience.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/experiences/ContextualToolbarOpenExperience.d.ts +5 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`916133ef0c6dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/916133ef0c6dd) -
|
|
8
|
+
[ux] Editor experience tracking foundation
|
|
9
|
+
- [`4f5569bde5e64`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4f5569bde5e64) -
|
|
10
|
+
Add new 'dragHandleSelected' user intent, use this to control table toolbar when drag handle is
|
|
11
|
+
selected
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 3.3.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -285,7 +296,6 @@
|
|
|
285
296
|
|
|
286
297
|
- [`286abb4d35eba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/286abb4d35eba) -
|
|
287
298
|
[ux] [ED-28960] Finish full page primary toolbar migration
|
|
288
|
-
|
|
289
299
|
- Align with design update (separator, gap, height, icon size)
|
|
290
300
|
- Add keyboard shortcut to focus toolbar and arrow key navigation
|
|
291
301
|
- Address accessibility
|
|
@@ -323,7 +333,6 @@
|
|
|
323
333
|
|
|
324
334
|
- [`3145f278b1f7a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3145f278b1f7a) -
|
|
325
335
|
[ux] [ED-28473] minor UI updates for editor-toolbar
|
|
326
|
-
|
|
327
336
|
- Use ADS ButtonGroup for ToolbarButtonGroup
|
|
328
337
|
- Remove groupLocation prop and use CSS instead
|
|
329
338
|
- Use DropdownItemGroup for ToolbarDropdownItemSection and expand props for section separator and
|
|
@@ -355,7 +364,6 @@
|
|
|
355
364
|
[`22cab8325fc62`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/22cab8325fc62) -
|
|
356
365
|
[ux] [ED-28760] Fix editor lose focus and hence editing flow is interrupted. This is done for 2
|
|
357
366
|
components
|
|
358
|
-
|
|
359
367
|
- Dropdown
|
|
360
368
|
- Create context ToolbarUIContext for toolbar consumers to access consumer specific state and
|
|
361
369
|
callbacks
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _experiences = require("@atlaskit/editor-common/experiences");
|
|
10
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
var pluginKey = new _state.PluginKey('contextualToolbarOpenExperience');
|
|
15
|
+
var _default = exports.default = function _default() {
|
|
16
|
+
var contextualToolbarOpenExperience = new _experiences.Experience('platform-editor-contextual-toolbar-open-experience', {
|
|
17
|
+
checks: [new _experiences.ExperienceCheckTimeout(500), new _experiences.ExperienceCheckDomMutation({
|
|
18
|
+
onDomMutation: function onDomMutation(_ref) {
|
|
19
|
+
var mutations = _ref.mutations;
|
|
20
|
+
if (mutations.some(isMutationAddingContextualToolbar)) {
|
|
21
|
+
return {
|
|
22
|
+
status: 'success'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
observeConfig: function observeConfig() {
|
|
27
|
+
return {
|
|
28
|
+
target: document.body,
|
|
29
|
+
options: {
|
|
30
|
+
childList: true,
|
|
31
|
+
subtree: true
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
return new _safePlugin.SafePlugin({
|
|
38
|
+
key: pluginKey,
|
|
39
|
+
state: {
|
|
40
|
+
init: function init() {
|
|
41
|
+
return {
|
|
42
|
+
shouldShowContextualToolbar: false
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
apply: function apply(_tr, pluginState, _, newState) {
|
|
46
|
+
var isTextSelection = newState.selection instanceof _state.TextSelection;
|
|
47
|
+
var isNotEmptySelection = !newState.selection.empty;
|
|
48
|
+
var shouldShowContextualToolbar = isTextSelection && isNotEmptySelection;
|
|
49
|
+
if (shouldShowContextualToolbar && !pluginState.shouldShowContextualToolbar) {
|
|
50
|
+
contextualToolbarOpenExperience.start();
|
|
51
|
+
} else if (!shouldShowContextualToolbar && pluginState.shouldShowContextualToolbar) {
|
|
52
|
+
contextualToolbarOpenExperience.abort();
|
|
53
|
+
}
|
|
54
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
55
|
+
shouldShowContextualToolbar: shouldShowContextualToolbar
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
view: function view() {
|
|
60
|
+
return {
|
|
61
|
+
destroy: function destroy() {
|
|
62
|
+
contextualToolbarOpenExperience.abort();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
var isMutationAddingContextualToolbar = function isMutationAddingContextualToolbar(mutation) {
|
|
69
|
+
return mutation.type === 'childList' && Array.from(mutation.addedNodes).some(nodeIncludesContextualToolbar);
|
|
70
|
+
};
|
|
71
|
+
var nodeIncludesContextualToolbar = function nodeIncludesContextualToolbar(node) {
|
|
72
|
+
return node instanceof HTMLElement && node.getAttribute('data-testid') === 'popup-wrapper' && node.querySelector('[data-testid="text-section"]');
|
|
73
|
+
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.toolbarPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
|
10
11
|
var _bindEventListener = require("bind-event-listener");
|
|
11
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
@@ -14,6 +15,7 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
14
15
|
var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
|
|
15
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
|
+
var _ContextualToolbarOpenExperience = _interopRequireDefault(require("./pm-plugins/experiences/ContextualToolbarOpenExperience"));
|
|
17
19
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
18
20
|
var _consts = require("./ui/consts");
|
|
19
21
|
var _SelectionToolbar = require("./ui/SelectionToolbar");
|
|
@@ -177,7 +179,12 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
177
179
|
}
|
|
178
180
|
});
|
|
179
181
|
}
|
|
180
|
-
}]
|
|
182
|
+
}].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
183
|
+
name: 'contextualToolbarOpenExperience',
|
|
184
|
+
plugin: function plugin() {
|
|
185
|
+
return (0, _ContextualToolbarOpenExperience.default)();
|
|
186
|
+
}
|
|
187
|
+
}] : []));
|
|
181
188
|
},
|
|
182
189
|
contentComponent: !disableSelectionToolbar ? function (_ref2) {
|
|
183
190
|
var editorView = _ref2.editorView,
|
|
@@ -137,7 +137,9 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
137
137
|
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && editorToolbarDockingPreference === 'top' && disableSelectionToolbarWhenPinned || !components || !toolbar) {
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
|
-
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ||
|
|
140
|
+
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_user_intent_fix') ?
|
|
141
|
+
// hide toolbar when user intent is not default, except when it's dragHandleSelected without cell selection
|
|
142
|
+
currentUserIntent && currentUserIntent !== 'default' && !(currentUserIntent === 'dragHandleSelected' && !isCellSelection) : currentUserIntent && currentUserIntent !== 'default') || (0, _coreUtils.isSSR)()) {
|
|
141
143
|
return null;
|
|
142
144
|
}
|
|
143
145
|
return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
const pluginKey = new PluginKey('contextualToolbarOpenExperience');
|
|
5
|
+
export default (() => {
|
|
6
|
+
const contextualToolbarOpenExperience = new Experience('platform-editor-contextual-toolbar-open-experience', {
|
|
7
|
+
checks: [new ExperienceCheckTimeout(500), new ExperienceCheckDomMutation({
|
|
8
|
+
onDomMutation: ({
|
|
9
|
+
mutations
|
|
10
|
+
}) => {
|
|
11
|
+
if (mutations.some(isMutationAddingContextualToolbar)) {
|
|
12
|
+
return {
|
|
13
|
+
status: 'success'
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
observeConfig: () => ({
|
|
18
|
+
target: document.body,
|
|
19
|
+
options: {
|
|
20
|
+
childList: true,
|
|
21
|
+
subtree: true
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
return new SafePlugin({
|
|
27
|
+
key: pluginKey,
|
|
28
|
+
state: {
|
|
29
|
+
init: () => ({
|
|
30
|
+
shouldShowContextualToolbar: false
|
|
31
|
+
}),
|
|
32
|
+
apply: (_tr, pluginState, _, newState) => {
|
|
33
|
+
const isTextSelection = newState.selection instanceof TextSelection;
|
|
34
|
+
const isNotEmptySelection = !newState.selection.empty;
|
|
35
|
+
const shouldShowContextualToolbar = isTextSelection && isNotEmptySelection;
|
|
36
|
+
if (shouldShowContextualToolbar && !pluginState.shouldShowContextualToolbar) {
|
|
37
|
+
contextualToolbarOpenExperience.start();
|
|
38
|
+
} else if (!shouldShowContextualToolbar && pluginState.shouldShowContextualToolbar) {
|
|
39
|
+
contextualToolbarOpenExperience.abort();
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
...pluginState,
|
|
43
|
+
shouldShowContextualToolbar
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
view: () => {
|
|
48
|
+
return {
|
|
49
|
+
destroy: () => {
|
|
50
|
+
contextualToolbarOpenExperience.abort();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
const isMutationAddingContextualToolbar = mutation => {
|
|
57
|
+
return mutation.type === 'childList' && Array.from(mutation.addedNodes).some(nodeIncludesContextualToolbar);
|
|
58
|
+
};
|
|
59
|
+
const nodeIncludesContextualToolbar = node => {
|
|
60
|
+
return node instanceof HTMLElement && node.getAttribute('data-testid') === 'popup-wrapper' && node.querySelector('[data-testid="text-section"]');
|
|
61
|
+
};
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
5
|
+
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
|
+
import contextualToolbarOpenExperience from './pm-plugins/experiences/ContextualToolbarOpenExperience';
|
|
9
10
|
import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
10
11
|
import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
|
|
11
12
|
import { SelectionToolbar, SelectionToolbarWithErrorBoundary } from './ui/SelectionToolbar';
|
|
@@ -169,7 +170,10 @@ export const toolbarPlugin = ({
|
|
|
169
170
|
}
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
|
-
}
|
|
173
|
+
}, ...(expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
174
|
+
name: 'contextualToolbarOpenExperience',
|
|
175
|
+
plugin: () => contextualToolbarOpenExperience()
|
|
176
|
+
}] : [])];
|
|
173
177
|
},
|
|
174
178
|
contentComponent: !disableSelectionToolbar ? ({
|
|
175
179
|
editorView,
|
|
@@ -128,7 +128,9 @@ export const SelectionToolbar = ({
|
|
|
128
128
|
if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && editorToolbarDockingPreference === 'top' && disableSelectionToolbarWhenPinned || !components || !toolbar) {
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ||
|
|
131
|
+
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || (fg('platform_editor_toolbar_aifc_user_intent_fix') ?
|
|
132
|
+
// hide toolbar when user intent is not default, except when it's dragHandleSelected without cell selection
|
|
133
|
+
currentUserIntent && currentUserIntent !== 'default' && !(currentUserIntent === 'dragHandleSelected' && !isCellSelection) : currentUserIntent && currentUserIntent !== 'default') || isSSR()) {
|
|
132
134
|
return null;
|
|
133
135
|
}
|
|
134
136
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
5
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
|
+
import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
var pluginKey = new PluginKey('contextualToolbarOpenExperience');
|
|
8
|
+
export default (function () {
|
|
9
|
+
var contextualToolbarOpenExperience = new Experience('platform-editor-contextual-toolbar-open-experience', {
|
|
10
|
+
checks: [new ExperienceCheckTimeout(500), new ExperienceCheckDomMutation({
|
|
11
|
+
onDomMutation: function onDomMutation(_ref) {
|
|
12
|
+
var mutations = _ref.mutations;
|
|
13
|
+
if (mutations.some(isMutationAddingContextualToolbar)) {
|
|
14
|
+
return {
|
|
15
|
+
status: 'success'
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
observeConfig: function observeConfig() {
|
|
20
|
+
return {
|
|
21
|
+
target: document.body,
|
|
22
|
+
options: {
|
|
23
|
+
childList: true,
|
|
24
|
+
subtree: true
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
return new SafePlugin({
|
|
31
|
+
key: pluginKey,
|
|
32
|
+
state: {
|
|
33
|
+
init: function init() {
|
|
34
|
+
return {
|
|
35
|
+
shouldShowContextualToolbar: false
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
apply: function apply(_tr, pluginState, _, newState) {
|
|
39
|
+
var isTextSelection = newState.selection instanceof TextSelection;
|
|
40
|
+
var isNotEmptySelection = !newState.selection.empty;
|
|
41
|
+
var shouldShowContextualToolbar = isTextSelection && isNotEmptySelection;
|
|
42
|
+
if (shouldShowContextualToolbar && !pluginState.shouldShowContextualToolbar) {
|
|
43
|
+
contextualToolbarOpenExperience.start();
|
|
44
|
+
} else if (!shouldShowContextualToolbar && pluginState.shouldShowContextualToolbar) {
|
|
45
|
+
contextualToolbarOpenExperience.abort();
|
|
46
|
+
}
|
|
47
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
48
|
+
shouldShowContextualToolbar: shouldShowContextualToolbar
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
view: function view() {
|
|
53
|
+
return {
|
|
54
|
+
destroy: function destroy() {
|
|
55
|
+
contextualToolbarOpenExperience.abort();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var isMutationAddingContextualToolbar = function isMutationAddingContextualToolbar(mutation) {
|
|
62
|
+
return mutation.type === 'childList' && Array.from(mutation.addedNodes).some(nodeIncludesContextualToolbar);
|
|
63
|
+
};
|
|
64
|
+
var nodeIncludesContextualToolbar = function nodeIncludesContextualToolbar(node) {
|
|
65
|
+
return node instanceof HTMLElement && node.getAttribute('data-testid') === 'popup-wrapper' && node.querySelector('[data-testid="text-section"]');
|
|
66
|
+
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { bind } from 'bind-event-listener';
|
|
6
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
8
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import {
|
|
9
|
+
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
10
|
import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
|
+
import contextualToolbarOpenExperience from './pm-plugins/experiences/ContextualToolbarOpenExperience';
|
|
12
14
|
import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
13
15
|
import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
|
|
14
16
|
import { SelectionToolbar, SelectionToolbarWithErrorBoundary } from './ui/SelectionToolbar';
|
|
@@ -170,7 +172,12 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
170
172
|
}
|
|
171
173
|
});
|
|
172
174
|
}
|
|
173
|
-
}]
|
|
175
|
+
}].concat(_toConsumableArray(expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
176
|
+
name: 'contextualToolbarOpenExperience',
|
|
177
|
+
plugin: function plugin() {
|
|
178
|
+
return contextualToolbarOpenExperience();
|
|
179
|
+
}
|
|
180
|
+
}] : []));
|
|
174
181
|
},
|
|
175
182
|
contentComponent: !disableSelectionToolbar ? function (_ref2) {
|
|
176
183
|
var editorView = _ref2.editorView,
|
|
@@ -129,7 +129,9 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
|
129
129
|
if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && editorToolbarDockingPreference === 'top' && disableSelectionToolbarWhenPinned || !components || !toolbar) {
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
|
-
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ||
|
|
132
|
+
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || (fg('platform_editor_toolbar_aifc_user_intent_fix') ?
|
|
133
|
+
// hide toolbar when user intent is not default, except when it's dragHandleSelected without cell selection
|
|
134
|
+
currentUserIntent && currentUserIntent !== 'default' && !(currentUserIntent === 'dragHandleSelected' && !isCellSelection) : currentUserIntent && currentUserIntent !== 'default') || isSSR()) {
|
|
133
135
|
return null;
|
|
134
136
|
}
|
|
135
137
|
return /*#__PURE__*/React.createElement(Popup, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
32
|
-
"@atlaskit/editor-plugin-analytics": "^6.
|
|
32
|
+
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
33
33
|
"@atlaskit/editor-plugin-connectivity": "^6.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
@@ -40,18 +40,21 @@
|
|
|
40
40
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags-react": "^0.3.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^13.16.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"bind-event-listener": "^3.0.0",
|
|
46
46
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^110.
|
|
49
|
+
"@atlaskit/editor-common": "^110.15.0",
|
|
50
50
|
"react": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"platform-feature-flags": {
|
|
53
53
|
"platform_editor_toolbar_aifc_patch_7": {
|
|
54
54
|
"type": "boolean"
|
|
55
|
+
},
|
|
56
|
+
"platform_editor_toolbar_aifc_user_intent_fix": {
|
|
57
|
+
"type": "boolean"
|
|
55
58
|
}
|
|
56
59
|
},
|
|
57
60
|
"techstack": {
|