@atlaskit/editor-plugin-insert-block 8.7.3 → 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 +8 -0
- package/dist/cjs/pm-plugins/experiences/toolbar-action-experiences.js +8 -2
- package/dist/cjs/pm-plugins/experiences/toolbar-experience-utils.js +26 -216
- package/dist/es2019/pm-plugins/experiences/toolbar-action-experiences.js +8 -2
- package/dist/es2019/pm-plugins/experiences/toolbar-experience-utils.js +2 -136
- package/dist/esm/pm-plugins/experiences/toolbar-action-experiences.js +8 -2
- package/dist/esm/pm-plugins/experiences/toolbar-experience-utils.js +20 -215
- package/dist/types/pm-plugins/experiences/toolbar-experience-utils.d.ts +2 -35
- package/dist/types-ts4.5/pm-plugins/experiences/toolbar-experience-utils.d.ts +2 -35
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 8.7.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -44,10 +44,11 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
44
44
|
* This allows inline popup checks to observe only the relevant button-group.
|
|
45
45
|
*/
|
|
46
46
|
var getInlinePopupTarget = function getInlinePopupTarget() {
|
|
47
|
+
var _lastClickedToolbarBu;
|
|
47
48
|
if (!lastClickedToolbarButton) {
|
|
48
49
|
return undefined;
|
|
49
50
|
}
|
|
50
|
-
return lastClickedToolbarButton;
|
|
51
|
+
return (_lastClickedToolbarBu = lastClickedToolbarButton.closest('[data-toolbar-component="button-group"]')) !== null && _lastClickedToolbarBu !== void 0 ? _lastClickedToolbarBu : lastClickedToolbarButton;
|
|
51
52
|
};
|
|
52
53
|
var narrowParentObserveConfig = function narrowParentObserveConfig() {
|
|
53
54
|
var _getParentDOMAtSelect;
|
|
@@ -90,7 +91,12 @@ var getToolbarActionExperiencesPlugin = exports.getToolbarActionExperiencesPlugi
|
|
|
90
91
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
91
92
|
checks: [new _experiences.ExperienceCheckTimeout({
|
|
92
93
|
durationMs: TIMEOUT_DURATION
|
|
93
|
-
}), new _toolbarExperienceUtils.ExperienceCheckPopupMutation(
|
|
94
|
+
}), new _toolbarExperienceUtils.ExperienceCheckPopupMutation({
|
|
95
|
+
nestedElementQuery: popupSelector,
|
|
96
|
+
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
97
|
+
getEditorDom: getEditorDom,
|
|
98
|
+
type: type
|
|
99
|
+
})]
|
|
94
100
|
});
|
|
95
101
|
};
|
|
96
102
|
var experienceButtonMappings = [{
|
|
@@ -1,25 +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
|
-
/**
|
|
17
|
-
* Popup check type determines how popups are observed based on their DOM location:
|
|
18
|
-
* - 'inline': Popups appearing in toolbar button-groups (emoji, media, table selector, image)
|
|
19
|
-
* - 'editorRoot': Popups attached to editor root (e.g., mention popups)
|
|
20
|
-
* - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
|
|
21
|
-
*/
|
|
22
|
-
|
|
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
|
|
23
17
|
/**
|
|
24
18
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
25
19
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -40,191 +34,7 @@ var isToolbarButtonClick = exports.isToolbarButtonClick = function isToolbarButt
|
|
|
40
34
|
}
|
|
41
35
|
return !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
42
36
|
};
|
|
43
|
-
var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__PURE__*/function () {
|
|
44
|
-
function ExperienceCheckPopupMutation(nestedElementQuery, getTarget, getEditorDom) {
|
|
45
|
-
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'editorRoot';
|
|
46
|
-
(0, _classCallCheck2.default)(this, ExperienceCheckPopupMutation);
|
|
47
|
-
(0, _defineProperty2.default)(this, "observers", []);
|
|
48
|
-
this.nestedElementQuery = nestedElementQuery;
|
|
49
|
-
this.getTarget = getTarget;
|
|
50
|
-
this.getEditorDom = getEditorDom;
|
|
51
|
-
this.type = type;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Returns the list of DOM elements to observe based on popup type.
|
|
56
|
-
*/
|
|
57
|
-
return (0, _createClass2.default)(ExperienceCheckPopupMutation, [{
|
|
58
|
-
key: "getObserveTargets",
|
|
59
|
-
value: function getObserveTargets() {
|
|
60
|
-
switch (this.type) {
|
|
61
|
-
case 'inline':
|
|
62
|
-
return this.getInlineTargets();
|
|
63
|
-
case 'editorRoot':
|
|
64
|
-
return this.getEditorRootTargets();
|
|
65
|
-
}
|
|
66
|
-
// Should never reach here - all types handled above
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* For 'inline' type: observe only the button-group container.
|
|
72
|
-
* The target passed in should be the button-group (or button within it) from getInlinePopupTarget().
|
|
73
|
-
* Inline popups appear as direct children of button-group elements.
|
|
74
|
-
*/
|
|
75
|
-
}, {
|
|
76
|
-
key: "getInlineTargets",
|
|
77
|
-
value: function getInlineTargets() {
|
|
78
|
-
var target = this.getTarget();
|
|
79
|
-
if (!target) {
|
|
80
|
-
return [];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Walk up to find the button-group container
|
|
84
|
-
var buttonGroup = target.closest('[data-toolbar-component="button-group"]');
|
|
85
|
-
|
|
86
|
-
// Target is already the button-group or button from getInlinePopupTarget()
|
|
87
|
-
// Just observe this single element
|
|
88
|
-
return buttonGroup ? [buttonGroup, target] : [target];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* For 'editorRoot' type: observe the actual editor root container.
|
|
93
|
-
* The editorDom is the ProseMirror element, but popups appear as direct children
|
|
94
|
-
* of the parent .akEditor container. So we observe the parent of editorDom.
|
|
95
|
-
* No portal observation needed.
|
|
96
|
-
*/
|
|
97
|
-
}, {
|
|
98
|
-
key: "getEditorRootTargets",
|
|
99
|
-
value: function getEditorRootTargets() {
|
|
100
|
-
var targets = [];
|
|
101
|
-
var editorDom = this.getEditorDom();
|
|
102
|
-
if (editorDom) {
|
|
103
|
-
// Find the actual editor root (.akEditor) by walking up the DOM
|
|
104
|
-
var editorRoot = editorDom.closest('.akEditor') || editorDom.parentElement;
|
|
105
|
-
if (editorRoot instanceof HTMLElement) {
|
|
106
|
-
targets.push(editorRoot);
|
|
107
|
-
|
|
108
|
-
// Observe existing [data-editor-popup] wrappers
|
|
109
|
-
var wrappers = editorRoot.querySelectorAll('[data-editor-popup]');
|
|
110
|
-
var _iterator = _createForOfIteratorHelper(wrappers),
|
|
111
|
-
_step;
|
|
112
|
-
try {
|
|
113
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
114
|
-
var wrapper = _step.value;
|
|
115
|
-
targets.push(wrapper);
|
|
116
|
-
}
|
|
117
|
-
} catch (err) {
|
|
118
|
-
_iterator.e(err);
|
|
119
|
-
} finally {
|
|
120
|
-
_iterator.f();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return targets;
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
127
|
-
key: "start",
|
|
128
|
-
value: function start(callback) {
|
|
129
|
-
var _this = this;
|
|
130
|
-
this.stop();
|
|
131
|
-
var target = this.getTarget();
|
|
132
|
-
if (!target) {
|
|
133
|
-
callback({
|
|
134
|
-
status: 'failure',
|
|
135
|
-
reason: _experiences.EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
136
|
-
});
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
var doc = (0, _browserApis.getDocument)();
|
|
140
|
-
if (!doc) {
|
|
141
|
-
callback({
|
|
142
|
-
status: 'failure',
|
|
143
|
-
reason: _experiences.EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
144
|
-
});
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
var query = this.nestedElementQuery;
|
|
148
|
-
var onMutation = function onMutation(mutations) {
|
|
149
|
-
var _iterator2 = _createForOfIteratorHelper(mutations),
|
|
150
|
-
_step2;
|
|
151
|
-
try {
|
|
152
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
153
|
-
var mutation = _step2.value;
|
|
154
|
-
if (mutation.type !== 'childList') {
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
var _iterator3 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
158
|
-
_step3;
|
|
159
|
-
try {
|
|
160
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
161
|
-
var node = _step3.value;
|
|
162
|
-
if (!(node instanceof HTMLElement)) {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
var found = (0, _experiences.popupWithNestedElement)(node, query) || node.matches(query) || !!node.querySelector(query);
|
|
166
|
-
if (found) {
|
|
167
|
-
_this.stop();
|
|
168
|
-
callback({
|
|
169
|
-
status: 'success'
|
|
170
|
-
});
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
} catch (err) {
|
|
175
|
-
_iterator3.e(err);
|
|
176
|
-
} finally {
|
|
177
|
-
_iterator3.f();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
} catch (err) {
|
|
181
|
-
_iterator2.e(err);
|
|
182
|
-
} finally {
|
|
183
|
-
_iterator2.f();
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
var observe = function observe(el) {
|
|
187
|
-
var observer = new MutationObserver(onMutation);
|
|
188
|
-
observer.observe(el, {
|
|
189
|
-
childList: true
|
|
190
|
-
});
|
|
191
|
-
_this.observers.push(observer);
|
|
192
|
-
};
|
|
193
37
|
|
|
194
|
-
// Get type-specific targets and observe them
|
|
195
|
-
var observeTargets = this.getObserveTargets();
|
|
196
|
-
var _iterator4 = _createForOfIteratorHelper(observeTargets),
|
|
197
|
-
_step4;
|
|
198
|
-
try {
|
|
199
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
200
|
-
var observeTarget = _step4.value;
|
|
201
|
-
observe(observeTarget);
|
|
202
|
-
}
|
|
203
|
-
} catch (err) {
|
|
204
|
-
_iterator4.e(err);
|
|
205
|
-
} finally {
|
|
206
|
-
_iterator4.f();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}, {
|
|
210
|
-
key: "stop",
|
|
211
|
-
value: function stop() {
|
|
212
|
-
var _iterator5 = _createForOfIteratorHelper(this.observers),
|
|
213
|
-
_step5;
|
|
214
|
-
try {
|
|
215
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
216
|
-
var observer = _step5.value;
|
|
217
|
-
observer.disconnect();
|
|
218
|
-
}
|
|
219
|
-
} catch (err) {
|
|
220
|
-
_iterator5.e(err);
|
|
221
|
-
} finally {
|
|
222
|
-
_iterator5.f();
|
|
223
|
-
}
|
|
224
|
-
this.observers = [];
|
|
225
|
-
}
|
|
226
|
-
}]);
|
|
227
|
-
}();
|
|
228
38
|
/**
|
|
229
39
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
230
40
|
* for observing with `{ childList: true }` (no subtree).
|
|
@@ -299,19 +109,19 @@ var handleEditorNodeInsertDomMutation = exports.handleEditorNodeInsertDomMutatio
|
|
|
299
109
|
var mutations = _ref.mutations;
|
|
300
110
|
var hasAddedElement = false;
|
|
301
111
|
var hasRemovedElement = false;
|
|
302
|
-
var
|
|
303
|
-
|
|
112
|
+
var _iterator = _createForOfIteratorHelper(mutations),
|
|
113
|
+
_step;
|
|
304
114
|
try {
|
|
305
|
-
for (
|
|
306
|
-
var mutation =
|
|
115
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
116
|
+
var mutation = _step.value;
|
|
307
117
|
if (mutation.type !== 'childList') {
|
|
308
118
|
continue;
|
|
309
119
|
}
|
|
310
|
-
var
|
|
311
|
-
|
|
120
|
+
var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
121
|
+
_step2;
|
|
312
122
|
try {
|
|
313
|
-
for (
|
|
314
|
-
var node =
|
|
123
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
124
|
+
var node = _step2.value;
|
|
315
125
|
if (matchesNodeInsertMarker(node)) {
|
|
316
126
|
return {
|
|
317
127
|
status: 'success'
|
|
@@ -322,29 +132,29 @@ var handleEditorNodeInsertDomMutation = exports.handleEditorNodeInsertDomMutatio
|
|
|
322
132
|
}
|
|
323
133
|
}
|
|
324
134
|
} catch (err) {
|
|
325
|
-
|
|
135
|
+
_iterator2.e(err);
|
|
326
136
|
} finally {
|
|
327
|
-
|
|
137
|
+
_iterator2.f();
|
|
328
138
|
}
|
|
329
|
-
var
|
|
330
|
-
|
|
139
|
+
var _iterator3 = _createForOfIteratorHelper(mutation.removedNodes),
|
|
140
|
+
_step3;
|
|
331
141
|
try {
|
|
332
|
-
for (
|
|
333
|
-
var _node =
|
|
142
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
143
|
+
var _node = _step3.value;
|
|
334
144
|
if (_node instanceof HTMLElement) {
|
|
335
145
|
hasRemovedElement = true;
|
|
336
146
|
}
|
|
337
147
|
}
|
|
338
148
|
} catch (err) {
|
|
339
|
-
|
|
149
|
+
_iterator3.e(err);
|
|
340
150
|
} finally {
|
|
341
|
-
|
|
151
|
+
_iterator3.f();
|
|
342
152
|
}
|
|
343
153
|
}
|
|
344
154
|
} catch (err) {
|
|
345
|
-
|
|
155
|
+
_iterator.e(err);
|
|
346
156
|
} finally {
|
|
347
|
-
|
|
157
|
+
_iterator.f();
|
|
348
158
|
}
|
|
349
159
|
if (hasAddedElement && hasRemovedElement) {
|
|
350
160
|
return {
|
|
@@ -39,10 +39,11 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
39
39
|
* This allows inline popup checks to observe only the relevant button-group.
|
|
40
40
|
*/
|
|
41
41
|
const getInlinePopupTarget = () => {
|
|
42
|
+
var _lastClickedToolbarBu;
|
|
42
43
|
if (!lastClickedToolbarButton) {
|
|
43
44
|
return undefined;
|
|
44
45
|
}
|
|
45
|
-
return lastClickedToolbarButton;
|
|
46
|
+
return (_lastClickedToolbarBu = lastClickedToolbarButton.closest('[data-toolbar-component="button-group"]')) !== null && _lastClickedToolbarBu !== void 0 ? _lastClickedToolbarBu : lastClickedToolbarButton;
|
|
46
47
|
};
|
|
47
48
|
const narrowParentObserveConfig = () => {
|
|
48
49
|
var _getParentDOMAtSelect;
|
|
@@ -79,7 +80,12 @@ export const getToolbarActionExperiencesPlugin = ({
|
|
|
79
80
|
dispatchAnalyticsEvent,
|
|
80
81
|
checks: [new ExperienceCheckTimeout({
|
|
81
82
|
durationMs: TIMEOUT_DURATION
|
|
82
|
-
}), new ExperienceCheckPopupMutation(
|
|
83
|
+
}), new ExperienceCheckPopupMutation({
|
|
84
|
+
nestedElementQuery: popupSelector,
|
|
85
|
+
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
86
|
+
getEditorDom,
|
|
87
|
+
type
|
|
88
|
+
})]
|
|
83
89
|
});
|
|
84
90
|
const experienceButtonMappings = [{
|
|
85
91
|
experience: createPopupExperience('insert', '[data-testid="popup-wrapper"]', 'inline'),
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { EXPERIENCE_FAILURE_REASON, popupWithNestedElement } from '@atlaskit/editor-common/experiences';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Popup check type determines how popups are observed based on their DOM location:
|
|
7
|
-
* - 'inline': Popups appearing in toolbar button-groups (emoji, media, table selector, image)
|
|
8
|
-
* - 'editorRoot': Popups attached to editor root (e.g., mention popups)
|
|
9
|
-
* - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
|
|
10
|
-
*/
|
|
1
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
2
|
+
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
11
3
|
|
|
12
4
|
/**
|
|
13
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
@@ -29,132 +21,6 @@ export const isToolbarButtonClick = (target, testId) => {
|
|
|
29
21
|
}
|
|
30
22
|
return !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
31
23
|
};
|
|
32
|
-
export class ExperienceCheckPopupMutation {
|
|
33
|
-
constructor(nestedElementQuery, getTarget, getEditorDom, type = 'editorRoot') {
|
|
34
|
-
_defineProperty(this, "observers", []);
|
|
35
|
-
this.nestedElementQuery = nestedElementQuery;
|
|
36
|
-
this.getTarget = getTarget;
|
|
37
|
-
this.getEditorDom = getEditorDom;
|
|
38
|
-
this.type = type;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns the list of DOM elements to observe based on popup type.
|
|
43
|
-
*/
|
|
44
|
-
getObserveTargets() {
|
|
45
|
-
switch (this.type) {
|
|
46
|
-
case 'inline':
|
|
47
|
-
return this.getInlineTargets();
|
|
48
|
-
case 'editorRoot':
|
|
49
|
-
return this.getEditorRootTargets();
|
|
50
|
-
}
|
|
51
|
-
// Should never reach here - all types handled above
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* For 'inline' type: observe only the button-group container.
|
|
57
|
-
* The target passed in should be the button-group (or button within it) from getInlinePopupTarget().
|
|
58
|
-
* Inline popups appear as direct children of button-group elements.
|
|
59
|
-
*/
|
|
60
|
-
getInlineTargets() {
|
|
61
|
-
const target = this.getTarget();
|
|
62
|
-
if (!target) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Walk up to find the button-group container
|
|
67
|
-
const buttonGroup = target.closest('[data-toolbar-component="button-group"]');
|
|
68
|
-
|
|
69
|
-
// Target is already the button-group or button from getInlinePopupTarget()
|
|
70
|
-
// Just observe this single element
|
|
71
|
-
return buttonGroup ? [buttonGroup, target] : [target];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* For 'editorRoot' type: observe the actual editor root container.
|
|
76
|
-
* The editorDom is the ProseMirror element, but popups appear as direct children
|
|
77
|
-
* of the parent .akEditor container. So we observe the parent of editorDom.
|
|
78
|
-
* No portal observation needed.
|
|
79
|
-
*/
|
|
80
|
-
getEditorRootTargets() {
|
|
81
|
-
const targets = [];
|
|
82
|
-
const editorDom = this.getEditorDom();
|
|
83
|
-
if (editorDom) {
|
|
84
|
-
// Find the actual editor root (.akEditor) by walking up the DOM
|
|
85
|
-
const editorRoot = editorDom.closest('.akEditor') || editorDom.parentElement;
|
|
86
|
-
if (editorRoot instanceof HTMLElement) {
|
|
87
|
-
targets.push(editorRoot);
|
|
88
|
-
|
|
89
|
-
// Observe existing [data-editor-popup] wrappers
|
|
90
|
-
const wrappers = editorRoot.querySelectorAll('[data-editor-popup]');
|
|
91
|
-
for (const wrapper of wrappers) {
|
|
92
|
-
targets.push(wrapper);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return targets;
|
|
97
|
-
}
|
|
98
|
-
start(callback) {
|
|
99
|
-
this.stop();
|
|
100
|
-
const target = this.getTarget();
|
|
101
|
-
if (!target) {
|
|
102
|
-
callback({
|
|
103
|
-
status: 'failure',
|
|
104
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
105
|
-
});
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const doc = getDocument();
|
|
109
|
-
if (!doc) {
|
|
110
|
-
callback({
|
|
111
|
-
status: 'failure',
|
|
112
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
113
|
-
});
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const query = this.nestedElementQuery;
|
|
117
|
-
const onMutation = mutations => {
|
|
118
|
-
for (const mutation of mutations) {
|
|
119
|
-
if (mutation.type !== 'childList') {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
for (const node of mutation.addedNodes) {
|
|
123
|
-
if (!(node instanceof HTMLElement)) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const found = popupWithNestedElement(node, query) || node.matches(query) || !!node.querySelector(query);
|
|
127
|
-
if (found) {
|
|
128
|
-
this.stop();
|
|
129
|
-
callback({
|
|
130
|
-
status: 'success'
|
|
131
|
-
});
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const observe = el => {
|
|
138
|
-
const observer = new MutationObserver(onMutation);
|
|
139
|
-
observer.observe(el, {
|
|
140
|
-
childList: true
|
|
141
|
-
});
|
|
142
|
-
this.observers.push(observer);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// Get type-specific targets and observe them
|
|
146
|
-
const observeTargets = this.getObserveTargets();
|
|
147
|
-
for (const observeTarget of observeTargets) {
|
|
148
|
-
observe(observeTarget);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
stop() {
|
|
152
|
-
for (const observer of this.observers) {
|
|
153
|
-
observer.disconnect();
|
|
154
|
-
}
|
|
155
|
-
this.observers = [];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
24
|
|
|
159
25
|
/**
|
|
160
26
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
@@ -38,10 +38,11 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
38
38
|
* This allows inline popup checks to observe only the relevant button-group.
|
|
39
39
|
*/
|
|
40
40
|
var getInlinePopupTarget = function getInlinePopupTarget() {
|
|
41
|
+
var _lastClickedToolbarBu;
|
|
41
42
|
if (!lastClickedToolbarButton) {
|
|
42
43
|
return undefined;
|
|
43
44
|
}
|
|
44
|
-
return lastClickedToolbarButton;
|
|
45
|
+
return (_lastClickedToolbarBu = lastClickedToolbarButton.closest('[data-toolbar-component="button-group"]')) !== null && _lastClickedToolbarBu !== void 0 ? _lastClickedToolbarBu : lastClickedToolbarButton;
|
|
45
46
|
};
|
|
46
47
|
var narrowParentObserveConfig = function narrowParentObserveConfig() {
|
|
47
48
|
var _getParentDOMAtSelect;
|
|
@@ -84,7 +85,12 @@ export var getToolbarActionExperiencesPlugin = function getToolbarActionExperien
|
|
|
84
85
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
85
86
|
checks: [new ExperienceCheckTimeout({
|
|
86
87
|
durationMs: TIMEOUT_DURATION
|
|
87
|
-
}), new ExperienceCheckPopupMutation(
|
|
88
|
+
}), new ExperienceCheckPopupMutation({
|
|
89
|
+
nestedElementQuery: popupSelector,
|
|
90
|
+
getTarget: type === 'inline' ? getInlinePopupTarget : getPopupsTarget,
|
|
91
|
+
getEditorDom: getEditorDom,
|
|
92
|
+
type: type
|
|
93
|
+
})]
|
|
88
94
|
});
|
|
89
95
|
};
|
|
90
96
|
var experienceButtonMappings = [{
|
|
@@ -1,18 +1,8 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Popup check type determines how popups are observed based on their DOM location:
|
|
12
|
-
* - 'inline': Popups appearing in toolbar button-groups (emoji, media, table selector, image)
|
|
13
|
-
* - 'editorRoot': Popups attached to editor root (e.g., mention popups)
|
|
14
|
-
* - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
|
|
15
|
-
*/
|
|
4
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
5
|
+
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
16
6
|
|
|
17
7
|
/**
|
|
18
8
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
@@ -34,191 +24,6 @@ export var isToolbarButtonClick = function isToolbarButtonClick(target, testId)
|
|
|
34
24
|
}
|
|
35
25
|
return !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
36
26
|
};
|
|
37
|
-
export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
|
|
38
|
-
function ExperienceCheckPopupMutation(nestedElementQuery, getTarget, getEditorDom) {
|
|
39
|
-
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'editorRoot';
|
|
40
|
-
_classCallCheck(this, ExperienceCheckPopupMutation);
|
|
41
|
-
_defineProperty(this, "observers", []);
|
|
42
|
-
this.nestedElementQuery = nestedElementQuery;
|
|
43
|
-
this.getTarget = getTarget;
|
|
44
|
-
this.getEditorDom = getEditorDom;
|
|
45
|
-
this.type = type;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Returns the list of DOM elements to observe based on popup type.
|
|
50
|
-
*/
|
|
51
|
-
return _createClass(ExperienceCheckPopupMutation, [{
|
|
52
|
-
key: "getObserveTargets",
|
|
53
|
-
value: function getObserveTargets() {
|
|
54
|
-
switch (this.type) {
|
|
55
|
-
case 'inline':
|
|
56
|
-
return this.getInlineTargets();
|
|
57
|
-
case 'editorRoot':
|
|
58
|
-
return this.getEditorRootTargets();
|
|
59
|
-
}
|
|
60
|
-
// Should never reach here - all types handled above
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* For 'inline' type: observe only the button-group container.
|
|
66
|
-
* The target passed in should be the button-group (or button within it) from getInlinePopupTarget().
|
|
67
|
-
* Inline popups appear as direct children of button-group elements.
|
|
68
|
-
*/
|
|
69
|
-
}, {
|
|
70
|
-
key: "getInlineTargets",
|
|
71
|
-
value: function getInlineTargets() {
|
|
72
|
-
var target = this.getTarget();
|
|
73
|
-
if (!target) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Walk up to find the button-group container
|
|
78
|
-
var buttonGroup = target.closest('[data-toolbar-component="button-group"]');
|
|
79
|
-
|
|
80
|
-
// Target is already the button-group or button from getInlinePopupTarget()
|
|
81
|
-
// Just observe this single element
|
|
82
|
-
return buttonGroup ? [buttonGroup, target] : [target];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* For 'editorRoot' type: observe the actual editor root container.
|
|
87
|
-
* The editorDom is the ProseMirror element, but popups appear as direct children
|
|
88
|
-
* of the parent .akEditor container. So we observe the parent of editorDom.
|
|
89
|
-
* No portal observation needed.
|
|
90
|
-
*/
|
|
91
|
-
}, {
|
|
92
|
-
key: "getEditorRootTargets",
|
|
93
|
-
value: function getEditorRootTargets() {
|
|
94
|
-
var targets = [];
|
|
95
|
-
var editorDom = this.getEditorDom();
|
|
96
|
-
if (editorDom) {
|
|
97
|
-
// Find the actual editor root (.akEditor) by walking up the DOM
|
|
98
|
-
var editorRoot = editorDom.closest('.akEditor') || editorDom.parentElement;
|
|
99
|
-
if (editorRoot instanceof HTMLElement) {
|
|
100
|
-
targets.push(editorRoot);
|
|
101
|
-
|
|
102
|
-
// Observe existing [data-editor-popup] wrappers
|
|
103
|
-
var wrappers = editorRoot.querySelectorAll('[data-editor-popup]');
|
|
104
|
-
var _iterator = _createForOfIteratorHelper(wrappers),
|
|
105
|
-
_step;
|
|
106
|
-
try {
|
|
107
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
108
|
-
var wrapper = _step.value;
|
|
109
|
-
targets.push(wrapper);
|
|
110
|
-
}
|
|
111
|
-
} catch (err) {
|
|
112
|
-
_iterator.e(err);
|
|
113
|
-
} finally {
|
|
114
|
-
_iterator.f();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return targets;
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
key: "start",
|
|
122
|
-
value: function start(callback) {
|
|
123
|
-
var _this = this;
|
|
124
|
-
this.stop();
|
|
125
|
-
var target = this.getTarget();
|
|
126
|
-
if (!target) {
|
|
127
|
-
callback({
|
|
128
|
-
status: 'failure',
|
|
129
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
130
|
-
});
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
var doc = getDocument();
|
|
134
|
-
if (!doc) {
|
|
135
|
-
callback({
|
|
136
|
-
status: 'failure',
|
|
137
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
138
|
-
});
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
var query = this.nestedElementQuery;
|
|
142
|
-
var onMutation = function onMutation(mutations) {
|
|
143
|
-
var _iterator2 = _createForOfIteratorHelper(mutations),
|
|
144
|
-
_step2;
|
|
145
|
-
try {
|
|
146
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
147
|
-
var mutation = _step2.value;
|
|
148
|
-
if (mutation.type !== 'childList') {
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
var _iterator3 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
152
|
-
_step3;
|
|
153
|
-
try {
|
|
154
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
155
|
-
var node = _step3.value;
|
|
156
|
-
if (!(node instanceof HTMLElement)) {
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
var found = popupWithNestedElement(node, query) || node.matches(query) || !!node.querySelector(query);
|
|
160
|
-
if (found) {
|
|
161
|
-
_this.stop();
|
|
162
|
-
callback({
|
|
163
|
-
status: 'success'
|
|
164
|
-
});
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
} catch (err) {
|
|
169
|
-
_iterator3.e(err);
|
|
170
|
-
} finally {
|
|
171
|
-
_iterator3.f();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
} catch (err) {
|
|
175
|
-
_iterator2.e(err);
|
|
176
|
-
} finally {
|
|
177
|
-
_iterator2.f();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
var observe = function observe(el) {
|
|
181
|
-
var observer = new MutationObserver(onMutation);
|
|
182
|
-
observer.observe(el, {
|
|
183
|
-
childList: true
|
|
184
|
-
});
|
|
185
|
-
_this.observers.push(observer);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// Get type-specific targets and observe them
|
|
189
|
-
var observeTargets = this.getObserveTargets();
|
|
190
|
-
var _iterator4 = _createForOfIteratorHelper(observeTargets),
|
|
191
|
-
_step4;
|
|
192
|
-
try {
|
|
193
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
194
|
-
var observeTarget = _step4.value;
|
|
195
|
-
observe(observeTarget);
|
|
196
|
-
}
|
|
197
|
-
} catch (err) {
|
|
198
|
-
_iterator4.e(err);
|
|
199
|
-
} finally {
|
|
200
|
-
_iterator4.f();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}, {
|
|
204
|
-
key: "stop",
|
|
205
|
-
value: function stop() {
|
|
206
|
-
var _iterator5 = _createForOfIteratorHelper(this.observers),
|
|
207
|
-
_step5;
|
|
208
|
-
try {
|
|
209
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
210
|
-
var observer = _step5.value;
|
|
211
|
-
observer.disconnect();
|
|
212
|
-
}
|
|
213
|
-
} catch (err) {
|
|
214
|
-
_iterator5.e(err);
|
|
215
|
-
} finally {
|
|
216
|
-
_iterator5.f();
|
|
217
|
-
}
|
|
218
|
-
this.observers = [];
|
|
219
|
-
}
|
|
220
|
-
}]);
|
|
221
|
-
}();
|
|
222
27
|
|
|
223
28
|
/**
|
|
224
29
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
@@ -294,19 +99,19 @@ export var handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDo
|
|
|
294
99
|
var mutations = _ref.mutations;
|
|
295
100
|
var hasAddedElement = false;
|
|
296
101
|
var hasRemovedElement = false;
|
|
297
|
-
var
|
|
298
|
-
|
|
102
|
+
var _iterator = _createForOfIteratorHelper(mutations),
|
|
103
|
+
_step;
|
|
299
104
|
try {
|
|
300
|
-
for (
|
|
301
|
-
var mutation =
|
|
105
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
106
|
+
var mutation = _step.value;
|
|
302
107
|
if (mutation.type !== 'childList') {
|
|
303
108
|
continue;
|
|
304
109
|
}
|
|
305
|
-
var
|
|
306
|
-
|
|
110
|
+
var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes),
|
|
111
|
+
_step2;
|
|
307
112
|
try {
|
|
308
|
-
for (
|
|
309
|
-
var node =
|
|
113
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
114
|
+
var node = _step2.value;
|
|
310
115
|
if (matchesNodeInsertMarker(node)) {
|
|
311
116
|
return {
|
|
312
117
|
status: 'success'
|
|
@@ -317,29 +122,29 @@ export var handleEditorNodeInsertDomMutation = function handleEditorNodeInsertDo
|
|
|
317
122
|
}
|
|
318
123
|
}
|
|
319
124
|
} catch (err) {
|
|
320
|
-
|
|
125
|
+
_iterator2.e(err);
|
|
321
126
|
} finally {
|
|
322
|
-
|
|
127
|
+
_iterator2.f();
|
|
323
128
|
}
|
|
324
|
-
var
|
|
325
|
-
|
|
129
|
+
var _iterator3 = _createForOfIteratorHelper(mutation.removedNodes),
|
|
130
|
+
_step3;
|
|
326
131
|
try {
|
|
327
|
-
for (
|
|
328
|
-
var _node =
|
|
132
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
133
|
+
var _node = _step3.value;
|
|
329
134
|
if (_node instanceof HTMLElement) {
|
|
330
135
|
hasRemovedElement = true;
|
|
331
136
|
}
|
|
332
137
|
}
|
|
333
138
|
} catch (err) {
|
|
334
|
-
|
|
139
|
+
_iterator3.e(err);
|
|
335
140
|
} finally {
|
|
336
|
-
|
|
141
|
+
_iterator3.f();
|
|
337
142
|
}
|
|
338
143
|
}
|
|
339
144
|
} catch (err) {
|
|
340
|
-
|
|
145
|
+
_iterator.e(err);
|
|
341
146
|
} finally {
|
|
342
|
-
|
|
147
|
+
_iterator.f();
|
|
343
148
|
}
|
|
344
149
|
if (hasAddedElement && hasRemovedElement) {
|
|
345
150
|
return {
|
|
@@ -1,12 +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
|
-
|
|
4
|
-
* Popup check type determines how popups are observed based on their DOM location:
|
|
5
|
-
* - 'inline': Popups appearing in toolbar button-groups (emoji, media, table selector, image)
|
|
6
|
-
* - 'editorRoot': Popups attached to editor root (e.g., mention popups)
|
|
7
|
-
* - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
|
|
8
|
-
*/
|
|
9
|
-
export type PopupCheckType = 'inline' | 'editorRoot' | 'editorContent';
|
|
3
|
+
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
10
4
|
/**
|
|
11
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
12
6
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -20,33 +14,6 @@ export declare const NODE_INSERT_MARKERS: {
|
|
|
20
14
|
readonly TASK_ITEM: ".taskItemView-content-wrap";
|
|
21
15
|
};
|
|
22
16
|
export declare const isToolbarButtonClick: (target: HTMLElement, testId: string) => boolean;
|
|
23
|
-
export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
|
|
24
|
-
private nestedElementQuery;
|
|
25
|
-
private getTarget;
|
|
26
|
-
private getEditorDom;
|
|
27
|
-
private type;
|
|
28
|
-
private observers;
|
|
29
|
-
constructor(nestedElementQuery: string, getTarget: () => HTMLElement | undefined | null, getEditorDom: () => HTMLElement | undefined | null, type?: PopupCheckType);
|
|
30
|
-
/**
|
|
31
|
-
* Returns the list of DOM elements to observe based on popup type.
|
|
32
|
-
*/
|
|
33
|
-
private getObserveTargets;
|
|
34
|
-
/**
|
|
35
|
-
* For 'inline' type: observe only the button-group container.
|
|
36
|
-
* The target passed in should be the button-group (or button within it) from getInlinePopupTarget().
|
|
37
|
-
* Inline popups appear as direct children of button-group elements.
|
|
38
|
-
*/
|
|
39
|
-
private getInlineTargets;
|
|
40
|
-
/**
|
|
41
|
-
* For 'editorRoot' type: observe the actual editor root container.
|
|
42
|
-
* The editorDom is the ProseMirror element, but popups appear as direct children
|
|
43
|
-
* of the parent .akEditor container. So we observe the parent of editorDom.
|
|
44
|
-
* No portal observation needed.
|
|
45
|
-
*/
|
|
46
|
-
private getEditorRootTargets;
|
|
47
|
-
start(callback: ExperienceCheckCallback): void;
|
|
48
|
-
stop(): void;
|
|
49
|
-
}
|
|
50
17
|
/**
|
|
51
18
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
52
19
|
* for observing with `{ childList: true }` (no subtree).
|
|
@@ -1,12 +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
|
-
|
|
4
|
-
* Popup check type determines how popups are observed based on their DOM location:
|
|
5
|
-
* - 'inline': Popups appearing in toolbar button-groups (emoji, media, table selector, image)
|
|
6
|
-
* - 'editorRoot': Popups attached to editor root (e.g., mention popups)
|
|
7
|
-
* - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
|
|
8
|
-
*/
|
|
9
|
-
export type PopupCheckType = 'inline' | 'editorRoot' | 'editorContent';
|
|
3
|
+
export { ExperienceCheckPopupMutation } from '@atlaskit/editor-common/experiences';
|
|
10
4
|
/**
|
|
11
5
|
* DOM marker selectors for node types inserted via toolbar actions.
|
|
12
6
|
* Matches outermost wrapper elements set synchronously by ReactNodeView
|
|
@@ -20,33 +14,6 @@ export declare const NODE_INSERT_MARKERS: {
|
|
|
20
14
|
readonly TASK_ITEM: ".taskItemView-content-wrap";
|
|
21
15
|
};
|
|
22
16
|
export declare const isToolbarButtonClick: (target: HTMLElement, testId: string) => boolean;
|
|
23
|
-
export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
|
|
24
|
-
private nestedElementQuery;
|
|
25
|
-
private getTarget;
|
|
26
|
-
private getEditorDom;
|
|
27
|
-
private type;
|
|
28
|
-
private observers;
|
|
29
|
-
constructor(nestedElementQuery: string, getTarget: () => HTMLElement | undefined | null, getEditorDom: () => HTMLElement | undefined | null, type?: PopupCheckType);
|
|
30
|
-
/**
|
|
31
|
-
* Returns the list of DOM elements to observe based on popup type.
|
|
32
|
-
*/
|
|
33
|
-
private getObserveTargets;
|
|
34
|
-
/**
|
|
35
|
-
* For 'inline' type: observe only the button-group container.
|
|
36
|
-
* The target passed in should be the button-group (or button within it) from getInlinePopupTarget().
|
|
37
|
-
* Inline popups appear as direct children of button-group elements.
|
|
38
|
-
*/
|
|
39
|
-
private getInlineTargets;
|
|
40
|
-
/**
|
|
41
|
-
* For 'editorRoot' type: observe the actual editor root container.
|
|
42
|
-
* The editorDom is the ProseMirror element, but popups appear as direct children
|
|
43
|
-
* of the parent .akEditor container. So we observe the parent of editorDom.
|
|
44
|
-
* No portal observation needed.
|
|
45
|
-
*/
|
|
46
|
-
private getEditorRootTargets;
|
|
47
|
-
start(callback: ExperienceCheckCallback): void;
|
|
48
|
-
stop(): void;
|
|
49
|
-
}
|
|
50
17
|
/**
|
|
51
18
|
* Returns the narrow parent DOM element at the current selection, suitable
|
|
52
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",
|
|
@@ -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",
|
|
@@ -65,7 +65,7 @@
|
|
|
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",
|