@atlaskit/editor-plugin-toolbar 3.4.2 → 3.4.4
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 → selection-toolbar-open-experience.js} +13 -25
- package/dist/cjs/toolbarPlugin.js +5 -8
- package/dist/es2019/pm-plugins/experiences/{SelectionToolbarOpenExperience.js → selection-toolbar-open-experience.js} +14 -26
- package/dist/es2019/toolbarPlugin.js +5 -8
- package/dist/esm/pm-plugins/experiences/{SelectionToolbarOpenExperience.js → selection-toolbar-open-experience.js} +14 -26
- package/dist/esm/toolbarPlugin.js +5 -8
- package/dist/types/pm-plugins/experiences/{SelectionToolbarOpenExperience.d.ts → selection-toolbar-open-experience.d.ts} +5 -7
- package/dist/types-ts4.5/pm-plugins/experiences/{SelectionToolbarOpenExperience.d.ts → selection-toolbar-open-experience.d.ts} +5 -7
- package/package.json +4 -4
- package/afm-townsquare/tsconfig.json +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.4.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`610bf07ab4a4f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/610bf07ab4a4f) -
|
|
14
|
+
ED-29611 Editor quick insert experience tracking
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.4.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.getSelectionToolbarOpenExperiencePlugin = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _experiences = require("@atlaskit/editor-common/experiences");
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
@@ -24,18 +24,18 @@ var ABORT_REASON = {
|
|
|
24
24
|
*
|
|
25
25
|
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
26
26
|
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
27
|
+
* Failure: When 500ms passes without the selection toolbar being added to the DOM
|
|
27
28
|
* Abort: When selection transition to empty or block menu is opened
|
|
28
29
|
*/
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
30
|
+
var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExperiencePlugin = function getSelectionToolbarOpenExperiencePlugin(_ref) {
|
|
31
|
+
var refs = _ref.refs;
|
|
32
|
+
var targetEl;
|
|
33
|
+
var editorViewEl;
|
|
33
34
|
var getTarget = function getTarget() {
|
|
34
|
-
if (!
|
|
35
|
-
|
|
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;
|
|
35
|
+
if (!targetEl) {
|
|
36
|
+
targetEl = refs.popupsMountPoint || (0, _experiences.getPopupContainerFromEditorView)(editorViewEl);
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return targetEl;
|
|
39
39
|
};
|
|
40
40
|
var experience = new _experiences.Experience('selection-toolbar-open', {
|
|
41
41
|
checks: [new _experiences.ExperienceCheckTimeout({
|
|
@@ -110,7 +110,8 @@ var _default = exports.default = function _default(_ref) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
-
view: function view() {
|
|
113
|
+
view: function view(_view2) {
|
|
114
|
+
editorViewEl = _view2.dom;
|
|
114
115
|
return {
|
|
115
116
|
destroy: function destroy() {
|
|
116
117
|
experience.abort({
|
|
@@ -129,21 +130,8 @@ var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutati
|
|
|
129
130
|
return type === 'childList' && (0, _toConsumableArray2.default)(addedNodes).some(isSelectionToolbarWithinNode);
|
|
130
131
|
};
|
|
131
132
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
132
|
-
return
|
|
133
|
+
return (0, _experiences.containsPopupWithNestedElement)(node, '[data-testid="editor-floating-toolbar"]');
|
|
133
134
|
};
|
|
134
135
|
var isBlockMenuWithinNode = function isBlockMenuWithinNode(node) {
|
|
135
|
-
return
|
|
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, "\"]"));
|
|
136
|
+
return (0, _experiences.containsPopupWithNestedElement)(node, '[data-testid="editor-block-menu"]');
|
|
149
137
|
};
|
|
@@ -15,7 +15,7 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
15
15
|
var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
|
-
var
|
|
18
|
+
var _selectionToolbarOpenExperience = require("./pm-plugins/experiences/selection-toolbar-open-experience");
|
|
19
19
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
20
20
|
var _consts = require("./ui/consts");
|
|
21
21
|
var _SelectionToolbar = require("./ui/SelectionToolbar");
|
|
@@ -75,8 +75,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
75
75
|
disableSelectionToolbar: false,
|
|
76
76
|
disableSelectionToolbarWhenPinned: false
|
|
77
77
|
} : _ref$config;
|
|
78
|
-
var
|
|
79
|
-
var editorViewDomRef = {};
|
|
78
|
+
var refs = {};
|
|
80
79
|
var disableSelectionToolbar = config.disableSelectionToolbar,
|
|
81
80
|
disableSelectionToolbarWhenPinned = config.disableSelectionToolbarWhenPinned,
|
|
82
81
|
_config$contextualFor = config.contextualFormattingEnabled,
|
|
@@ -141,7 +140,6 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
141
140
|
}
|
|
142
141
|
},
|
|
143
142
|
view: function view(_view) {
|
|
144
|
-
editorViewDomRef.current = _view.dom;
|
|
145
143
|
var unbind = (0, _bindEventListener.bind)(_view.root, {
|
|
146
144
|
type: 'mouseup',
|
|
147
145
|
listener: function listener(ev) {
|
|
@@ -190,9 +188,8 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
190
188
|
}].concat((0, _toConsumableArray2.default)(!disableSelectionToolbar && (0, _expValEquals.expValEquals)('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
191
189
|
name: 'selectionToolbarOpenExperience',
|
|
192
190
|
plugin: function plugin() {
|
|
193
|
-
return (0,
|
|
194
|
-
|
|
195
|
-
editorViewDomRef: editorViewDomRef
|
|
191
|
+
return (0, _selectionToolbarOpenExperience.getSelectionToolbarOpenExperiencePlugin)({
|
|
192
|
+
refs: refs
|
|
196
193
|
});
|
|
197
194
|
}
|
|
198
195
|
}] : []));
|
|
@@ -200,7 +197,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
200
197
|
contentComponent: !disableSelectionToolbar ? function (_ref2) {
|
|
201
198
|
var editorView = _ref2.editorView,
|
|
202
199
|
popupsMountPoint = _ref2.popupsMountPoint;
|
|
203
|
-
|
|
200
|
+
refs.popupsMountPoint = popupsMountPoint || undefined;
|
|
204
201
|
if (!editorView) {
|
|
205
202
|
return null;
|
|
206
203
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
1
|
+
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout, containsPopupWithNestedElement, getPopupContainerFromEditorView } from '@atlaskit/editor-common/experiences';
|
|
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');
|
|
@@ -16,19 +16,19 @@ const ABORT_REASON = {
|
|
|
16
16
|
*
|
|
17
17
|
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
18
18
|
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
19
|
+
* Failure: When 500ms passes without the selection toolbar being added to the DOM
|
|
19
20
|
* Abort: When selection transition to empty or block menu is opened
|
|
20
21
|
*/
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
editorViewDomRef
|
|
22
|
+
export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
23
|
+
refs
|
|
24
24
|
}) => {
|
|
25
|
-
let
|
|
25
|
+
let targetEl;
|
|
26
|
+
let editorViewEl;
|
|
26
27
|
const getTarget = () => {
|
|
27
|
-
if (!
|
|
28
|
-
|
|
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;
|
|
28
|
+
if (!targetEl) {
|
|
29
|
+
targetEl = refs.popupsMountPoint || getPopupContainerFromEditorView(editorViewEl);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return targetEl;
|
|
32
32
|
};
|
|
33
33
|
const experience = new Experience('selection-toolbar-open', {
|
|
34
34
|
checks: [new ExperienceCheckTimeout({
|
|
@@ -101,7 +101,8 @@ export default (({
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
|
-
view:
|
|
104
|
+
view: view => {
|
|
105
|
+
editorViewEl = view.dom;
|
|
105
106
|
return {
|
|
106
107
|
destroy: () => {
|
|
107
108
|
experience.abort({
|
|
@@ -113,7 +114,7 @@ export default (({
|
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
116
|
});
|
|
116
|
-
}
|
|
117
|
+
};
|
|
117
118
|
const isSelectionToolbarAddedInMutation = ({
|
|
118
119
|
type,
|
|
119
120
|
addedNodes
|
|
@@ -121,21 +122,8 @@ const isSelectionToolbarAddedInMutation = ({
|
|
|
121
122
|
return type === 'childList' && [...addedNodes].some(isSelectionToolbarWithinNode);
|
|
122
123
|
};
|
|
123
124
|
const isSelectionToolbarWithinNode = node => {
|
|
124
|
-
return
|
|
125
|
+
return containsPopupWithNestedElement(node, '[data-testid="editor-floating-toolbar"]');
|
|
125
126
|
};
|
|
126
127
|
const isBlockMenuWithinNode = node => {
|
|
127
|
-
return
|
|
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}"]`);
|
|
128
|
+
return containsPopupWithNestedElement(node, '[data-testid="editor-block-menu"]');
|
|
141
129
|
};
|
|
@@ -6,7 +6,7 @@ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-p
|
|
|
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
|
|
9
|
+
import { getSelectionToolbarOpenExperiencePlugin } from './pm-plugins/experiences/selection-toolbar-open-experience';
|
|
10
10
|
import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
11
11
|
import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
|
|
12
12
|
import { SelectionToolbar, SelectionToolbarWithErrorBoundary } from './ui/SelectionToolbar';
|
|
@@ -60,8 +60,7 @@ export const toolbarPlugin = ({
|
|
|
60
60
|
disableSelectionToolbarWhenPinned: false
|
|
61
61
|
}
|
|
62
62
|
}) => {
|
|
63
|
-
const
|
|
64
|
-
const editorViewDomRef = {};
|
|
63
|
+
const refs = {};
|
|
65
64
|
const {
|
|
66
65
|
disableSelectionToolbar,
|
|
67
66
|
disableSelectionToolbarWhenPinned,
|
|
@@ -131,7 +130,6 @@ export const toolbarPlugin = ({
|
|
|
131
130
|
}
|
|
132
131
|
},
|
|
133
132
|
view(view) {
|
|
134
|
-
editorViewDomRef.current = view.dom;
|
|
135
133
|
const unbind = bind(view.root, {
|
|
136
134
|
type: 'mouseup',
|
|
137
135
|
listener: function (ev) {
|
|
@@ -179,9 +177,8 @@ export const toolbarPlugin = ({
|
|
|
179
177
|
}
|
|
180
178
|
}, ...(!disableSelectionToolbar && expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
181
179
|
name: 'selectionToolbarOpenExperience',
|
|
182
|
-
plugin: () =>
|
|
183
|
-
|
|
184
|
-
editorViewDomRef
|
|
180
|
+
plugin: () => getSelectionToolbarOpenExperiencePlugin({
|
|
181
|
+
refs
|
|
185
182
|
})
|
|
186
183
|
}] : [])];
|
|
187
184
|
},
|
|
@@ -189,7 +186,7 @@ export const toolbarPlugin = ({
|
|
|
189
186
|
editorView,
|
|
190
187
|
popupsMountPoint
|
|
191
188
|
}) => {
|
|
192
|
-
|
|
189
|
+
refs.popupsMountPoint = popupsMountPoint || undefined;
|
|
193
190
|
if (!editorView) {
|
|
194
191
|
return null;
|
|
195
192
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
2
|
+
import { Experience, ExperienceCheckDomMutation, ExperienceCheckTimeout, containsPopupWithNestedElement, 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
5
|
var pluginKey = new PluginKey('selectionToolbarOpenExperience');
|
|
@@ -17,18 +17,18 @@ var ABORT_REASON = {
|
|
|
17
17
|
*
|
|
18
18
|
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
19
19
|
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
20
|
+
* Failure: When 500ms passes without the selection toolbar being added to the DOM
|
|
20
21
|
* Abort: When selection transition to empty or block menu is opened
|
|
21
22
|
*/
|
|
22
|
-
export
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
var
|
|
23
|
+
export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolbarOpenExperiencePlugin(_ref) {
|
|
24
|
+
var refs = _ref.refs;
|
|
25
|
+
var targetEl;
|
|
26
|
+
var editorViewEl;
|
|
26
27
|
var getTarget = function getTarget() {
|
|
27
|
-
if (!
|
|
28
|
-
|
|
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;
|
|
28
|
+
if (!targetEl) {
|
|
29
|
+
targetEl = refs.popupsMountPoint || getPopupContainerFromEditorView(editorViewEl);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return targetEl;
|
|
32
32
|
};
|
|
33
33
|
var experience = new Experience('selection-toolbar-open', {
|
|
34
34
|
checks: [new ExperienceCheckTimeout({
|
|
@@ -103,7 +103,8 @@ export default (function (_ref) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
view: function view() {
|
|
106
|
+
view: function view(_view2) {
|
|
107
|
+
editorViewEl = _view2.dom;
|
|
107
108
|
return {
|
|
108
109
|
destroy: function destroy() {
|
|
109
110
|
experience.abort({
|
|
@@ -115,28 +116,15 @@ export default (function (_ref) {
|
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
118
|
});
|
|
118
|
-
}
|
|
119
|
+
};
|
|
119
120
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
120
121
|
var type = _ref4.type,
|
|
121
122
|
addedNodes = _ref4.addedNodes;
|
|
122
123
|
return type === 'childList' && _toConsumableArray(addedNodes).some(isSelectionToolbarWithinNode);
|
|
123
124
|
};
|
|
124
125
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
125
|
-
return
|
|
126
|
+
return containsPopupWithNestedElement(node, '[data-testid="editor-floating-toolbar"]');
|
|
126
127
|
};
|
|
127
128
|
var isBlockMenuWithinNode = function isBlockMenuWithinNode(node) {
|
|
128
|
-
return
|
|
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, "\"]"));
|
|
129
|
+
return containsPopupWithNestedElement(node, '[data-testid="editor-block-menu"]');
|
|
142
130
|
};
|
|
@@ -10,7 +10,7 @@ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-p
|
|
|
10
10
|
import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
|
-
import
|
|
13
|
+
import { getSelectionToolbarOpenExperiencePlugin } from './pm-plugins/experiences/selection-toolbar-open-experience';
|
|
14
14
|
import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
15
15
|
import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
|
|
16
16
|
import { SelectionToolbar, SelectionToolbarWithErrorBoundary } from './ui/SelectionToolbar';
|
|
@@ -68,8 +68,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
68
68
|
disableSelectionToolbar: false,
|
|
69
69
|
disableSelectionToolbarWhenPinned: false
|
|
70
70
|
} : _ref$config;
|
|
71
|
-
var
|
|
72
|
-
var editorViewDomRef = {};
|
|
71
|
+
var refs = {};
|
|
73
72
|
var disableSelectionToolbar = config.disableSelectionToolbar,
|
|
74
73
|
disableSelectionToolbarWhenPinned = config.disableSelectionToolbarWhenPinned,
|
|
75
74
|
_config$contextualFor = config.contextualFormattingEnabled,
|
|
@@ -134,7 +133,6 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
134
133
|
}
|
|
135
134
|
},
|
|
136
135
|
view: function view(_view) {
|
|
137
|
-
editorViewDomRef.current = _view.dom;
|
|
138
136
|
var unbind = bind(_view.root, {
|
|
139
137
|
type: 'mouseup',
|
|
140
138
|
listener: function listener(ev) {
|
|
@@ -183,9 +181,8 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
183
181
|
}].concat(_toConsumableArray(!disableSelectionToolbar && expValEquals('platform_editor_experience_tracking', 'isEnabled', true) ? [{
|
|
184
182
|
name: 'selectionToolbarOpenExperience',
|
|
185
183
|
plugin: function plugin() {
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
editorViewDomRef: editorViewDomRef
|
|
184
|
+
return getSelectionToolbarOpenExperiencePlugin({
|
|
185
|
+
refs: refs
|
|
189
186
|
});
|
|
190
187
|
}
|
|
191
188
|
}] : []));
|
|
@@ -193,7 +190,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
193
190
|
contentComponent: !disableSelectionToolbar ? function (_ref2) {
|
|
194
191
|
var editorView = _ref2.editorView,
|
|
195
192
|
popupsMountPoint = _ref2.popupsMountPoint;
|
|
196
|
-
|
|
193
|
+
refs.popupsMountPoint = popupsMountPoint || undefined;
|
|
197
194
|
if (!editorView) {
|
|
198
195
|
return null;
|
|
199
196
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
type SelectionToolbarOpenExperienceOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
popupsMountPointRef: {
|
|
7
|
-
current?: HTMLElement;
|
|
3
|
+
refs: {
|
|
4
|
+
popupsMountPoint?: HTMLElement;
|
|
8
5
|
};
|
|
9
6
|
};
|
|
10
7
|
/**
|
|
@@ -12,7 +9,8 @@ type SelectionToolbarOpenExperienceOptions = {
|
|
|
12
9
|
*
|
|
13
10
|
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
14
11
|
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
12
|
+
* Failure: When 500ms passes without the selection toolbar being added to the DOM
|
|
15
13
|
* Abort: When selection transition to empty or block menu is opened
|
|
16
14
|
*/
|
|
17
|
-
declare const
|
|
18
|
-
export
|
|
15
|
+
export declare const getSelectionToolbarOpenExperiencePlugin: ({ refs, }: SelectionToolbarOpenExperienceOptions) => SafePlugin<{}>;
|
|
16
|
+
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
type SelectionToolbarOpenExperienceOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
popupsMountPointRef: {
|
|
7
|
-
current?: HTMLElement;
|
|
3
|
+
refs: {
|
|
4
|
+
popupsMountPoint?: HTMLElement;
|
|
8
5
|
};
|
|
9
6
|
};
|
|
10
7
|
/**
|
|
@@ -12,7 +9,8 @@ type SelectionToolbarOpenExperienceOptions = {
|
|
|
12
9
|
*
|
|
13
10
|
* Start: When user makes a selection via mouseup or shift+arrow key down
|
|
14
11
|
* Success: When the selection toolbar is added to the DOM within 500ms of start
|
|
12
|
+
* Failure: When 500ms passes without the selection toolbar being added to the DOM
|
|
15
13
|
* Abort: When selection transition to empty or block menu is opened
|
|
16
14
|
*/
|
|
17
|
-
declare const
|
|
18
|
-
export
|
|
15
|
+
export declare const getSelectionToolbarOpenExperiencePlugin: ({ refs, }: SelectionToolbarOpenExperienceOptions) => SafePlugin<{}>;
|
|
16
|
+
export {};
|
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.4",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"@atlaskit/editor-plugin-user-intent": "^4.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-user-preferences": "^4.0.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
39
|
+
"@atlaskit/editor-toolbar": "^0.17.0",
|
|
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.4.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^13.22.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.19.0",
|
|
50
50
|
"react": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"platform-feature-flags": {
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.townsquare.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../townsquare/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-townsquare/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-plugin-analytics/afm-townsquare/tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../editor-plugin-connectivity/afm-townsquare/tsconfig.json"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../editor-plugin-editor-viewmode/afm-townsquare/tsconfig.json"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../editor-plugin-selection/afm-townsquare/tsconfig.json"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../editor-plugin-user-intent/afm-townsquare/tsconfig.json"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../editor-plugin-user-preferences/afm-townsquare/tsconfig.json"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../editor-toolbar/afm-townsquare/tsconfig.json"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../editor-toolbar-model/afm-townsquare/tsconfig.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../../platform/feature-flags/afm-townsquare/tsconfig.json"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "../../../platform/feature-flags-react/afm-townsquare/tsconfig.json"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"path": "../../tmp-editor-statsig/afm-townsquare/tsconfig.json"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"path": "../../editor-common/afm-townsquare/tsconfig.json"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|