@atlaskit/editor-plugin-insert-block 8.7.2 → 8.7.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/toolbar-action-experiences.js +30 -16
- package/dist/cjs/pm-plugins/experiences/toolbar-experience-utils.js +28 -272
- package/dist/es2019/pm-plugins/experiences/toolbar-action-experiences.js +31 -18
- package/dist/es2019/pm-plugins/experiences/toolbar-experience-utils.js +3 -153
- package/dist/esm/pm-plugins/experiences/toolbar-action-experiences.js +31 -17
- package/dist/esm/pm-plugins/experiences/toolbar-experience-utils.js +23 -271
- package/dist/types/pm-plugins/experiences/toolbar-experience-utils.d.ts +2 -22
- package/dist/types-ts4.5/pm-plugins/experiences/toolbar-experience-utils.d.ts +2 -22
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 8.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`57f499d6937db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/57f499d6937db) -
|
|
8
|
+
Extract ExperienceCheckPopupMutation logic to be reusable for block menu experience tracking
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.7.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.7.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -23,6 +23,7 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
23
23
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
24
24
|
var editorView;
|
|
25
25
|
var popupTargetEl;
|
|
26
|
+
var lastClickedToolbarButton;
|
|
26
27
|
var getPopupsTarget = function getPopupsTarget() {
|
|
27
28
|
if (!popupTargetEl) {
|
|
28
29
|
var _editorView;
|
|
@@ -37,6 +38,18 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
37
38
|
}
|
|
38
39
|
return null;
|
|
39
40
|
};
|
|
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
|
+
var getInlinePopupTarget = function getInlinePopupTarget() {
|
|
47
|
+
var _lastClickedToolbarBu;
|
|
48
|
+
if (!lastClickedToolbarButton) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return (_lastClickedToolbarBu = lastClickedToolbarButton.closest('[data-toolbar-component="button-group"]')) !== null && _lastClickedToolbarBu !== void 0 ? _lastClickedToolbarBu : lastClickedToolbarButton;
|
|
52
|
+
};
|
|
40
53
|
var narrowParentObserveConfig = function narrowParentObserveConfig() {
|
|
41
54
|
var _getParentDOMAtSelect;
|
|
42
55
|
return {
|
|
@@ -71,45 +84,44 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
71
84
|
});
|
|
72
85
|
};
|
|
73
86
|
var createPopupExperience = function createPopupExperience(action, popupSelector) {
|
|
87
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'editorRoot';
|
|
74
88
|
return new _experiences.Experience(_experiences.EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
75
89
|
action: action,
|
|
76
90
|
actionSubjectId: PRIMARY_TOOLBAR,
|
|
77
91
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
78
92
|
checks: [new _experiences.ExperienceCheckTimeout({
|
|
79
93
|
durationMs: TIMEOUT_DURATION
|
|
80
|
-
}), new _toolbarExperienceUtils.ExperienceCheckPopupMutation(
|
|
94
|
+
}), new _toolbarExperienceUtils.ExperienceCheckPopupMutation({
|
|
95
|
+
nestedElementQuery: popupSelector,
|
|
96
|
+
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
97
|
+
getEditorDom: getEditorDom,
|
|
98
|
+
type: type
|
|
99
|
+
})]
|
|
81
100
|
});
|
|
82
101
|
};
|
|
83
102
|
var experienceButtonMappings = [{
|
|
84
|
-
experience: createPopupExperience('
|
|
103
|
+
experience: createPopupExperience('insert', '[data-testid="popup-wrapper"]', 'inline'),
|
|
104
|
+
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.INSERT
|
|
105
|
+
}, {
|
|
106
|
+
experience: createPopupExperience('emoji', '[data-emoji-picker-container], [data-emoji-picker-container="true"], [data-testid="popup-wrapper"]', 'inline'),
|
|
85
107
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.EMOJI
|
|
86
108
|
}, {
|
|
87
|
-
experience: createPopupExperience('media', '[
|
|
109
|
+
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline'),
|
|
88
110
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.MEDIA
|
|
89
111
|
}, {
|
|
90
|
-
experience:
|
|
91
|
-
action: 'mention',
|
|
92
|
-
actionSubjectId: PRIMARY_TOOLBAR,
|
|
93
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
94
|
-
checks: [new _experiences.ExperienceCheckTimeout({
|
|
95
|
-
durationMs: TIMEOUT_DURATION
|
|
96
|
-
}), new _experiences.ExperienceCheckDomMutation({
|
|
97
|
-
onDomMutation: _toolbarExperienceUtils.handleTypeAheadOpenDomMutation,
|
|
98
|
-
observeConfig: narrowParentObserveConfig
|
|
99
|
-
})]
|
|
100
|
-
}),
|
|
112
|
+
experience: createPopupExperience('mention', '[data-testid="popup-wrapper"], [data-type-ahead="typeaheadDecoration"]', 'editorRoot'),
|
|
101
113
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.MENTION
|
|
102
114
|
}, {
|
|
103
115
|
experience: createNodeInsertExperience('table'),
|
|
104
116
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.TABLE
|
|
105
117
|
}, {
|
|
106
|
-
experience: createPopupExperience('tableSelector', '[aria-label*="table size"], [data-testid*="table-selector"]'),
|
|
118
|
+
experience: createPopupExperience('tableSelector', '[aria-label*="table size"], [data-testid*="table-selector"]', 'inline'),
|
|
107
119
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.TABLE_SELECTOR
|
|
108
120
|
}, {
|
|
109
121
|
experience: createNodeInsertExperience('layout'),
|
|
110
122
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.LAYOUT
|
|
111
123
|
}, {
|
|
112
|
-
experience: createPopupExperience('image', '[
|
|
124
|
+
experience: createPopupExperience('image', '[data-testid="popup-wrapper"]', 'inline'),
|
|
113
125
|
buttonTestId: _toolbar.TOOLBAR_BUTTON_TEST_ID.IMAGE
|
|
114
126
|
}, {
|
|
115
127
|
experience: createNodeInsertExperience('action'),
|
|
@@ -121,6 +133,8 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
121
133
|
experience = _experienceButtonMapp2.experience,
|
|
122
134
|
buttonTestId = _experienceButtonMapp2.buttonTestId;
|
|
123
135
|
if ((0, _toolbarExperienceUtils.isToolbarButtonClick)(target, buttonTestId)) {
|
|
136
|
+
// Store the clicked button so inline popup checks can find its button-group
|
|
137
|
+
lastClickedToolbarButton = target;
|
|
124
138
|
experience.start({
|
|
125
139
|
forceRestart: true
|
|
126
140
|
});
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
Object.defineProperty(exports, "ExperienceCheckPopupMutation", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _experiences.ExperienceCheckPopupMutation;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.isToolbarButtonClick = exports.handleEditorNodeInsertDomMutation = exports.getParentDOMAtSelection = exports.NODE_INSERT_MARKERS = void 0;
|
|
12
13
|
var _experiences = require("@atlaskit/editor-common/experiences");
|
|
13
14
|
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; } } }; }
|
|
14
15
|
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; } }
|
|
15
|
-
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; }
|
|
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; } // eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
16
17
|
/**
|
|
17
18
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
18
19
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -34,251 +35,6 @@ var isToolbarButtonClick = exports.isToolbarButtonClick = function isToolbarButt
|
|
|
34
35
|
return !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
/**
|
|
38
|
-
* ExperienceCheck that observes popup mount point and all its
|
|
39
|
-
* `[data-editor-popup]` children with `{ childList: true }` (no subtree).
|
|
40
|
-
*
|
|
41
|
-
* Detects when a popup containing the given nested element is added to the
|
|
42
|
-
* DOM — either as a new `[data-editor-popup]` direct child, or as content
|
|
43
|
-
* rendered inside an existing `[data-editor-popup]` wrapper.
|
|
44
|
-
*/
|
|
45
|
-
var TYPEAHEAD_DECORATION_SELECTOR = exports.TYPEAHEAD_DECORATION_SELECTOR = '[data-type-ahead="typeaheadDecoration"]';
|
|
46
|
-
var handleTypeAheadOpenDomMutation = exports.handleTypeAheadOpenDomMutation = function handleTypeAheadOpenDomMutation(_ref) {
|
|
47
|
-
var mutations = _ref.mutations;
|
|
48
|
-
var _iterator = _createForOfIteratorHelper(mutations),
|
|
49
|
-
_step;
|
|
50
|
-
try {
|
|
51
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
52
|
-
var mutation = _step.value;
|
|
53
|
-
if (mutation.type !== 'childList') {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
57
|
-
_step2;
|
|
58
|
-
try {
|
|
59
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
60
|
-
var node = _step2.value;
|
|
61
|
-
if (!(node instanceof HTMLElement)) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (node.matches(TYPEAHEAD_DECORATION_SELECTOR) || node.querySelector(TYPEAHEAD_DECORATION_SELECTOR)) {
|
|
65
|
-
return {
|
|
66
|
-
status: 'success'
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} catch (err) {
|
|
71
|
-
_iterator2.e(err);
|
|
72
|
-
} finally {
|
|
73
|
-
_iterator2.f();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} catch (err) {
|
|
77
|
-
_iterator.e(err);
|
|
78
|
-
} finally {
|
|
79
|
-
_iterator.f();
|
|
80
|
-
}
|
|
81
|
-
return undefined;
|
|
82
|
-
};
|
|
83
|
-
var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__PURE__*/function () {
|
|
84
|
-
function ExperienceCheckPopupMutation(nestedElementQuery, getTarget, getEditorDom) {
|
|
85
|
-
(0, _classCallCheck2.default)(this, ExperienceCheckPopupMutation);
|
|
86
|
-
(0, _defineProperty2.default)(this, "observers", []);
|
|
87
|
-
this.nestedElementQuery = nestedElementQuery;
|
|
88
|
-
this.getTarget = getTarget;
|
|
89
|
-
this.getEditorDom = getEditorDom;
|
|
90
|
-
}
|
|
91
|
-
return (0, _createClass2.default)(ExperienceCheckPopupMutation, [{
|
|
92
|
-
key: "start",
|
|
93
|
-
value: function start(callback) {
|
|
94
|
-
var _this = this;
|
|
95
|
-
this.stop();
|
|
96
|
-
var target = this.getTarget();
|
|
97
|
-
if (!target) {
|
|
98
|
-
callback({
|
|
99
|
-
status: 'failure',
|
|
100
|
-
reason: _experiences.EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
101
|
-
});
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
var doc = (0, _browserApis.getDocument)();
|
|
105
|
-
if (!doc) {
|
|
106
|
-
callback({
|
|
107
|
-
status: 'failure',
|
|
108
|
-
reason: _experiences.EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
109
|
-
});
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
var query = this.nestedElementQuery;
|
|
113
|
-
var onMutation = function onMutation(mutations) {
|
|
114
|
-
var _iterator3 = _createForOfIteratorHelper(mutations),
|
|
115
|
-
_step3;
|
|
116
|
-
try {
|
|
117
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
118
|
-
var mutation = _step3.value;
|
|
119
|
-
if (mutation.type !== 'childList') {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
var _iterator4 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
123
|
-
_step4;
|
|
124
|
-
try {
|
|
125
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
126
|
-
var node = _step4.value;
|
|
127
|
-
if (!(node instanceof HTMLElement)) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if ((0, _experiences.popupWithNestedElement)(node, query) || node.matches(query) || !!node.querySelector(query)) {
|
|
131
|
-
_this.stop();
|
|
132
|
-
callback({
|
|
133
|
-
status: 'success'
|
|
134
|
-
});
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
} catch (err) {
|
|
139
|
-
_iterator4.e(err);
|
|
140
|
-
} finally {
|
|
141
|
-
_iterator4.f();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} catch (err) {
|
|
145
|
-
_iterator3.e(err);
|
|
146
|
-
} finally {
|
|
147
|
-
_iterator3.f();
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
var observe = function observe(el) {
|
|
151
|
-
var observer = new MutationObserver(onMutation);
|
|
152
|
-
observer.observe(el, {
|
|
153
|
-
childList: true
|
|
154
|
-
});
|
|
155
|
-
_this.observers.push(observer);
|
|
156
|
-
};
|
|
157
|
-
observe(target);
|
|
158
|
-
var _iterator5 = _createForOfIteratorHelper(target.querySelectorAll('[data-editor-popup]')),
|
|
159
|
-
_step5;
|
|
160
|
-
try {
|
|
161
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
162
|
-
var wrapper = _step5.value;
|
|
163
|
-
observe(wrapper);
|
|
164
|
-
}
|
|
165
|
-
} catch (err) {
|
|
166
|
-
_iterator5.e(err);
|
|
167
|
-
} finally {
|
|
168
|
-
_iterator5.f();
|
|
169
|
-
}
|
|
170
|
-
var portalContainer = doc.querySelector('.atlaskit-portal-container');
|
|
171
|
-
if (portalContainer instanceof HTMLElement) {
|
|
172
|
-
var observePortal = function observePortal(portal) {
|
|
173
|
-
observe(portal);
|
|
174
|
-
var _iterator6 = _createForOfIteratorHelper(portal.children),
|
|
175
|
-
_step6;
|
|
176
|
-
try {
|
|
177
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
178
|
-
var child = _step6.value;
|
|
179
|
-
if (child instanceof HTMLElement) {
|
|
180
|
-
observe(child);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} catch (err) {
|
|
184
|
-
_iterator6.e(err);
|
|
185
|
-
} finally {
|
|
186
|
-
_iterator6.f();
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var containerObserver = new MutationObserver(function (mutations) {
|
|
190
|
-
var _iterator7 = _createForOfIteratorHelper(mutations),
|
|
191
|
-
_step7;
|
|
192
|
-
try {
|
|
193
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
194
|
-
var mutation = _step7.value;
|
|
195
|
-
if (mutation.type !== 'childList') {
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
var _iterator8 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
199
|
-
_step8;
|
|
200
|
-
try {
|
|
201
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
202
|
-
var node = _step8.value;
|
|
203
|
-
if (node instanceof HTMLElement) {
|
|
204
|
-
observePortal(node);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
} catch (err) {
|
|
208
|
-
_iterator8.e(err);
|
|
209
|
-
} finally {
|
|
210
|
-
_iterator8.f();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
} catch (err) {
|
|
214
|
-
_iterator7.e(err);
|
|
215
|
-
} finally {
|
|
216
|
-
_iterator7.f();
|
|
217
|
-
}
|
|
218
|
-
onMutation(mutations);
|
|
219
|
-
});
|
|
220
|
-
containerObserver.observe(portalContainer, {
|
|
221
|
-
childList: true
|
|
222
|
-
});
|
|
223
|
-
this.observers.push(containerObserver);
|
|
224
|
-
var _iterator9 = _createForOfIteratorHelper(portalContainer.querySelectorAll('.atlaskit-portal')),
|
|
225
|
-
_step9;
|
|
226
|
-
try {
|
|
227
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
228
|
-
var portal = _step9.value;
|
|
229
|
-
observePortal(portal);
|
|
230
|
-
}
|
|
231
|
-
} catch (err) {
|
|
232
|
-
_iterator9.e(err);
|
|
233
|
-
} finally {
|
|
234
|
-
_iterator9.f();
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
var editorDom = this.getEditorDom();
|
|
238
|
-
if (editorDom !== null && editorDom !== void 0 && editorDom.parentElement) {
|
|
239
|
-
observe(editorDom.parentElement);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Two-frame DOM check to handle cases where rendering happens before
|
|
243
|
-
// observers are attached.
|
|
244
|
-
var checkDom = function checkDom() {
|
|
245
|
-
if (doc.querySelector(query)) {
|
|
246
|
-
_this.stop();
|
|
247
|
-
callback({
|
|
248
|
-
status: 'success'
|
|
249
|
-
});
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
requestAnimationFrame(function () {
|
|
253
|
-
if (doc.querySelector(query)) {
|
|
254
|
-
_this.stop();
|
|
255
|
-
callback({
|
|
256
|
-
status: 'success'
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
requestAnimationFrame(checkDom);
|
|
262
|
-
}
|
|
263
|
-
}, {
|
|
264
|
-
key: "stop",
|
|
265
|
-
value: function stop() {
|
|
266
|
-
var _iterator0 = _createForOfIteratorHelper(this.observers),
|
|
267
|
-
_step0;
|
|
268
|
-
try {
|
|
269
|
-
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
270
|
-
var observer = _step0.value;
|
|
271
|
-
observer.disconnect();
|
|
272
|
-
}
|
|
273
|
-
} catch (err) {
|
|
274
|
-
_iterator0.e(err);
|
|
275
|
-
} finally {
|
|
276
|
-
_iterator0.f();
|
|
277
|
-
}
|
|
278
|
-
this.observers = [];
|
|
279
|
-
}
|
|
280
|
-
}]);
|
|
281
|
-
}();
|
|
282
38
|
/**
|
|
283
39
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
284
40
|
* for observing with `{ childList: true }` (no subtree).
|
|
@@ -349,23 +105,23 @@ var matchesNodeInsertMarker = function matchesNodeInsertMarker(node) {
|
|
|
349
105
|
* 1. Marker-based: checks `addedNodes` against known node insert selectors.
|
|
350
106
|
* 2. Structure-based: detects element add+remove (block-level replacement).
|
|
351
107
|
*/
|
|
352
|
-
var handleEditorNodeInsertDomMutation = exports.handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDomMutation(
|
|
353
|
-
var mutations =
|
|
108
|
+
var handleEditorNodeInsertDomMutation = exports.handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDomMutation(_ref) {
|
|
109
|
+
var mutations = _ref.mutations;
|
|
354
110
|
var hasAddedElement = false;
|
|
355
111
|
var hasRemovedElement = false;
|
|
356
|
-
var
|
|
357
|
-
|
|
112
|
+
var _iterator = _createForOfIteratorHelper(mutations),
|
|
113
|
+
_step;
|
|
358
114
|
try {
|
|
359
|
-
for (
|
|
360
|
-
var mutation =
|
|
115
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
116
|
+
var mutation = _step.value;
|
|
361
117
|
if (mutation.type !== 'childList') {
|
|
362
118
|
continue;
|
|
363
119
|
}
|
|
364
|
-
var
|
|
365
|
-
|
|
120
|
+
var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
121
|
+
_step2;
|
|
366
122
|
try {
|
|
367
|
-
for (
|
|
368
|
-
var node =
|
|
123
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
124
|
+
var node = _step2.value;
|
|
369
125
|
if (matchesNodeInsertMarker(node)) {
|
|
370
126
|
return {
|
|
371
127
|
status: 'success'
|
|
@@ -376,29 +132,29 @@ var handleEditorNodeInsertDomMutation = exports.handleEditorNodeInsertDomMutatio
|
|
|
376
132
|
}
|
|
377
133
|
}
|
|
378
134
|
} catch (err) {
|
|
379
|
-
|
|
135
|
+
_iterator2.e(err);
|
|
380
136
|
} finally {
|
|
381
|
-
|
|
137
|
+
_iterator2.f();
|
|
382
138
|
}
|
|
383
|
-
var
|
|
384
|
-
|
|
139
|
+
var _iterator3 = _createForOfIteratorHelper(mutation.removedNodes),
|
|
140
|
+
_step3;
|
|
385
141
|
try {
|
|
386
|
-
for (
|
|
387
|
-
var _node =
|
|
142
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
143
|
+
var _node = _step3.value;
|
|
388
144
|
if (_node instanceof HTMLElement) {
|
|
389
145
|
hasRemovedElement = true;
|
|
390
146
|
}
|
|
391
147
|
}
|
|
392
148
|
} catch (err) {
|
|
393
|
-
|
|
149
|
+
_iterator3.e(err);
|
|
394
150
|
} finally {
|
|
395
|
-
|
|
151
|
+
_iterator3.f();
|
|
396
152
|
}
|
|
397
153
|
}
|
|
398
154
|
} catch (err) {
|
|
399
|
-
|
|
155
|
+
_iterator.e(err);
|
|
400
156
|
} finally {
|
|
401
|
-
|
|
157
|
+
_iterator.f();
|
|
402
158
|
}
|
|
403
159
|
if (hasAddedElement && hasRemovedElement) {
|
|
404
160
|
return {
|
|
@@ -4,7 +4,7 @@ import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckT
|
|
|
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 { ExperienceCheckPopupMutation, getParentDOMAtSelection, handleEditorNodeInsertDomMutation,
|
|
7
|
+
import { ExperienceCheckPopupMutation, 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';
|
|
@@ -18,6 +18,7 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
18
18
|
}) => {
|
|
19
19
|
let editorView;
|
|
20
20
|
let popupTargetEl;
|
|
21
|
+
let lastClickedToolbarButton;
|
|
21
22
|
const getPopupsTarget = () => {
|
|
22
23
|
if (!popupTargetEl) {
|
|
23
24
|
var _editorView;
|
|
@@ -32,6 +33,18 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
32
33
|
}
|
|
33
34
|
return null;
|
|
34
35
|
};
|
|
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
|
+
const getInlinePopupTarget = () => {
|
|
42
|
+
var _lastClickedToolbarBu;
|
|
43
|
+
if (!lastClickedToolbarButton) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return (_lastClickedToolbarBu = lastClickedToolbarButton.closest('[data-toolbar-component="button-group"]')) !== null && _lastClickedToolbarBu !== void 0 ? _lastClickedToolbarBu : lastClickedToolbarButton;
|
|
47
|
+
};
|
|
35
48
|
const narrowParentObserveConfig = () => {
|
|
36
49
|
var _getParentDOMAtSelect;
|
|
37
50
|
return {
|
|
@@ -61,44 +74,42 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
61
74
|
observeConfig: rootObserveConfig
|
|
62
75
|
})]
|
|
63
76
|
});
|
|
64
|
-
const createPopupExperience = (action, popupSelector) => new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
77
|
+
const createPopupExperience = (action, popupSelector, type = 'editorRoot') => new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
65
78
|
action,
|
|
66
79
|
actionSubjectId: PRIMARY_TOOLBAR,
|
|
67
80
|
dispatchAnalyticsEvent,
|
|
68
81
|
checks: [new ExperienceCheckTimeout({
|
|
69
82
|
durationMs: TIMEOUT_DURATION
|
|
70
|
-
}), new ExperienceCheckPopupMutation(
|
|
83
|
+
}), new ExperienceCheckPopupMutation({
|
|
84
|
+
nestedElementQuery: popupSelector,
|
|
85
|
+
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
86
|
+
getEditorDom,
|
|
87
|
+
type
|
|
88
|
+
})]
|
|
71
89
|
});
|
|
72
90
|
const experienceButtonMappings = [{
|
|
73
|
-
experience: createPopupExperience('
|
|
91
|
+
experience: createPopupExperience('insert', '[data-testid="popup-wrapper"]', 'inline'),
|
|
92
|
+
buttonTestId: TOOLBAR_BUTTON_TEST_ID.INSERT
|
|
93
|
+
}, {
|
|
94
|
+
experience: createPopupExperience('emoji', '[data-emoji-picker-container], [data-emoji-picker-container="true"], [data-testid="popup-wrapper"]', 'inline'),
|
|
74
95
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.EMOJI
|
|
75
96
|
}, {
|
|
76
|
-
experience: createPopupExperience('media', '[
|
|
97
|
+
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline'),
|
|
77
98
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.MEDIA
|
|
78
99
|
}, {
|
|
79
|
-
experience:
|
|
80
|
-
action: 'mention',
|
|
81
|
-
actionSubjectId: PRIMARY_TOOLBAR,
|
|
82
|
-
dispatchAnalyticsEvent,
|
|
83
|
-
checks: [new ExperienceCheckTimeout({
|
|
84
|
-
durationMs: TIMEOUT_DURATION
|
|
85
|
-
}), new ExperienceCheckDomMutation({
|
|
86
|
-
onDomMutation: handleTypeAheadOpenDomMutation,
|
|
87
|
-
observeConfig: narrowParentObserveConfig
|
|
88
|
-
})]
|
|
89
|
-
}),
|
|
100
|
+
experience: createPopupExperience('mention', '[data-testid="popup-wrapper"], [data-type-ahead="typeaheadDecoration"]', 'editorRoot'),
|
|
90
101
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.MENTION
|
|
91
102
|
}, {
|
|
92
103
|
experience: createNodeInsertExperience('table'),
|
|
93
104
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE
|
|
94
105
|
}, {
|
|
95
|
-
experience: createPopupExperience('tableSelector', '[aria-label*="table size"], [data-testid*="table-selector"]'),
|
|
106
|
+
experience: createPopupExperience('tableSelector', '[aria-label*="table size"], [data-testid*="table-selector"]', 'inline'),
|
|
96
107
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE_SELECTOR
|
|
97
108
|
}, {
|
|
98
109
|
experience: createNodeInsertExperience('layout'),
|
|
99
110
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.LAYOUT
|
|
100
111
|
}, {
|
|
101
|
-
experience: createPopupExperience('image', '[
|
|
112
|
+
experience: createPopupExperience('image', '[data-testid="popup-wrapper"]', 'inline'),
|
|
102
113
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.IMAGE
|
|
103
114
|
}, {
|
|
104
115
|
experience: createNodeInsertExperience('action'),
|
|
@@ -110,6 +121,8 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
110
121
|
buttonTestId
|
|
111
122
|
} of experienceButtonMappings) {
|
|
112
123
|
if (isToolbarButtonClick(target, buttonTestId)) {
|
|
124
|
+
// Store the clicked button so inline popup checks can find its button-group
|
|
125
|
+
lastClickedToolbarButton = target;
|
|
113
126
|
experience.start({
|
|
114
127
|
forceRestart: true
|
|
115
128
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
2
|
+
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
6
6
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -22,156 +22,6 @@ export const isToolbarButtonClick = (target, testId) => {
|
|
|
22
22
|
return !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* ExperienceCheck that observes popup mount point and all its
|
|
27
|
-
* `[data-editor-popup]` children with `{ childList: true }` (no subtree).
|
|
28
|
-
*
|
|
29
|
-
* Detects when a popup containing the given nested element is added to the
|
|
30
|
-
* DOM — either as a new `[data-editor-popup]` direct child, or as content
|
|
31
|
-
* rendered inside an existing `[data-editor-popup]` wrapper.
|
|
32
|
-
*/
|
|
33
|
-
export const TYPEAHEAD_DECORATION_SELECTOR = '[data-type-ahead="typeaheadDecoration"]';
|
|
34
|
-
export const handleTypeAheadOpenDomMutation = ({
|
|
35
|
-
mutations
|
|
36
|
-
}) => {
|
|
37
|
-
for (const mutation of mutations) {
|
|
38
|
-
if (mutation.type !== 'childList') {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
for (const node of mutation.addedNodes) {
|
|
42
|
-
if (!(node instanceof HTMLElement)) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (node.matches(TYPEAHEAD_DECORATION_SELECTOR) || node.querySelector(TYPEAHEAD_DECORATION_SELECTOR)) {
|
|
46
|
-
return {
|
|
47
|
-
status: 'success'
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return undefined;
|
|
53
|
-
};
|
|
54
|
-
export class ExperienceCheckPopupMutation {
|
|
55
|
-
constructor(nestedElementQuery, getTarget, getEditorDom) {
|
|
56
|
-
_defineProperty(this, "observers", []);
|
|
57
|
-
this.nestedElementQuery = nestedElementQuery;
|
|
58
|
-
this.getTarget = getTarget;
|
|
59
|
-
this.getEditorDom = getEditorDom;
|
|
60
|
-
}
|
|
61
|
-
start(callback) {
|
|
62
|
-
this.stop();
|
|
63
|
-
const target = this.getTarget();
|
|
64
|
-
if (!target) {
|
|
65
|
-
callback({
|
|
66
|
-
status: 'failure',
|
|
67
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
68
|
-
});
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const doc = getDocument();
|
|
72
|
-
if (!doc) {
|
|
73
|
-
callback({
|
|
74
|
-
status: 'failure',
|
|
75
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const query = this.nestedElementQuery;
|
|
80
|
-
const onMutation = mutations => {
|
|
81
|
-
for (const mutation of mutations) {
|
|
82
|
-
if (mutation.type !== 'childList') {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
for (const node of mutation.addedNodes) {
|
|
86
|
-
if (!(node instanceof HTMLElement)) {
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if (popupWithNestedElement(node, query) || node.matches(query) || !!node.querySelector(query)) {
|
|
90
|
-
this.stop();
|
|
91
|
-
callback({
|
|
92
|
-
status: 'success'
|
|
93
|
-
});
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const observe = el => {
|
|
100
|
-
const observer = new MutationObserver(onMutation);
|
|
101
|
-
observer.observe(el, {
|
|
102
|
-
childList: true
|
|
103
|
-
});
|
|
104
|
-
this.observers.push(observer);
|
|
105
|
-
};
|
|
106
|
-
observe(target);
|
|
107
|
-
for (const wrapper of target.querySelectorAll('[data-editor-popup]')) {
|
|
108
|
-
observe(wrapper);
|
|
109
|
-
}
|
|
110
|
-
const portalContainer = doc.querySelector('.atlaskit-portal-container');
|
|
111
|
-
if (portalContainer instanceof HTMLElement) {
|
|
112
|
-
const observePortal = portal => {
|
|
113
|
-
observe(portal);
|
|
114
|
-
for (const child of portal.children) {
|
|
115
|
-
if (child instanceof HTMLElement) {
|
|
116
|
-
observe(child);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const containerObserver = new MutationObserver(mutations => {
|
|
121
|
-
for (const mutation of mutations) {
|
|
122
|
-
if (mutation.type !== 'childList') {
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
for (const node of mutation.addedNodes) {
|
|
126
|
-
if (node instanceof HTMLElement) {
|
|
127
|
-
observePortal(node);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
onMutation(mutations);
|
|
132
|
-
});
|
|
133
|
-
containerObserver.observe(portalContainer, {
|
|
134
|
-
childList: true
|
|
135
|
-
});
|
|
136
|
-
this.observers.push(containerObserver);
|
|
137
|
-
for (const portal of portalContainer.querySelectorAll('.atlaskit-portal')) {
|
|
138
|
-
observePortal(portal);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const editorDom = this.getEditorDom();
|
|
142
|
-
if (editorDom !== null && editorDom !== void 0 && editorDom.parentElement) {
|
|
143
|
-
observe(editorDom.parentElement);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Two-frame DOM check to handle cases where rendering happens before
|
|
147
|
-
// observers are attached.
|
|
148
|
-
const checkDom = () => {
|
|
149
|
-
if (doc.querySelector(query)) {
|
|
150
|
-
this.stop();
|
|
151
|
-
callback({
|
|
152
|
-
status: 'success'
|
|
153
|
-
});
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
requestAnimationFrame(() => {
|
|
157
|
-
if (doc.querySelector(query)) {
|
|
158
|
-
this.stop();
|
|
159
|
-
callback({
|
|
160
|
-
status: 'success'
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
requestAnimationFrame(checkDom);
|
|
166
|
-
}
|
|
167
|
-
stop() {
|
|
168
|
-
for (const observer of this.observers) {
|
|
169
|
-
observer.disconnect();
|
|
170
|
-
}
|
|
171
|
-
this.observers = [];
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
25
|
/**
|
|
176
26
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
177
27
|
* for observing with `{ childList: true }` (no subtree).
|
|
@@ -4,7 +4,7 @@ import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckT
|
|
|
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 { ExperienceCheckPopupMutation, getParentDOMAtSelection, handleEditorNodeInsertDomMutation,
|
|
7
|
+
import { ExperienceCheckPopupMutation, 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';
|
|
@@ -17,6 +17,7 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
17
17
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
18
18
|
var editorView;
|
|
19
19
|
var popupTargetEl;
|
|
20
|
+
var lastClickedToolbarButton;
|
|
20
21
|
var getPopupsTarget = function getPopupsTarget() {
|
|
21
22
|
if (!popupTargetEl) {
|
|
22
23
|
var _editorView;
|
|
@@ -31,6 +32,18 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
31
32
|
}
|
|
32
33
|
return null;
|
|
33
34
|
};
|
|
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
|
+
var getInlinePopupTarget = function getInlinePopupTarget() {
|
|
41
|
+
var _lastClickedToolbarBu;
|
|
42
|
+
if (!lastClickedToolbarButton) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
return (_lastClickedToolbarBu = lastClickedToolbarButton.closest('[data-toolbar-component="button-group"]')) !== null && _lastClickedToolbarBu !== void 0 ? _lastClickedToolbarBu : lastClickedToolbarButton;
|
|
46
|
+
};
|
|
34
47
|
var narrowParentObserveConfig = function narrowParentObserveConfig() {
|
|
35
48
|
var _getParentDOMAtSelect;
|
|
36
49
|
return {
|
|
@@ -65,45 +78,44 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
65
78
|
});
|
|
66
79
|
};
|
|
67
80
|
var createPopupExperience = function createPopupExperience(action, popupSelector) {
|
|
81
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'editorRoot';
|
|
68
82
|
return new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
|
|
69
83
|
action: action,
|
|
70
84
|
actionSubjectId: PRIMARY_TOOLBAR,
|
|
71
85
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
72
86
|
checks: [new ExperienceCheckTimeout({
|
|
73
87
|
durationMs: TIMEOUT_DURATION
|
|
74
|
-
}), new ExperienceCheckPopupMutation(
|
|
88
|
+
}), new ExperienceCheckPopupMutation({
|
|
89
|
+
nestedElementQuery: popupSelector,
|
|
90
|
+
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
91
|
+
getEditorDom: getEditorDom,
|
|
92
|
+
type: type
|
|
93
|
+
})]
|
|
75
94
|
});
|
|
76
95
|
};
|
|
77
96
|
var experienceButtonMappings = [{
|
|
78
|
-
experience: createPopupExperience('
|
|
97
|
+
experience: createPopupExperience('insert', '[data-testid="popup-wrapper"]', 'inline'),
|
|
98
|
+
buttonTestId: TOOLBAR_BUTTON_TEST_ID.INSERT
|
|
99
|
+
}, {
|
|
100
|
+
experience: createPopupExperience('emoji', '[data-emoji-picker-container], [data-emoji-picker-container="true"], [data-testid="popup-wrapper"]', 'inline'),
|
|
79
101
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.EMOJI
|
|
80
102
|
}, {
|
|
81
|
-
experience: createPopupExperience('media', '[
|
|
103
|
+
experience: createPopupExperience('media', '[data-testid="popup-wrapper"]', 'inline'),
|
|
82
104
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.MEDIA
|
|
83
105
|
}, {
|
|
84
|
-
experience:
|
|
85
|
-
action: 'mention',
|
|
86
|
-
actionSubjectId: PRIMARY_TOOLBAR,
|
|
87
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
88
|
-
checks: [new ExperienceCheckTimeout({
|
|
89
|
-
durationMs: TIMEOUT_DURATION
|
|
90
|
-
}), new ExperienceCheckDomMutation({
|
|
91
|
-
onDomMutation: handleTypeAheadOpenDomMutation,
|
|
92
|
-
observeConfig: narrowParentObserveConfig
|
|
93
|
-
})]
|
|
94
|
-
}),
|
|
106
|
+
experience: createPopupExperience('mention', '[data-testid="popup-wrapper"], [data-type-ahead="typeaheadDecoration"]', 'editorRoot'),
|
|
95
107
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.MENTION
|
|
96
108
|
}, {
|
|
97
109
|
experience: createNodeInsertExperience('table'),
|
|
98
110
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE
|
|
99
111
|
}, {
|
|
100
|
-
experience: createPopupExperience('tableSelector', '[aria-label*="table size"], [data-testid*="table-selector"]'),
|
|
112
|
+
experience: createPopupExperience('tableSelector', '[aria-label*="table size"], [data-testid*="table-selector"]', 'inline'),
|
|
101
113
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.TABLE_SELECTOR
|
|
102
114
|
}, {
|
|
103
115
|
experience: createNodeInsertExperience('layout'),
|
|
104
116
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.LAYOUT
|
|
105
117
|
}, {
|
|
106
|
-
experience: createPopupExperience('image', '[
|
|
118
|
+
experience: createPopupExperience('image', '[data-testid="popup-wrapper"]', 'inline'),
|
|
107
119
|
buttonTestId: TOOLBAR_BUTTON_TEST_ID.IMAGE
|
|
108
120
|
}, {
|
|
109
121
|
experience: createNodeInsertExperience('action'),
|
|
@@ -115,6 +127,8 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
115
127
|
experience = _experienceButtonMapp2.experience,
|
|
116
128
|
buttonTestId = _experienceButtonMapp2.buttonTestId;
|
|
117
129
|
if (isToolbarButtonClick(target, buttonTestId)) {
|
|
130
|
+
// Store the clicked button so inline popup checks can find its button-group
|
|
131
|
+
lastClickedToolbarButton = target;
|
|
118
132
|
experience.start({
|
|
119
133
|
forceRestart: true
|
|
120
134
|
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
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; } } }; }
|
|
5
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; } }
|
|
6
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; }
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
5
|
+
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
6
|
+
|
|
9
7
|
/**
|
|
10
8
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
11
9
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -27,252 +25,6 @@ export var isToolbarButtonClick = function isToolbarButtonClick(target, testId)
|
|
|
27
25
|
return !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
28
26
|
};
|
|
29
27
|
|
|
30
|
-
/**
|
|
31
|
-
* ExperienceCheck that observes popup mount point and all its
|
|
32
|
-
* `[data-editor-popup]` children with `{ childList: true }` (no subtree).
|
|
33
|
-
*
|
|
34
|
-
* Detects when a popup containing the given nested element is added to the
|
|
35
|
-
* DOM — either as a new `[data-editor-popup]` direct child, or as content
|
|
36
|
-
* rendered inside an existing `[data-editor-popup]` wrapper.
|
|
37
|
-
*/
|
|
38
|
-
export var TYPEAHEAD_DECORATION_SELECTOR = '[data-type-ahead="typeaheadDecoration"]';
|
|
39
|
-
export var handleTypeAheadOpenDomMutation = function handleTypeAheadOpenDomMutation(_ref) {
|
|
40
|
-
var mutations = _ref.mutations;
|
|
41
|
-
var _iterator = _createForOfIteratorHelper(mutations),
|
|
42
|
-
_step;
|
|
43
|
-
try {
|
|
44
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
45
|
-
var mutation = _step.value;
|
|
46
|
-
if (mutation.type !== 'childList') {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
50
|
-
_step2;
|
|
51
|
-
try {
|
|
52
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
53
|
-
var node = _step2.value;
|
|
54
|
-
if (!(node instanceof HTMLElement)) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (node.matches(TYPEAHEAD_DECORATION_SELECTOR) || node.querySelector(TYPEAHEAD_DECORATION_SELECTOR)) {
|
|
58
|
-
return {
|
|
59
|
-
status: 'success'
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
} catch (err) {
|
|
64
|
-
_iterator2.e(err);
|
|
65
|
-
} finally {
|
|
66
|
-
_iterator2.f();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} catch (err) {
|
|
70
|
-
_iterator.e(err);
|
|
71
|
-
} finally {
|
|
72
|
-
_iterator.f();
|
|
73
|
-
}
|
|
74
|
-
return undefined;
|
|
75
|
-
};
|
|
76
|
-
export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
|
|
77
|
-
function ExperienceCheckPopupMutation(nestedElementQuery, getTarget, getEditorDom) {
|
|
78
|
-
_classCallCheck(this, ExperienceCheckPopupMutation);
|
|
79
|
-
_defineProperty(this, "observers", []);
|
|
80
|
-
this.nestedElementQuery = nestedElementQuery;
|
|
81
|
-
this.getTarget = getTarget;
|
|
82
|
-
this.getEditorDom = getEditorDom;
|
|
83
|
-
}
|
|
84
|
-
return _createClass(ExperienceCheckPopupMutation, [{
|
|
85
|
-
key: "start",
|
|
86
|
-
value: function start(callback) {
|
|
87
|
-
var _this = this;
|
|
88
|
-
this.stop();
|
|
89
|
-
var target = this.getTarget();
|
|
90
|
-
if (!target) {
|
|
91
|
-
callback({
|
|
92
|
-
status: 'failure',
|
|
93
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
94
|
-
});
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
var doc = getDocument();
|
|
98
|
-
if (!doc) {
|
|
99
|
-
callback({
|
|
100
|
-
status: 'failure',
|
|
101
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
102
|
-
});
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
var query = this.nestedElementQuery;
|
|
106
|
-
var onMutation = function onMutation(mutations) {
|
|
107
|
-
var _iterator3 = _createForOfIteratorHelper(mutations),
|
|
108
|
-
_step3;
|
|
109
|
-
try {
|
|
110
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
111
|
-
var mutation = _step3.value;
|
|
112
|
-
if (mutation.type !== 'childList') {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
var _iterator4 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
116
|
-
_step4;
|
|
117
|
-
try {
|
|
118
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
119
|
-
var node = _step4.value;
|
|
120
|
-
if (!(node instanceof HTMLElement)) {
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (popupWithNestedElement(node, query) || node.matches(query) || !!node.querySelector(query)) {
|
|
124
|
-
_this.stop();
|
|
125
|
-
callback({
|
|
126
|
-
status: 'success'
|
|
127
|
-
});
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
} catch (err) {
|
|
132
|
-
_iterator4.e(err);
|
|
133
|
-
} finally {
|
|
134
|
-
_iterator4.f();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
} catch (err) {
|
|
138
|
-
_iterator3.e(err);
|
|
139
|
-
} finally {
|
|
140
|
-
_iterator3.f();
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
var observe = function observe(el) {
|
|
144
|
-
var observer = new MutationObserver(onMutation);
|
|
145
|
-
observer.observe(el, {
|
|
146
|
-
childList: true
|
|
147
|
-
});
|
|
148
|
-
_this.observers.push(observer);
|
|
149
|
-
};
|
|
150
|
-
observe(target);
|
|
151
|
-
var _iterator5 = _createForOfIteratorHelper(target.querySelectorAll('[data-editor-popup]')),
|
|
152
|
-
_step5;
|
|
153
|
-
try {
|
|
154
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
155
|
-
var wrapper = _step5.value;
|
|
156
|
-
observe(wrapper);
|
|
157
|
-
}
|
|
158
|
-
} catch (err) {
|
|
159
|
-
_iterator5.e(err);
|
|
160
|
-
} finally {
|
|
161
|
-
_iterator5.f();
|
|
162
|
-
}
|
|
163
|
-
var portalContainer = doc.querySelector('.atlaskit-portal-container');
|
|
164
|
-
if (portalContainer instanceof HTMLElement) {
|
|
165
|
-
var observePortal = function observePortal(portal) {
|
|
166
|
-
observe(portal);
|
|
167
|
-
var _iterator6 = _createForOfIteratorHelper(portal.children),
|
|
168
|
-
_step6;
|
|
169
|
-
try {
|
|
170
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
171
|
-
var child = _step6.value;
|
|
172
|
-
if (child instanceof HTMLElement) {
|
|
173
|
-
observe(child);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
} catch (err) {
|
|
177
|
-
_iterator6.e(err);
|
|
178
|
-
} finally {
|
|
179
|
-
_iterator6.f();
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
var containerObserver = new MutationObserver(function (mutations) {
|
|
183
|
-
var _iterator7 = _createForOfIteratorHelper(mutations),
|
|
184
|
-
_step7;
|
|
185
|
-
try {
|
|
186
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
187
|
-
var mutation = _step7.value;
|
|
188
|
-
if (mutation.type !== 'childList') {
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
var _iterator8 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
192
|
-
_step8;
|
|
193
|
-
try {
|
|
194
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
195
|
-
var node = _step8.value;
|
|
196
|
-
if (node instanceof HTMLElement) {
|
|
197
|
-
observePortal(node);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
} catch (err) {
|
|
201
|
-
_iterator8.e(err);
|
|
202
|
-
} finally {
|
|
203
|
-
_iterator8.f();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
} catch (err) {
|
|
207
|
-
_iterator7.e(err);
|
|
208
|
-
} finally {
|
|
209
|
-
_iterator7.f();
|
|
210
|
-
}
|
|
211
|
-
onMutation(mutations);
|
|
212
|
-
});
|
|
213
|
-
containerObserver.observe(portalContainer, {
|
|
214
|
-
childList: true
|
|
215
|
-
});
|
|
216
|
-
this.observers.push(containerObserver);
|
|
217
|
-
var _iterator9 = _createForOfIteratorHelper(portalContainer.querySelectorAll('.atlaskit-portal')),
|
|
218
|
-
_step9;
|
|
219
|
-
try {
|
|
220
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
221
|
-
var portal = _step9.value;
|
|
222
|
-
observePortal(portal);
|
|
223
|
-
}
|
|
224
|
-
} catch (err) {
|
|
225
|
-
_iterator9.e(err);
|
|
226
|
-
} finally {
|
|
227
|
-
_iterator9.f();
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
var editorDom = this.getEditorDom();
|
|
231
|
-
if (editorDom !== null && editorDom !== void 0 && editorDom.parentElement) {
|
|
232
|
-
observe(editorDom.parentElement);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Two-frame DOM check to handle cases where rendering happens before
|
|
236
|
-
// observers are attached.
|
|
237
|
-
var checkDom = function checkDom() {
|
|
238
|
-
if (doc.querySelector(query)) {
|
|
239
|
-
_this.stop();
|
|
240
|
-
callback({
|
|
241
|
-
status: 'success'
|
|
242
|
-
});
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
requestAnimationFrame(function () {
|
|
246
|
-
if (doc.querySelector(query)) {
|
|
247
|
-
_this.stop();
|
|
248
|
-
callback({
|
|
249
|
-
status: 'success'
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
requestAnimationFrame(checkDom);
|
|
255
|
-
}
|
|
256
|
-
}, {
|
|
257
|
-
key: "stop",
|
|
258
|
-
value: function stop() {
|
|
259
|
-
var _iterator0 = _createForOfIteratorHelper(this.observers),
|
|
260
|
-
_step0;
|
|
261
|
-
try {
|
|
262
|
-
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
263
|
-
var observer = _step0.value;
|
|
264
|
-
observer.disconnect();
|
|
265
|
-
}
|
|
266
|
-
} catch (err) {
|
|
267
|
-
_iterator0.e(err);
|
|
268
|
-
} finally {
|
|
269
|
-
_iterator0.f();
|
|
270
|
-
}
|
|
271
|
-
this.observers = [];
|
|
272
|
-
}
|
|
273
|
-
}]);
|
|
274
|
-
}();
|
|
275
|
-
|
|
276
28
|
/**
|
|
277
29
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
278
30
|
* for observing with `{ childList: true }` (no subtree).
|
|
@@ -343,23 +95,23 @@ var matchesNodeInsertMarker = function matchesNodeInsertMarker(node) {
|
|
|
343
95
|
* 1. Marker-based: checks `addedNodes` against known node insert selectors.
|
|
344
96
|
* 2. Structure-based: detects element add+remove (block-level replacement).
|
|
345
97
|
*/
|
|
346
|
-
export var handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDomMutation(
|
|
347
|
-
var mutations =
|
|
98
|
+
export var handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDomMutation(_ref) {
|
|
99
|
+
var mutations = _ref.mutations;
|
|
348
100
|
var hasAddedElement = false;
|
|
349
101
|
var hasRemovedElement = false;
|
|
350
|
-
var
|
|
351
|
-
|
|
102
|
+
var _iterator = _createForOfIteratorHelper(mutations),
|
|
103
|
+
_step;
|
|
352
104
|
try {
|
|
353
|
-
for (
|
|
354
|
-
var mutation =
|
|
105
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
106
|
+
var mutation = _step.value;
|
|
355
107
|
if (mutation.type !== 'childList') {
|
|
356
108
|
continue;
|
|
357
109
|
}
|
|
358
|
-
var
|
|
359
|
-
|
|
110
|
+
var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
111
|
+
_step2;
|
|
360
112
|
try {
|
|
361
|
-
for (
|
|
362
|
-
var node =
|
|
113
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
114
|
+
var node = _step2.value;
|
|
363
115
|
if (matchesNodeInsertMarker(node)) {
|
|
364
116
|
return {
|
|
365
117
|
status: 'success'
|
|
@@ -370,29 +122,29 @@ export var handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDo
|
|
|
370
122
|
}
|
|
371
123
|
}
|
|
372
124
|
} catch (err) {
|
|
373
|
-
|
|
125
|
+
_iterator2.e(err);
|
|
374
126
|
} finally {
|
|
375
|
-
|
|
127
|
+
_iterator2.f();
|
|
376
128
|
}
|
|
377
|
-
var
|
|
378
|
-
|
|
129
|
+
var _iterator3 = _createForOfIteratorHelper(mutation.removedNodes),
|
|
130
|
+
_step3;
|
|
379
131
|
try {
|
|
380
|
-
for (
|
|
381
|
-
var _node =
|
|
132
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
133
|
+
var _node = _step3.value;
|
|
382
134
|
if (_node instanceof HTMLElement) {
|
|
383
135
|
hasRemovedElement = true;
|
|
384
136
|
}
|
|
385
137
|
}
|
|
386
138
|
} catch (err) {
|
|
387
|
-
|
|
139
|
+
_iterator3.e(err);
|
|
388
140
|
} finally {
|
|
389
|
-
|
|
141
|
+
_iterator3.f();
|
|
390
142
|
}
|
|
391
143
|
}
|
|
392
144
|
} catch (err) {
|
|
393
|
-
|
|
145
|
+
_iterator.e(err);
|
|
394
146
|
} finally {
|
|
395
|
-
|
|
147
|
+
_iterator.f();
|
|
396
148
|
}
|
|
397
149
|
if (hasAddedElement && hasRemovedElement) {
|
|
398
150
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
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';
|
|
3
4
|
/**
|
|
4
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
5
6
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -13,27 +14,6 @@ export declare const NODE_INSERT_MARKERS: {
|
|
|
13
14
|
readonly TASK_ITEM: ".taskItemView-content-wrap";
|
|
14
15
|
};
|
|
15
16
|
export declare const isToolbarButtonClick: (target: HTMLElement, testId: string) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* ExperienceCheck that observes popup mount point and all its
|
|
18
|
-
* `[data-editor-popup]` children with `{ childList: true }` (no subtree).
|
|
19
|
-
*
|
|
20
|
-
* Detects when a popup containing the given nested element is added to the
|
|
21
|
-
* DOM — either as a new `[data-editor-popup]` direct child, or as content
|
|
22
|
-
* rendered inside an existing `[data-editor-popup]` wrapper.
|
|
23
|
-
*/
|
|
24
|
-
export declare const TYPEAHEAD_DECORATION_SELECTOR = "[data-type-ahead=\"typeaheadDecoration\"]";
|
|
25
|
-
export declare const handleTypeAheadOpenDomMutation: ({ mutations, }: {
|
|
26
|
-
mutations: MutationRecord[];
|
|
27
|
-
}) => ExperienceCheckResult | undefined;
|
|
28
|
-
export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
|
|
29
|
-
private nestedElementQuery;
|
|
30
|
-
private getTarget;
|
|
31
|
-
private getEditorDom;
|
|
32
|
-
private observers;
|
|
33
|
-
constructor(nestedElementQuery: string, getTarget: () => HTMLElement | undefined | null, getEditorDom: () => HTMLElement | undefined | null);
|
|
34
|
-
start(callback: ExperienceCheckCallback): void;
|
|
35
|
-
stop(): void;
|
|
36
|
-
}
|
|
37
17
|
/**
|
|
38
18
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
39
19
|
* for observing with `{ childList: true }` (no subtree).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
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';
|
|
3
4
|
/**
|
|
4
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
5
6
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -13,27 +14,6 @@ export declare const NODE_INSERT_MARKERS: {
|
|
|
13
14
|
readonly TASK_ITEM: ".taskItemView-content-wrap";
|
|
14
15
|
};
|
|
15
16
|
export declare const isToolbarButtonClick: (target: HTMLElement, testId: string) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* ExperienceCheck that observes popup mount point and all its
|
|
18
|
-
* `[data-editor-popup]` children with `{ childList: true }` (no subtree).
|
|
19
|
-
*
|
|
20
|
-
* Detects when a popup containing the given nested element is added to the
|
|
21
|
-
* DOM — either as a new `[data-editor-popup]` direct child, or as content
|
|
22
|
-
* rendered inside an existing `[data-editor-popup]` wrapper.
|
|
23
|
-
*/
|
|
24
|
-
export declare const TYPEAHEAD_DECORATION_SELECTOR = "[data-type-ahead=\"typeaheadDecoration\"]";
|
|
25
|
-
export declare const handleTypeAheadOpenDomMutation: ({ mutations, }: {
|
|
26
|
-
mutations: MutationRecord[];
|
|
27
|
-
}) => ExperienceCheckResult | undefined;
|
|
28
|
-
export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
|
|
29
|
-
private nestedElementQuery;
|
|
30
|
-
private getTarget;
|
|
31
|
-
private getEditorDom;
|
|
32
|
-
private observers;
|
|
33
|
-
constructor(nestedElementQuery: string, getTarget: () => HTMLElement | undefined | null, getEditorDom: () => HTMLElement | undefined | null);
|
|
34
|
-
start(callback: ExperienceCheckCallback): void;
|
|
35
|
-
stop(): void;
|
|
36
|
-
}
|
|
37
17
|
/**
|
|
38
18
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
39
19
|
* for observing with `{ childList: true }` (no subtree).
|
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.4",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/editor-plugin-connectivity": "^7.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-date": "^9.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-emoji": "^8.1.0",
|
|
39
|
-
"@atlaskit/editor-plugin-expand": "^8.
|
|
39
|
+
"@atlaskit/editor-plugin-expand": "^8.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-extension": "^10.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-feature-flags": "^6.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-hyperlink": "^9.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/editor-plugin-layout": "^7.0.0",
|
|
45
45
|
"@atlaskit/editor-plugin-media": "^9.5.0",
|
|
46
46
|
"@atlaskit/editor-plugin-media-insert": "^18.0.0",
|
|
47
|
-
"@atlaskit/editor-plugin-mentions": "^9.
|
|
47
|
+
"@atlaskit/editor-plugin-mentions": "^9.3.0",
|
|
48
48
|
"@atlaskit/editor-plugin-metrics": "^8.0.0",
|
|
49
49
|
"@atlaskit/editor-plugin-panel": "^9.0.0",
|
|
50
50
|
"@atlaskit/editor-plugin-placeholder-text": "^8.0.0",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
60
60
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
61
61
|
"@atlaskit/editor-toolbar": "^0.19.0",
|
|
62
|
-
"@atlaskit/editor-toolbar-model": "^0.
|
|
62
|
+
"@atlaskit/editor-toolbar-model": "^0.4.0",
|
|
63
63
|
"@atlaskit/emoji": "^69.10.0",
|
|
64
64
|
"@atlaskit/icon": "^31.0.0",
|
|
65
65
|
"@atlaskit/icon-lab": "^5.16.0",
|
|
66
66
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
67
67
|
"@atlaskit/theme": "^21.0.0",
|
|
68
|
-
"@atlaskit/tmp-editor-statsig": "^29.
|
|
68
|
+
"@atlaskit/tmp-editor-statsig": "^29.6.0",
|
|
69
69
|
"@atlaskit/tokens": "^11.0.0",
|
|
70
70
|
"@babel/runtime": "^7.0.0",
|
|
71
71
|
"@emotion/react": "^11.7.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"react-virtualized": "^9.22.6"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@atlaskit/editor-common": "^111.
|
|
78
|
+
"@atlaskit/editor-common": "^111.19.0",
|
|
79
79
|
"react": "^18.2.0",
|
|
80
80
|
"react-dom": "^18.2.0",
|
|
81
81
|
"react-intl-next": "npm:react-intl@^5.18.1"
|