@atlaskit/editor-core 150.0.1 → 151.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 +69 -0
- package/dist/cjs/actions/index.js +5 -23
- package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
- package/dist/cjs/create-editor/ReactEditorView.js +145 -31
- package/dist/cjs/create-editor/create-plugins-list.js +8 -2
- package/dist/cjs/editor.js +101 -40
- package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
- package/dist/cjs/plugins/analytics/types/enums.js +3 -1
- package/dist/cjs/plugins/base/index.js +4 -3
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/cjs/plugins/card/index.js +13 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
- package/dist/cjs/plugins/code-bidi-warning/index.js +25 -0
- package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +43 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +118 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
- package/dist/cjs/plugins/code-block/index.js +10 -6
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/code-block/toolbar.js +1 -1
- package/dist/cjs/plugins/collab-edit/ui/to-avatar.js +4 -8
- package/dist/cjs/plugins/emoji/styles.js +1 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/cjs/plugins/extension/toolbar.js +28 -23
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +9 -3
- package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/cjs/plugins/hyperlink/utils.js +6 -69
- package/dist/cjs/plugins/index.js +8 -0
- package/dist/cjs/plugins/media/index.js +14 -3
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
- package/dist/cjs/plugins/media/toolbar/index.js +49 -17
- package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
- package/dist/cjs/plugins/media/utils/media-files.js +67 -1
- package/dist/cjs/plugins/mentions/type-ahead/index.js +39 -3
- package/dist/cjs/plugins/panel/index.js +2 -3
- package/dist/cjs/plugins/panel/message.js +47 -0
- package/dist/cjs/plugins/panel/toolbar.js +64 -84
- package/dist/cjs/plugins/panel/utils.js +2 -2
- package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/status/styles.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/cjs/profiler/render-count.js +82 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +6 -28
- package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
- package/dist/es2019/create-editor/ReactEditorView.js +130 -23
- package/dist/es2019/create-editor/create-plugins-list.js +9 -3
- package/dist/es2019/editor.js +74 -35
- package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
- package/dist/es2019/plugins/analytics/types/enums.js +3 -1
- package/dist/es2019/plugins/base/index.js +4 -3
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
- package/dist/es2019/plugins/card/index.js +7 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/es2019/plugins/code-bidi-warning/index.js +15 -0
- package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
- package/dist/es2019/plugins/code-block/index.js +6 -1
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
- package/dist/es2019/plugins/code-block/toolbar.js +1 -1
- package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
- package/dist/es2019/plugins/emoji/styles.js +2 -0
- package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/es2019/plugins/extension/toolbar.js +30 -25
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
- package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/es2019/plugins/hyperlink/utils.js +3 -59
- package/dist/es2019/plugins/index.js +2 -1
- package/dist/es2019/plugins/media/index.js +13 -4
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
- package/dist/es2019/plugins/media/toolbar/index.js +44 -15
- package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
- package/dist/es2019/plugins/media/utils/media-files.js +68 -2
- package/dist/es2019/plugins/mentions/type-ahead/index.js +21 -2
- package/dist/es2019/plugins/panel/index.js +3 -4
- package/dist/es2019/plugins/panel/message.js +38 -0
- package/dist/es2019/plugins/panel/toolbar.js +52 -71
- package/dist/es2019/plugins/panel/utils.js +2 -2
- package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/status/styles.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/es2019/profiler/render-count.js +60 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +6 -24
- package/dist/esm/create-editor/ErrorBoundary.js +113 -78
- package/dist/esm/create-editor/ReactEditorView.js +146 -31
- package/dist/esm/create-editor/create-plugins-list.js +9 -3
- package/dist/esm/editor.js +100 -40
- package/dist/esm/labs/next/presets/cxhtml.js +2 -1
- package/dist/esm/plugins/analytics/types/enums.js +3 -1
- package/dist/esm/plugins/base/index.js +4 -3
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/esm/plugins/card/index.js +13 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/esm/plugins/code-bidi-warning/index.js +17 -0
- package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
- package/dist/esm/plugins/code-block/index.js +10 -6
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
- package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
- package/dist/esm/plugins/code-block/toolbar.js +1 -1
- package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
- package/dist/esm/plugins/emoji/styles.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/esm/plugins/extension/toolbar.js +28 -23
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
- package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/esm/plugins/hyperlink/utils.js +3 -59
- package/dist/esm/plugins/index.js +2 -1
- package/dist/esm/plugins/media/index.js +14 -4
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
- package/dist/esm/plugins/media/toolbar/index.js +47 -19
- package/dist/esm/plugins/media/toolbar/utils.js +15 -1
- package/dist/esm/plugins/media/utils/media-files.js +60 -2
- package/dist/esm/plugins/mentions/type-ahead/index.js +39 -3
- package/dist/esm/plugins/panel/index.js +3 -4
- package/dist/esm/plugins/panel/message.js +38 -0
- package/dist/esm/plugins/panel/toolbar.js +57 -77
- package/dist/esm/plugins/panel/utils.js +2 -2
- package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/status/styles.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/esm/profiler/render-count.js +57 -0
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
- package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
- package/dist/types/editor.d.ts +3 -1
- package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
- package/dist/types/plugins/analytics/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
- package/dist/types/plugins/analytics/types/events.d.ts +7 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
- package/dist/types/plugins/analytics/types/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -0
- package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
- package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/types.d.ts +6 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
- package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
- package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types/plugins/extension/types.d.ts +0 -2
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
- package/dist/types/plugins/index.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
- package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
- package/dist/types/plugins/panel/message.d.ts +37 -0
- package/dist/types/plugins/panel/toolbar.d.ts +4 -37
- package/dist/types/plugins/panel/types.d.ts +1 -0
- package/dist/types/plugins/quick-insert/index.d.ts +1 -1
- package/dist/types/profiler/render-count.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +17 -0
- package/dist/types/ui/LinkSearch/types.d.ts +1 -0
- package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
- package/package.json +22 -19
- package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
- package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
- package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
- package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
- package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
- package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
- package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
- package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
- package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
- package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
- package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
- package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
- package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
- package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
- package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
- package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
- package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
- package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
- package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
- package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
- package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
- package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
- package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
- package/dist/esm/plugins/code-block/language-list.test.js +0 -71
- package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/esm/plugins/media/commands/captions.test.js +0 -135
- package/dist/esm/plugins/media/commands/linking.test.js +0 -268
- package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/esm/plugins/panel/toolbar.test.js +0 -230
- package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
- package/dist/esm/ui/PortalProvider/index.test.js +0 -129
|
@@ -8,6 +8,10 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
|
+
|
|
11
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
16
|
|
|
13
17
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -16,6 +20,7 @@ import React from 'react';
|
|
|
16
20
|
import uuid from 'uuid';
|
|
17
21
|
import memoizeOne from 'memoize-one';
|
|
18
22
|
import { sniffUserBrowserExtensions } from '@atlaskit/editor-common';
|
|
23
|
+
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
19
24
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../plugins/analytics';
|
|
20
25
|
import { editorAnalyticsChannel } from '../plugins/analytics/consts';
|
|
21
26
|
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
@@ -26,16 +31,12 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
|
|
|
26
31
|
|
|
27
32
|
var _super = _createSuper(ErrorBoundaryWithEditorView);
|
|
28
33
|
|
|
29
|
-
function ErrorBoundaryWithEditorView() {
|
|
34
|
+
function ErrorBoundaryWithEditorView(props) {
|
|
30
35
|
var _this;
|
|
31
36
|
|
|
32
37
|
_classCallCheck(this, ErrorBoundaryWithEditorView);
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
args[_key] = arguments[_key];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
39
|
+
_this = _super.call(this, props);
|
|
39
40
|
|
|
40
41
|
_defineProperty(_assertThisInitialized(_this), "browserExtensions", undefined);
|
|
41
42
|
|
|
@@ -51,102 +52,138 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
|
|
|
51
52
|
return getFeatureFlags(editorView.state);
|
|
52
53
|
}));
|
|
53
54
|
|
|
54
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
_this.getProductName().then(function (product) {
|
|
58
|
-
if (createAnalyticsEvent) {
|
|
59
|
-
var error = analyticsErrorPayload.error,
|
|
60
|
-
errorInfo = analyticsErrorPayload.errorInfo,
|
|
61
|
-
errorStack = analyticsErrorPayload.errorStack;
|
|
62
|
-
var sharedId = uuid();
|
|
63
|
-
var event = {
|
|
64
|
-
action: ACTION.EDITOR_CRASHED,
|
|
65
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
66
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
67
|
-
attributes: {
|
|
68
|
-
product: product,
|
|
69
|
-
browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
|
|
70
|
-
error: error,
|
|
71
|
-
errorInfo: errorInfo,
|
|
72
|
-
errorId: sharedId,
|
|
73
|
-
browserExtensions: _this.browserExtensions
|
|
74
|
-
}
|
|
75
|
-
}; // Add doc structure if the feature flag is on
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "sendErrorData", /*#__PURE__*/function () {
|
|
56
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(analyticsErrorPayload) {
|
|
57
|
+
var product, error, errorInfo, errorStack, sharedId, attributes, _this$experienceStore;
|
|
76
58
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
59
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
60
|
+
while (1) {
|
|
61
|
+
switch (_context.prev = _context.next) {
|
|
62
|
+
case 0:
|
|
63
|
+
_context.next = 2;
|
|
64
|
+
return _this.getProductName();
|
|
65
|
+
|
|
66
|
+
case 2:
|
|
67
|
+
product = _context.sent;
|
|
68
|
+
error = analyticsErrorPayload.error, errorInfo = analyticsErrorPayload.errorInfo, errorStack = analyticsErrorPayload.errorStack;
|
|
69
|
+
sharedId = uuid();
|
|
70
|
+
attributes = {
|
|
71
|
+
product: product,
|
|
72
|
+
browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
|
|
73
|
+
error: error,
|
|
74
|
+
errorInfo: errorInfo,
|
|
75
|
+
errorId: sharedId,
|
|
76
|
+
browserExtensions: _this.browserExtensions,
|
|
77
|
+
docStructure: _this.featureFlags.errorBoundaryDocStructure && _this.props.editorView ? getDocStructure(_this.props.editorView.state.doc, {
|
|
78
|
+
compact: true
|
|
79
|
+
}) : undefined
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
_this.fireAnalyticsEvent({
|
|
83
|
+
action: ACTION.EDITOR_CRASHED,
|
|
84
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
85
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
86
|
+
attributes: attributes
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
_this.fireAnalyticsEvent({
|
|
90
|
+
action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
|
|
91
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
92
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
93
|
+
attributes: {
|
|
94
|
+
errorStack: errorStack,
|
|
95
|
+
errorId: sharedId
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (_this.featureFlags.ufo && _this.props.editorView) {
|
|
100
|
+
(_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.failAll(_objectSpread(_objectSpread({}, _this.getExperienceMetadata(attributes)), {}, {
|
|
101
|
+
errorStack: errorStack
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
82
104
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
87
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
88
|
-
attributes: {
|
|
89
|
-
errorStack: errorStack,
|
|
90
|
-
errorId: sharedId
|
|
105
|
+
case 9:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
91
108
|
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
}).catch(function (e) {
|
|
102
|
-
// eslint-disable-next-line no-console
|
|
103
|
-
console.error('Failed to resolve product name from contextIdentifierProvider.', e);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
109
|
+
}
|
|
110
|
+
}, _callee);
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
return function (_x) {
|
|
114
|
+
return _ref.apply(this, arguments);
|
|
115
|
+
};
|
|
116
|
+
}());
|
|
106
117
|
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "getProductName", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
118
|
+
_defineProperty(_assertThisInitialized(_this), "getProductName", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
108
119
|
var contextIdentifierProvider, context;
|
|
109
|
-
return _regeneratorRuntime.wrap(function
|
|
120
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
110
121
|
while (1) {
|
|
111
|
-
switch (
|
|
122
|
+
switch (_context2.prev = _context2.next) {
|
|
112
123
|
case 0:
|
|
113
124
|
contextIdentifierProvider = _this.props.contextIdentifierProvider;
|
|
114
125
|
|
|
115
126
|
if (!contextIdentifierProvider) {
|
|
116
|
-
|
|
127
|
+
_context2.next = 7;
|
|
117
128
|
break;
|
|
118
129
|
}
|
|
119
130
|
|
|
120
|
-
|
|
131
|
+
_context2.next = 4;
|
|
121
132
|
return contextIdentifierProvider;
|
|
122
133
|
|
|
123
134
|
case 4:
|
|
124
|
-
context =
|
|
135
|
+
context = _context2.sent;
|
|
125
136
|
|
|
126
137
|
if (!context.product) {
|
|
127
|
-
|
|
138
|
+
_context2.next = 7;
|
|
128
139
|
break;
|
|
129
140
|
}
|
|
130
141
|
|
|
131
|
-
return
|
|
142
|
+
return _context2.abrupt("return", context.product);
|
|
132
143
|
|
|
133
144
|
case 7:
|
|
134
|
-
return
|
|
145
|
+
return _context2.abrupt("return", 'atlaskit');
|
|
135
146
|
|
|
136
147
|
case 8:
|
|
137
148
|
case "end":
|
|
138
|
-
return
|
|
149
|
+
return _context2.stop();
|
|
139
150
|
}
|
|
140
151
|
}
|
|
141
|
-
},
|
|
152
|
+
}, _callee2);
|
|
142
153
|
})));
|
|
143
154
|
|
|
155
|
+
_defineProperty(_assertThisInitialized(_this), "fireAnalyticsEvent", function (event) {
|
|
156
|
+
var _this$props$createAna, _this$props;
|
|
157
|
+
|
|
158
|
+
(_this$props$createAna = (_this$props = _this.props).createAnalyticsEvent) === null || _this$props$createAna === void 0 ? void 0 : _this$props$createAna.call(_this$props, event).fire(editorAnalyticsChannel);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
_defineProperty(_assertThisInitialized(_this), "getExperienceMetadata", function (attributes) {
|
|
162
|
+
var _attributes$browserEx;
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
browserInfo: attributes.browserInfo,
|
|
166
|
+
error: attributes.error.toString(),
|
|
167
|
+
errorInfo: {
|
|
168
|
+
componentStack: attributes.errorInfo.componentStack
|
|
169
|
+
},
|
|
170
|
+
errorId: attributes.errorId,
|
|
171
|
+
browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
|
|
172
|
+
docStructure: attributes.docStructure
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (props.editorView) {
|
|
177
|
+
_this.experienceStore = ExperienceStore.getInstance(props.editorView);
|
|
178
|
+
}
|
|
179
|
+
|
|
144
180
|
return _this;
|
|
145
181
|
}
|
|
146
182
|
|
|
147
183
|
_createClass(ErrorBoundaryWithEditorView, [{
|
|
148
184
|
key: "featureFlags",
|
|
149
|
-
get:
|
|
185
|
+
get: // Memoizing this as react alternative suggestion of https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
|
|
186
|
+
function get() {
|
|
150
187
|
return this.getFeatureFlags(this.props.editorView);
|
|
151
188
|
}
|
|
152
189
|
}, {
|
|
@@ -154,13 +191,11 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
|
|
|
154
191
|
value: function componentDidCatch(error, errorInfo) {
|
|
155
192
|
var _this2 = this;
|
|
156
193
|
|
|
157
|
-
|
|
158
|
-
this.fireAnalytics({
|
|
194
|
+
this.sendErrorData({
|
|
159
195
|
error: error.toString(),
|
|
160
196
|
errorInfo: errorInfo,
|
|
161
197
|
errorStack: error.stack
|
|
162
|
-
}); //
|
|
163
|
-
// // Update state to allow a re-render to attempt graceful recovery (in the event that
|
|
198
|
+
}); // // Update state to allow a re-render to attempt graceful recovery (in the event that
|
|
164
199
|
// // the error was caused by a race condition or is intermittent)
|
|
165
200
|
|
|
166
201
|
this.setState({
|
|
@@ -180,12 +215,12 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
|
|
|
180
215
|
}, {
|
|
181
216
|
key: "componentDidMount",
|
|
182
217
|
value: function () {
|
|
183
|
-
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
184
|
-
return _regeneratorRuntime.wrap(function
|
|
218
|
+
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
219
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
185
220
|
while (1) {
|
|
186
|
-
switch (
|
|
221
|
+
switch (_context3.prev = _context3.next) {
|
|
187
222
|
case 0:
|
|
188
|
-
|
|
223
|
+
_context3.next = 2;
|
|
189
224
|
return sniffUserBrowserExtensions({
|
|
190
225
|
extensions: ['grammarly'],
|
|
191
226
|
async: true,
|
|
@@ -193,14 +228,14 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
|
|
|
193
228
|
});
|
|
194
229
|
|
|
195
230
|
case 2:
|
|
196
|
-
this.browserExtensions =
|
|
231
|
+
this.browserExtensions = _context3.sent;
|
|
197
232
|
|
|
198
233
|
case 3:
|
|
199
234
|
case "end":
|
|
200
|
-
return
|
|
235
|
+
return _context3.stop();
|
|
201
236
|
}
|
|
202
237
|
}
|
|
203
|
-
},
|
|
238
|
+
}, _callee3, this);
|
|
204
239
|
}));
|
|
205
240
|
|
|
206
241
|
function componentDidMount() {
|
|
@@ -22,6 +22,7 @@ import { EditorState, Selection } from 'prosemirror-state';
|
|
|
22
22
|
import { EditorView } from 'prosemirror-view';
|
|
23
23
|
import { intlShape } from 'react-intl';
|
|
24
24
|
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common';
|
|
25
|
+
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
25
26
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
26
27
|
import { processRawValue } from '../utils';
|
|
27
28
|
import { RenderTracking } from '../utils/react-hooks/use-component-renderer-tracking';
|
|
@@ -111,7 +112,12 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
111
112
|
return FULL_WIDTH_MODE.FIXED_WIDTH;
|
|
112
113
|
});
|
|
113
114
|
|
|
114
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
115
|
+
_defineProperty(_assertThisInitialized(_this), "resetEditorState", function (_ref) {
|
|
116
|
+
var _this$props$editorPro, _this$props$editorPro2;
|
|
117
|
+
|
|
118
|
+
var doc = _ref.doc,
|
|
119
|
+
shouldScrollToBottom = _ref.shouldScrollToBottom;
|
|
120
|
+
|
|
115
121
|
if (!_this.view) {
|
|
116
122
|
return;
|
|
117
123
|
} // We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
@@ -119,9 +125,51 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
119
125
|
// nodes that haven't been re-rendered to the document yet.
|
|
120
126
|
|
|
121
127
|
|
|
128
|
+
_this.blur();
|
|
129
|
+
|
|
130
|
+
_this.featureFlags = createFeatureFlagsFromProps(_this.props.editorProps);
|
|
131
|
+
_this.editorState = _this.createEditorState({
|
|
132
|
+
props: _this.props,
|
|
133
|
+
context: _this.context,
|
|
134
|
+
doc: doc,
|
|
135
|
+
resetting: true,
|
|
136
|
+
selectionAtStart: !shouldScrollToBottom
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
_this.view.updateState(_this.editorState);
|
|
140
|
+
|
|
141
|
+
(_this$props$editorPro = (_this$props$editorPro2 = _this.props.editorProps).onChange) === null || _this$props$editorPro === void 0 ? void 0 : _this$props$editorPro.call(_this$props$editorPro2, _this.view, {
|
|
142
|
+
source: 'local'
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
_defineProperty(_assertThisInitialized(_this), "blur", function () {
|
|
147
|
+
if (!_this.view) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
122
151
|
if (_this.view.dom instanceof HTMLElement && _this.view.hasFocus()) {
|
|
123
152
|
_this.view.dom.blur();
|
|
153
|
+
} // The selectionToDOM method uses the document selection to determine currently selected node
|
|
154
|
+
// We need to mimic blurring this as it seems doing the above is not enough.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
var sel = _this.view.root.getSelection();
|
|
158
|
+
|
|
159
|
+
if (sel) {
|
|
160
|
+
sel.removeAllRanges();
|
|
124
161
|
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
_defineProperty(_assertThisInitialized(_this), "reconfigureState", function (props) {
|
|
165
|
+
if (!_this.view) {
|
|
166
|
+
return;
|
|
167
|
+
} // We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
168
|
+
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
169
|
+
// nodes that haven't been re-rendered to the document yet.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
_this.blur();
|
|
125
173
|
|
|
126
174
|
_this.config = processPluginsList(_this.getPlugins(props.editorProps, _this.props.editorProps, _this.props.createAnalyticsEvent));
|
|
127
175
|
var state = _this.editorState;
|
|
@@ -162,7 +210,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
162
210
|
});
|
|
163
211
|
|
|
164
212
|
_defineProperty(_assertThisInitialized(_this), "createEditorState", function (options) {
|
|
165
|
-
if (_this.view) {
|
|
213
|
+
if (_this.view && !options.resetting) {
|
|
166
214
|
/**
|
|
167
215
|
* There's presently a number of issues with changing the schema of a
|
|
168
216
|
* editor inflight. A significant issue is that we lose the ability
|
|
@@ -177,9 +225,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
177
225
|
|
|
178
226
|
_this.config = processPluginsList(_this.getPlugins(options.props.editorProps, undefined, options.props.createAnalyticsEvent));
|
|
179
227
|
var schema = createSchema(_this.config);
|
|
180
|
-
var
|
|
181
|
-
contentTransformerProvider = _options$props$editor.contentTransformerProvider,
|
|
182
|
-
defaultValue = _options$props$editor.defaultValue;
|
|
228
|
+
var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
|
|
183
229
|
var plugins = createPMPlugins({
|
|
184
230
|
schema: schema,
|
|
185
231
|
dispatch: _this.dispatch,
|
|
@@ -199,15 +245,14 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
199
245
|
_this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
200
246
|
var doc;
|
|
201
247
|
|
|
202
|
-
if (options.
|
|
203
|
-
doc = processRawValue(schema,
|
|
248
|
+
if (options.doc) {
|
|
249
|
+
doc = processRawValue(schema, options.doc, options.props.providerFactory, options.props.editorProps.sanitizePrivateContent, _this.contentTransformer, _this.dispatchAnalyticsEvent);
|
|
204
250
|
}
|
|
205
251
|
|
|
206
252
|
var selection;
|
|
207
253
|
|
|
208
254
|
if (doc) {
|
|
209
|
-
|
|
210
|
-
selection = isFullPage(options.props.editorProps.appearance) ? Selection.atStart(doc) : Selection.atEnd(doc);
|
|
255
|
+
selection = options.selectionAtStart ? Selection.atStart(doc) : Selection.atEnd(doc);
|
|
211
256
|
} // Workaround for ED-3507: When media node is the last element, scrollIntoView throws an error
|
|
212
257
|
|
|
213
258
|
|
|
@@ -220,11 +265,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
220
265
|
});
|
|
221
266
|
});
|
|
222
267
|
|
|
223
|
-
_defineProperty(_assertThisInitialized(_this), "onEditorViewStateUpdated", function (
|
|
224
|
-
var originalTransaction =
|
|
225
|
-
transactions =
|
|
226
|
-
oldEditorState =
|
|
227
|
-
newEditorState =
|
|
268
|
+
_defineProperty(_assertThisInitialized(_this), "onEditorViewStateUpdated", function (_ref2) {
|
|
269
|
+
var originalTransaction = _ref2.originalTransaction,
|
|
270
|
+
transactions = _ref2.transactions,
|
|
271
|
+
oldEditorState = _ref2.oldEditorState,
|
|
272
|
+
newEditorState = _ref2.newEditorState;
|
|
228
273
|
var trackinEnabled = _this.transactionTracking.enabled;
|
|
229
274
|
|
|
230
275
|
_this.config.onEditorViewStateUpdatedCallbacks.forEach(function (entry) {
|
|
@@ -270,6 +315,13 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
270
315
|
stopMeasure = _this$transactionTrac.stopMeasure;
|
|
271
316
|
|
|
272
317
|
startMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
|
|
318
|
+
|
|
319
|
+
if (_this.transactionTracker.shouldTrackTransaction(_this.transactionTracking)) {
|
|
320
|
+
var _this$experienceStore;
|
|
321
|
+
|
|
322
|
+
(_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.start(EditorExperience.interaction);
|
|
323
|
+
}
|
|
324
|
+
|
|
273
325
|
var nodes = findChangedNodesFromTransaction(transaction);
|
|
274
326
|
var changedNodesValid = validateNodes(nodes);
|
|
275
327
|
|
|
@@ -282,7 +334,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
282
334
|
editorState = _this$view$state$appl.state,
|
|
283
335
|
transactions = _this$view$state$appl.transactions;
|
|
284
336
|
|
|
285
|
-
stopMeasure(EVENT_NAME_STATE_APPLY)
|
|
337
|
+
stopMeasure(EVENT_NAME_STATE_APPLY, function (duration, startTime) {
|
|
338
|
+
var _this$experienceStore2;
|
|
339
|
+
|
|
340
|
+
(_this$experienceStore2 = _this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.mark(EditorExperience.interaction, 'stateApply', startTime + duration);
|
|
341
|
+
});
|
|
286
342
|
|
|
287
343
|
_this.trackValidTransactions();
|
|
288
344
|
|
|
@@ -294,7 +350,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
294
350
|
|
|
295
351
|
_this.view.updateState(editorState);
|
|
296
352
|
|
|
297
|
-
stopMeasure(EVENT_NAME_UPDATE_STATE)
|
|
353
|
+
stopMeasure(EVENT_NAME_UPDATE_STATE, function (duration, startTime) {
|
|
354
|
+
var _this$experienceStore3;
|
|
355
|
+
|
|
356
|
+
(_this$experienceStore3 = _this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
357
|
+
});
|
|
298
358
|
startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
|
|
299
359
|
|
|
300
360
|
_this.onEditorViewStateUpdated({
|
|
@@ -304,7 +364,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
304
364
|
newEditorState: editorState
|
|
305
365
|
});
|
|
306
366
|
|
|
307
|
-
stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED)
|
|
367
|
+
stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED, function (duration, startTime) {
|
|
368
|
+
var _this$experienceStore4;
|
|
369
|
+
|
|
370
|
+
(_this$experienceStore4 = _this.experienceStore) === null || _this$experienceStore4 === void 0 ? void 0 : _this$experienceStore4.mark(EditorExperience.interaction, 'onEditorViewStateUpdated', startTime + duration);
|
|
371
|
+
});
|
|
308
372
|
|
|
309
373
|
if (_this.props.editorProps.onChange && transaction.docChanged) {
|
|
310
374
|
var source = transaction.getMeta('isRemote') ? 'remote' : 'local';
|
|
@@ -315,9 +379,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
315
379
|
});
|
|
316
380
|
|
|
317
381
|
stopMeasure(EVENT_NAME_ON_CHANGE, function (duration, startTime) {
|
|
318
|
-
var _this$props$
|
|
382
|
+
var _this$experienceStore5, _this$props$editorPro3, _this$props$editorPro4;
|
|
383
|
+
|
|
384
|
+
(_this$experienceStore5 = _this.experienceStore) === null || _this$experienceStore5 === void 0 ? void 0 : _this$experienceStore5.mark(EditorExperience.interaction, 'onChange', startTime + duration);
|
|
319
385
|
|
|
320
|
-
if (((_this$props$
|
|
386
|
+
if (((_this$props$editorPro3 = _this.props.editorProps.performanceTracking) === null || _this$props$editorPro3 === void 0 ? void 0 : (_this$props$editorPro4 = _this$props$editorPro3.onChangeCallbackTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : _this$props$editorPro4.enabled) !== true) {
|
|
321
387
|
return;
|
|
322
388
|
}
|
|
323
389
|
|
|
@@ -334,7 +400,15 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
334
400
|
}
|
|
335
401
|
|
|
336
402
|
_this.editorState = editorState;
|
|
403
|
+
stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION, function (duration, startTime) {
|
|
404
|
+
var _this$experienceStore6, _this$experienceStore7;
|
|
405
|
+
|
|
406
|
+
(_this$experienceStore6 = _this.experienceStore) === null || _this$experienceStore6 === void 0 ? void 0 : _this$experienceStore6.mark(EditorExperience.interaction, 'dispatchTransaction', startTime + duration);
|
|
407
|
+
(_this$experienceStore7 = _this.experienceStore) === null || _this$experienceStore7 === void 0 ? void 0 : _this$experienceStore7.success(EditorExperience.interaction);
|
|
408
|
+
});
|
|
337
409
|
} else {
|
|
410
|
+
var _this$experienceStore8;
|
|
411
|
+
|
|
338
412
|
var invalidNodes = nodes.filter(function (node) {
|
|
339
413
|
return !validNode(node);
|
|
340
414
|
}).map(function (node) {
|
|
@@ -352,9 +426,12 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
352
426
|
invalidNodes: invalidNodes
|
|
353
427
|
}
|
|
354
428
|
});
|
|
355
|
-
}
|
|
356
429
|
|
|
357
|
-
|
|
430
|
+
(_this$experienceStore8 = _this.experienceStore) === null || _this$experienceStore8 === void 0 ? void 0 : _this$experienceStore8.fail(EditorExperience.interaction, {
|
|
431
|
+
reason: 'invalid transaction',
|
|
432
|
+
invalidNodes: invalidNodes.toString()
|
|
433
|
+
});
|
|
434
|
+
}
|
|
358
435
|
});
|
|
359
436
|
|
|
360
437
|
_defineProperty(_assertThisInitialized(_this), "getDirectEditorProps", function (state) {
|
|
@@ -380,14 +457,17 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
380
457
|
|
|
381
458
|
_defineProperty(_assertThisInitialized(_this), "createEditorView", function (node) {
|
|
382
459
|
measureRender(measurements.PROSEMIRROR_RENDERED, function (duration, startTime) {
|
|
383
|
-
var _this$props$
|
|
460
|
+
var _this$props$editorPro5, _this$props$editorPro6, _proseMirrorRenderedT, _proseMirrorRenderedT2;
|
|
384
461
|
|
|
385
|
-
var proseMirrorRenderedTracking = (_this$props$
|
|
462
|
+
var proseMirrorRenderedTracking = (_this$props$editorPro5 = _this.props.editorProps) === null || _this$props$editorPro5 === void 0 ? void 0 : (_this$props$editorPro6 = _this$props$editorPro5.performanceTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.proseMirrorRenderedTracking;
|
|
386
463
|
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && shouldForceTracking();
|
|
387
464
|
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? getAnalyticsEventSeverity(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
388
465
|
|
|
389
466
|
if (_this.view) {
|
|
390
|
-
var _getContextIdentifier;
|
|
467
|
+
var _getContextIdentifier, _this$experienceStore9, _this$experienceStore10;
|
|
468
|
+
|
|
469
|
+
var nodes = getNodesCount(_this.view.state.doc);
|
|
470
|
+
var ttfb = getResponseEndTime();
|
|
391
471
|
|
|
392
472
|
_this.dispatchAnalyticsEvent({
|
|
393
473
|
action: ACTION.PROSEMIRROR_RENDERED,
|
|
@@ -395,13 +475,19 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
395
475
|
attributes: {
|
|
396
476
|
duration: duration,
|
|
397
477
|
startTime: startTime,
|
|
398
|
-
nodes:
|
|
399
|
-
ttfb:
|
|
478
|
+
nodes: nodes,
|
|
479
|
+
ttfb: ttfb,
|
|
400
480
|
severity: _this.proseMirrorRenderedSeverity,
|
|
401
481
|
objectId: (_getContextIdentifier = getContextIdentifier(_this.editorState)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId
|
|
402
482
|
},
|
|
403
483
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
404
484
|
});
|
|
485
|
+
|
|
486
|
+
(_this$experienceStore9 = _this.experienceStore) === null || _this$experienceStore9 === void 0 ? void 0 : _this$experienceStore9.mark(EditorExperience.loadEditor, ACTION.PROSEMIRROR_RENDERED, startTime + duration);
|
|
487
|
+
(_this$experienceStore10 = _this.experienceStore) === null || _this$experienceStore10 === void 0 ? void 0 : _this$experienceStore10.addMetadata(EditorExperience.loadEditor, {
|
|
488
|
+
nodes: nodes,
|
|
489
|
+
ttfb: ttfb
|
|
490
|
+
});
|
|
405
491
|
}
|
|
406
492
|
}); // Creates the editor-view from this.editorState. If an editor has been mounted
|
|
407
493
|
// previously, this will contain the previous state of the editor.
|
|
@@ -424,8 +510,27 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
424
510
|
transformer: _this.contentTransformer
|
|
425
511
|
});
|
|
426
512
|
|
|
513
|
+
if (_this.featureFlags.ufo) {
|
|
514
|
+
_this.reliabilityInterval = window.setInterval(function () {
|
|
515
|
+
var reliabilityEvent = {
|
|
516
|
+
action: ACTION.UFO_SESSION_COMPLETE,
|
|
517
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
518
|
+
attributes: {
|
|
519
|
+
interval: RELIABILITY_INTERVAL
|
|
520
|
+
},
|
|
521
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
_this.dispatchAnalyticsEvent(reliabilityEvent);
|
|
525
|
+
}, RELIABILITY_INTERVAL);
|
|
526
|
+
}
|
|
527
|
+
|
|
427
528
|
if (_this.props.editorProps.shouldFocus && view.props.editable && view.props.editable(view.state)) {
|
|
428
529
|
_this.focusTimeoutId = handleEditorFocus(view);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
if (_this.featureFlags.ufo) {
|
|
533
|
+
_this.experienceStore = ExperienceStore.getInstance(view);
|
|
429
534
|
} // Force React to re-render so consumers get a reference to the editor view
|
|
430
535
|
|
|
431
536
|
|
|
@@ -493,10 +598,14 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
493
598
|
|
|
494
599
|
_this.eventDispatcher.on(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
495
600
|
|
|
601
|
+
_this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
|
|
602
|
+
|
|
496
603
|
_this.editorState = _this.createEditorState({
|
|
497
604
|
props: _props,
|
|
498
605
|
context: context,
|
|
499
|
-
|
|
606
|
+
doc: _props.editorProps.defaultValue,
|
|
607
|
+
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
608
|
+
selectionAtStart: isFullPage(_props.editorProps.appearance)
|
|
500
609
|
});
|
|
501
610
|
|
|
502
611
|
_this.dispatchAnalyticsEvent({
|
|
@@ -517,9 +626,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
517
626
|
get: // ProseMirror is instantiated prior to the initial React render cycle,
|
|
518
627
|
// so we allow transactions by default, to avoid discarding the initial one.
|
|
519
628
|
function get() {
|
|
520
|
-
var _this$props$
|
|
629
|
+
var _this$props$editorPro7, _this$props$editorPro8;
|
|
521
630
|
|
|
522
|
-
return (_this$props$
|
|
631
|
+
return (_this$props$editorPro7 = (_this$props$editorPro8 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro8 === void 0 ? void 0 : _this$props$editorPro8.transactionTracking) !== null && _this$props$editorPro7 !== void 0 ? _this$props$editorPro7 : {
|
|
523
632
|
enabled: false
|
|
524
633
|
};
|
|
525
634
|
}
|
|
@@ -612,6 +721,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
612
721
|
this.canDispatchTransactions = false;
|
|
613
722
|
this.eventDispatcher.destroy();
|
|
614
723
|
clearTimeout(this.focusTimeoutId);
|
|
724
|
+
|
|
725
|
+
if (this.reliabilityInterval) {
|
|
726
|
+
clearInterval(this.reliabilityInterval);
|
|
727
|
+
}
|
|
728
|
+
|
|
615
729
|
this.pluginPerformanceObserver.disconnect();
|
|
616
730
|
|
|
617
731
|
if (this.view) {
|
|
@@ -628,6 +742,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
628
742
|
|
|
629
743
|
|
|
630
744
|
this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
|
|
745
|
+
this.eventDispatcher.off('resetEditorState', this.resetEditorState);
|
|
631
746
|
} // Helper to allow tests to inject plugins directly
|
|
632
747
|
|
|
633
748
|
}, {
|
|
@@ -647,9 +762,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
647
762
|
}, {
|
|
648
763
|
key: "render",
|
|
649
764
|
value: function render() {
|
|
650
|
-
var _this$props$
|
|
765
|
+
var _this$props$editorPro9, _this$props$editorPro10;
|
|
651
766
|
|
|
652
|
-
var renderTracking = (_this$props$
|
|
767
|
+
var renderTracking = (_this$props$editorPro9 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro9 === void 0 ? void 0 : (_this$props$editorPro10 = _this$props$editorPro9.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
|
|
653
768
|
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
654
769
|
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
655
770
|
return /*#__PURE__*/React.createElement(React.Fragment, null, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|