@atlaskit/editor-common 84.5.0 → 85.0.0
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 +34 -0
- package/afm-jira/tsconfig.json +3 -0
- package/dist/cjs/analytics/types/enums.js +2 -0
- package/dist/cjs/element-browser/components/ElementList/ElementList.js +27 -91
- package/dist/cjs/extensibility/extensionNodeView.js +1 -2
- package/dist/cjs/keymaps/keymap.js +25 -43
- package/dist/cjs/link/ConfigureLinkOverlay/Dropdown.js +34 -9
- package/dist/cjs/link/ConfigureLinkOverlay/index.js +15 -5
- package/dist/cjs/link/ConfigureLinkOverlay/useLinkOverlayAnalyticsEvents.js +46 -0
- package/dist/cjs/messages/table.js +30 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +2 -4
- package/dist/cjs/react-node-view/index.js +4 -10
- package/dist/cjs/selection-based-node-view/SelectionBasedNodeView.js +2 -5
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/analytics/types/enums.js +2 -0
- package/dist/es2019/element-browser/components/ElementList/ElementList.js +7 -70
- package/dist/es2019/extensibility/extensionNodeView.js +1 -2
- package/dist/es2019/keymaps/keymap.js +25 -43
- package/dist/es2019/link/ConfigureLinkOverlay/Dropdown.js +33 -7
- package/dist/es2019/link/ConfigureLinkOverlay/index.js +16 -5
- package/dist/es2019/link/ConfigureLinkOverlay/useLinkOverlayAnalyticsEvents.js +39 -0
- package/dist/es2019/messages/table.js +30 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +2 -4
- package/dist/es2019/react-node-view/index.js +5 -7
- package/dist/es2019/selection-based-node-view/SelectionBasedNodeView.js +3 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/analytics/types/enums.js +2 -0
- package/dist/esm/element-browser/components/ElementList/ElementList.js +27 -91
- package/dist/esm/extensibility/extensionNodeView.js +1 -2
- package/dist/esm/keymaps/keymap.js +25 -43
- package/dist/esm/link/ConfigureLinkOverlay/Dropdown.js +34 -9
- package/dist/esm/link/ConfigureLinkOverlay/index.js +15 -5
- package/dist/esm/link/ConfigureLinkOverlay/useLinkOverlayAnalyticsEvents.js +40 -0
- package/dist/esm/messages/table.js +30 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +2 -4
- package/dist/esm/react-node-view/index.js +4 -10
- package/dist/esm/selection-based-node-view/SelectionBasedNodeView.js +3 -5
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/types/enums.d.ts +3 -1
- package/dist/types/extensibility/extensionNodeView.d.ts +1 -2
- package/dist/types/link/ConfigureLinkOverlay/Dropdown.d.ts +5 -4
- package/dist/types/link/ConfigureLinkOverlay/index.d.ts +2 -2
- package/dist/types/link/ConfigureLinkOverlay/useLinkOverlayAnalyticsEvents.d.ts +5 -0
- package/dist/types/messages/table.d.ts +30 -0
- package/dist/types/react-node-view/index.d.ts +2 -5
- package/dist/types/selection-based-node-view/SelectionBasedNodeView.d.ts +1 -2
- package/dist/types/types/plugin-factory.d.ts +1 -2
- package/dist/types-ts4.5/analytics/types/enums.d.ts +3 -1
- package/dist/types-ts4.5/extensibility/extensionNodeView.d.ts +1 -2
- package/dist/types-ts4.5/link/ConfigureLinkOverlay/Dropdown.d.ts +5 -4
- package/dist/types-ts4.5/link/ConfigureLinkOverlay/index.d.ts +2 -2
- package/dist/types-ts4.5/link/ConfigureLinkOverlay/useLinkOverlayAnalyticsEvents.d.ts +5 -0
- package/dist/types-ts4.5/messages/table.d.ts +30 -0
- package/dist/types-ts4.5/react-node-view/index.d.ts +2 -5
- package/dist/types-ts4.5/selection-based-node-view/SelectionBasedNodeView.d.ts +1 -2
- package/dist/types-ts4.5/types/plugin-factory.d.ts +1 -2
- package/package.json +6 -14
- package/dist/cjs/ui/PortalProvider/index.js +0 -235
- package/dist/es2019/ui/PortalProvider/index.js +0 -171
- package/dist/esm/ui/PortalProvider/index.js +0 -229
- package/dist/types/ui/PortalProvider/index.d.ts +0 -48
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +0 -48
- package/portal-provider/package.json +0 -15
|
@@ -30,11 +30,8 @@ var _analytics2 = require("../utils/analytics");
|
|
|
30
30
|
var _generateUniqueNodeKey = require("./generateUniqueNodeKey");
|
|
31
31
|
var _getInlineNodeViewProducer = require("./getInlineNodeViewProducer");
|
|
32
32
|
var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
33
|
-
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
33
|
+
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate) {
|
|
34
34
|
var _this = this;
|
|
35
|
-
var hasAnalyticsContext = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
36
|
-
var viewShouldUpdate = arguments.length > 8 ? arguments[8] : undefined;
|
|
37
|
-
var hasIntlContext = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
38
35
|
(0, _classCallCheck2.default)(this, ReactNodeView);
|
|
39
36
|
(0, _defineProperty2.default)(this, "decorations", []);
|
|
40
37
|
(0, _defineProperty2.default)(this, "handleRef", function (node) {
|
|
@@ -54,10 +51,8 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
54
51
|
this.portalProviderAPI = portalProviderAPI;
|
|
55
52
|
this.reactComponentProps = reactComponentProps || {};
|
|
56
53
|
this.reactComponent = reactComponent;
|
|
57
|
-
this.hasAnalyticsContext = hasAnalyticsContext;
|
|
58
54
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
59
55
|
this.eventDispatcher = eventDispatcher;
|
|
60
|
-
this.hasIntlContext = hasIntlContext;
|
|
61
56
|
this.key = (0, _generateUniqueNodeKey.generateUniqueNodeKey)();
|
|
62
57
|
}
|
|
63
58
|
|
|
@@ -126,7 +121,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
126
121
|
dispatchAnalyticsEvent: _this3.dispatchAnalyticsEvent
|
|
127
122
|
}, component());
|
|
128
123
|
};
|
|
129
|
-
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key
|
|
124
|
+
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key);
|
|
130
125
|
}
|
|
131
126
|
}, {
|
|
132
127
|
key: "createDomRef",
|
|
@@ -223,16 +218,15 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
223
218
|
if (!this.domRef) {
|
|
224
219
|
return;
|
|
225
220
|
}
|
|
226
|
-
this.portalProviderAPI.remove(this.key
|
|
221
|
+
this.portalProviderAPI.remove(this.key);
|
|
227
222
|
this.domRef = undefined;
|
|
228
223
|
this.contentDOM = undefined;
|
|
229
224
|
}
|
|
230
225
|
}], [{
|
|
231
226
|
key: "fromComponent",
|
|
232
227
|
value: function fromComponent(component, portalProviderAPI, eventDispatcher, props, viewShouldUpdate) {
|
|
233
|
-
var hasIntlContext = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
234
228
|
return function (node, view, getPos) {
|
|
235
|
-
return new ReactNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, props, component,
|
|
229
|
+
return new ReactNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, props, component, viewShouldUpdate).init();
|
|
236
230
|
};
|
|
237
231
|
}
|
|
238
232
|
}]);
|
|
@@ -41,13 +41,10 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
41
41
|
var SelectionBasedNodeView = exports.SelectionBasedNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
42
42
|
(0, _inherits2.default)(SelectionBasedNodeView, _ReactNodeView);
|
|
43
43
|
var _super = _createSuper(SelectionBasedNodeView);
|
|
44
|
-
function SelectionBasedNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
44
|
+
function SelectionBasedNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate) {
|
|
45
45
|
var _this;
|
|
46
|
-
var hasContext = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
47
|
-
var viewShouldUpdate = arguments.length > 8 ? arguments[8] : undefined;
|
|
48
|
-
var hasIntlContext = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
49
46
|
(0, _classCallCheck2.default)(this, SelectionBasedNodeView);
|
|
50
|
-
_this = _super.call(this, node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent,
|
|
47
|
+
_this = _super.call(this, node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate);
|
|
51
48
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isSelectedNode", false);
|
|
52
49
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isNodeInsideSelection", function (from, to, pos, posEnd) {
|
|
53
50
|
var _this$getPositionsWit = _this.getPositionsWithDefault(pos, posEnd);
|
|
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
|
|
|
20
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "
|
|
23
|
+
var packageVersion = "85.0.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -235,6 +235,7 @@ export let ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
|
|
|
235
235
|
ACTION_SUBJECT["DRAG"] = "drag";
|
|
236
236
|
ACTION_SUBJECT["ELEMENT"] = "element";
|
|
237
237
|
ACTION_SUBJECT["CONTEXT_MENU"] = "contextMenu";
|
|
238
|
+
ACTION_SUBJECT["INLINE_DIALOG"] = "inlineDialog";
|
|
238
239
|
return ACTION_SUBJECT;
|
|
239
240
|
}({});
|
|
240
241
|
export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
@@ -349,6 +350,7 @@ export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
349
350
|
ACTION_SUBJECT_ID["SAVE"] = "save";
|
|
350
351
|
ACTION_SUBJECT_ID["SECTION"] = "section";
|
|
351
352
|
ACTION_SUBJECT_ID["SMART_LINK"] = "smartLink";
|
|
353
|
+
ACTION_SUBJECT_ID["SMART_LINK_TOOLBAR"] = "smartLinkToolbar";
|
|
352
354
|
ACTION_SUBJECT_ID["STATUS"] = "status";
|
|
353
355
|
ACTION_SUBJECT_ID["SYMBOL"] = "symbol";
|
|
354
356
|
ACTION_SUBJECT_ID["TABLE"] = "table";
|
|
@@ -7,12 +7,10 @@ import { css, jsx } from '@emotion/react';
|
|
|
7
7
|
import { Grid } from 'react-virtualized';
|
|
8
8
|
import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
|
|
9
9
|
import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
10
|
-
import { Collection } from 'react-virtualized/dist/commonjs/Collection';
|
|
11
10
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
12
11
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
13
12
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
14
13
|
import { ButtonItem } from '@atlaskit/menu';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
14
|
import { B100, N200 } from '@atlaskit/theme/colors';
|
|
17
15
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
18
16
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -22,7 +20,6 @@ import { ELEMENT_ITEM_HEIGHT, ELEMENT_ITEM_PADDING, ELEMENT_LIST_PADDING, SCROLL
|
|
|
22
20
|
import useContainerWidth from '../../hooks/use-container-width';
|
|
23
21
|
import useFocus from '../../hooks/use-focus';
|
|
24
22
|
import { Modes } from '../../types';
|
|
25
|
-
import cellSizeAndPositionGetter from './cellSizeAndPositionGetter';
|
|
26
23
|
import EmptyState from './EmptyState';
|
|
27
24
|
import { getColumnCount, getScrollbarWidth } from './utils';
|
|
28
25
|
export const ICON_HEIGHT = 40;
|
|
@@ -107,52 +104,6 @@ function ElementList({
|
|
|
107
104
|
index
|
|
108
105
|
}) + ELEMENT_ITEM_PADDING * 2;
|
|
109
106
|
const cellRenderer = useMemo(() => ({
|
|
110
|
-
index,
|
|
111
|
-
key,
|
|
112
|
-
style
|
|
113
|
-
}) => {
|
|
114
|
-
if (items[index] == null) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
return jsx("div", {
|
|
118
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
119
|
-
style: style,
|
|
120
|
-
key: key
|
|
121
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
122
|
-
,
|
|
123
|
-
className: "element-item-wrapper",
|
|
124
|
-
css: elementItemWrapper,
|
|
125
|
-
onKeyDown: e => {
|
|
126
|
-
if (e.key === 'Tab') {
|
|
127
|
-
if (e.shiftKey && index === 0) {
|
|
128
|
-
if (setFocusedCategoryIndex) {
|
|
129
|
-
if (!!selectedCategoryIndex) {
|
|
130
|
-
setFocusedCategoryIndex(selectedCategoryIndex);
|
|
131
|
-
} else {
|
|
132
|
-
setFocusedCategoryIndex(0);
|
|
133
|
-
}
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// before focus jumps from elements list we need to rerender react-virtualized collection.
|
|
138
|
-
// Otherwise on the next render 'scrollToCell' will have same cached value
|
|
139
|
-
// and collection will not be scrolled to top.
|
|
140
|
-
// So Tab press on category will not work anymore due to invisible 1-t element.
|
|
141
|
-
else if (index === items.length - 2) {
|
|
142
|
-
setFocusedItemIndex(items.length - 1);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}, jsx(MemoizedElementItem, _extends({
|
|
147
|
-
inlineMode: !fullMode,
|
|
148
|
-
index: index,
|
|
149
|
-
item: items[index],
|
|
150
|
-
selected: selectedItemIndex === index,
|
|
151
|
-
focus: focusedItemIndex === index,
|
|
152
|
-
setFocusedItemIndex: setFocusedItemIndex
|
|
153
|
-
}, props)));
|
|
154
|
-
}, [items, fullMode, selectedItemIndex, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
|
|
155
|
-
const gridCellRenderer = useMemo(() => ({
|
|
156
107
|
columnIndex,
|
|
157
108
|
key,
|
|
158
109
|
parent,
|
|
@@ -189,9 +140,9 @@ function ElementList({
|
|
|
189
140
|
e.preventDefault();
|
|
190
141
|
}
|
|
191
142
|
}
|
|
192
|
-
// before focus jumps from elements list we need to rerender react-virtualized
|
|
143
|
+
// before focus jumps from elements list we need to rerender react-virtualized grid.
|
|
193
144
|
// Otherwise on the next render 'scrollToCell' will have same cached value
|
|
194
|
-
// and
|
|
145
|
+
// and grid will not be scrolled to top.
|
|
195
146
|
// So Tab press on category will not work anymore due to invisible 1-t element.
|
|
196
147
|
else if (index === items.length - 2) {
|
|
197
148
|
setFocusedItemIndex(items.length - 1);
|
|
@@ -226,8 +177,8 @@ function ElementList({
|
|
|
226
177
|
disableWidth: true
|
|
227
178
|
}, ({
|
|
228
179
|
height
|
|
229
|
-
}) =>
|
|
230
|
-
cellRenderer:
|
|
180
|
+
}) => jsx(Grid, _extends({
|
|
181
|
+
cellRenderer: cellRenderer,
|
|
231
182
|
height: height,
|
|
232
183
|
width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
|
|
233
184
|
/**
|
|
@@ -244,21 +195,7 @@ function ElementList({
|
|
|
244
195
|
deferredMeasurementCache: cache
|
|
245
196
|
}, selectedItemIndex !== undefined && {
|
|
246
197
|
scrollToRow: Math.floor(selectedItemIndex / columnCount)
|
|
247
|
-
}))
|
|
248
|
-
cellCount: items.length,
|
|
249
|
-
cellRenderer: cellRenderer,
|
|
250
|
-
cellSizeAndPositionGetter: cellSizeAndPositionGetter(containerWidth - ELEMENT_LIST_PADDING * 2, scrollbarWidth),
|
|
251
|
-
height: height,
|
|
252
|
-
width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
|
|
253
|
-
/**
|
|
254
|
-
* Refresh Collection on WidthObserver value change.
|
|
255
|
-
* Length of the items used to force re-render to solve Firefox bug with react-virtualized retaining
|
|
256
|
-
* scroll position after updating the data. If new data has different number of cells, a re-render
|
|
257
|
-
* is forced to prevent the scroll position render bug.
|
|
258
|
-
*/,
|
|
259
|
-
key: containerWidth + items.length,
|
|
260
|
-
scrollToCell: selectedItemIndex
|
|
261
|
-
})))));
|
|
198
|
+
}))))));
|
|
262
199
|
}
|
|
263
200
|
const MemoizedElementItem = /*#__PURE__*/memo(ElementItem);
|
|
264
201
|
MemoizedElementItem.displayName = 'MemoizedElementItem';
|
|
@@ -373,7 +310,7 @@ const elementItemsWrapper = css({
|
|
|
373
310
|
overflow: 'hidden',
|
|
374
311
|
padding: "var(--ds-space-025, 2px)",
|
|
375
312
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
376
|
-
'.
|
|
313
|
+
'.ReactVirtualized__Grid': {
|
|
377
314
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
378
315
|
borderRadius: '3px',
|
|
379
316
|
outline: 'none',
|
|
@@ -383,7 +320,7 @@ const elementItemsWrapper = css({
|
|
|
383
320
|
}
|
|
384
321
|
},
|
|
385
322
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
386
|
-
'.
|
|
323
|
+
'.ReactVirtualized__Grid__innerScrollContainer': {
|
|
387
324
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
388
325
|
"div[class='element-item-wrapper']:last-child": {
|
|
389
326
|
paddingBottom: "var(--ds-space-050, 4px)"
|
|
@@ -53,13 +53,12 @@ export class ExtensionNode extends ReactNodeView {
|
|
|
53
53
|
}
|
|
54
54
|
export default function ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags) {
|
|
55
55
|
return (node, view, getPos) => {
|
|
56
|
-
const hasIntlContext = true;
|
|
57
56
|
return new ExtensionNode(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
58
57
|
providerFactory,
|
|
59
58
|
extensionHandlers,
|
|
60
59
|
extensionNodeViewOptions,
|
|
61
60
|
pluginInjectionApi,
|
|
62
61
|
macroInteractionDesignFeatureFlags
|
|
63
|
-
}
|
|
62
|
+
}).init();
|
|
64
63
|
};
|
|
65
64
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { base, keyName } from 'w3c-keyname';
|
|
2
2
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { SafePlugin } from '../safe-plugin';
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -14,52 +13,35 @@ export function keymap(bindings) {
|
|
|
14
13
|
return new SafePlugin({
|
|
15
14
|
props: {
|
|
16
15
|
handleKeyDown(view, event) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let keyboardEvent = event;
|
|
16
|
+
const name = keyName(event);
|
|
17
|
+
let keyboardEvent = event;
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// We will try to bypass the keycode only if any of mod keys are pressed,
|
|
20
|
+
// to allow users to use non-latin and Dead characters.
|
|
21
|
+
const isModKeyPressed = event.ctrlKey || event.metaKey;
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
// Check the unicode of the character to assert that it's not an ASCII character.
|
|
24
|
+
// These are characters outside latin's range.
|
|
25
|
+
const isNonLatinKey = name.length === 1 && /[^\u0000-\u007f]/.test(name);
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
return keydownHandler(bindings)(view, keyboardEvent);
|
|
47
|
-
} else {
|
|
48
|
-
const name = keyName(event);
|
|
49
|
-
let keyboardEvent = event;
|
|
50
|
-
if (event.ctrlKey && name.length === 1 &&
|
|
51
|
-
// Check the unicode of the character to
|
|
52
|
-
// assert that its not an ASCII character.
|
|
53
|
-
// These are characters outside Latin's range.
|
|
54
|
-
/[^\u0000-\u007f]/.test(name)) {
|
|
55
|
-
keyboardEvent = new KeyboardEvent('keydown', {
|
|
56
|
-
key: base[event.keyCode],
|
|
57
|
-
code: event.code,
|
|
58
|
-
ctrlKey: true
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return keydownHandler(bindings)(view, keyboardEvent);
|
|
27
|
+
// The `Dead` key is a key that combines with a following key to produce a combined character.
|
|
28
|
+
// It will have `even.key === 'Dead'` in some browsers but the `keyCode` will be the same as in a qwerty-keyboard.
|
|
29
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key and https://en.wikipedia.org/wiki/Dead_key
|
|
30
|
+
const isDeadKey = name === 'Dead';
|
|
31
|
+
if (isModKeyPressed && (isNonLatinKey || isDeadKey)) {
|
|
32
|
+
keyboardEvent = new KeyboardEvent(event.type, {
|
|
33
|
+
// FIXME: The event.keyCode is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode),
|
|
34
|
+
// and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
|
|
35
|
+
// a key by event.code.
|
|
36
|
+
key: base[event.keyCode],
|
|
37
|
+
code: event.code,
|
|
38
|
+
ctrlKey: event.ctrlKey,
|
|
39
|
+
altKey: event.altKey,
|
|
40
|
+
metaKey: event.metaKey,
|
|
41
|
+
shiftKey: event.shiftKey
|
|
42
|
+
});
|
|
62
43
|
}
|
|
44
|
+
return keydownHandler(bindings)(view, keyboardEvent);
|
|
63
45
|
}
|
|
64
46
|
}
|
|
65
47
|
});
|
|
@@ -5,28 +5,46 @@ import { useCallback } from 'react';
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
|
+
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
8
9
|
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
9
10
|
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
10
11
|
import PreferencesIcon from '@atlaskit/icon/glyph/preferences';
|
|
11
12
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
12
13
|
import { cardMessages as messages } from '../../messages';
|
|
13
14
|
import { StyledButton } from './StyledButton';
|
|
15
|
+
import { useLinkOverlayAnalyticsEvents } from './useLinkOverlayAnalyticsEvents';
|
|
16
|
+
const SMALL_LINK_TOOLBAR_ANALYTICS_SOURCE = 'smallLinkToolbar';
|
|
14
17
|
const Dropdown = ({
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
onDropdownChange,
|
|
19
|
+
testId
|
|
17
20
|
}) => {
|
|
18
21
|
const {
|
|
19
22
|
formatMessage
|
|
20
23
|
} = useIntl();
|
|
21
24
|
const configureLinkLabel = formatMessage(messages.inlineConfigureLink);
|
|
22
25
|
const goToLinkLabel = formatMessage(messages.inlineGoToLink);
|
|
26
|
+
const {
|
|
27
|
+
fireActionClickEvent,
|
|
28
|
+
fireLinkClickEvent,
|
|
29
|
+
fireToolbarViewEvent
|
|
30
|
+
} = useLinkOverlayAnalyticsEvents();
|
|
23
31
|
const onOpenChange = useCallback(({
|
|
24
32
|
isOpen
|
|
25
33
|
}) => {
|
|
26
34
|
onDropdownChange === null || onDropdownChange === void 0 ? void 0 : onDropdownChange(isOpen);
|
|
27
|
-
|
|
35
|
+
if (isOpen) {
|
|
36
|
+
fireToolbarViewEvent();
|
|
37
|
+
}
|
|
38
|
+
}, [fireToolbarViewEvent, onDropdownChange]);
|
|
39
|
+
const onGoToLinkClick = useCallback(() => {
|
|
40
|
+
fireActionClickEvent('goToLink');
|
|
41
|
+
}, [fireActionClickEvent]);
|
|
42
|
+
const onConfigureClick = useCallback(() => {
|
|
43
|
+
fireActionClickEvent('configureLink');
|
|
44
|
+
}, [fireActionClickEvent]);
|
|
28
45
|
return jsx(DropdownMenu, {
|
|
29
46
|
trigger: ({
|
|
47
|
+
onClick,
|
|
30
48
|
triggerRef,
|
|
31
49
|
...props
|
|
32
50
|
}) => jsx(StyledButton, _extends({
|
|
@@ -35,7 +53,11 @@ const Dropdown = ({
|
|
|
35
53
|
iconBefore: jsx(ChevronDownIcon, {
|
|
36
54
|
label: configureLinkLabel,
|
|
37
55
|
size: 'small'
|
|
38
|
-
})
|
|
56
|
+
}),
|
|
57
|
+
onClick: e => {
|
|
58
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
59
|
+
fireLinkClickEvent();
|
|
60
|
+
}
|
|
39
61
|
})),
|
|
40
62
|
testId: `${testId}-dropdown`,
|
|
41
63
|
onOpenChange: onOpenChange
|
|
@@ -43,12 +65,16 @@ const Dropdown = ({
|
|
|
43
65
|
elemBefore: jsx(ShortcutIcon, {
|
|
44
66
|
label: goToLinkLabel,
|
|
45
67
|
size: 'medium'
|
|
46
|
-
})
|
|
68
|
+
}),
|
|
69
|
+
onClick: onGoToLinkClick
|
|
47
70
|
}, goToLinkLabel), jsx(DropdownItem, {
|
|
48
71
|
elemBefore: jsx(PreferencesIcon, {
|
|
49
72
|
label: configureLinkLabel,
|
|
50
73
|
size: 'medium'
|
|
51
|
-
})
|
|
74
|
+
}),
|
|
75
|
+
onClick: onConfigureClick
|
|
52
76
|
}, configureLinkLabel)));
|
|
53
77
|
};
|
|
54
|
-
export default
|
|
78
|
+
export default withAnalyticsContext({
|
|
79
|
+
source: SMALL_LINK_TOOLBAR_ANALYTICS_SOURCE
|
|
80
|
+
})(Dropdown);
|
|
@@ -4,6 +4,7 @@ import { useCallback, useLayoutEffect, useState } from 'react';
|
|
|
4
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { useIntl } from 'react-intl-next';
|
|
7
|
+
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
7
8
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
9
|
import PreferencesIcon from '@atlaskit/icon/glyph/preferences';
|
|
9
10
|
import { N0 } from '@atlaskit/theme/colors';
|
|
@@ -12,6 +13,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
12
13
|
import { cardMessages } from '../../messages';
|
|
13
14
|
import Dropdown from './Dropdown';
|
|
14
15
|
import { StyledButton } from './StyledButton';
|
|
16
|
+
import { useLinkOverlayAnalyticsEvents } from './useLinkOverlayAnalyticsEvents';
|
|
15
17
|
const buttonWrapperStyles = css({
|
|
16
18
|
position: 'absolute',
|
|
17
19
|
zIndex: layers.card(),
|
|
@@ -22,7 +24,7 @@ const buttonWrapperStyles = css({
|
|
|
22
24
|
borderRadius: "var(--ds-border-radius, 3px)"
|
|
23
25
|
});
|
|
24
26
|
const showDropdownThresholdPx = 50;
|
|
25
|
-
export const OverlayButton = ({
|
|
27
|
+
export const OverlayButton = withAnalyticsContext()(({
|
|
26
28
|
editorView,
|
|
27
29
|
testId = 'link-configure-overlay-button',
|
|
28
30
|
targetElementPos = 0,
|
|
@@ -34,6 +36,10 @@ export const OverlayButton = ({
|
|
|
34
36
|
} = useIntl();
|
|
35
37
|
const configureLinkLabel = formatMessage(cardMessages.inlineConfigureLink);
|
|
36
38
|
const [showDropdown, setShowDropdown] = useState(false);
|
|
39
|
+
const {
|
|
40
|
+
fireLinkClickEvent,
|
|
41
|
+
fireActionClickEvent
|
|
42
|
+
} = useLinkOverlayAnalyticsEvents();
|
|
37
43
|
useLayoutEffect(() => {
|
|
38
44
|
var _domNode;
|
|
39
45
|
let domNode = editorView.nodeDOM(targetElementPos);
|
|
@@ -52,7 +58,7 @@ export const OverlayButton = ({
|
|
|
52
58
|
const docNode = editorView.state.doc.nodeAt(targetElementPos);
|
|
53
59
|
const nodeEnd = targetElementPos + ((_docNode$nodeSize = docNode === null || docNode === void 0 ? void 0 : docNode.nodeSize) !== null && _docNode$nodeSize !== void 0 ? _docNode$nodeSize : 0);
|
|
54
60
|
const isText = docNode === null || docNode === void 0 ? void 0 : docNode.isText;
|
|
55
|
-
const
|
|
61
|
+
const handleConfigureClick = useCallback(() => {
|
|
56
62
|
const tr = editorView.state.tr;
|
|
57
63
|
if (isText) {
|
|
58
64
|
tr.setSelection(TextSelection.create(tr.doc, targetElementPos, Math.min(nodeEnd, tr.doc.nodeSize)));
|
|
@@ -60,7 +66,12 @@ export const OverlayButton = ({
|
|
|
60
66
|
tr.setSelection(NodeSelection.create(tr.doc, targetElementPos));
|
|
61
67
|
}
|
|
62
68
|
editorView.dispatch(tr);
|
|
63
|
-
}, [isText,
|
|
69
|
+
}, [editorView, isText, targetElementPos, nodeEnd]);
|
|
70
|
+
const handleConfigureClickWithAnalytics = useCallback(() => {
|
|
71
|
+
fireLinkClickEvent();
|
|
72
|
+
fireActionClickEvent('configureLink');
|
|
73
|
+
handleConfigureClick();
|
|
74
|
+
}, [fireActionClickEvent, fireLinkClickEvent, handleConfigureClick]);
|
|
64
75
|
const {
|
|
65
76
|
from,
|
|
66
77
|
to
|
|
@@ -80,11 +91,11 @@ export const OverlayButton = ({
|
|
|
80
91
|
hideTooltipOnClick: true,
|
|
81
92
|
testId: `${testId}-tooltip`
|
|
82
93
|
}, jsx(StyledButton, {
|
|
83
|
-
onClick:
|
|
94
|
+
onClick: handleConfigureClickWithAnalytics,
|
|
84
95
|
iconBefore: jsx(PreferencesIcon, {
|
|
85
96
|
label: configureLinkLabel,
|
|
86
97
|
size: "small",
|
|
87
98
|
testId: `${testId}-configure-icon`
|
|
88
99
|
})
|
|
89
100
|
})));
|
|
90
|
-
};
|
|
101
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
3
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
5
|
+
export const useLinkOverlayAnalyticsEvents = () => {
|
|
6
|
+
const {
|
|
7
|
+
createAnalyticsEvent
|
|
8
|
+
} = useAnalyticsEvents();
|
|
9
|
+
return useMemo(() => ({
|
|
10
|
+
fireActionClickEvent: linkAction => {
|
|
11
|
+
createAnalyticsEvent({
|
|
12
|
+
action: ACTION.CLICKED,
|
|
13
|
+
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
14
|
+
eventType: EVENT_TYPE.UI,
|
|
15
|
+
attributes: {
|
|
16
|
+
action: linkAction
|
|
17
|
+
}
|
|
18
|
+
}).fire(FabricChannel.media);
|
|
19
|
+
},
|
|
20
|
+
fireLinkClickEvent: () => {
|
|
21
|
+
createAnalyticsEvent({
|
|
22
|
+
action: ACTION.CLICKED,
|
|
23
|
+
actionSubject: ACTION_SUBJECT.LINK,
|
|
24
|
+
eventType: EVENT_TYPE.UI
|
|
25
|
+
}).fire(FabricChannel.media);
|
|
26
|
+
},
|
|
27
|
+
fireToolbarViewEvent: () => {
|
|
28
|
+
createAnalyticsEvent({
|
|
29
|
+
action: ACTION.VIEWED,
|
|
30
|
+
actionSubject: ACTION_SUBJECT.INLINE_DIALOG,
|
|
31
|
+
actionSubjectId: ACTION_SUBJECT_ID.SMART_LINK_TOOLBAR,
|
|
32
|
+
eventType: EVENT_TYPE.SCREEN,
|
|
33
|
+
attributes: {
|
|
34
|
+
linkType: 'smallLink'
|
|
35
|
+
}
|
|
36
|
+
}).fire(FabricChannel.media);
|
|
37
|
+
}
|
|
38
|
+
}), [createAnalyticsEvent]);
|
|
39
|
+
};
|
|
@@ -125,6 +125,21 @@ export const messages = defineMessages({
|
|
|
125
125
|
defaultMessage: '{count, plural, one {The row has been} other {{count} rows have been}} removed',
|
|
126
126
|
description: 'Assistive message following the removal of row(s)'
|
|
127
127
|
},
|
|
128
|
+
rowSelected: {
|
|
129
|
+
id: 'fabric.editor.rowSelected',
|
|
130
|
+
defaultMessage: 'Row {index} of {total} selected',
|
|
131
|
+
description: 'Assistive message following the selection of a row'
|
|
132
|
+
},
|
|
133
|
+
rowMovedUp: {
|
|
134
|
+
id: 'fabric.editor.rowMovedUp',
|
|
135
|
+
defaultMessage: 'Row moved up to {index} of {total}',
|
|
136
|
+
description: 'Assistive message following the upward movement of a row'
|
|
137
|
+
},
|
|
138
|
+
rowMovedDown: {
|
|
139
|
+
id: 'fabric.editor.rowMovedDown',
|
|
140
|
+
defaultMessage: 'Row moved down to {index} of {total}',
|
|
141
|
+
description: 'Assistive message following the downward movement of a row'
|
|
142
|
+
},
|
|
128
143
|
columnsAreInserted: {
|
|
129
144
|
id: 'fabric.editor.columnsAreInserted',
|
|
130
145
|
defaultMessage: '{count, plural, one {A column has been} other {{count} columns have been}} inserted',
|
|
@@ -135,6 +150,21 @@ export const messages = defineMessages({
|
|
|
135
150
|
defaultMessage: '{count, plural, one {The column has been} other {{count} columns have been}} removed',
|
|
136
151
|
description: 'Assistive message following the removal of column(s)'
|
|
137
152
|
},
|
|
153
|
+
columnSelected: {
|
|
154
|
+
id: 'fabric.editor.columnSelected',
|
|
155
|
+
defaultMessage: 'Column {index} of {total} selected',
|
|
156
|
+
description: 'Assistive message following the selection of a column'
|
|
157
|
+
},
|
|
158
|
+
columnMovedLeft: {
|
|
159
|
+
id: 'fabric.editor.columnMovedLeft',
|
|
160
|
+
defaultMessage: 'Column moved left to {index} of {total}',
|
|
161
|
+
description: 'Assistive message following the left movement of a column'
|
|
162
|
+
},
|
|
163
|
+
columnMovedRight: {
|
|
164
|
+
id: 'fabric.editor.columnMovedRight',
|
|
165
|
+
defaultMessage: 'Column moved right to {index} of {total}',
|
|
166
|
+
description: 'Assistive message following the right movement of a column'
|
|
167
|
+
},
|
|
138
168
|
cellOptions: {
|
|
139
169
|
id: 'fabric.editor.cellOptions',
|
|
140
170
|
defaultMessage: 'Cell options',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "
|
|
4
|
+
const packageVersion = "85.0.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -58,9 +58,7 @@ function createNodeView({
|
|
|
58
58
|
nodeViewParams,
|
|
59
59
|
Component,
|
|
60
60
|
extraComponentProps
|
|
61
|
-
}), domRef, key
|
|
62
|
-
// node views should be rendered with intl context
|
|
63
|
-
true);
|
|
61
|
+
}), domRef, key);
|
|
64
62
|
}
|
|
65
63
|
const {
|
|
66
64
|
samplingRate,
|
|
@@ -117,7 +115,7 @@ function createNodeView({
|
|
|
117
115
|
// When prosemirror destroys the node view, we need to clean up
|
|
118
116
|
// what we have previously rendered using the editor portal
|
|
119
117
|
// provider api.
|
|
120
|
-
pmPluginFactoryParams.portalProviderAPI.remove(key
|
|
118
|
+
pmPluginFactoryParams.portalProviderAPI.remove(key);
|
|
121
119
|
// @ts-expect-error Expect an error as domRef is expected to be
|
|
122
120
|
// of HTMLSpanElement type however once the node view has
|
|
123
121
|
// been destroyed no other consumers should still be using it.
|
|
@@ -9,7 +9,7 @@ import { analyticsEventKey } from '../utils/analytics';
|
|
|
9
9
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
10
10
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
11
11
|
export default class ReactNodeView {
|
|
12
|
-
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent,
|
|
12
|
+
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate) {
|
|
13
13
|
_defineProperty(this, "decorations", []);
|
|
14
14
|
_defineProperty(this, "handleRef", node => this._handleRef(node));
|
|
15
15
|
_defineProperty(this, "dispatchAnalyticsEvent", payload => {
|
|
@@ -26,10 +26,8 @@ export default class ReactNodeView {
|
|
|
26
26
|
this.portalProviderAPI = portalProviderAPI;
|
|
27
27
|
this.reactComponentProps = reactComponentProps || {};
|
|
28
28
|
this.reactComponent = reactComponent;
|
|
29
|
-
this.hasAnalyticsContext = hasAnalyticsContext;
|
|
30
29
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
31
30
|
this.eventDispatcher = eventDispatcher;
|
|
32
|
-
this.hasIntlContext = hasIntlContext;
|
|
33
31
|
this.key = generateUniqueNodeKey();
|
|
34
32
|
}
|
|
35
33
|
|
|
@@ -92,7 +90,7 @@ export default class ReactNodeView {
|
|
|
92
90
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
|
|
93
91
|
}, component());
|
|
94
92
|
};
|
|
95
|
-
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key
|
|
93
|
+
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key);
|
|
96
94
|
}
|
|
97
95
|
createDomRef() {
|
|
98
96
|
if (!this.node.isInline) {
|
|
@@ -165,11 +163,11 @@ export default class ReactNodeView {
|
|
|
165
163
|
if (!this.domRef) {
|
|
166
164
|
return;
|
|
167
165
|
}
|
|
168
|
-
this.portalProviderAPI.remove(this.key
|
|
166
|
+
this.portalProviderAPI.remove(this.key);
|
|
169
167
|
this.domRef = undefined;
|
|
170
168
|
this.contentDOM = undefined;
|
|
171
169
|
}
|
|
172
|
-
static fromComponent(component, portalProviderAPI, eventDispatcher, props, viewShouldUpdate
|
|
173
|
-
return (node, view, getPos) => new ReactNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, props, component,
|
|
170
|
+
static fromComponent(component, portalProviderAPI, eventDispatcher, props, viewShouldUpdate) {
|
|
171
|
+
return (node, view, getPos) => new ReactNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, props, component, viewShouldUpdate).init();
|
|
174
172
|
}
|
|
175
173
|
}
|