@atlaskit/editor-common 101.1.2 → 102.1.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 +25 -0
- package/dist/cjs/ai-messages/ai.js +5 -0
- package/dist/cjs/analytics/types/general-events.js +1 -1
- package/dist/cjs/collab/index.js +2 -0
- package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +26 -52
- package/dist/cjs/extensibility/MultiBodiedExtension/action-api.js +2 -0
- package/dist/cjs/insert/index.js +2 -0
- package/dist/cjs/keymaps/keymap.js +4 -2
- package/dist/cjs/lazy-node-view/index.js +1 -1
- package/dist/cjs/media-inline/inline-image-card.js +2 -0
- package/dist/cjs/messages/annotation.js +2 -0
- package/dist/cjs/messages/help-dialog.js +2 -0
- package/dist/cjs/monitoring/environment.js +2 -0
- package/dist/cjs/monitoring/error.js +3 -1
- package/dist/cjs/node-width/index.js +0 -1
- package/dist/cjs/quick-insert/assets/datasource-assets-objects.js +1 -1
- package/dist/cjs/quick-insert/assets/datasource-jira-issue.js +1 -1
- package/dist/cjs/quick-insert/assets/feedback.js +1 -1
- package/dist/cjs/quick-insert/assets/quote.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +1 -1
- package/dist/cjs/react-node-view/index.js +1 -1
- package/dist/cjs/selection/gap-cursor/selection.js +1 -1
- package/dist/cjs/selection/utils.js +2 -2
- package/dist/cjs/styles/shared/annotation.js +1 -1
- package/dist/cjs/ugc-tokens/index.js +13 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Layer/index.js +0 -1
- package/dist/cjs/ui-menu/ColorPickerButton/index.js +1 -1
- package/dist/cjs/ui-menu/ToolbarButton/styles.js +2 -0
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +13 -4
- package/dist/cjs/utils/calculate-toolbar-position.js +4 -0
- package/dist/cjs/utils/compareNodes.js +0 -1
- package/dist/cjs/utils/get-performance-options.js +0 -1
- package/dist/cjs/utils/is-text-input.js +0 -2
- package/dist/cjs/utils/table.js +2 -0
- package/dist/cjs/utils/validate-using-spec.js +2 -0
- package/dist/cjs/with-plugin-state/index.js +4 -270
- package/dist/es2019/ai-messages/ai.js +5 -0
- package/dist/es2019/analytics/types/general-events.js +1 -3
- package/dist/es2019/collab/index.js +2 -0
- package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +28 -54
- package/dist/es2019/extensibility/MultiBodiedExtension/action-api.js +2 -0
- package/dist/es2019/insert/index.js +2 -0
- package/dist/es2019/keymaps/keymap.js +4 -2
- package/dist/es2019/lazy-node-view/index.js +1 -1
- package/dist/es2019/media-inline/inline-image-card.js +2 -0
- package/dist/es2019/messages/annotation.js +2 -0
- package/dist/es2019/messages/help-dialog.js +2 -0
- package/dist/es2019/monitoring/environment.js +2 -0
- package/dist/es2019/monitoring/error.js +3 -1
- package/dist/es2019/node-width/index.js +0 -1
- package/dist/es2019/quick-insert/assets/datasource-assets-objects.js +1 -1
- package/dist/es2019/quick-insert/assets/datasource-jira-issue.js +1 -1
- package/dist/es2019/quick-insert/assets/feedback.js +1 -1
- package/dist/es2019/quick-insert/assets/quote.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +1 -1
- package/dist/es2019/react-node-view/index.js +1 -1
- package/dist/es2019/selection/gap-cursor/selection.js +1 -1
- package/dist/es2019/selection/utils.js +2 -2
- package/dist/es2019/styles/shared/annotation.js +1 -1
- package/dist/es2019/ugc-tokens/index.js +3 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Layer/index.js +0 -1
- package/dist/es2019/ui-menu/ColorPickerButton/index.js +1 -1
- package/dist/es2019/ui-menu/ToolbarButton/styles.js +2 -0
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +12 -3
- package/dist/es2019/utils/calculate-toolbar-position.js +4 -0
- package/dist/es2019/utils/compareNodes.js +0 -1
- package/dist/es2019/utils/get-performance-options.js +0 -1
- package/dist/es2019/utils/is-text-input.js +0 -2
- package/dist/es2019/utils/table.js +2 -0
- package/dist/es2019/utils/validate-using-spec.js +2 -0
- package/dist/es2019/with-plugin-state/index.js +2 -241
- package/dist/esm/ai-messages/ai.js +5 -0
- package/dist/esm/analytics/types/general-events.js +1 -3
- package/dist/esm/collab/index.js +2 -0
- package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +27 -52
- package/dist/esm/extensibility/MultiBodiedExtension/action-api.js +2 -0
- package/dist/esm/insert/index.js +2 -0
- package/dist/esm/keymaps/keymap.js +4 -2
- package/dist/esm/lazy-node-view/index.js +1 -1
- package/dist/esm/media-inline/inline-image-card.js +2 -0
- package/dist/esm/messages/annotation.js +2 -0
- package/dist/esm/messages/help-dialog.js +2 -0
- package/dist/esm/monitoring/environment.js +2 -0
- package/dist/esm/monitoring/error.js +3 -1
- package/dist/esm/node-width/index.js +0 -1
- package/dist/esm/quick-insert/assets/datasource-assets-objects.js +1 -1
- package/dist/esm/quick-insert/assets/datasource-jira-issue.js +1 -1
- package/dist/esm/quick-insert/assets/feedback.js +1 -1
- package/dist/esm/quick-insert/assets/quote.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +1 -1
- package/dist/esm/react-node-view/index.js +1 -1
- package/dist/esm/selection/gap-cursor/selection.js +1 -1
- package/dist/esm/selection/utils.js +2 -2
- package/dist/esm/styles/shared/annotation.js +1 -1
- package/dist/esm/ugc-tokens/index.js +3 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Layer/index.js +0 -1
- package/dist/esm/ui-menu/ColorPickerButton/index.js +1 -1
- package/dist/esm/ui-menu/ToolbarButton/styles.js +2 -0
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +13 -4
- package/dist/esm/utils/calculate-toolbar-position.js +4 -0
- package/dist/esm/utils/compareNodes.js +0 -1
- package/dist/esm/utils/get-performance-options.js +0 -1
- package/dist/esm/utils/is-text-input.js +0 -2
- package/dist/esm/utils/table.js +2 -0
- package/dist/esm/utils/validate-using-spec.js +2 -0
- package/dist/esm/with-plugin-state/index.js +2 -270
- package/dist/types/ai-messages/ai.d.ts +5 -0
- package/dist/types/analytics/types/ai-unified-events.d.ts +13 -6
- package/dist/types/selection/utils.d.ts +3 -4
- package/dist/types/types/annotation/index.d.ts +0 -3
- package/dist/types/ugc-tokens/index.d.ts +2 -0
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
- package/dist/types/with-plugin-state/index.d.ts +0 -42
- package/dist/types-ts4.5/ai-messages/ai.d.ts +5 -0
- package/dist/types-ts4.5/analytics/types/ai-unified-events.d.ts +13 -6
- package/dist/types-ts4.5/selection/utils.d.ts +3 -4
- package/dist/types-ts4.5/types/annotation/index.d.ts +0 -3
- package/dist/types-ts4.5/ugc-tokens/index.d.ts +2 -0
- package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
- package/dist/types-ts4.5/with-plugin-state/index.d.ts +0 -42
- package/package.json +8 -10
- package/ugc-tokens/package.json +17 -0
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.WithPluginStateInner = exports.WithPluginState = void 0;
|
|
8
8
|
var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -14,8 +14,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
17
|
var _analytics = require("../analytics");
|
|
20
18
|
var _eventDispatcher = require("../event-dispatcher");
|
|
21
19
|
var _performanceMeasures = require("../performance-measures");
|
|
@@ -79,18 +77,13 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
|
|
|
79
77
|
return (0, _createClass2.default)(WithPluginState, [{
|
|
80
78
|
key: "render",
|
|
81
79
|
value: function render() {
|
|
82
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
83
|
-
// Ignored via go/ees005
|
|
84
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
85
|
-
return /*#__PURE__*/_react.default.createElement(WithPluginStateNew, this.props);
|
|
86
|
-
}
|
|
87
80
|
// Ignored via go/ees005
|
|
88
81
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
89
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(WithPluginStateEditionActionsWrapper, this.props);
|
|
90
83
|
}
|
|
91
84
|
}]);
|
|
92
85
|
}(_react.default.Component);
|
|
93
|
-
function
|
|
86
|
+
function WithPluginStateEditionActionsWrapper(props) {
|
|
94
87
|
var context = _react.default.useContext(_EditorContext.EditorContext);
|
|
95
88
|
return /*#__PURE__*/_react.default.createElement(WithPluginStateInner
|
|
96
89
|
// Ignored via go/ees005
|
|
@@ -224,7 +217,6 @@ var WithPluginStateInner = exports.WithPluginStateInner = /*#__PURE__*/function
|
|
|
224
217
|
return;
|
|
225
218
|
}
|
|
226
219
|
|
|
227
|
-
// TODO: ED-15663
|
|
228
220
|
// Please, do not copy or use this kind of code below
|
|
229
221
|
// @ts-ignore
|
|
230
222
|
var fakePluginKey = {
|
|
@@ -354,263 +346,5 @@ var WithPluginStateInner = exports.WithPluginStateInner = /*#__PURE__*/function
|
|
|
354
346
|
return render(this.state);
|
|
355
347
|
}
|
|
356
348
|
}]);
|
|
357
|
-
}(_react.default.Component); // Ignored via go/ees005
|
|
358
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
359
|
-
(0, _defineProperty2.default)(WithPluginStateInner, "displayName", 'WithPluginState');
|
|
360
|
-
var WithPluginStateOld = exports.WithPluginStateOld = /*#__PURE__*/function (_React$Component3) {
|
|
361
|
-
function WithPluginStateOld(props, context) {
|
|
362
|
-
var _this6;
|
|
363
|
-
(0, _classCallCheck2.default)(this, WithPluginStateOld);
|
|
364
|
-
_this6 = _callSuper(this, WithPluginStateOld, [props, context]);
|
|
365
|
-
(0, _defineProperty2.default)(_this6, "listeners", {});
|
|
366
|
-
(0, _defineProperty2.default)(_this6, "debounce", null);
|
|
367
|
-
(0, _defineProperty2.default)(_this6, "notAppliedState", {});
|
|
368
|
-
(0, _defineProperty2.default)(_this6, "isSubscribed", false);
|
|
369
|
-
(0, _defineProperty2.default)(_this6, "callsCount", 0);
|
|
370
|
-
(0, _defineProperty2.default)(_this6, "handlePluginStateChange", function (propName, pluginName, performanceOptions, skipEqualityCheck) {
|
|
371
|
-
return (
|
|
372
|
-
// Ignored via go/ees005
|
|
373
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
374
|
-
function (pluginState) {
|
|
375
|
-
// skipEqualityCheck is being used for old plugins since they are mutating plugin state instead of creating a new one
|
|
376
|
-
// Ignored via go/ees005
|
|
377
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
378
|
-
if (_this6.state[propName] !== pluginState || skipEqualityCheck) {
|
|
379
|
-
_this6.updateState({
|
|
380
|
-
stateSubset: (0, _defineProperty2.default)({}, propName, pluginState),
|
|
381
|
-
pluginName: pluginName,
|
|
382
|
-
performanceOptions: performanceOptions
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
);
|
|
387
|
-
});
|
|
388
|
-
/**
|
|
389
|
-
* Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
|
|
390
|
-
*/
|
|
391
|
-
(0, _defineProperty2.default)(_this6, "updateState", function (_ref2) {
|
|
392
|
-
var stateSubset = _ref2.stateSubset,
|
|
393
|
-
pluginName = _ref2.pluginName,
|
|
394
|
-
performanceOptions = _ref2.performanceOptions;
|
|
395
|
-
_this6.notAppliedState = _objectSpread(_objectSpread({}, _this6.notAppliedState), stateSubset);
|
|
396
|
-
if (_this6.debounce) {
|
|
397
|
-
window.clearTimeout(_this6.debounce);
|
|
398
|
-
}
|
|
399
|
-
var debounce = _this6.props.debounce !== false ? function (fn) {
|
|
400
|
-
return window.setTimeout(fn, 0);
|
|
401
|
-
} : function (fn) {
|
|
402
|
-
return fn();
|
|
403
|
-
};
|
|
404
|
-
_this6.debounce = debounce(function () {
|
|
405
|
-
var measure = "\uD83E\uDD89".concat(pluginName, "::WithPluginState");
|
|
406
|
-
performanceOptions.trackingEnabled && (0, _performanceMeasures.startMeasure)(measure);
|
|
407
|
-
_this6.setState(_this6.notAppliedState, function () {
|
|
408
|
-
performanceOptions.trackingEnabled && (0, _performanceMeasures.stopMeasure)(measure, function (duration) {
|
|
409
|
-
// Each WithPluginState component will fire analytics event no more than once every `samplingLimit` times
|
|
410
|
-
if (++_this6.callsCount % performanceOptions.samplingRate === 0 && duration > performanceOptions.slowThreshold) {
|
|
411
|
-
_this6.dispatchAnalyticsEvent({
|
|
412
|
-
action: _analytics.ACTION.WITH_PLUGIN_STATE_CALLED,
|
|
413
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
414
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
415
|
-
attributes: {
|
|
416
|
-
plugin: pluginName,
|
|
417
|
-
duration: duration
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
});
|
|
423
|
-
_this6.debounce = null;
|
|
424
|
-
_this6.notAppliedState = {};
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
(0, _defineProperty2.default)(_this6, "dispatchAnalyticsEvent", function (payload) {
|
|
428
|
-
var eventDispatcher = _this6.getEventDispatcher();
|
|
429
|
-
if (eventDispatcher) {
|
|
430
|
-
var dispatch = (0, _eventDispatcher.createDispatch)(eventDispatcher);
|
|
431
|
-
dispatch(_utils.analyticsEventKey, {
|
|
432
|
-
payload: payload
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
(0, _defineProperty2.default)(_this6, "onContextUpdate", function () {
|
|
437
|
-
_this6.subscribe(_this6.props);
|
|
438
|
-
});
|
|
439
|
-
_this6.state = _this6.getPluginsStates(_this6.props.plugins, _this6.getEditorView(props, context));
|
|
440
|
-
return _this6;
|
|
441
|
-
}
|
|
442
|
-
(0, _inherits2.default)(WithPluginStateOld, _React$Component3);
|
|
443
|
-
return (0, _createClass2.default)(WithPluginStateOld, [{
|
|
444
|
-
key: "getEditorView",
|
|
445
|
-
value: function getEditorView(maybeProps, maybeContext) {
|
|
446
|
-
var props = maybeProps || this.props;
|
|
447
|
-
var context = maybeContext || this.context;
|
|
448
|
-
return props.editorView || context && context.editorActions && context.editorActions._privateGetEditorView() || context && context.editorSharedConfig && context.editorSharedConfig.editorView;
|
|
449
|
-
}
|
|
450
|
-
}, {
|
|
451
|
-
key: "getEventDispatcher",
|
|
452
|
-
value: function getEventDispatcher(maybeProps) {
|
|
453
|
-
var props = maybeProps || this.props;
|
|
454
|
-
return props.eventDispatcher || this.context && this.context.editorActions && this.context.editorActions._privateGetEventDispatcher() || this.context && this.context.editorSharedConfig && this.context.editorSharedConfig.eventDispatcher;
|
|
455
|
-
}
|
|
456
|
-
}, {
|
|
457
|
-
key: "getPluginsStates",
|
|
458
|
-
value: function getPluginsStates(plugins, editorView) {
|
|
459
|
-
if (!editorView || !plugins) {
|
|
460
|
-
return {};
|
|
461
|
-
}
|
|
462
|
-
var keys = Object.keys(plugins);
|
|
463
|
-
return keys.reduce(function (acc, propName) {
|
|
464
|
-
var pluginKey = plugins[propName];
|
|
465
|
-
if (!pluginKey) {
|
|
466
|
-
return acc;
|
|
467
|
-
}
|
|
468
|
-
acc[propName] = pluginKey.getState(editorView.state);
|
|
469
|
-
return acc;
|
|
470
|
-
}, {});
|
|
471
|
-
}
|
|
472
|
-
}, {
|
|
473
|
-
key: "subscribe",
|
|
474
|
-
value: function subscribe(props) {
|
|
475
|
-
var _uiTracking$samplingR2,
|
|
476
|
-
_uiTracking$slowThres2,
|
|
477
|
-
_this7 = this;
|
|
478
|
-
var plugins = props.plugins;
|
|
479
|
-
var eventDispatcher = this.getEventDispatcher(props);
|
|
480
|
-
var editorView = this.getEditorView(props);
|
|
481
|
-
if (!eventDispatcher || !editorView || this.isSubscribed) {
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// TODO: ED-15663
|
|
486
|
-
// Please, do not copy or use this kind of code below
|
|
487
|
-
// @ts-ignore
|
|
488
|
-
var fakePluginKey = {
|
|
489
|
-
key: 'analyticsPlugin$',
|
|
490
|
-
getState: function getState(state) {
|
|
491
|
-
// Ignored via go/ees005
|
|
492
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
493
|
-
return state['analyticsPlugin$'];
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
var analyticsPlugin = fakePluginKey.getState(editorView.state);
|
|
497
|
-
var uiTracking = analyticsPlugin && analyticsPlugin.performanceTracking ? analyticsPlugin.performanceTracking.uiTracking || {} : {};
|
|
498
|
-
var trackingEnabled = uiTracking.enabled === true;
|
|
499
|
-
var samplingRate = (_uiTracking$samplingR2 = uiTracking.samplingRate) !== null && _uiTracking$samplingR2 !== void 0 ? _uiTracking$samplingR2 : DEFAULT_SAMPLING_RATE;
|
|
500
|
-
var slowThreshold = (_uiTracking$slowThres2 = uiTracking.slowThreshold) !== null && _uiTracking$slowThres2 !== void 0 ? _uiTracking$slowThres2 : DEFAULT_SLOW_THRESHOLD;
|
|
501
|
-
this.isSubscribed = true;
|
|
502
|
-
var pluginsStates = this.getPluginsStates(plugins, editorView);
|
|
503
|
-
this.setState(pluginsStates);
|
|
504
|
-
Object.keys(plugins).forEach(function (propName) {
|
|
505
|
-
var pluginKey = plugins[propName];
|
|
506
|
-
if (!pluginKey) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// Ignored via go/ees005
|
|
511
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
512
|
-
var pluginName = pluginKey.key;
|
|
513
|
-
// Ignored via go/ees005
|
|
514
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
515
|
-
var pluginState = pluginsStates[propName];
|
|
516
|
-
var isPluginWithSubscribe = pluginState && pluginState.subscribe;
|
|
517
|
-
var handler = _this7.handlePluginStateChange(propName, pluginName, {
|
|
518
|
-
samplingRate: samplingRate,
|
|
519
|
-
slowThreshold: slowThreshold,
|
|
520
|
-
trackingEnabled: trackingEnabled
|
|
521
|
-
}, isPluginWithSubscribe);
|
|
522
|
-
if (isPluginWithSubscribe) {
|
|
523
|
-
pluginState.subscribe(handler);
|
|
524
|
-
} else {
|
|
525
|
-
// Ignored via go/ees005
|
|
526
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
527
|
-
eventDispatcher.on(pluginKey.key, handler);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// Ignored via go/ees005
|
|
531
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
532
|
-
// Ignored via go/ees005
|
|
533
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
534
|
-
_this7.listeners[pluginKey.key] = {
|
|
535
|
-
handler: handler,
|
|
536
|
-
pluginKey: pluginKey
|
|
537
|
-
};
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
}, {
|
|
541
|
-
key: "unsubscribe",
|
|
542
|
-
value: function unsubscribe() {
|
|
543
|
-
var _this8 = this;
|
|
544
|
-
var eventDispatcher = this.getEventDispatcher();
|
|
545
|
-
var editorView = this.getEditorView();
|
|
546
|
-
if (!eventDispatcher || !editorView || !this.isSubscribed) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
Object.keys(this.listeners).forEach(function (key) {
|
|
550
|
-
// Ignored via go/ees005
|
|
551
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
552
|
-
var pluginState = _this8.listeners[key].pluginKey.getState(editorView.state);
|
|
553
|
-
if (pluginState && pluginState.unsubscribe) {
|
|
554
|
-
// Ignored via go/ees005
|
|
555
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
556
|
-
pluginState.unsubscribe(_this8.listeners[key].handler);
|
|
557
|
-
} else {
|
|
558
|
-
// Ignored via go/ees005
|
|
559
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
560
|
-
eventDispatcher.off(key, _this8.listeners[key].handler);
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
this.listeners = [];
|
|
564
|
-
}
|
|
565
|
-
}, {
|
|
566
|
-
key: "subscribeToContextUpdates",
|
|
567
|
-
value: function subscribeToContextUpdates(context) {
|
|
568
|
-
if (context && context.editorActions) {
|
|
569
|
-
context.editorActions._privateSubscribe(this.onContextUpdate);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}, {
|
|
573
|
-
key: "unsubscribeFromContextUpdates",
|
|
574
|
-
value: function unsubscribeFromContextUpdates(context) {
|
|
575
|
-
if (context && context.editorActions) {
|
|
576
|
-
context.editorActions._privateUnsubscribe(this.onContextUpdate);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}, {
|
|
580
|
-
key: "componentDidMount",
|
|
581
|
-
value: function componentDidMount() {
|
|
582
|
-
this.subscribe(this.props);
|
|
583
|
-
this.subscribeToContextUpdates(this.context);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// Ignored via go/ees005
|
|
587
|
-
// eslint-disable-next-line react/no-unsafe
|
|
588
|
-
}, {
|
|
589
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
590
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
591
|
-
if (!this.isSubscribed) {
|
|
592
|
-
this.subscribe(nextProps);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}, {
|
|
596
|
-
key: "componentWillUnmount",
|
|
597
|
-
value: function componentWillUnmount() {
|
|
598
|
-
if (this.debounce) {
|
|
599
|
-
window.clearTimeout(this.debounce);
|
|
600
|
-
}
|
|
601
|
-
this.unsubscribeFromContextUpdates(this.context);
|
|
602
|
-
this.unsubscribe();
|
|
603
|
-
}
|
|
604
|
-
}, {
|
|
605
|
-
key: "render",
|
|
606
|
-
value: function render() {
|
|
607
|
-
var render = this.props.render;
|
|
608
|
-
return render(this.state);
|
|
609
|
-
}
|
|
610
|
-
}]);
|
|
611
349
|
}(_react.default.Component);
|
|
612
|
-
(0, _defineProperty2.default)(
|
|
613
|
-
(0, _defineProperty2.default)(WithPluginStateOld, "contextTypes", {
|
|
614
|
-
editorActions: _propTypes.default.object,
|
|
615
|
-
editorSharedConfig: _propTypes.default.object
|
|
616
|
-
});
|
|
350
|
+
(0, _defineProperty2.default)(WithPluginStateInner, "displayName", 'WithPluginState');
|
|
@@ -6,6 +6,11 @@ export const aiMessages = defineMessages({
|
|
|
6
6
|
defaultMessage: 'Page title',
|
|
7
7
|
description: 'A fallback suggested title for the suggest title prompt'
|
|
8
8
|
},
|
|
9
|
+
eventHubfallbackSuggestedTitlePrefix: {
|
|
10
|
+
id: 'fabric.editor.ai.eventHub.fallbackSuggestedTitlePrefix',
|
|
11
|
+
defaultMessage: 'Page',
|
|
12
|
+
description: 'A fallback suggested title prefix for the suggest title prompt'
|
|
13
|
+
},
|
|
9
14
|
// Toolbar messages
|
|
10
15
|
aiToolbarTitle: {
|
|
11
16
|
id: 'fabric.editor.ai.toolbar.titleText',
|
|
@@ -20,6 +20,4 @@ export let BROWSER_FREEZE_INTERACTION_TYPE = /*#__PURE__*/function (BROWSER_FREE
|
|
|
20
20
|
BROWSER_FREEZE_INTERACTION_TYPE["CLICKING"] = "clicking";
|
|
21
21
|
BROWSER_FREEZE_INTERACTION_TYPE["PASTING"] = "pasting";
|
|
22
22
|
return BROWSER_FREEZE_INTERACTION_TYPE;
|
|
23
|
-
}({});
|
|
24
|
-
|
|
25
|
-
// TODO: https://product-fabric.atlassian.net/browse/AFP-1418
|
|
23
|
+
}({});
|
|
@@ -117,6 +117,8 @@ export let PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
|
117
117
|
|
|
118
118
|
// Collab Provider interface
|
|
119
119
|
|
|
120
|
+
// Ignored via go/ees007
|
|
121
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
120
122
|
// TODO: Deprecate redundant payload types
|
|
121
123
|
|
|
122
124
|
export let DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
/**
|
|
4
4
|
* a custom hook that handles keyboard navigation for Arrow keys based on a
|
|
5
5
|
* given listSize, and a step (for up and down arrows).
|
|
@@ -81,29 +81,19 @@ const moveReducer = (state, action) => {
|
|
|
81
81
|
selectedItemIndex: canFocusViewMore ? undefined : listSize
|
|
82
82
|
};
|
|
83
83
|
} else {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
} else {
|
|
99
|
-
return {
|
|
100
|
-
...state,
|
|
101
|
-
focusOnSearch: false,
|
|
102
|
-
focusOnViewMore: false,
|
|
103
|
-
focusedItemIndex: 0,
|
|
104
|
-
selectedItemIndex: 0
|
|
105
|
-
};
|
|
106
|
-
}
|
|
84
|
+
var _action$payload$step;
|
|
85
|
+
const newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
|
|
86
|
+
const safeIndex = ensureSafeIndex(newIndex, state.listSize);
|
|
87
|
+
const isLastItemFocused = newIndex > listSize;
|
|
88
|
+
const focusOnSearch = isLastItemFocused && !canFocusViewMore;
|
|
89
|
+
const focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
|
|
90
|
+
return {
|
|
91
|
+
...state,
|
|
92
|
+
focusOnSearch: focusOnSearch,
|
|
93
|
+
focusOnViewMore: focusOnViewMore,
|
|
94
|
+
focusedItemIndex: safeIndex,
|
|
95
|
+
selectedItemIndex: safeIndex
|
|
96
|
+
};
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
99
|
if (state.focusOnViewMore) {
|
|
@@ -328,45 +318,29 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, it
|
|
|
328
318
|
return setFocusOnSearch();
|
|
329
319
|
case 'ArrowRight':
|
|
330
320
|
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return move(e, nextItem);
|
|
336
|
-
} else {
|
|
337
|
-
return move(e, +1);
|
|
338
|
-
}
|
|
321
|
+
var _skipForwardOffsetToS;
|
|
322
|
+
const itemIndex = focusOnSearch ? -1 : selectedItemIndex;
|
|
323
|
+
const nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
|
|
324
|
+
return move(e, nextItem);
|
|
339
325
|
}
|
|
340
326
|
case 'ArrowLeft':
|
|
341
327
|
{
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return move(e, -nextItem);
|
|
346
|
-
} else {
|
|
347
|
-
return move(e, -1);
|
|
348
|
-
}
|
|
328
|
+
var _skipBackwardOffsetTo;
|
|
329
|
+
const nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
|
|
330
|
+
return move(e, -nextItem);
|
|
349
331
|
}
|
|
350
332
|
case 'ArrowDown':
|
|
351
333
|
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return move(e, +nextItem, step);
|
|
357
|
-
} else {
|
|
358
|
-
return move(e, +step);
|
|
359
|
-
}
|
|
334
|
+
var _skipForwardOffsetToS2;
|
|
335
|
+
const itemIndex = focusOnSearch ? -step : selectedItemIndex;
|
|
336
|
+
const nextItem = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
|
|
337
|
+
return move(e, +nextItem, step);
|
|
360
338
|
}
|
|
361
339
|
case 'ArrowUp':
|
|
362
340
|
{
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return move(e, Math.min(-nextItem, -step), step);
|
|
367
|
-
} else {
|
|
368
|
-
return move(e, -step, step);
|
|
369
|
-
}
|
|
341
|
+
var _skipBackwardOffsetTo2;
|
|
342
|
+
const nextItem = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
|
|
343
|
+
return move(e, Math.min(-nextItem, -step), step);
|
|
370
344
|
}
|
|
371
345
|
}
|
|
372
346
|
}, [focusOnSearch, setFocusOnSearch, move, selectedItemIndex, itemIsDisabled, listSize, step]);
|
|
@@ -73,6 +73,8 @@ export const useMultiBodiedExtensionActions = ({
|
|
|
73
73
|
},
|
|
74
74
|
removeChild(index) {
|
|
75
75
|
const pos = getPos();
|
|
76
|
+
// Ignored via go/ees007
|
|
77
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
76
78
|
// TODO: Add child index validation here, don't trust this data
|
|
77
79
|
if (typeof pos !== 'number' || typeof index !== 'number') {
|
|
78
80
|
throw new Error('Position or index not valid');
|
|
@@ -73,6 +73,8 @@ const insertBeforeOrAfter = (tr, lookDirection, $parentPos, $proposedPosition, c
|
|
|
73
73
|
return tr.insert($proposedPosition[lookDirection](), content);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
// Ignored via go/ees007
|
|
77
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
76
78
|
// FIXME: A more sustainable and configurable way to choose when to split
|
|
77
79
|
// Ignored via go/ees005
|
|
78
80
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -34,9 +34,11 @@ export function keymap(bindings) {
|
|
|
34
34
|
const isDeadKey = name === 'Dead';
|
|
35
35
|
if (isModKeyPressed && (isNonLatinKey || isDeadKey)) {
|
|
36
36
|
keyboardEvent = new KeyboardEvent(event.type, {
|
|
37
|
+
// Ignored via go/ees007
|
|
38
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
37
39
|
// FIXME: The event.keyCode is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode),
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
+
// and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
|
|
41
|
+
// a key by event.code.
|
|
40
42
|
key: base[event.keyCode],
|
|
41
43
|
code: event.code,
|
|
42
44
|
ctrlKey: event.ctrlKey,
|
|
@@ -174,7 +174,7 @@ export const withLazyLoading = ({
|
|
|
174
174
|
});
|
|
175
175
|
requestedNodes.set(nodeName, loaderPromise);
|
|
176
176
|
if (typeof ((_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
|
|
177
|
-
// TODO:
|
|
177
|
+
// TODO: ED-23982 - Analytics
|
|
178
178
|
// dispatchAnalyticsEvent({
|
|
179
179
|
// action: ACTION.LAZY_NODE_VIEW_ERROR,
|
|
180
180
|
// actionSubject: ACTION_SUBJECT.LAZY_NODE_VIEW,
|
|
@@ -5,6 +5,8 @@ export const annotationMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Comment',
|
|
6
6
|
description: 'Create/add an inline comment based on the users selection'
|
|
7
7
|
},
|
|
8
|
+
// Ignored via go/ees007
|
|
9
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
8
10
|
// TODO: Remove this message when the editor_inline_comments_on_inline_nodes FF is removed
|
|
9
11
|
createCommentInvalid: {
|
|
10
12
|
id: 'fabric.editor.createCommentInvalid',
|
|
@@ -85,6 +85,8 @@ export const helpDialogMessages = defineMessages({
|
|
|
85
85
|
defaultMessage: 'Close help dialog',
|
|
86
86
|
description: ''
|
|
87
87
|
},
|
|
88
|
+
// Ignored via go/ees007
|
|
89
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
88
90
|
// TODO: Move it inside quick insert plugin
|
|
89
91
|
quickInsert: {
|
|
90
92
|
id: 'fabric.editor.quickInsert',
|
|
@@ -3,6 +3,8 @@ const FEDRAMP_MODERATE = 'fedramp-moderate';
|
|
|
3
3
|
// To determine whether an instance is a FedRAMP instance
|
|
4
4
|
// Copied from platform/packages/uip/atl-context/src/services/is-fedramp/index.tsx
|
|
5
5
|
// We cannot import the same-named function from @atlassian/atl-context due to editor-common being a public package (and atl-context being private)
|
|
6
|
+
// Ignored via go/ees007
|
|
7
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
6
8
|
// TODO: Seek alternatives
|
|
7
9
|
export function isFedRamp() {
|
|
8
10
|
var _global$location, _global$location$host;
|
|
@@ -1,9 +1,11 @@
|
|
|
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 = "102.1.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
|
+
// Ignored via go/ees007
|
|
8
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
7
9
|
// TODO: Sanitise the URL instead of just removing it
|
|
8
10
|
if (data.request) {
|
|
9
11
|
delete data.request.url;
|
|
@@ -37,7 +37,6 @@ export const getParentNodeWidth = (pos, state, containerWidth, isFullWidthModeEn
|
|
|
37
37
|
}
|
|
38
38
|
let parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
|
|
39
39
|
|
|
40
|
-
// TODO: ED-15663
|
|
41
40
|
// Please, do not copy or use this kind of code below
|
|
42
41
|
// @ts-ignore
|
|
43
42
|
const contextPanelPluginKey = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: DSP-4138 - migrate to @atlaskit/design-system
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export default function IconDatasourceAssetsObjects() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: DSP-4138 - Migrate to @atlaskit/design-system
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export default function IconDatasourceJiraIssue() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: DSP-4138 - Migrate to @atlaskit/design-system
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useIconThemed } from '../use-icon-themed';
|
|
@@ -270,7 +270,7 @@ function getPortalChildren({
|
|
|
270
270
|
className: `${inlineNodeViewClassname}AddZeroWidthSpace`
|
|
271
271
|
}), ZERO_WIDTH_SPACE), jsx(Component, _extends({
|
|
272
272
|
view: nodeViewParams.view
|
|
273
|
-
// TODO:
|
|
273
|
+
// TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
|
|
274
274
|
// Ignored via go/ees005
|
|
275
275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
276
|
,
|
|
@@ -194,7 +194,7 @@ export default class ReactNodeView {
|
|
|
194
194
|
|
|
195
195
|
// View should not process a re-render if this is false.
|
|
196
196
|
// We dont want to destroy the view, so we return true.
|
|
197
|
-
// TODO: ED-13910 Fix viewShouldUpdate readonly decoration array
|
|
197
|
+
// TODO: ED-13910 - Fix viewShouldUpdate readonly decoration array
|
|
198
198
|
if (!this.viewShouldUpdate(node, decorations)) {
|
|
199
199
|
this.node = node;
|
|
200
200
|
return true;
|
|
@@ -42,7 +42,7 @@ export class GapCursorSelection extends Selection {
|
|
|
42
42
|
}
|
|
43
43
|
let pos = $pos.pos;
|
|
44
44
|
|
|
45
|
-
// TODO: Fix any, potential issue.
|
|
45
|
+
// TODO: ED-5048 - Fix any, potential issue.
|
|
46
46
|
// Ignored via go/ees005
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
48
|
let next = null;
|
|
@@ -7,7 +7,7 @@ export const isSelectionAtStartOfNode = ($pos, parentNode) => {
|
|
|
7
7
|
}
|
|
8
8
|
for (let i = $pos.depth + 1; i > 0; i--) {
|
|
9
9
|
const node = $pos.node(i);
|
|
10
|
-
if (node && node.eq(parentNode
|
|
10
|
+
if (node && node.eq(parentNode)) {
|
|
11
11
|
break;
|
|
12
12
|
}
|
|
13
13
|
if (i > 1 && $pos.before(i) !== $pos.before(i - 1) + 1) {
|
|
@@ -22,7 +22,7 @@ export const isSelectionAtEndOfNode = ($pos, parentNode) => {
|
|
|
22
22
|
}
|
|
23
23
|
for (let i = $pos.depth + 1; i > 0; i--) {
|
|
24
24
|
const node = $pos.node(i);
|
|
25
|
-
if (node && node.eq(parentNode
|
|
25
|
+
if (node && node.eq(parentNode)) {
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
28
|
if (i > 1 && $pos.after(i) !== $pos.after(i - 1) - 1) {
|
|
@@ -59,7 +59,7 @@ export const AnnotationSharedCSSByState = () => {
|
|
|
59
59
|
// emotion and token look up
|
|
60
60
|
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
61
61
|
borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
|
|
62
|
-
// TODO:
|
|
62
|
+
// TODO: DSP-4147 - Annotation shadow
|
|
63
63
|
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)",
|
|
64
64
|
cursor: 'pointer'
|
|
65
65
|
}),
|