@atlaskit/editor-plugin-type-ahead 2.7.4 → 2.7.5
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 +10 -0
- package/dist/cjs/ui/TypeAheadPopup.js +16 -29
- package/dist/cjs/ui/modern/TypeAheadPopup.js +16 -29
- package/dist/es2019/ui/TypeAheadPopup.js +16 -29
- package/dist/es2019/ui/modern/TypeAheadPopup.js +16 -29
- package/dist/esm/ui/TypeAheadPopup.js +16 -29
- package/dist/esm/ui/modern/TypeAheadPopup.js +16 -29
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 2.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#154311](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154311)
|
|
8
|
+
[`a9aff3b749e22`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a9aff3b749e22) -
|
|
9
|
+
[ux] EDITOR-730 Fix bug with typeaheads and legacy content extension that resulted in typeahead
|
|
10
|
+
text remaining in the inserted element
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 2.7.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -242,34 +242,21 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
242
242
|
// Handles cases like emoji (:) and mention (@) typeaheads that open new typeaheads
|
|
243
243
|
var isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
244
244
|
if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro_typeahead_fix')) {
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
} else {
|
|
261
|
-
// if the new focus contains current focus node, the popup won't close
|
|
262
|
-
newFocusInsideCurrentEditor = relatedTarget.contains(focusNode);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
} else {
|
|
269
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
270
|
-
if (!isTextSelected) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
245
|
+
var innerEditor = anchorElement.closest('.extension-editable-area');
|
|
246
|
+
if (innerEditor) {
|
|
247
|
+
// When there is no related target, we default to not closing the popup
|
|
248
|
+
var newFocusInsideCurrentEditor = !relatedTarget;
|
|
249
|
+
if (relatedTarget instanceof HTMLElement) {
|
|
250
|
+
// check if the new focus is inside inner editor, keep popup opens
|
|
251
|
+
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
252
|
+
}
|
|
253
|
+
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
258
|
+
if (!isTextSelected) {
|
|
259
|
+
return;
|
|
273
260
|
}
|
|
274
261
|
}
|
|
275
262
|
} else {
|
|
@@ -292,7 +279,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
292
279
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
293
280
|
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
294
281
|
};
|
|
295
|
-
}, [ref, cancel, editorView.state, isEditorControlsPatch2Enabled]);
|
|
282
|
+
}, [ref, cancel, editorView.state, isEditorControlsPatch2Enabled, anchorElement]);
|
|
296
283
|
|
|
297
284
|
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
298
285
|
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
@@ -205,34 +205,21 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
205
205
|
// Handles cases like emoji and @ typeaheads that open new typeaheads
|
|
206
206
|
var isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
207
207
|
if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro_typeahead_fix')) {
|
|
208
|
-
var
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
} else {
|
|
224
|
-
// if the new focus contains current focus node, the popup won't close
|
|
225
|
-
newFocusInsideCurrentEditor = relatedTarget.contains(focusNode);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
} else {
|
|
232
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
233
|
-
if (!isTextSelected) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
208
|
+
var innerEditor = anchorElement.closest('.extension-editable-area');
|
|
209
|
+
if (innerEditor) {
|
|
210
|
+
// When there is no related target, we default to not closing the popup
|
|
211
|
+
var newFocusInsideCurrentEditor = !relatedTarget;
|
|
212
|
+
if (relatedTarget instanceof HTMLElement) {
|
|
213
|
+
// check if the new focus is inside inner editor, keep popup opens
|
|
214
|
+
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
215
|
+
}
|
|
216
|
+
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
221
|
+
if (!isTextSelected) {
|
|
222
|
+
return;
|
|
236
223
|
}
|
|
237
224
|
}
|
|
238
225
|
} else {
|
|
@@ -255,7 +242,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
255
242
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
256
243
|
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
257
244
|
};
|
|
258
|
-
}, [ref, cancel]);
|
|
245
|
+
}, [ref, cancel, anchorElement]);
|
|
259
246
|
|
|
260
247
|
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
261
248
|
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
@@ -233,34 +233,21 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
233
233
|
// Handles cases like emoji (:) and mention (@) typeaheads that open new typeaheads
|
|
234
234
|
const isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
235
235
|
if (fg('platform_editor_legacy_content_macro_typeahead_fix')) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
} else {
|
|
252
|
-
// if the new focus contains current focus node, the popup won't close
|
|
253
|
-
newFocusInsideCurrentEditor = relatedTarget.contains(focusNode);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
261
|
-
if (!isTextSelected) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
236
|
+
const innerEditor = anchorElement.closest('.extension-editable-area');
|
|
237
|
+
if (innerEditor) {
|
|
238
|
+
// When there is no related target, we default to not closing the popup
|
|
239
|
+
let newFocusInsideCurrentEditor = !relatedTarget;
|
|
240
|
+
if (relatedTarget instanceof HTMLElement) {
|
|
241
|
+
// check if the new focus is inside inner editor, keep popup opens
|
|
242
|
+
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
243
|
+
}
|
|
244
|
+
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
249
|
+
if (!isTextSelected) {
|
|
250
|
+
return;
|
|
264
251
|
}
|
|
265
252
|
}
|
|
266
253
|
} else {
|
|
@@ -285,7 +272,7 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
285
272
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
286
273
|
element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
|
|
287
274
|
};
|
|
288
|
-
}, [ref, cancel, editorView.state, isEditorControlsPatch2Enabled]);
|
|
275
|
+
}, [ref, cancel, editorView.state, isEditorControlsPatch2Enabled, anchorElement]);
|
|
289
276
|
|
|
290
277
|
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
291
278
|
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
@@ -196,34 +196,21 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
196
196
|
// Handles cases like emoji and @ typeaheads that open new typeaheads
|
|
197
197
|
const isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
198
198
|
if (fg('platform_editor_legacy_content_macro_typeahead_fix')) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
} else {
|
|
215
|
-
// if the new focus contains current focus node, the popup won't close
|
|
216
|
-
newFocusInsideCurrentEditor = relatedTarget.contains(focusNode);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
223
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
224
|
-
if (!isTextSelected) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
199
|
+
const innerEditor = anchorElement.closest('.extension-editable-area');
|
|
200
|
+
if (innerEditor) {
|
|
201
|
+
// When there is no related target, we default to not closing the popup
|
|
202
|
+
let newFocusInsideCurrentEditor = !relatedTarget;
|
|
203
|
+
if (relatedTarget instanceof HTMLElement) {
|
|
204
|
+
// check if the new focus is inside inner editor, keep popup opens
|
|
205
|
+
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
206
|
+
}
|
|
207
|
+
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
212
|
+
if (!isTextSelected) {
|
|
213
|
+
return;
|
|
227
214
|
}
|
|
228
215
|
}
|
|
229
216
|
} else {
|
|
@@ -248,7 +235,7 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
248
235
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
249
236
|
element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
|
|
250
237
|
};
|
|
251
|
-
}, [ref, cancel]);
|
|
238
|
+
}, [ref, cancel, anchorElement]);
|
|
252
239
|
|
|
253
240
|
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
254
241
|
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
@@ -231,34 +231,21 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
231
231
|
// Handles cases like emoji (:) and mention (@) typeaheads that open new typeaheads
|
|
232
232
|
var isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
233
233
|
if (fg('platform_editor_legacy_content_macro_typeahead_fix')) {
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} else {
|
|
250
|
-
// if the new focus contains current focus node, the popup won't close
|
|
251
|
-
newFocusInsideCurrentEditor = relatedTarget.contains(focusNode);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
} else {
|
|
258
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
259
|
-
if (!isTextSelected) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
234
|
+
var innerEditor = anchorElement.closest('.extension-editable-area');
|
|
235
|
+
if (innerEditor) {
|
|
236
|
+
// When there is no related target, we default to not closing the popup
|
|
237
|
+
var newFocusInsideCurrentEditor = !relatedTarget;
|
|
238
|
+
if (relatedTarget instanceof HTMLElement) {
|
|
239
|
+
// check if the new focus is inside inner editor, keep popup opens
|
|
240
|
+
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
241
|
+
}
|
|
242
|
+
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
247
|
+
if (!isTextSelected) {
|
|
248
|
+
return;
|
|
262
249
|
}
|
|
263
250
|
}
|
|
264
251
|
} else {
|
|
@@ -281,7 +268,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
281
268
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
282
269
|
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
283
270
|
};
|
|
284
|
-
}, [ref, cancel, editorView.state, isEditorControlsPatch2Enabled]);
|
|
271
|
+
}, [ref, cancel, editorView.state, isEditorControlsPatch2Enabled, anchorElement]);
|
|
285
272
|
|
|
286
273
|
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
287
274
|
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
@@ -195,34 +195,21 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
195
195
|
// Handles cases like emoji and @ typeaheads that open new typeaheads
|
|
196
196
|
var isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
197
197
|
if (fg('platform_editor_legacy_content_macro_typeahead_fix')) {
|
|
198
|
-
var
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
} else {
|
|
214
|
-
// if the new focus contains current focus node, the popup won't close
|
|
215
|
-
newFocusInsideCurrentEditor = relatedTarget.contains(focusNode);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
} else {
|
|
222
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
223
|
-
if (!isTextSelected) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
198
|
+
var innerEditor = anchorElement.closest('.extension-editable-area');
|
|
199
|
+
if (innerEditor) {
|
|
200
|
+
// When there is no related target, we default to not closing the popup
|
|
201
|
+
var newFocusInsideCurrentEditor = !relatedTarget;
|
|
202
|
+
if (relatedTarget instanceof HTMLElement) {
|
|
203
|
+
// check if the new focus is inside inner editor, keep popup opens
|
|
204
|
+
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
205
|
+
}
|
|
206
|
+
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
211
|
+
if (!isTextSelected) {
|
|
212
|
+
return;
|
|
226
213
|
}
|
|
227
214
|
}
|
|
228
215
|
} else {
|
|
@@ -245,7 +232,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
245
232
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
246
233
|
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
247
234
|
};
|
|
248
|
-
}, [ref, cancel]);
|
|
235
|
+
}, [ref, cancel, anchorElement]);
|
|
249
236
|
|
|
250
237
|
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
251
238
|
// This is the expected keyboard behaviour advised by the Accessibility team
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^105.
|
|
37
|
+
"@atlaskit/editor-common": "^105.6.0",
|
|
38
38
|
"@atlaskit/editor-element-browser": "^0.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
45
45
|
"@atlaskit/heading": "^5.2.0",
|
|
46
|
-
"@atlaskit/icon": "^26.
|
|
46
|
+
"@atlaskit/icon": "^26.1.0",
|
|
47
47
|
"@atlaskit/menu": "^7.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^14.7.0",
|
|
50
50
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
51
51
|
"@atlaskit/theme": "^18.0.0",
|
|
52
52
|
"@atlaskit/tmp-editor-statsig": "^4.22.0",
|
|
53
|
-
"@atlaskit/tokens": "^4.
|
|
53
|
+
"@atlaskit/tokens": "^4.9.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
56
56
|
"lodash": "^4.17.21",
|