@atlaskit/editor-common 108.6.0 → 108.6.1
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/hooks/useSharedPluginState.js +1 -1
- package/dist/cjs/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +3 -0
- package/dist/cjs/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +42 -2
- package/dist/cjs/link/LinkSearch/LinkSearchList.js +66 -2
- package/dist/cjs/link/LinkSearch/LinkSearchListItem.js +87 -1
- package/dist/cjs/messages/block-menu.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/core-plugin/index.js +13 -2
- package/dist/cjs/safe-plugin/index.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/hooks/useSharedPluginState.js +1 -1
- package/dist/es2019/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +3 -0
- package/dist/es2019/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +42 -2
- package/dist/es2019/link/LinkSearch/LinkSearchList.js +58 -1
- package/dist/es2019/link/LinkSearch/LinkSearchListItem.js +89 -1
- package/dist/es2019/messages/block-menu.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/core-plugin/index.js +13 -2
- package/dist/es2019/safe-plugin/index.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/hooks/useSharedPluginState.js +1 -1
- package/dist/esm/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +3 -0
- package/dist/esm/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +42 -2
- package/dist/esm/link/LinkSearch/LinkSearchList.js +63 -1
- package/dist/esm/link/LinkSearch/LinkSearchListItem.js +87 -1
- package/dist/esm/messages/block-menu.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/core-plugin/index.js +13 -2
- package/dist/esm/safe-plugin/index.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/hooks/useSharedPluginState.d.ts +1 -1
- package/dist/types/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.d.ts +3 -0
- package/dist/types/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +3 -0
- package/dist/types/link/LinkSearch/LinkSearchList.d.ts +22 -1
- package/dist/types/link/LinkSearch/LinkSearchListItem.d.ts +16 -1
- package/dist/types/safe-plugin/index.d.ts +1 -1
- package/dist/types/types/next-editor-plugin.d.ts +2 -1
- package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +1 -1
- package/dist/types-ts4.5/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.d.ts +3 -0
- package/dist/types-ts4.5/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +3 -0
- package/dist/types-ts4.5/link/LinkSearch/LinkSearchList.d.ts +22 -1
- package/dist/types-ts4.5/link/LinkSearch/LinkSearchListItem.d.ts +16 -1
- package/dist/types-ts4.5/safe-plugin/index.d.ts +1 -1
- package/dist/types-ts4.5/types/next-editor-plugin.d.ts +2 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 108.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1315abde398a6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1315abde398a6) -
|
|
8
|
+
[ux] a11y: make search result items focusable under insert link popup
|
|
9
|
+
- [`c308a1fcb2292`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c308a1fcb2292) -
|
|
10
|
+
Fix codeblock block menu option text
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 108.6.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -43,7 +43,7 @@ function useStaticPlugins(plugins) {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
*
|
|
46
|
-
* NOTE: Generally you
|
|
46
|
+
* NOTE: Generally you want to use `usePluginStateWithSelector` over this which behaves similarly
|
|
47
47
|
* but selects a slice of the state which is more performant.
|
|
48
48
|
*
|
|
49
49
|
* ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
|
|
@@ -41,6 +41,9 @@ var _usePluginStateEffect = require("../usePluginStateEffect");
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
*
|
|
44
|
+
* NOTE: Generally you want to use `usePluginStateWithSelector` over this which behaves similarly
|
|
45
|
+
* but selects a slice of the state which is more performant.
|
|
46
|
+
*
|
|
44
47
|
* ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
|
|
45
48
|
* If the plugins you are listening to generate multiple shared states while the user is typing,
|
|
46
49
|
* your React Component will get only the last one.
|
|
@@ -25,13 +25,14 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
25
25
|
var _withAnalyticsEvents = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsEvents"));
|
|
26
26
|
var _ = _interopRequireDefault(require("@atlaskit/icon-object/glyph/page/16"));
|
|
27
27
|
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/core/migration/cross-circle"));
|
|
28
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
29
|
var _primitives = require("@atlaskit/primitives");
|
|
29
30
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
30
31
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
31
32
|
var _analytics = require("../../../analytics");
|
|
32
33
|
var _ui = require("../../../ui");
|
|
33
34
|
var _utils = require("../../../utils");
|
|
34
|
-
var _LinkSearchList =
|
|
35
|
+
var _LinkSearchList = _interopRequireWildcard(require("../../LinkSearch/LinkSearchList"));
|
|
35
36
|
var _ToolbarComponents = require("../../LinkSearch/ToolbarComponents");
|
|
36
37
|
var _transformTimeStamp = require("../../LinkSearch/transformTimeStamp");
|
|
37
38
|
var _utils2 = require("./utils");
|
|
@@ -170,6 +171,10 @@ var HyperlinkLinkAddToolbar = exports.HyperlinkLinkAddToolbar = /*#__PURE__*/fun
|
|
|
170
171
|
(0, _defineProperty2.default)(_this, "urlInputContainer", null);
|
|
171
172
|
(0, _defineProperty2.default)(_this, "displayTextInputContainer", null);
|
|
172
173
|
(0, _defineProperty2.default)(_this, "wrapperRef", /*#__PURE__*/_react.default.createRef());
|
|
174
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
175
|
+
(0, _defineProperty2.default)(_this, "listItemRefs", {
|
|
176
|
+
current: {}
|
|
177
|
+
});
|
|
173
178
|
(0, _defineProperty2.default)(_this, "quickSearchQueryVersion", 0);
|
|
174
179
|
(0, _defineProperty2.default)(_this, "analyticSource", 'createLinkInlineDialog');
|
|
175
180
|
(0, _defineProperty2.default)(_this, "quickSearch", /*#__PURE__*/function () {
|
|
@@ -418,6 +423,17 @@ var HyperlinkLinkAddToolbar = exports.HyperlinkLinkAddToolbar = /*#__PURE__*/fun
|
|
|
418
423
|
return "".concat(name, ", ").concat(_container, ", ").concat(date === null || date === void 0 ? void 0 : date.pageAction, " ").concat(date === null || date === void 0 ? void 0 : date.dateString, " ").concat((date === null || date === void 0 ? void 0 : date.timeSince) || '');
|
|
419
424
|
}
|
|
420
425
|
});
|
|
426
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
427
|
+
(0, _defineProperty2.default)(_this, "listItemRefCallback", function (el, id) {
|
|
428
|
+
if (!_this.listItemRefs.current) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (el === null) {
|
|
432
|
+
delete _this.listItemRefs.current[id];
|
|
433
|
+
} else {
|
|
434
|
+
_this.listItemRefs.current[id] = el;
|
|
435
|
+
}
|
|
436
|
+
});
|
|
421
437
|
(0, _defineProperty2.default)(_this, "isUrlPopulatedWithSelectedItem", function () {
|
|
422
438
|
/**
|
|
423
439
|
* When we use ArrowKey to navigate through result items,
|
|
@@ -530,6 +546,12 @@ var HyperlinkLinkAddToolbar = exports.HyperlinkLinkAddToolbar = /*#__PURE__*/fun
|
|
|
530
546
|
return;
|
|
531
547
|
}
|
|
532
548
|
});
|
|
549
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
550
|
+
(0, _defineProperty2.default)(_this, "handleListItemFocus", function (index) {
|
|
551
|
+
_this.setState({
|
|
552
|
+
selectedIndex: index
|
|
553
|
+
});
|
|
554
|
+
});
|
|
533
555
|
// Ignored via go/ees005
|
|
534
556
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
535
557
|
(0, _defineProperty2.default)(_this, "handleKeyDown", function (event) {
|
|
@@ -566,6 +588,11 @@ var HyperlinkLinkAddToolbar = exports.HyperlinkLinkAddToolbar = /*#__PURE__*/fun
|
|
|
566
588
|
updatedIndex = selectedIndex > 0 ? selectedIndex - 1 : items.length - 1;
|
|
567
589
|
}
|
|
568
590
|
if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
|
|
591
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
592
|
+
if (_this.listItemRefs.current) {
|
|
593
|
+
var _this$listItemRefs$cu;
|
|
594
|
+
(_this$listItemRefs$cu = _this.listItemRefs.current[items[updatedIndex].objectId]) === null || _this$listItemRefs$cu === void 0 || _this$listItemRefs$cu.focus();
|
|
595
|
+
}
|
|
569
596
|
_this.setState({
|
|
570
597
|
selectedIndex: updatedIndex,
|
|
571
598
|
displayUrl: items[updatedIndex].url
|
|
@@ -937,7 +964,20 @@ var HyperlinkLinkAddToolbar = exports.HyperlinkLinkAddToolbar = /*#__PURE__*/fun
|
|
|
937
964
|
id: "fabric.editor.hyperlink.suggested.results"
|
|
938
965
|
}, displayUrl && formatMessage(messages.searchLinkResults, {
|
|
939
966
|
count: items.length
|
|
940
|
-
})), (0, _react2.jsx)(_LinkSearchList.
|
|
967
|
+
})), (0, _platformFeatureFlags.fg)('platform_editor_a11y_insert_link_item_focus') ? (0, _react2.jsx)(_LinkSearchList.LinkSearchListNext, {
|
|
968
|
+
ariaControls: "fabric.editor.hyperlink.suggested.results",
|
|
969
|
+
id: linkSearchListId,
|
|
970
|
+
role: "listbox",
|
|
971
|
+
items: items,
|
|
972
|
+
isLoading: isLoading,
|
|
973
|
+
selectedIndex: selectedIndex,
|
|
974
|
+
listItemRefCallback: this.listItemRefCallback,
|
|
975
|
+
onFocus: this.handleListItemFocus,
|
|
976
|
+
onKeyDown: this.handleKeyDown,
|
|
977
|
+
onSelect: this.handleSelected,
|
|
978
|
+
onMouseEnter: this.handleMouseEnterResultItem,
|
|
979
|
+
onMouseLeave: this.handleMouseLeaveResultItem
|
|
980
|
+
}) : (0, _react2.jsx)(_LinkSearchList.default, {
|
|
941
981
|
ariaControls: "fabric.editor.hyperlink.suggested.results",
|
|
942
982
|
id: linkSearchListId,
|
|
943
983
|
role: "listbox",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
|
-
exports.linkSearchList = exports.default = void 0;
|
|
8
|
+
exports.linkSearchList = exports.default = exports.LinkSearchListNext = void 0;
|
|
8
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -13,7 +14,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
14
|
var _react = require("react");
|
|
14
15
|
var _react2 = require("@emotion/react");
|
|
15
16
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
16
|
-
var _LinkSearchListItem =
|
|
17
|
+
var _LinkSearchListItem = _interopRequireWildcard(require("./LinkSearchListItem"));
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
19
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
18
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
19
21
|
* @jsxRuntime classic
|
|
@@ -35,6 +37,68 @@ var linkSearchList = exports.linkSearchList = (0, _react2.css)({
|
|
|
35
37
|
padding: 0,
|
|
36
38
|
listStyle: 'none'
|
|
37
39
|
});
|
|
40
|
+
var LinkSearchListNext = exports.LinkSearchListNext = function LinkSearchListNext(_ref) {
|
|
41
|
+
var listItemRefCallback = _ref.listItemRefCallback,
|
|
42
|
+
_onFocus = _ref.onFocus,
|
|
43
|
+
onKeyDown = _ref.onKeyDown,
|
|
44
|
+
onSelect = _ref.onSelect,
|
|
45
|
+
onMouseMove = _ref.onMouseMove,
|
|
46
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
47
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
48
|
+
items = _ref.items,
|
|
49
|
+
selectedIndex = _ref.selectedIndex,
|
|
50
|
+
isLoading = _ref.isLoading,
|
|
51
|
+
ariaControls = _ref.ariaControls,
|
|
52
|
+
role = _ref.role,
|
|
53
|
+
id = _ref.id;
|
|
54
|
+
var itemsContent;
|
|
55
|
+
var loadingContent;
|
|
56
|
+
if (items && items.length > 0) {
|
|
57
|
+
itemsContent = (0, _react2.jsx)("ul", {
|
|
58
|
+
css: linkSearchList,
|
|
59
|
+
id: id,
|
|
60
|
+
role: role,
|
|
61
|
+
"aria-controls": ariaControls,
|
|
62
|
+
"data-testid": "".concat(id, "--items")
|
|
63
|
+
}, items.map(function (item, index) {
|
|
64
|
+
return (0, _react2.jsx)(_LinkSearchListItem.ForwardedLinkSearchListItemNextWithIntl, {
|
|
65
|
+
id: "link-search-list-item-".concat(index),
|
|
66
|
+
item: item,
|
|
67
|
+
selected: selectedIndex === index,
|
|
68
|
+
onFocus: function onFocus() {
|
|
69
|
+
return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(index);
|
|
70
|
+
},
|
|
71
|
+
onKeyDown: onKeyDown,
|
|
72
|
+
onMouseMove: onMouseMove,
|
|
73
|
+
onMouseEnter: onMouseEnter,
|
|
74
|
+
onMouseLeave: onMouseLeave,
|
|
75
|
+
onSelect: onSelect,
|
|
76
|
+
key: item.objectId,
|
|
77
|
+
ref: function ref(el) {
|
|
78
|
+
return listItemRefCallback === null || listItemRefCallback === void 0 ? void 0 : listItemRefCallback(el, item.objectId);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
if (isLoading) {
|
|
84
|
+
loadingContent = (0, _react2.jsx)("div", {
|
|
85
|
+
id: id,
|
|
86
|
+
"data-testid": "".concat(id, "--loading"),
|
|
87
|
+
css: spinnerContainer
|
|
88
|
+
}, (0, _react2.jsx)(_spinner.default, {
|
|
89
|
+
size: "medium",
|
|
90
|
+
interactionName: "link-search-spinner"
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
return (0, _react2.jsx)("div", {
|
|
94
|
+
css: listContainer
|
|
95
|
+
}, itemsContent, loadingContent);
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* *Warning:* With `platform_editor_a11y_insert_link_item_focus` enabled this component is no longer used and is replaced with `<LinkSearchListNext />`.
|
|
99
|
+
*
|
|
100
|
+
* If making changes to this component please ensure to also update `<LinkSearchListNext />`.
|
|
101
|
+
*/
|
|
38
102
|
// Ignored via go/ees005
|
|
39
103
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
40
104
|
var LinkSearchList = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.nameStyle = exports.default = exports.containerSelected = exports.containerName = exports.container = void 0;
|
|
8
|
+
exports.nameStyle = exports.default = exports.containerSelected = exports.containerName = exports.container = exports.ForwardedLinkSearchListItemNextWithIntl = void 0;
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -70,6 +70,92 @@ var iconStyle = (0, _react2.css)({
|
|
|
70
70
|
maxWidth: '16px'
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
var LinkSearchListItemNext = function LinkSearchListItemNext(props, ref) {
|
|
74
|
+
var id = props.id,
|
|
75
|
+
item = props.item,
|
|
76
|
+
onFocus = props.onFocus,
|
|
77
|
+
onKeyDown = props.onKeyDown,
|
|
78
|
+
onMouseEnter = props.onMouseEnter,
|
|
79
|
+
onMouseLeave = props.onMouseLeave,
|
|
80
|
+
onMouseMove = props.onMouseMove,
|
|
81
|
+
onSelect = props.onSelect,
|
|
82
|
+
selected = props.selected,
|
|
83
|
+
intl = props.intl;
|
|
84
|
+
var handleSelect = (0, _react.useCallback)(function (e) {
|
|
85
|
+
e.preventDefault(); // don't let editor lose focus
|
|
86
|
+
onSelect(item.url, item.name);
|
|
87
|
+
}, [onSelect, item.url, item.name]);
|
|
88
|
+
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
89
|
+
if (event.key === 'Enter') {
|
|
90
|
+
onSelect(item.url, item.name);
|
|
91
|
+
}
|
|
92
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
93
|
+
}, [onSelect, onKeyDown, item.url, item.name]);
|
|
94
|
+
var handleMouseMove = (0, _react.useCallback)(function () {
|
|
95
|
+
onMouseMove === null || onMouseMove === void 0 || onMouseMove(item.objectId);
|
|
96
|
+
}, [onMouseMove, item.objectId]);
|
|
97
|
+
var handleMouseEnter = (0, _react.useCallback)(function () {
|
|
98
|
+
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter(item.objectId);
|
|
99
|
+
}, [onMouseEnter, item.objectId]);
|
|
100
|
+
var handleMouseLeave = (0, _react.useCallback)(function () {
|
|
101
|
+
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave(item.objectId);
|
|
102
|
+
}, [onMouseLeave, item.objectId]);
|
|
103
|
+
var renderIcon = function renderIcon() {
|
|
104
|
+
if (item.icon) {
|
|
105
|
+
return (0, _react2.jsx)("span", {
|
|
106
|
+
css: iconStyle
|
|
107
|
+
}, item.icon);
|
|
108
|
+
}
|
|
109
|
+
if (item.iconUrl) {
|
|
110
|
+
return (0, _react2.jsx)("span", {
|
|
111
|
+
css: iconStyle
|
|
112
|
+
}, (0, _react2.jsx)("img", {
|
|
113
|
+
src: item.iconUrl,
|
|
114
|
+
alt: (0, _listItemAlts.getCorrectAltByIconUrl)(item.iconUrl, intl)
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
var renderTimeStamp = function renderTimeStamp() {
|
|
120
|
+
var date = (0, _transformTimeStamp.transformTimeStamp)(intl, item.lastViewedDate, item.lastUpdatedDate);
|
|
121
|
+
return date && (0, _react2.jsx)(_react.Fragment, null, "\xA0 \u2022", (0, _react2.jsx)("span", {
|
|
122
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
123
|
+
className: "link-search-timestamp",
|
|
124
|
+
"data-testid": "link-search-timestamp"
|
|
125
|
+
}, "\xA0 ", date.pageAction, " ", date.dateString, " ", date.timeSince || ''));
|
|
126
|
+
};
|
|
127
|
+
return (0, _react2.jsx)("div", {
|
|
128
|
+
ref: ref,
|
|
129
|
+
css: [container, selected && containerSelected],
|
|
130
|
+
role: 'option',
|
|
131
|
+
tabIndex: 0,
|
|
132
|
+
id: id,
|
|
133
|
+
"aria-selected": selected,
|
|
134
|
+
"data-testid": "link-search-list-item",
|
|
135
|
+
onFocus: onFocus,
|
|
136
|
+
onKeyDown: handleKeyDown,
|
|
137
|
+
onMouseMove: handleMouseMove,
|
|
138
|
+
onMouseEnter: handleMouseEnter,
|
|
139
|
+
onMouseLeave: handleMouseLeave,
|
|
140
|
+
onClick: handleSelect
|
|
141
|
+
}, renderIcon(), (0, _react2.jsx)("span", {
|
|
142
|
+
css: nameWrapper
|
|
143
|
+
}, (0, _react2.jsx)("div", {
|
|
144
|
+
css: nameStyle
|
|
145
|
+
}, item.name), (0, _react2.jsx)("div", {
|
|
146
|
+
"data-testid": "link-search-list-item-container",
|
|
147
|
+
css: containerName
|
|
148
|
+
}, item.container, renderTimeStamp())));
|
|
149
|
+
};
|
|
150
|
+
var ForwardedLinkSearchListItemNext = /*#__PURE__*/(0, _react.forwardRef)(LinkSearchListItemNext);
|
|
151
|
+
var ForwardedLinkSearchListItemNextWithIntl = exports.ForwardedLinkSearchListItemNextWithIntl = (0, _reactIntlNext.injectIntl)(ForwardedLinkSearchListItemNext, {
|
|
152
|
+
forwardRef: true
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* *Warning:* With `platform_editor_a11y_insert_link_item_focus` enabled this component is no longer used and is replaced with `<LinkSearchListItemNext />`.
|
|
156
|
+
*
|
|
157
|
+
* If making changes to this component please ensure to also update `<LinkSearchListItemNext />`.
|
|
158
|
+
*/
|
|
73
159
|
// Ignored via go/ees005
|
|
74
160
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
75
161
|
var LinkSearchListItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -37,7 +37,7 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
37
37
|
description: 'Convert to a code block'
|
|
38
38
|
},
|
|
39
39
|
layout: {
|
|
40
|
-
id: 'fabric.editor.block.menu.
|
|
40
|
+
id: 'fabric.editor.block.menu.layout',
|
|
41
41
|
defaultMessage: 'Layout',
|
|
42
42
|
description: 'Convert to a layout node'
|
|
43
43
|
}
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "
|
|
19
|
+
var packageVersion = "108.6.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// Ignored via go/ees007
|
|
@@ -130,13 +130,24 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
|
|
|
130
130
|
}
|
|
131
131
|
return cb(view === null || view === void 0 ? void 0 : view.state.schema);
|
|
132
132
|
},
|
|
133
|
-
getAnchorIdForNode: function getAnchorIdForNode(node) {
|
|
133
|
+
getAnchorIdForNode: function getAnchorIdForNode(node, pos) {
|
|
134
134
|
var _config$getEditorView3;
|
|
135
135
|
var view = (_config$getEditorView3 = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView3 !== void 0 ? _config$getEditorView3 : null;
|
|
136
136
|
if (!view) {
|
|
137
137
|
return undefined;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
var cachedId = (0, _nodeAnchorProvider.getNodeIdProvider)(view).getIdForNode(node);
|
|
140
|
+
if (cachedId) {
|
|
141
|
+
return cachedId;
|
|
142
|
+
}
|
|
143
|
+
if (pos < 0) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
var nodeDOM = view.nodeDOM(pos);
|
|
147
|
+
if (nodeDOM instanceof HTMLElement) {
|
|
148
|
+
return nodeDOM.getAttribute('data-node-anchor') || undefined;
|
|
149
|
+
}
|
|
150
|
+
return undefined;
|
|
140
151
|
}
|
|
141
152
|
}
|
|
142
153
|
};
|
|
@@ -26,7 +26,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
26
26
|
* This function is useful for annotating DOM elements with metadata that describes the type and characteristics of the ProseMirror node.
|
|
27
27
|
*
|
|
28
28
|
*
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {object} params - The parameters for the function.
|
|
30
30
|
* @param {PMNode} params.node - The ProseMirror node from which to derive metadata.
|
|
31
31
|
* @param {HTMLElement} params.dom - The DOM element to which the metadata attributes will be attached.
|
|
32
32
|
*/
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "
|
|
27
|
+
var packageVersion = "108.6.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -29,7 +29,7 @@ function useStaticPlugins(plugins) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
|
-
* NOTE: Generally you
|
|
32
|
+
* NOTE: Generally you want to use `usePluginStateWithSelector` over this which behaves similarly
|
|
33
33
|
* but selects a slice of the state which is more performant.
|
|
34
34
|
*
|
|
35
35
|
* ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
|
|
@@ -32,6 +32,9 @@ import { usePluginStateEffect } from '../usePluginStateEffect';
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
|
+
* NOTE: Generally you want to use `usePluginStateWithSelector` over this which behaves similarly
|
|
36
|
+
* but selects a slice of the state which is more performant.
|
|
37
|
+
*
|
|
35
38
|
* ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
|
|
36
39
|
* If the plugins you are listening to generate multiple shared states while the user is typing,
|
|
37
40
|
* your React Component will get only the last one.
|
|
@@ -15,6 +15,7 @@ import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
|
15
15
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
16
16
|
import Page16Icon from '@atlaskit/icon-object/glyph/page/16';
|
|
17
17
|
import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
19
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
19
20
|
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
20
21
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -22,7 +23,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
22
23
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '../../../analytics';
|
|
23
24
|
import { Announcer, PanelTextInput } from '../../../ui';
|
|
24
25
|
import { browser, normalizeUrl } from '../../../utils';
|
|
25
|
-
import LinkSearchList from '../../LinkSearch/LinkSearchList';
|
|
26
|
+
import LinkSearchList, { LinkSearchListNext } from '../../LinkSearch/LinkSearchList';
|
|
26
27
|
import { container, containerWithProvider, inputWrapper } from '../../LinkSearch/ToolbarComponents';
|
|
27
28
|
import { transformTimeStamp } from '../../LinkSearch/transformTimeStamp';
|
|
28
29
|
import { filterUniqueItems, mapContentTypeToIcon, sha1, wordCount } from './utils';
|
|
@@ -151,6 +152,10 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
151
152
|
_defineProperty(this, "urlInputContainer", null);
|
|
152
153
|
_defineProperty(this, "displayTextInputContainer", null);
|
|
153
154
|
_defineProperty(this, "wrapperRef", /*#__PURE__*/React.createRef());
|
|
155
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
156
|
+
_defineProperty(this, "listItemRefs", {
|
|
157
|
+
current: {}
|
|
158
|
+
});
|
|
154
159
|
_defineProperty(this, "quickSearchQueryVersion", 0);
|
|
155
160
|
_defineProperty(this, "analyticSource", 'createLinkInlineDialog');
|
|
156
161
|
_defineProperty(this, "quickSearch", async (input, items, quickSearchLimit) => {
|
|
@@ -331,6 +336,17 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
331
336
|
return `${name}, ${container}, ${date === null || date === void 0 ? void 0 : date.pageAction} ${date === null || date === void 0 ? void 0 : date.dateString} ${(date === null || date === void 0 ? void 0 : date.timeSince) || ''}`;
|
|
332
337
|
}
|
|
333
338
|
});
|
|
339
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
340
|
+
_defineProperty(this, "listItemRefCallback", (el, id) => {
|
|
341
|
+
if (!this.listItemRefs.current) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (el === null) {
|
|
345
|
+
delete this.listItemRefs.current[id];
|
|
346
|
+
} else {
|
|
347
|
+
this.listItemRefs.current[id] = el;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
334
350
|
_defineProperty(this, "isUrlPopulatedWithSelectedItem", () => {
|
|
335
351
|
/**
|
|
336
352
|
* When we use ArrowKey to navigate through result items,
|
|
@@ -449,6 +465,12 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
449
465
|
return;
|
|
450
466
|
}
|
|
451
467
|
});
|
|
468
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
469
|
+
_defineProperty(this, "handleListItemFocus", index => {
|
|
470
|
+
this.setState({
|
|
471
|
+
selectedIndex: index
|
|
472
|
+
});
|
|
473
|
+
});
|
|
452
474
|
// Ignored via go/ees005
|
|
453
475
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
454
476
|
_defineProperty(this, "handleKeyDown", event => {
|
|
@@ -491,6 +513,11 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
491
513
|
updatedIndex = selectedIndex > 0 ? selectedIndex - 1 : items.length - 1;
|
|
492
514
|
}
|
|
493
515
|
if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
|
|
516
|
+
// introduced via ff platform_editor_a11y_insert_link_item_focus, remove this comment cleaning up
|
|
517
|
+
if (this.listItemRefs.current) {
|
|
518
|
+
var _this$listItemRefs$cu;
|
|
519
|
+
(_this$listItemRefs$cu = this.listItemRefs.current[items[updatedIndex].objectId]) === null || _this$listItemRefs$cu === void 0 ? void 0 : _this$listItemRefs$cu.focus();
|
|
520
|
+
}
|
|
494
521
|
this.setState({
|
|
495
522
|
selectedIndex: updatedIndex,
|
|
496
523
|
displayUrl: items[updatedIndex].url
|
|
@@ -785,7 +812,20 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
785
812
|
id: "fabric.editor.hyperlink.suggested.results"
|
|
786
813
|
}, displayUrl && formatMessage(messages.searchLinkResults, {
|
|
787
814
|
count: items.length
|
|
788
|
-
})), jsx(
|
|
815
|
+
})), fg('platform_editor_a11y_insert_link_item_focus') ? jsx(LinkSearchListNext, {
|
|
816
|
+
ariaControls: "fabric.editor.hyperlink.suggested.results",
|
|
817
|
+
id: linkSearchListId,
|
|
818
|
+
role: "listbox",
|
|
819
|
+
items: items,
|
|
820
|
+
isLoading: isLoading,
|
|
821
|
+
selectedIndex: selectedIndex,
|
|
822
|
+
listItemRefCallback: this.listItemRefCallback,
|
|
823
|
+
onFocus: this.handleListItemFocus,
|
|
824
|
+
onKeyDown: this.handleKeyDown,
|
|
825
|
+
onSelect: this.handleSelected,
|
|
826
|
+
onMouseEnter: this.handleMouseEnterResultItem,
|
|
827
|
+
onMouseLeave: this.handleMouseLeaveResultItem
|
|
828
|
+
}) : jsx(LinkSearchList, {
|
|
789
829
|
ariaControls: "fabric.editor.hyperlink.suggested.results",
|
|
790
830
|
id: linkSearchListId,
|
|
791
831
|
role: "listbox",
|
|
@@ -7,7 +7,7 @@ import { PureComponent } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import Spinner from '@atlaskit/spinner';
|
|
10
|
-
import LinkSearchListItem from './LinkSearchListItem';
|
|
10
|
+
import LinkSearchListItem, { ForwardedLinkSearchListItemNextWithIntl } from './LinkSearchListItem';
|
|
11
11
|
const listContainer = css({
|
|
12
12
|
paddingTop: 0,
|
|
13
13
|
marginTop: "var(--ds-space-150, 12px)",
|
|
@@ -24,6 +24,63 @@ export const linkSearchList = css({
|
|
|
24
24
|
padding: 0,
|
|
25
25
|
listStyle: 'none'
|
|
26
26
|
});
|
|
27
|
+
export const LinkSearchListNext = ({
|
|
28
|
+
listItemRefCallback,
|
|
29
|
+
onFocus,
|
|
30
|
+
onKeyDown,
|
|
31
|
+
onSelect,
|
|
32
|
+
onMouseMove,
|
|
33
|
+
onMouseEnter,
|
|
34
|
+
onMouseLeave,
|
|
35
|
+
items,
|
|
36
|
+
selectedIndex,
|
|
37
|
+
isLoading,
|
|
38
|
+
ariaControls,
|
|
39
|
+
role,
|
|
40
|
+
id
|
|
41
|
+
}) => {
|
|
42
|
+
let itemsContent;
|
|
43
|
+
let loadingContent;
|
|
44
|
+
if (items && items.length > 0) {
|
|
45
|
+
itemsContent = jsx("ul", {
|
|
46
|
+
css: linkSearchList,
|
|
47
|
+
id: id,
|
|
48
|
+
role: role,
|
|
49
|
+
"aria-controls": ariaControls,
|
|
50
|
+
"data-testid": `${id}--items`
|
|
51
|
+
}, items.map((item, index) => jsx(ForwardedLinkSearchListItemNextWithIntl, {
|
|
52
|
+
id: `link-search-list-item-${index}`,
|
|
53
|
+
item: item,
|
|
54
|
+
selected: selectedIndex === index,
|
|
55
|
+
onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(index),
|
|
56
|
+
onKeyDown: onKeyDown,
|
|
57
|
+
onMouseMove: onMouseMove,
|
|
58
|
+
onMouseEnter: onMouseEnter,
|
|
59
|
+
onMouseLeave: onMouseLeave,
|
|
60
|
+
onSelect: onSelect,
|
|
61
|
+
key: item.objectId,
|
|
62
|
+
ref: el => listItemRefCallback === null || listItemRefCallback === void 0 ? void 0 : listItemRefCallback(el, item.objectId)
|
|
63
|
+
})));
|
|
64
|
+
}
|
|
65
|
+
if (isLoading) {
|
|
66
|
+
loadingContent = jsx("div", {
|
|
67
|
+
id: id,
|
|
68
|
+
"data-testid": `${id}--loading`,
|
|
69
|
+
css: spinnerContainer
|
|
70
|
+
}, jsx(Spinner, {
|
|
71
|
+
size: "medium",
|
|
72
|
+
interactionName: "link-search-spinner"
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
return jsx("div", {
|
|
76
|
+
css: listContainer
|
|
77
|
+
}, itemsContent, loadingContent);
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* *Warning:* With `platform_editor_a11y_insert_link_item_focus` enabled this component is no longer used and is replaced with `<LinkSearchListNext />`.
|
|
81
|
+
*
|
|
82
|
+
* If making changes to this component please ensure to also update `<LinkSearchListNext />`.
|
|
83
|
+
*/
|
|
27
84
|
// Ignored via go/ees005
|
|
28
85
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
29
86
|
export default class LinkSearchList extends PureComponent {
|