@atlaskit/editor-plugin-toolbar 3.4.0 → 3.4.2
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 +14 -0
- package/dist/cjs/pm-plugins/experiences/SelectionToolbarOpenExperience.js +77 -12
- package/dist/cjs/toolbarPlugin.js +1 -1
- package/dist/es2019/pm-plugins/experiences/SelectionToolbarOpenExperience.js +75 -12
- package/dist/es2019/toolbarPlugin.js +1 -1
- package/dist/esm/pm-plugins/experiences/SelectionToolbarOpenExperience.js +76 -12
- package/dist/esm/toolbarPlugin.js +1 -1
- package/dist/types/pm-plugins/experiences/SelectionToolbarOpenExperience.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/experiences/SelectionToolbarOpenExperience.d.ts +7 -0
- package/package.json +3 -3
- package/afm-dev-agents/tsconfig.json +0 -60
- package/afm-passionfruit/tsconfig.json +0 -60
- package/afm-rovo-extension/tsconfig.json +0 -60
- package/afm-volt/tsconfig.json +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`7aff1e36b43e1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7aff1e36b43e1) -
|
|
14
|
+
Improve editor selection toolbar experience tracking
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.4.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -1,22 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
7
9
|
var _experiences = require("@atlaskit/editor-common/experiences");
|
|
8
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
12
|
var pluginKey = new _state.PluginKey('selectionToolbarOpenExperience');
|
|
13
|
+
var START_METHOD = {
|
|
14
|
+
MOUSE_UP: 'mouse-up',
|
|
15
|
+
KEY_DOWN: 'key-down'
|
|
16
|
+
};
|
|
17
|
+
var ABORT_REASON = {
|
|
18
|
+
SELECTION_CLEARED: 'selection-cleared',
|
|
19
|
+
BLOCK_MENU_OPENED: 'block-menu-opened',
|
|
20
|
+
EDITOR_DESTROYED: 'editor-destroyed'
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* This experience tracks when the selection toolbar is opened.
|
|
24
|
+
*
|
|
25
|
+
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
26
|
+
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
27
|
+
* Abort: When selection transition to empty or block menu is opened
|
|
28
|
+
*/
|
|
11
29
|
var _default = exports.default = function _default(_ref) {
|
|
12
30
|
var popupsMountPointRef = _ref.popupsMountPointRef,
|
|
13
31
|
editorViewDomRef = _ref.editorViewDomRef;
|
|
32
|
+
var cachedTarget = null;
|
|
14
33
|
var getTarget = function getTarget() {
|
|
15
|
-
|
|
16
|
-
|
|
34
|
+
if (!cachedTarget) {
|
|
35
|
+
var _editorViewDomRef$cur;
|
|
36
|
+
cachedTarget = popupsMountPointRef.current || ((_editorViewDomRef$cur = editorViewDomRef.current) === null || _editorViewDomRef$cur === void 0 || (_editorViewDomRef$cur = _editorViewDomRef$cur.closest('.ak-editor-content-area')) === null || _editorViewDomRef$cur === void 0 ? void 0 : _editorViewDomRef$cur.querySelector(':scope > [data-testid="plugins-components-wrapper"]')) || null;
|
|
37
|
+
}
|
|
38
|
+
return cachedTarget;
|
|
17
39
|
};
|
|
18
40
|
var experience = new _experiences.Experience('selection-toolbar-open', {
|
|
19
|
-
checks: [new _experiences.ExperienceCheckTimeout(
|
|
41
|
+
checks: [new _experiences.ExperienceCheckTimeout({
|
|
42
|
+
durationMs: 500,
|
|
43
|
+
onTimeout: function onTimeout() {
|
|
44
|
+
if (isBlockMenuWithinNode(getTarget())) {
|
|
45
|
+
return {
|
|
46
|
+
status: 'abort',
|
|
47
|
+
metadata: {
|
|
48
|
+
reason: ABORT_REASON.BLOCK_MENU_OPENED
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}), new _experiences.ExperienceCheckDomMutation({
|
|
20
54
|
onDomMutation: function onDomMutation(_ref2) {
|
|
21
55
|
var mutations = _ref2.mutations;
|
|
22
56
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
@@ -29,8 +63,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
29
63
|
return {
|
|
30
64
|
target: getTarget(),
|
|
31
65
|
options: {
|
|
32
|
-
childList: true
|
|
33
|
-
subtree: true
|
|
66
|
+
childList: true
|
|
34
67
|
}
|
|
35
68
|
};
|
|
36
69
|
}
|
|
@@ -44,7 +77,11 @@ var _default = exports.default = function _default(_ref) {
|
|
|
44
77
|
},
|
|
45
78
|
apply: function apply(_tr, pluginState, oldState, newState) {
|
|
46
79
|
if (!oldState.selection.empty && newState.selection.empty) {
|
|
47
|
-
experience.abort(
|
|
80
|
+
experience.abort({
|
|
81
|
+
metadata: {
|
|
82
|
+
reason: ABORT_REASON.SELECTION_CLEARED
|
|
83
|
+
}
|
|
84
|
+
});
|
|
48
85
|
}
|
|
49
86
|
return pluginState;
|
|
50
87
|
}
|
|
@@ -52,15 +89,23 @@ var _default = exports.default = function _default(_ref) {
|
|
|
52
89
|
props: {
|
|
53
90
|
handleDOMEvents: {
|
|
54
91
|
mouseup: function mouseup(view) {
|
|
55
|
-
if (!view.state.selection.empty) {
|
|
56
|
-
experience.start(
|
|
92
|
+
if (!view.state.selection.empty && !isSelectionToolbarWithinNode(getTarget())) {
|
|
93
|
+
experience.start({
|
|
94
|
+
metadata: {
|
|
95
|
+
method: START_METHOD.MOUSE_UP
|
|
96
|
+
}
|
|
97
|
+
});
|
|
57
98
|
}
|
|
58
99
|
},
|
|
59
100
|
keydown: function keydown(_view, _ref3) {
|
|
60
101
|
var shiftKey = _ref3.shiftKey,
|
|
61
102
|
key = _ref3.key;
|
|
62
103
|
if (shiftKey && key.includes('Arrow') && !isSelectionToolbarWithinNode(getTarget())) {
|
|
63
|
-
experience.start(
|
|
104
|
+
experience.start({
|
|
105
|
+
metadata: {
|
|
106
|
+
method: START_METHOD.KEY_DOWN
|
|
107
|
+
}
|
|
108
|
+
});
|
|
64
109
|
}
|
|
65
110
|
}
|
|
66
111
|
}
|
|
@@ -68,7 +113,11 @@ var _default = exports.default = function _default(_ref) {
|
|
|
68
113
|
view: function view() {
|
|
69
114
|
return {
|
|
70
115
|
destroy: function destroy() {
|
|
71
|
-
experience.abort(
|
|
116
|
+
experience.abort({
|
|
117
|
+
metadata: {
|
|
118
|
+
reason: ABORT_REASON.EDITOR_DESTROYED
|
|
119
|
+
}
|
|
120
|
+
});
|
|
72
121
|
}
|
|
73
122
|
};
|
|
74
123
|
}
|
|
@@ -77,8 +126,24 @@ var _default = exports.default = function _default(_ref) {
|
|
|
77
126
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
78
127
|
var type = _ref4.type,
|
|
79
128
|
addedNodes = _ref4.addedNodes;
|
|
80
|
-
return type === 'childList' &&
|
|
129
|
+
return type === 'childList' && (0, _toConsumableArray2.default)(addedNodes).some(isSelectionToolbarWithinNode);
|
|
81
130
|
};
|
|
82
131
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
83
|
-
return node
|
|
132
|
+
return containsPopupWithNestedTestId(node, 'editor-floating-toolbar');
|
|
133
|
+
};
|
|
134
|
+
var isBlockMenuWithinNode = function isBlockMenuWithinNode(node) {
|
|
135
|
+
return containsPopupWithNestedTestId(node, 'editor-block-menu');
|
|
136
|
+
};
|
|
137
|
+
var containsPopupWithNestedTestId = function containsPopupWithNestedTestId(node, testId) {
|
|
138
|
+
if (!(node instanceof HTMLElement)) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Check if node itself has the popup attribute and contains the element with testId
|
|
143
|
+
if (node.matches('[data-editor-popup="true"]')) {
|
|
144
|
+
return !!node.querySelector("[data-testid=\"".concat(testId, "\"]"));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Check if any direct child with popup attribute contains the element with testId
|
|
148
|
+
return !!node.querySelector(":scope > [data-editor-popup=\"true\"] [data-testid=\"".concat(testId, "\"]"));
|
|
84
149
|
};
|
|
@@ -187,7 +187,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
}].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
190
|
+
}].concat((0, _toConsumableArray2.default)(!disableSelectionToolbar && (0, _expValEquals.expValEquals)('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
191
191
|
name: 'selectionToolbarOpenExperience',
|
|
192
192
|
plugin: function plugin() {
|
|
193
193
|
return (0, _SelectionToolbarOpenExperience.default)({
|
|
@@ -2,16 +2,48 @@ import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout } from '
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
const pluginKey = new PluginKey('selectionToolbarOpenExperience');
|
|
5
|
+
const START_METHOD = {
|
|
6
|
+
MOUSE_UP: 'mouse-up',
|
|
7
|
+
KEY_DOWN: 'key-down'
|
|
8
|
+
};
|
|
9
|
+
const ABORT_REASON = {
|
|
10
|
+
SELECTION_CLEARED: 'selection-cleared',
|
|
11
|
+
BLOCK_MENU_OPENED: 'block-menu-opened',
|
|
12
|
+
EDITOR_DESTROYED: 'editor-destroyed'
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* This experience tracks when the selection toolbar is opened.
|
|
16
|
+
*
|
|
17
|
+
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
18
|
+
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
19
|
+
* Abort: When selection transition to empty or block menu is opened
|
|
20
|
+
*/
|
|
5
21
|
export default (({
|
|
6
22
|
popupsMountPointRef,
|
|
7
23
|
editorViewDomRef
|
|
8
24
|
}) => {
|
|
25
|
+
let cachedTarget = null;
|
|
9
26
|
const getTarget = () => {
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
if (!cachedTarget) {
|
|
28
|
+
var _editorViewDomRef$cur, _editorViewDomRef$cur2;
|
|
29
|
+
cachedTarget = popupsMountPointRef.current || ((_editorViewDomRef$cur = editorViewDomRef.current) === null || _editorViewDomRef$cur === void 0 ? void 0 : (_editorViewDomRef$cur2 = _editorViewDomRef$cur.closest('.ak-editor-content-area')) === null || _editorViewDomRef$cur2 === void 0 ? void 0 : _editorViewDomRef$cur2.querySelector(':scope > [data-testid="plugins-components-wrapper"]')) || null;
|
|
30
|
+
}
|
|
31
|
+
return cachedTarget;
|
|
12
32
|
};
|
|
13
33
|
const experience = new Experience('selection-toolbar-open', {
|
|
14
|
-
checks: [new ExperienceCheckTimeout(
|
|
34
|
+
checks: [new ExperienceCheckTimeout({
|
|
35
|
+
durationMs: 500,
|
|
36
|
+
onTimeout: () => {
|
|
37
|
+
if (isBlockMenuWithinNode(getTarget())) {
|
|
38
|
+
return {
|
|
39
|
+
status: 'abort',
|
|
40
|
+
metadata: {
|
|
41
|
+
reason: ABORT_REASON.BLOCK_MENU_OPENED
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}), new ExperienceCheckDomMutation({
|
|
15
47
|
onDomMutation: ({
|
|
16
48
|
mutations
|
|
17
49
|
}) => {
|
|
@@ -24,8 +56,7 @@ export default (({
|
|
|
24
56
|
observeConfig: () => ({
|
|
25
57
|
target: getTarget(),
|
|
26
58
|
options: {
|
|
27
|
-
childList: true
|
|
28
|
-
subtree: true
|
|
59
|
+
childList: true
|
|
29
60
|
}
|
|
30
61
|
})
|
|
31
62
|
})]
|
|
@@ -36,7 +67,11 @@ export default (({
|
|
|
36
67
|
init: () => ({}),
|
|
37
68
|
apply: (_tr, pluginState, oldState, newState) => {
|
|
38
69
|
if (!oldState.selection.empty && newState.selection.empty) {
|
|
39
|
-
experience.abort(
|
|
70
|
+
experience.abort({
|
|
71
|
+
metadata: {
|
|
72
|
+
reason: ABORT_REASON.SELECTION_CLEARED
|
|
73
|
+
}
|
|
74
|
+
});
|
|
40
75
|
}
|
|
41
76
|
return pluginState;
|
|
42
77
|
}
|
|
@@ -44,8 +79,12 @@ export default (({
|
|
|
44
79
|
props: {
|
|
45
80
|
handleDOMEvents: {
|
|
46
81
|
mouseup: view => {
|
|
47
|
-
if (!view.state.selection.empty) {
|
|
48
|
-
experience.start(
|
|
82
|
+
if (!view.state.selection.empty && !isSelectionToolbarWithinNode(getTarget())) {
|
|
83
|
+
experience.start({
|
|
84
|
+
metadata: {
|
|
85
|
+
method: START_METHOD.MOUSE_UP
|
|
86
|
+
}
|
|
87
|
+
});
|
|
49
88
|
}
|
|
50
89
|
},
|
|
51
90
|
keydown: (_view, {
|
|
@@ -53,7 +92,11 @@ export default (({
|
|
|
53
92
|
key
|
|
54
93
|
}) => {
|
|
55
94
|
if (shiftKey && key.includes('Arrow') && !isSelectionToolbarWithinNode(getTarget())) {
|
|
56
|
-
experience.start(
|
|
95
|
+
experience.start({
|
|
96
|
+
metadata: {
|
|
97
|
+
method: START_METHOD.KEY_DOWN
|
|
98
|
+
}
|
|
99
|
+
});
|
|
57
100
|
}
|
|
58
101
|
}
|
|
59
102
|
}
|
|
@@ -61,7 +104,11 @@ export default (({
|
|
|
61
104
|
view: () => {
|
|
62
105
|
return {
|
|
63
106
|
destroy: () => {
|
|
64
|
-
experience.abort(
|
|
107
|
+
experience.abort({
|
|
108
|
+
metadata: {
|
|
109
|
+
reason: ABORT_REASON.EDITOR_DESTROYED
|
|
110
|
+
}
|
|
111
|
+
});
|
|
65
112
|
}
|
|
66
113
|
};
|
|
67
114
|
}
|
|
@@ -71,8 +118,24 @@ const isSelectionToolbarAddedInMutation = ({
|
|
|
71
118
|
type,
|
|
72
119
|
addedNodes
|
|
73
120
|
}) => {
|
|
74
|
-
return type === 'childList' &&
|
|
121
|
+
return type === 'childList' && [...addedNodes].some(isSelectionToolbarWithinNode);
|
|
75
122
|
};
|
|
76
123
|
const isSelectionToolbarWithinNode = node => {
|
|
77
|
-
return node
|
|
124
|
+
return containsPopupWithNestedTestId(node, 'editor-floating-toolbar');
|
|
125
|
+
};
|
|
126
|
+
const isBlockMenuWithinNode = node => {
|
|
127
|
+
return containsPopupWithNestedTestId(node, 'editor-block-menu');
|
|
128
|
+
};
|
|
129
|
+
const containsPopupWithNestedTestId = (node, testId) => {
|
|
130
|
+
if (!(node instanceof HTMLElement)) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Check if node itself has the popup attribute and contains the element with testId
|
|
135
|
+
if (node.matches('[data-editor-popup="true"]')) {
|
|
136
|
+
return !!node.querySelector(`[data-testid="${testId}"]`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Check if any direct child with popup attribute contains the element with testId
|
|
140
|
+
return !!node.querySelector(`:scope > [data-editor-popup="true"] [data-testid="${testId}"]`);
|
|
78
141
|
};
|
|
@@ -177,7 +177,7 @@ export const toolbarPlugin = ({
|
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
}, ...(expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
180
|
+
}, ...(!disableSelectionToolbar && expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
181
181
|
name: 'selectionToolbarOpenExperience',
|
|
182
182
|
plugin: () => selectionToolbarOpenExperience({
|
|
183
183
|
popupsMountPointRef,
|
|
@@ -1,16 +1,49 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
2
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
var pluginKey = new PluginKey('selectionToolbarOpenExperience');
|
|
6
|
+
var START_METHOD = {
|
|
7
|
+
MOUSE_UP: 'mouse-up',
|
|
8
|
+
KEY_DOWN: 'key-down'
|
|
9
|
+
};
|
|
10
|
+
var ABORT_REASON = {
|
|
11
|
+
SELECTION_CLEARED: 'selection-cleared',
|
|
12
|
+
BLOCK_MENU_OPENED: 'block-menu-opened',
|
|
13
|
+
EDITOR_DESTROYED: 'editor-destroyed'
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This experience tracks when the selection toolbar is opened.
|
|
17
|
+
*
|
|
18
|
+
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
19
|
+
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
20
|
+
* Abort: When selection transition to empty or block menu is opened
|
|
21
|
+
*/
|
|
5
22
|
export default (function (_ref) {
|
|
6
23
|
var popupsMountPointRef = _ref.popupsMountPointRef,
|
|
7
24
|
editorViewDomRef = _ref.editorViewDomRef;
|
|
25
|
+
var cachedTarget = null;
|
|
8
26
|
var getTarget = function getTarget() {
|
|
9
|
-
|
|
10
|
-
|
|
27
|
+
if (!cachedTarget) {
|
|
28
|
+
var _editorViewDomRef$cur;
|
|
29
|
+
cachedTarget = popupsMountPointRef.current || ((_editorViewDomRef$cur = editorViewDomRef.current) === null || _editorViewDomRef$cur === void 0 || (_editorViewDomRef$cur = _editorViewDomRef$cur.closest('.ak-editor-content-area')) === null || _editorViewDomRef$cur === void 0 ? void 0 : _editorViewDomRef$cur.querySelector(':scope > [data-testid="plugins-components-wrapper"]')) || null;
|
|
30
|
+
}
|
|
31
|
+
return cachedTarget;
|
|
11
32
|
};
|
|
12
33
|
var experience = new Experience('selection-toolbar-open', {
|
|
13
|
-
checks: [new ExperienceCheckTimeout(
|
|
34
|
+
checks: [new ExperienceCheckTimeout({
|
|
35
|
+
durationMs: 500,
|
|
36
|
+
onTimeout: function onTimeout() {
|
|
37
|
+
if (isBlockMenuWithinNode(getTarget())) {
|
|
38
|
+
return {
|
|
39
|
+
status: 'abort',
|
|
40
|
+
metadata: {
|
|
41
|
+
reason: ABORT_REASON.BLOCK_MENU_OPENED
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}), new ExperienceCheckDomMutation({
|
|
14
47
|
onDomMutation: function onDomMutation(_ref2) {
|
|
15
48
|
var mutations = _ref2.mutations;
|
|
16
49
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
@@ -23,8 +56,7 @@ export default (function (_ref) {
|
|
|
23
56
|
return {
|
|
24
57
|
target: getTarget(),
|
|
25
58
|
options: {
|
|
26
|
-
childList: true
|
|
27
|
-
subtree: true
|
|
59
|
+
childList: true
|
|
28
60
|
}
|
|
29
61
|
};
|
|
30
62
|
}
|
|
@@ -38,7 +70,11 @@ export default (function (_ref) {
|
|
|
38
70
|
},
|
|
39
71
|
apply: function apply(_tr, pluginState, oldState, newState) {
|
|
40
72
|
if (!oldState.selection.empty && newState.selection.empty) {
|
|
41
|
-
experience.abort(
|
|
73
|
+
experience.abort({
|
|
74
|
+
metadata: {
|
|
75
|
+
reason: ABORT_REASON.SELECTION_CLEARED
|
|
76
|
+
}
|
|
77
|
+
});
|
|
42
78
|
}
|
|
43
79
|
return pluginState;
|
|
44
80
|
}
|
|
@@ -46,15 +82,23 @@ export default (function (_ref) {
|
|
|
46
82
|
props: {
|
|
47
83
|
handleDOMEvents: {
|
|
48
84
|
mouseup: function mouseup(view) {
|
|
49
|
-
if (!view.state.selection.empty) {
|
|
50
|
-
experience.start(
|
|
85
|
+
if (!view.state.selection.empty && !isSelectionToolbarWithinNode(getTarget())) {
|
|
86
|
+
experience.start({
|
|
87
|
+
metadata: {
|
|
88
|
+
method: START_METHOD.MOUSE_UP
|
|
89
|
+
}
|
|
90
|
+
});
|
|
51
91
|
}
|
|
52
92
|
},
|
|
53
93
|
keydown: function keydown(_view, _ref3) {
|
|
54
94
|
var shiftKey = _ref3.shiftKey,
|
|
55
95
|
key = _ref3.key;
|
|
56
96
|
if (shiftKey && key.includes('Arrow') && !isSelectionToolbarWithinNode(getTarget())) {
|
|
57
|
-
experience.start(
|
|
97
|
+
experience.start({
|
|
98
|
+
metadata: {
|
|
99
|
+
method: START_METHOD.KEY_DOWN
|
|
100
|
+
}
|
|
101
|
+
});
|
|
58
102
|
}
|
|
59
103
|
}
|
|
60
104
|
}
|
|
@@ -62,7 +106,11 @@ export default (function (_ref) {
|
|
|
62
106
|
view: function view() {
|
|
63
107
|
return {
|
|
64
108
|
destroy: function destroy() {
|
|
65
|
-
experience.abort(
|
|
109
|
+
experience.abort({
|
|
110
|
+
metadata: {
|
|
111
|
+
reason: ABORT_REASON.EDITOR_DESTROYED
|
|
112
|
+
}
|
|
113
|
+
});
|
|
66
114
|
}
|
|
67
115
|
};
|
|
68
116
|
}
|
|
@@ -71,8 +119,24 @@ export default (function (_ref) {
|
|
|
71
119
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
72
120
|
var type = _ref4.type,
|
|
73
121
|
addedNodes = _ref4.addedNodes;
|
|
74
|
-
return type === 'childList' &&
|
|
122
|
+
return type === 'childList' && _toConsumableArray(addedNodes).some(isSelectionToolbarWithinNode);
|
|
75
123
|
};
|
|
76
124
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
77
|
-
return node
|
|
125
|
+
return containsPopupWithNestedTestId(node, 'editor-floating-toolbar');
|
|
126
|
+
};
|
|
127
|
+
var isBlockMenuWithinNode = function isBlockMenuWithinNode(node) {
|
|
128
|
+
return containsPopupWithNestedTestId(node, 'editor-block-menu');
|
|
129
|
+
};
|
|
130
|
+
var containsPopupWithNestedTestId = function containsPopupWithNestedTestId(node, testId) {
|
|
131
|
+
if (!(node instanceof HTMLElement)) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Check if node itself has the popup attribute and contains the element with testId
|
|
136
|
+
if (node.matches('[data-editor-popup="true"]')) {
|
|
137
|
+
return !!node.querySelector("[data-testid=\"".concat(testId, "\"]"));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Check if any direct child with popup attribute contains the element with testId
|
|
141
|
+
return !!node.querySelector(":scope > [data-editor-popup=\"true\"] [data-testid=\"".concat(testId, "\"]"));
|
|
78
142
|
};
|
|
@@ -180,7 +180,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
}].concat(_toConsumableArray(expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
183
|
+
}].concat(_toConsumableArray(!disableSelectionToolbar && expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
184
184
|
name: 'selectionToolbarOpenExperience',
|
|
185
185
|
plugin: function plugin() {
|
|
186
186
|
return selectionToolbarOpenExperience({
|
|
@@ -7,5 +7,12 @@ type SelectionToolbarOpenExperienceOptions = {
|
|
|
7
7
|
current?: HTMLElement;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* This experience tracks when the selection toolbar is opened.
|
|
12
|
+
*
|
|
13
|
+
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
14
|
+
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
15
|
+
* Abort: When selection transition to empty or block menu is opened
|
|
16
|
+
*/
|
|
10
17
|
declare const _default: ({ popupsMountPointRef, editorViewDomRef, }: SelectionToolbarOpenExperienceOptions) => SafePlugin<{}>;
|
|
11
18
|
export default _default;
|
|
@@ -7,5 +7,12 @@ type SelectionToolbarOpenExperienceOptions = {
|
|
|
7
7
|
current?: HTMLElement;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* This experience tracks when the selection toolbar is opened.
|
|
12
|
+
*
|
|
13
|
+
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
14
|
+
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
15
|
+
* Abort: When selection transition to empty or block menu is opened
|
|
16
|
+
*/
|
|
10
17
|
declare const _default: ({ popupsMountPointRef, editorViewDomRef, }: SelectionToolbarOpenExperienceOptions) => SafePlugin<{}>;
|
|
11
18
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@atlaskit/editor-toolbar": "^0.16.0",
|
|
40
40
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
|
-
"@atlaskit/platform-feature-flags-react": "^0.
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
42
|
+
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^13.19.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"
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.dev-agents.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../dev-agents/tsDist/@atlaskit__editor-plugin-toolbar/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../helpers/browser-apis/afm-dev-agents/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-plugin-analytics/afm-dev-agents/tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../editor-plugin-connectivity/afm-dev-agents/tsconfig.json"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../editor-plugin-editor-viewmode/afm-dev-agents/tsconfig.json"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../editor-plugin-selection/afm-dev-agents/tsconfig.json"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../editor-plugin-user-intent/afm-dev-agents/tsconfig.json"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../editor-plugin-user-preferences/afm-dev-agents/tsconfig.json"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../editor-toolbar/afm-dev-agents/tsconfig.json"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../editor-toolbar-model/afm-dev-agents/tsconfig.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../../platform/feature-flags/afm-dev-agents/tsconfig.json"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "../../../platform/feature-flags-react/afm-dev-agents/tsconfig.json"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"path": "../../tmp-editor-statsig/afm-dev-agents/tsconfig.json"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"path": "../../editor-common/afm-dev-agents/tsconfig.json"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.passionfruit.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../passionfruit/tsDist/@atlaskit__editor-plugin-toolbar/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../helpers/browser-apis/afm-passionfruit/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-plugin-analytics/afm-passionfruit/tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../editor-plugin-connectivity/afm-passionfruit/tsconfig.json"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../editor-plugin-editor-viewmode/afm-passionfruit/tsconfig.json"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../editor-plugin-selection/afm-passionfruit/tsconfig.json"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../editor-plugin-user-intent/afm-passionfruit/tsconfig.json"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../editor-plugin-user-preferences/afm-passionfruit/tsconfig.json"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../editor-toolbar/afm-passionfruit/tsconfig.json"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../editor-toolbar-model/afm-passionfruit/tsconfig.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../../platform/feature-flags/afm-passionfruit/tsconfig.json"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "../../../platform/feature-flags-react/afm-passionfruit/tsconfig.json"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"path": "../../tmp-editor-statsig/afm-passionfruit/tsconfig.json"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"path": "../../editor-common/afm-passionfruit/tsconfig.json"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.rovo-extension.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../rovo-extension/tsDist/@atlaskit__editor-plugin-toolbar/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../helpers/browser-apis/afm-rovo-extension/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-plugin-analytics/afm-rovo-extension/tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../editor-plugin-connectivity/afm-rovo-extension/tsconfig.json"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../editor-plugin-editor-viewmode/afm-rovo-extension/tsconfig.json"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../editor-plugin-selection/afm-rovo-extension/tsconfig.json"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../editor-plugin-user-intent/afm-rovo-extension/tsconfig.json"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../editor-plugin-user-preferences/afm-rovo-extension/tsconfig.json"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../editor-toolbar/afm-rovo-extension/tsconfig.json"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../editor-toolbar-model/afm-rovo-extension/tsconfig.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../../platform/feature-flags/afm-rovo-extension/tsconfig.json"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "../../../platform/feature-flags-react/afm-rovo-extension/tsconfig.json"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"path": "../../tmp-editor-statsig/afm-rovo-extension/tsconfig.json"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"path": "../../editor-common/afm-rovo-extension/tsconfig.json"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
package/afm-volt/tsconfig.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.volt.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../volt/tsDist/@atlaskit__editor-plugin-toolbar/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../editor-plugin-selection/afm-volt/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-plugin-user-intent/afm-volt/tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../editor-toolbar/afm-volt/tsconfig.json"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../editor-toolbar-model/afm-volt/tsconfig.json"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../editor-common/afm-volt/tsconfig.json"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|