@atlaskit/editor-plugin-insert-block 8.7.6 → 8.7.8
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/insertBlockPlugin.js +0 -1
- package/dist/cjs/pm-plugins/experiences/toolbar-action-experiences.js +24 -28
- package/dist/cjs/pm-plugins/experiences/toolbar-experience-utils.js +1 -8
- package/dist/es2019/insertBlockPlugin.js +0 -1
- package/dist/es2019/pm-plugins/experiences/toolbar-action-experiences.js +25 -28
- package/dist/es2019/pm-plugins/experiences/toolbar-experience-utils.js +0 -3
- package/dist/esm/insertBlockPlugin.js +0 -1
- package/dist/esm/pm-plugins/experiences/toolbar-action-experiences.js +26 -30
- package/dist/esm/pm-plugins/experiences/toolbar-experience-utils.js +0 -3
- package/dist/types/pm-plugins/experiences/toolbar-action-experiences.d.ts +1 -4
- package/dist/types/pm-plugins/experiences/toolbar-experience-utils.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/experiences/toolbar-action-experiences.d.ts +1 -4
- package/dist/types-ts4.5/pm-plugins/experiences/toolbar-experience-utils.d.ts +0 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 8.7.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`64fe39d800a84`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64fe39d800a84) -
|
|
8
|
+
Improve ExperienceCheckPopupMutation logic to be more performant
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.7.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.7.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -234,7 +234,6 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
234
234
|
name: 'toolbarActionExperiences',
|
|
235
235
|
plugin: function plugin() {
|
|
236
236
|
return (0, _toolbarActionExperiences.getToolbarActionExperiencesPlugin)({
|
|
237
|
-
refs: refs,
|
|
238
237
|
dispatchAnalyticsEvent: function dispatchAnalyticsEvent(payload) {
|
|
239
238
|
var _api$analytics;
|
|
240
239
|
return api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent(payload);
|
|
@@ -19,30 +19,16 @@ var ABORT_REASON = {
|
|
|
19
19
|
EDITOR_DESTROYED: 'editorDestroyed'
|
|
20
20
|
};
|
|
21
21
|
var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugin = function getToolbarActionExperiencesPlugin(_ref) {
|
|
22
|
-
var
|
|
23
|
-
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
22
|
+
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
24
23
|
var editorView;
|
|
25
|
-
var popupTargetEl;
|
|
26
24
|
var lastClickedToolbarButton;
|
|
27
|
-
var getPopupsTarget = function getPopupsTarget() {
|
|
28
|
-
if (!popupTargetEl) {
|
|
29
|
-
var _editorView;
|
|
30
|
-
popupTargetEl = refs.popupsMountPoint || (0, _experiences.getPopupContainerFromEditorView)((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.dom);
|
|
31
|
-
}
|
|
32
|
-
return popupTargetEl;
|
|
33
|
-
};
|
|
34
25
|
var getEditorDom = function getEditorDom() {
|
|
35
|
-
var
|
|
36
|
-
if (((
|
|
26
|
+
var _editorView;
|
|
27
|
+
if (((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.dom) instanceof HTMLElement) {
|
|
37
28
|
return editorView.dom;
|
|
38
29
|
}
|
|
39
30
|
return null;
|
|
40
31
|
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* For inline popups, returns the button-group ancestor of the clicked toolbar button.
|
|
44
|
-
* This allows inline popup checks to observe only the relevant button-group.
|
|
45
|
-
*/
|
|
46
32
|
var getInlinePopupTarget = function getInlinePopupTarget() {
|
|
47
33
|
var _lastClickedToolbarBu;
|
|
48
34
|
if (!lastClickedToolbarButton) {
|
|
@@ -83,20 +69,31 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
83
69
|
})]
|
|
84
70
|
});
|
|
85
71
|
};
|
|
86
|
-
var
|
|
87
|
-
|
|
72
|
+
var buildPopupMutationConfig = function buildPopupMutationConfig(popupSelector, type, subtree) {
|
|
73
|
+
switch (type) {
|
|
74
|
+
case 'inline':
|
|
75
|
+
return {
|
|
76
|
+
type: type,
|
|
77
|
+
nestedElementQuery: popupSelector,
|
|
78
|
+
getTarget: getInlinePopupTarget,
|
|
79
|
+
subtree: subtree
|
|
80
|
+
};
|
|
81
|
+
case 'editorRoot':
|
|
82
|
+
return {
|
|
83
|
+
type: type,
|
|
84
|
+
nestedElementQuery: popupSelector,
|
|
85
|
+
getEditorDom: getEditorDom
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var createPopupExperience = function createPopupExperience(action, popupSelector, type, subtree) {
|
|
88
90
|
return new _experiences.Experience(_experiences.EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
89
91
|
action: action,
|
|
90
92
|
actionSubjectId: PRIMARY_TOOLBAR,
|
|
91
93
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
92
94
|
checks: [new _experiences.ExperienceCheckTimeout({
|
|
93
95
|
durationMs: TIMEOUT_DURATION
|
|
94
|
-
}), new
|
|
95
|
-
nestedElementQuery: popupSelector,
|
|
96
|
-
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
97
|
-
getEditorDom: getEditorDom,
|
|
98
|
-
type: type
|
|
99
|
-
})]
|
|
96
|
+
}), new _experiences.ExperienceCheckPopupMutation(buildPopupMutationConfig(popupSelector, type, subtree))]
|
|
100
97
|
});
|
|
101
98
|
};
|
|
102
99
|
var experienceButtonMappings = [{
|
|
@@ -106,7 +103,7 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
106
103
|
experience: createPopupExperience('emoji', '[data-emoji-picker-container], [data-emoji-picker-container="true"], [data-testid="popup-wrapper"]', 'inline'),
|
|
107
104
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.EMOJI
|
|
108
105
|
}, {
|
|
109
|
-
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline'),
|
|
106
|
+
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline', true),
|
|
110
107
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.MEDIA
|
|
111
108
|
}, {
|
|
112
109
|
experience: createPopupExperience('mention', '[data-testid="popup-wrapper"], [data-type-ahead="typeaheadDecoration"]', 'editorRoot'),
|
|
@@ -115,7 +112,7 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
115
112
|
experience: createNodeInsertExperience('table'),
|
|
116
113
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.TABLE
|
|
117
114
|
}, {
|
|
118
|
-
experience: createPopupExperience('tableSelector', '[
|
|
115
|
+
experience: createPopupExperience('tableSelector', '[data-testid="popup-wrapper"]', 'inline', true),
|
|
119
116
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.TABLE_SELECTOR
|
|
120
117
|
}, {
|
|
121
118
|
experience: createNodeInsertExperience('layout'),
|
|
@@ -187,7 +184,6 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
187
184
|
destroy: function destroy() {
|
|
188
185
|
abortAllExperiences(ABORT_REASON.EDITOR_DESTROYED);
|
|
189
186
|
editorView = undefined;
|
|
190
|
-
popupTargetEl = undefined;
|
|
191
187
|
unbindClickListener();
|
|
192
188
|
unbindKeydownListener();
|
|
193
189
|
}
|
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "ExperienceCheckPopupMutation", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _experiences.ExperienceCheckPopupMutation;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
exports.isToolbarButtonClick = exports.handleEditorNodeInsertDomMutation = exports.getParentDOMAtSelection = exports.NODE_INSERT_MARKERS = void 0;
|
|
13
|
-
var _experiences = require("@atlaskit/editor-common/experiences");
|
|
14
7
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
15
8
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17
10
|
/**
|
|
18
11
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
19
12
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -217,7 +217,6 @@ export const insertBlockPlugin = ({
|
|
|
217
217
|
plugins.push({
|
|
218
218
|
name: 'toolbarActionExperiences',
|
|
219
219
|
plugin: () => getToolbarActionExperiencesPlugin({
|
|
220
|
-
refs,
|
|
221
220
|
dispatchAnalyticsEvent: payload => {
|
|
222
221
|
var _api$analytics, _api$analytics$action;
|
|
223
222
|
return api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.fireAnalyticsEvent(payload);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { bind } from 'bind-event-listener';
|
|
2
2
|
import { getDocument } from '@atlaskit/browser-apis';
|
|
3
|
-
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation,
|
|
3
|
+
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckPopupMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { TOOLBAR_BUTTON_TEST_ID } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import {
|
|
7
|
+
import { getParentDOMAtSelection, handleEditorNodeInsertDomMutation, isToolbarButtonClick } from './toolbar-experience-utils';
|
|
8
8
|
const pluginKey = new PluginKey('toolbarActionExperiences');
|
|
9
9
|
const TIMEOUT_DURATION = 1000;
|
|
10
10
|
const PRIMARY_TOOLBAR = 'primaryToolbar';
|
|
@@ -13,31 +13,17 @@ const ABORT_REASON = {
|
|
|
13
13
|
EDITOR_DESTROYED: 'editorDestroyed'
|
|
14
14
|
};
|
|
15
15
|
export const getToolbarActionExperiencesPlugin = ({
|
|
16
|
-
refs,
|
|
17
16
|
dispatchAnalyticsEvent
|
|
18
17
|
}) => {
|
|
19
18
|
let editorView;
|
|
20
|
-
let popupTargetEl;
|
|
21
19
|
let lastClickedToolbarButton;
|
|
22
|
-
const getPopupsTarget = () => {
|
|
23
|
-
if (!popupTargetEl) {
|
|
24
|
-
var _editorView;
|
|
25
|
-
popupTargetEl = refs.popupsMountPoint || getPopupContainerFromEditorView((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.dom);
|
|
26
|
-
}
|
|
27
|
-
return popupTargetEl;
|
|
28
|
-
};
|
|
29
20
|
const getEditorDom = () => {
|
|
30
|
-
var
|
|
31
|
-
if (((
|
|
21
|
+
var _editorView;
|
|
22
|
+
if (((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.dom) instanceof HTMLElement) {
|
|
32
23
|
return editorView.dom;
|
|
33
24
|
}
|
|
34
25
|
return null;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* For inline popups, returns the button-group ancestor of the clicked toolbar button.
|
|
39
|
-
* This allows inline popup checks to observe only the relevant button-group.
|
|
40
|
-
*/
|
|
41
27
|
const getInlinePopupTarget = () => {
|
|
42
28
|
var _lastClickedToolbarBu;
|
|
43
29
|
if (!lastClickedToolbarButton) {
|
|
@@ -74,18 +60,30 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
74
60
|
observeConfig: rootObserveConfig
|
|
75
61
|
})]
|
|
76
62
|
});
|
|
77
|
-
const
|
|
63
|
+
const buildPopupMutationConfig = (popupSelector, type, subtree) => {
|
|
64
|
+
switch (type) {
|
|
65
|
+
case 'inline':
|
|
66
|
+
return {
|
|
67
|
+
type,
|
|
68
|
+
nestedElementQuery: popupSelector,
|
|
69
|
+
getTarget: getInlinePopupTarget,
|
|
70
|
+
subtree
|
|
71
|
+
};
|
|
72
|
+
case 'editorRoot':
|
|
73
|
+
return {
|
|
74
|
+
type,
|
|
75
|
+
nestedElementQuery: popupSelector,
|
|
76
|
+
getEditorDom
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const createPopupExperience = (action, popupSelector, type, subtree) => new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
78
81
|
action,
|
|
79
82
|
actionSubjectId: PRIMARY_TOOLBAR,
|
|
80
83
|
dispatchAnalyticsEvent,
|
|
81
84
|
checks: [new ExperienceCheckTimeout({
|
|
82
85
|
durationMs: TIMEOUT_DURATION
|
|
83
|
-
}), new ExperienceCheckPopupMutation(
|
|
84
|
-
nestedElementQuery: popupSelector,
|
|
85
|
-
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
86
|
-
getEditorDom,
|
|
87
|
-
type
|
|
88
|
-
})]
|
|
86
|
+
}), new ExperienceCheckPopupMutation(buildPopupMutationConfig(popupSelector, type, subtree))]
|
|
89
87
|
});
|
|
90
88
|
const experienceButtonMappings = [{
|
|
91
89
|
experience: createPopupExperience('insert', '[data-testid="popup-wrapper"]', 'inline'),
|
|
@@ -94,7 +92,7 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
94
92
|
experience: createPopupExperience('emoji', '[data-emoji-picker-container], [data-emoji-picker-container="true"], [data-testid="popup-wrapper"]', 'inline'),
|
|
95
93
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.EMOJI
|
|
96
94
|
}, {
|
|
97
|
-
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline'),
|
|
95
|
+
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline', true),
|
|
98
96
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.MEDIA
|
|
99
97
|
}, {
|
|
100
98
|
experience: createPopupExperience('mention', '[data-testid="popup-wrapper"], [data-type-ahead="typeaheadDecoration"]', 'editorRoot'),
|
|
@@ -103,7 +101,7 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
103
101
|
experience: createNodeInsertExperience('table'),
|
|
104
102
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE
|
|
105
103
|
}, {
|
|
106
|
-
experience: createPopupExperience('tableSelector', '[
|
|
104
|
+
experience: createPopupExperience('tableSelector', '[data-testid="popup-wrapper"]', 'inline', true),
|
|
107
105
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE_SELECTOR
|
|
108
106
|
}, {
|
|
109
107
|
experience: createNodeInsertExperience('layout'),
|
|
@@ -176,7 +174,6 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
176
174
|
destroy: () => {
|
|
177
175
|
abortAllExperiences(ABORT_REASON.EDITOR_DESTROYED);
|
|
178
176
|
editorView = undefined;
|
|
179
|
-
popupTargetEl = undefined;
|
|
180
177
|
unbindClickListener();
|
|
181
178
|
unbindKeydownListener();
|
|
182
179
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
2
|
-
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
6
3
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -224,7 +224,6 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
224
224
|
name: 'toolbarActionExperiences',
|
|
225
225
|
plugin: function plugin() {
|
|
226
226
|
return getToolbarActionExperiencesPlugin({
|
|
227
|
-
refs: refs,
|
|
228
227
|
dispatchAnalyticsEvent: function dispatchAnalyticsEvent(payload) {
|
|
229
228
|
var _api$analytics;
|
|
230
229
|
return api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent(payload);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { bind } from 'bind-event-listener';
|
|
2
2
|
import { getDocument } from '@atlaskit/browser-apis';
|
|
3
|
-
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation,
|
|
3
|
+
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckPopupMutation, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { TOOLBAR_BUTTON_TEST_ID } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import {
|
|
7
|
+
import { getParentDOMAtSelection, handleEditorNodeInsertDomMutation, isToolbarButtonClick } from './toolbar-experience-utils';
|
|
8
8
|
var pluginKey = new PluginKey('toolbarActionExperiences');
|
|
9
9
|
var TIMEOUT_DURATION = 1000;
|
|
10
10
|
var PRIMARY_TOOLBAR = 'primaryToolbar';
|
|
@@ -13,30 +13,16 @@ var ABORT_REASON = {
|
|
|
13
13
|
EDITOR_DESTROYED: 'editorDestroyed'
|
|
14
14
|
};
|
|
15
15
|
export var getToolbarActionExperiencesPlugin = function getToolbarActionExperiencesPlugin(_ref) {
|
|
16
|
-
var
|
|
17
|
-
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
16
|
+
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
18
17
|
var editorView;
|
|
19
|
-
var popupTargetEl;
|
|
20
18
|
var lastClickedToolbarButton;
|
|
21
|
-
var getPopupsTarget = function getPopupsTarget() {
|
|
22
|
-
if (!popupTargetEl) {
|
|
23
|
-
var _editorView;
|
|
24
|
-
popupTargetEl = refs.popupsMountPoint || getPopupContainerFromEditorView((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.dom);
|
|
25
|
-
}
|
|
26
|
-
return popupTargetEl;
|
|
27
|
-
};
|
|
28
19
|
var getEditorDom = function getEditorDom() {
|
|
29
|
-
var
|
|
30
|
-
if (((
|
|
20
|
+
var _editorView;
|
|
21
|
+
if (((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.dom) instanceof HTMLElement) {
|
|
31
22
|
return editorView.dom;
|
|
32
23
|
}
|
|
33
24
|
return null;
|
|
34
25
|
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* For inline popups, returns the button-group ancestor of the clicked toolbar button.
|
|
38
|
-
* This allows inline popup checks to observe only the relevant button-group.
|
|
39
|
-
*/
|
|
40
26
|
var getInlinePopupTarget = function getInlinePopupTarget() {
|
|
41
27
|
var _lastClickedToolbarBu;
|
|
42
28
|
if (!lastClickedToolbarButton) {
|
|
@@ -77,20 +63,31 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
77
63
|
})]
|
|
78
64
|
});
|
|
79
65
|
};
|
|
80
|
-
var
|
|
81
|
-
|
|
66
|
+
var buildPopupMutationConfig = function buildPopupMutationConfig(popupSelector, type, subtree) {
|
|
67
|
+
switch (type) {
|
|
68
|
+
case 'inline':
|
|
69
|
+
return {
|
|
70
|
+
type: type,
|
|
71
|
+
nestedElementQuery: popupSelector,
|
|
72
|
+
getTarget: getInlinePopupTarget,
|
|
73
|
+
subtree: subtree
|
|
74
|
+
};
|
|
75
|
+
case 'editorRoot':
|
|
76
|
+
return {
|
|
77
|
+
type: type,
|
|
78
|
+
nestedElementQuery: popupSelector,
|
|
79
|
+
getEditorDom: getEditorDom
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var createPopupExperience = function createPopupExperience(action, popupSelector, type, subtree) {
|
|
82
84
|
return new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
83
85
|
action: action,
|
|
84
86
|
actionSubjectId: PRIMARY_TOOLBAR,
|
|
85
87
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
86
88
|
checks: [new ExperienceCheckTimeout({
|
|
87
89
|
durationMs: TIMEOUT_DURATION
|
|
88
|
-
}), new ExperienceCheckPopupMutation(
|
|
89
|
-
nestedElementQuery: popupSelector,
|
|
90
|
-
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
91
|
-
getEditorDom: getEditorDom,
|
|
92
|
-
type: type
|
|
93
|
-
})]
|
|
90
|
+
}), new ExperienceCheckPopupMutation(buildPopupMutationConfig(popupSelector, type, subtree))]
|
|
94
91
|
});
|
|
95
92
|
};
|
|
96
93
|
var experienceButtonMappings = [{
|
|
@@ -100,7 +97,7 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
100
97
|
experience: createPopupExperience('emoji', '[data-emoji-picker-container], [data-emoji-picker-container="true"], [data-testid="popup-wrapper"]', 'inline'),
|
|
101
98
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.EMOJI
|
|
102
99
|
}, {
|
|
103
|
-
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline'),
|
|
100
|
+
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline', true),
|
|
104
101
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.MEDIA
|
|
105
102
|
}, {
|
|
106
103
|
experience: createPopupExperience('mention', '[data-testid="popup-wrapper"], [data-type-ahead="typeaheadDecoration"]', 'editorRoot'),
|
|
@@ -109,7 +106,7 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
109
106
|
experience: createNodeInsertExperience('table'),
|
|
110
107
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE
|
|
111
108
|
}, {
|
|
112
|
-
experience: createPopupExperience('tableSelector', '[
|
|
109
|
+
experience: createPopupExperience('tableSelector', '[data-testid="popup-wrapper"]', 'inline', true),
|
|
113
110
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE_SELECTOR
|
|
114
111
|
}, {
|
|
115
112
|
experience: createNodeInsertExperience('layout'),
|
|
@@ -181,7 +178,6 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
181
178
|
destroy: function destroy() {
|
|
182
179
|
abortAllExperiences(ABORT_REASON.EDITOR_DESTROYED);
|
|
183
180
|
editorView = undefined;
|
|
184
|
-
popupTargetEl = undefined;
|
|
185
181
|
unbindClickListener();
|
|
186
182
|
unbindKeydownListener();
|
|
187
183
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
-
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
5
|
-
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
6
|
-
|
|
7
4
|
/**
|
|
8
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
9
6
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -2,9 +2,6 @@ import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
type ToolbarActionExperienceOptions = {
|
|
4
4
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
5
|
-
refs: {
|
|
6
|
-
popupsMountPoint?: HTMLElement;
|
|
7
|
-
};
|
|
8
5
|
};
|
|
9
|
-
export declare const getToolbarActionExperiencesPlugin: ({
|
|
6
|
+
export declare const getToolbarActionExperiencesPlugin: ({ dispatchAnalyticsEvent, }: ToolbarActionExperienceOptions) => SafePlugin<any>;
|
|
10
7
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ExperienceCheckResult } from '@atlaskit/editor-common/experiences';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
4
3
|
/**
|
|
5
4
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
6
5
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -2,9 +2,6 @@ import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
type ToolbarActionExperienceOptions = {
|
|
4
4
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
5
|
-
refs: {
|
|
6
|
-
popupsMountPoint?: HTMLElement;
|
|
7
|
-
};
|
|
8
5
|
};
|
|
9
|
-
export declare const getToolbarActionExperiencesPlugin: ({
|
|
6
|
+
export declare const getToolbarActionExperiencesPlugin: ({ dispatchAnalyticsEvent, }: ToolbarActionExperienceOptions) => SafePlugin<any>;
|
|
10
7
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ExperienceCheckResult } from '@atlaskit/editor-common/experiences';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
4
3
|
/**
|
|
5
4
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
6
5
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.8",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/editor-plugin-hyperlink": "^9.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-image-upload": "^7.0.0",
|
|
44
44
|
"@atlaskit/editor-plugin-layout": "^7.0.0",
|
|
45
|
-
"@atlaskit/editor-plugin-media": "^9.
|
|
45
|
+
"@atlaskit/editor-plugin-media": "^9.6.0",
|
|
46
46
|
"@atlaskit/editor-plugin-media-insert": "^18.0.0",
|
|
47
47
|
"@atlaskit/editor-plugin-mentions": "^9.3.0",
|
|
48
48
|
"@atlaskit/editor-plugin-metrics": "^8.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@atlaskit/icon-lab": "^5.17.0",
|
|
66
66
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
67
67
|
"@atlaskit/theme": "^21.0.0",
|
|
68
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
68
|
+
"@atlaskit/tmp-editor-statsig": "^31.2.0",
|
|
69
69
|
"@atlaskit/tokens": "^11.0.0",
|
|
70
70
|
"@babel/runtime": "^7.0.0",
|
|
71
71
|
"@emotion/react": "^11.7.1",
|