@atlaskit/editor-core 150.0.2 → 151.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +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/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/HyperlinkToolbarAppearance.js +2 -2
- 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/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/HyperlinkToolbarAppearance.js +1 -1
- 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/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/HyperlinkToolbarAppearance.js +2 -2
- 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 +2 -0
- 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/extension/types.d.ts +0 -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/HyperlinkToolbarAppearance.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/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/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 +21 -18
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Node } from 'prosemirror-model';
|
|
3
|
-
import { TextSelection
|
|
3
|
+
import { TextSelection } from 'prosemirror-state';
|
|
4
4
|
import { toJSON } from '../utils';
|
|
5
5
|
import { processRawValue, isEmptyDocument } from '../utils/document';
|
|
6
6
|
import { getEditorValueWithMedia, __temporaryFixForConfigPanel } from '../utils/action';
|
|
@@ -171,35 +171,13 @@ export default class EditorActions {
|
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
} = state;
|
|
180
|
-
const content = processRawValue(schema, rawValue, undefined, undefined, this.contentTransformer, this.dispatchAnalyticsEvent);
|
|
181
|
-
|
|
182
|
-
if (!content) {
|
|
183
|
-
return false;
|
|
184
|
-
} // In case of replacing a whole document, we only need a content of a top level node e.g. document.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
let tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content.content);
|
|
188
|
-
|
|
189
|
-
if (!shouldScrollToBottom && !tr.selectionSet) {
|
|
190
|
-
// Restore selection at start of document instead of the end.
|
|
191
|
-
tr.setSelection(Selection.atStart(tr.doc));
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (shouldScrollToBottom) {
|
|
195
|
-
tr = tr.scrollIntoView();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (!shouldAddToHistory) {
|
|
199
|
-
tr.setMeta('addToHistory', false);
|
|
174
|
+
if (this.eventDispatcher) {
|
|
175
|
+
this.eventDispatcher.emit('resetEditorState', {
|
|
176
|
+
doc: rawValue,
|
|
177
|
+
shouldScrollToBottom
|
|
178
|
+
});
|
|
200
179
|
}
|
|
201
180
|
|
|
202
|
-
this.editorView.dispatch(tr);
|
|
203
181
|
return true;
|
|
204
182
|
}
|
|
205
183
|
|
|
@@ -3,14 +3,20 @@ import React from 'react';
|
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import memoizeOne from 'memoize-one';
|
|
5
5
|
import { sniffUserBrowserExtensions } from '@atlaskit/editor-common';
|
|
6
|
+
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
6
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../plugins/analytics';
|
|
7
8
|
import { editorAnalyticsChannel } from '../plugins/analytics/consts';
|
|
8
9
|
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
9
10
|
import { getDocStructure } from '../utils/document-logger';
|
|
10
11
|
import { WithEditorView } from './WithEditorView';
|
|
11
12
|
export class ErrorBoundaryWithEditorView extends React.Component {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
// Memoizing this as react alternative suggestion of https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
|
|
14
|
+
get featureFlags() {
|
|
15
|
+
return this.getFeatureFlags(this.props.editorView);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
14
20
|
|
|
15
21
|
_defineProperty(this, "browserExtensions", undefined);
|
|
16
22
|
|
|
@@ -26,60 +32,48 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
26
32
|
return getFeatureFlags(editorView.state);
|
|
27
33
|
}));
|
|
28
34
|
|
|
29
|
-
_defineProperty(this, "
|
|
35
|
+
_defineProperty(this, "sendErrorData", async analyticsErrorPayload => {
|
|
36
|
+
const product = await this.getProductName();
|
|
30
37
|
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
createAnalyticsEvent(event).fire(editorAnalyticsChannel);
|
|
62
|
-
createAnalyticsEvent({
|
|
63
|
-
action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
|
|
64
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
65
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
66
|
-
attributes: {
|
|
67
|
-
errorStack,
|
|
68
|
-
errorId: sharedId
|
|
69
|
-
}
|
|
70
|
-
}).fire(editorAnalyticsChannel);
|
|
71
|
-
} else {
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
console.error('Editor Error Boundary: Missing `createAnalyticsEvent` prop.', {
|
|
74
|
-
channel: editorAnalyticsChannel,
|
|
75
|
-
product,
|
|
76
|
-
error: analyticsErrorPayload
|
|
77
|
-
});
|
|
38
|
+
error,
|
|
39
|
+
errorInfo,
|
|
40
|
+
errorStack
|
|
41
|
+
} = analyticsErrorPayload;
|
|
42
|
+
const sharedId = uuid();
|
|
43
|
+
const attributes = {
|
|
44
|
+
product,
|
|
45
|
+
browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
|
|
46
|
+
error: error,
|
|
47
|
+
errorInfo,
|
|
48
|
+
errorId: sharedId,
|
|
49
|
+
browserExtensions: this.browserExtensions,
|
|
50
|
+
docStructure: this.featureFlags.errorBoundaryDocStructure && this.props.editorView ? getDocStructure(this.props.editorView.state.doc, {
|
|
51
|
+
compact: true
|
|
52
|
+
}) : undefined
|
|
53
|
+
};
|
|
54
|
+
this.fireAnalyticsEvent({
|
|
55
|
+
action: ACTION.EDITOR_CRASHED,
|
|
56
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
57
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
58
|
+
attributes
|
|
59
|
+
});
|
|
60
|
+
this.fireAnalyticsEvent({
|
|
61
|
+
action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
|
|
62
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
63
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
64
|
+
attributes: {
|
|
65
|
+
errorStack,
|
|
66
|
+
errorId: sharedId
|
|
78
67
|
}
|
|
79
|
-
}).catch(e => {
|
|
80
|
-
// eslint-disable-next-line no-console
|
|
81
|
-
console.error('Failed to resolve product name from contextIdentifierProvider.', e);
|
|
82
68
|
});
|
|
69
|
+
|
|
70
|
+
if (this.featureFlags.ufo && this.props.editorView) {
|
|
71
|
+
var _this$experienceStore;
|
|
72
|
+
|
|
73
|
+
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.failAll({ ...this.getExperienceMetadata(attributes),
|
|
74
|
+
errorStack
|
|
75
|
+
});
|
|
76
|
+
}
|
|
83
77
|
});
|
|
84
78
|
|
|
85
79
|
_defineProperty(this, "getProductName", async () => {
|
|
@@ -97,20 +91,39 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
97
91
|
|
|
98
92
|
return 'atlaskit';
|
|
99
93
|
});
|
|
100
|
-
}
|
|
101
94
|
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
_defineProperty(this, "fireAnalyticsEvent", event => {
|
|
96
|
+
var _this$props$createAna, _this$props;
|
|
97
|
+
|
|
98
|
+
(_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);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
_defineProperty(this, "getExperienceMetadata", attributes => {
|
|
102
|
+
var _attributes$browserEx;
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
browserInfo: attributes.browserInfo,
|
|
106
|
+
error: attributes.error.toString(),
|
|
107
|
+
errorInfo: {
|
|
108
|
+
componentStack: attributes.errorInfo.componentStack
|
|
109
|
+
},
|
|
110
|
+
errorId: attributes.errorId,
|
|
111
|
+
browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
|
|
112
|
+
docStructure: attributes.docStructure
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (props.editorView) {
|
|
117
|
+
this.experienceStore = ExperienceStore.getInstance(props.editorView);
|
|
118
|
+
}
|
|
104
119
|
}
|
|
105
120
|
|
|
106
121
|
componentDidCatch(error, errorInfo) {
|
|
107
|
-
|
|
108
|
-
this.fireAnalytics({
|
|
122
|
+
this.sendErrorData({
|
|
109
123
|
error: error.toString(),
|
|
110
124
|
errorInfo,
|
|
111
125
|
errorStack: error.stack
|
|
112
|
-
}); //
|
|
113
|
-
// // Update state to allow a re-render to attempt graceful recovery (in the event that
|
|
126
|
+
}); // // Update state to allow a re-render to attempt graceful recovery (in the event that
|
|
114
127
|
// // the error was caused by a race condition or is intermittent)
|
|
115
128
|
|
|
116
129
|
this.setState({
|
|
@@ -5,6 +5,7 @@ import { EditorState, Selection } from 'prosemirror-state';
|
|
|
5
5
|
import { EditorView } from 'prosemirror-view';
|
|
6
6
|
import { intlShape } from 'react-intl';
|
|
7
7
|
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common';
|
|
8
|
+
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
8
9
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
9
10
|
import { processRawValue } from '../utils';
|
|
10
11
|
import { RenderTracking } from '../utils/react-hooks/use-component-renderer-tracking';
|
|
@@ -97,7 +98,12 @@ export default class ReactEditorView extends React.Component {
|
|
|
97
98
|
return FULL_WIDTH_MODE.FIXED_WIDTH;
|
|
98
99
|
});
|
|
99
100
|
|
|
100
|
-
_defineProperty(this, "
|
|
101
|
+
_defineProperty(this, "resetEditorState", ({
|
|
102
|
+
doc,
|
|
103
|
+
shouldScrollToBottom
|
|
104
|
+
}) => {
|
|
105
|
+
var _this$props$editorPro3, _this$props$editorPro4;
|
|
106
|
+
|
|
101
107
|
if (!this.view) {
|
|
102
108
|
return;
|
|
103
109
|
} // We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
@@ -105,10 +111,48 @@ export default class ReactEditorView extends React.Component {
|
|
|
105
111
|
// nodes that haven't been re-rendered to the document yet.
|
|
106
112
|
|
|
107
113
|
|
|
114
|
+
this.blur();
|
|
115
|
+
this.featureFlags = createFeatureFlagsFromProps(this.props.editorProps);
|
|
116
|
+
this.editorState = this.createEditorState({
|
|
117
|
+
props: this.props,
|
|
118
|
+
context: this.context,
|
|
119
|
+
doc: doc,
|
|
120
|
+
resetting: true,
|
|
121
|
+
selectionAtStart: !shouldScrollToBottom
|
|
122
|
+
});
|
|
123
|
+
this.view.updateState(this.editorState);
|
|
124
|
+
(_this$props$editorPro3 = (_this$props$editorPro4 = this.props.editorProps).onChange) === null || _this$props$editorPro3 === void 0 ? void 0 : _this$props$editorPro3.call(_this$props$editorPro4, this.view, {
|
|
125
|
+
source: 'local'
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
_defineProperty(this, "blur", () => {
|
|
130
|
+
if (!this.view) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
108
134
|
if (this.view.dom instanceof HTMLElement && this.view.hasFocus()) {
|
|
109
135
|
this.view.dom.blur();
|
|
136
|
+
} // The selectionToDOM method uses the document selection to determine currently selected node
|
|
137
|
+
// We need to mimic blurring this as it seems doing the above is not enough.
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
const sel = this.view.root.getSelection();
|
|
141
|
+
|
|
142
|
+
if (sel) {
|
|
143
|
+
sel.removeAllRanges();
|
|
110
144
|
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
_defineProperty(this, "reconfigureState", props => {
|
|
148
|
+
if (!this.view) {
|
|
149
|
+
return;
|
|
150
|
+
} // We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
151
|
+
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
152
|
+
// nodes that haven't been re-rendered to the document yet.
|
|
111
153
|
|
|
154
|
+
|
|
155
|
+
this.blur();
|
|
112
156
|
this.config = processPluginsList(this.getPlugins(props.editorProps, this.props.editorProps, this.props.createAnalyticsEvent));
|
|
113
157
|
const state = this.editorState;
|
|
114
158
|
const plugins = createPMPlugins({
|
|
@@ -145,7 +189,7 @@ export default class ReactEditorView extends React.Component {
|
|
|
145
189
|
});
|
|
146
190
|
|
|
147
191
|
_defineProperty(this, "createEditorState", options => {
|
|
148
|
-
if (this.view) {
|
|
192
|
+
if (this.view && !options.resetting) {
|
|
149
193
|
/**
|
|
150
194
|
* There's presently a number of issues with changing the schema of a
|
|
151
195
|
* editor inflight. A significant issue is that we lose the ability
|
|
@@ -161,8 +205,7 @@ export default class ReactEditorView extends React.Component {
|
|
|
161
205
|
this.config = processPluginsList(this.getPlugins(options.props.editorProps, undefined, options.props.createAnalyticsEvent));
|
|
162
206
|
const schema = createSchema(this.config);
|
|
163
207
|
const {
|
|
164
|
-
contentTransformerProvider
|
|
165
|
-
defaultValue
|
|
208
|
+
contentTransformerProvider
|
|
166
209
|
} = options.props.editorProps;
|
|
167
210
|
const plugins = createPMPlugins({
|
|
168
211
|
schema,
|
|
@@ -181,15 +224,14 @@ export default class ReactEditorView extends React.Component {
|
|
|
181
224
|
this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
182
225
|
let doc;
|
|
183
226
|
|
|
184
|
-
if (options.
|
|
185
|
-
doc = processRawValue(schema,
|
|
227
|
+
if (options.doc) {
|
|
228
|
+
doc = processRawValue(schema, options.doc, options.props.providerFactory, options.props.editorProps.sanitizePrivateContent, this.contentTransformer, this.dispatchAnalyticsEvent);
|
|
186
229
|
}
|
|
187
230
|
|
|
188
231
|
let selection;
|
|
189
232
|
|
|
190
233
|
if (doc) {
|
|
191
|
-
|
|
192
|
-
selection = isFullPage(options.props.editorProps.appearance) ? Selection.atStart(doc) : Selection.atEnd(doc);
|
|
234
|
+
selection = options.selectionAtStart ? Selection.atStart(doc) : Selection.atEnd(doc);
|
|
193
235
|
} // Workaround for ED-3507: When media node is the last element, scrollIntoView throws an error
|
|
194
236
|
|
|
195
237
|
|
|
@@ -254,6 +296,13 @@ export default class ReactEditorView extends React.Component {
|
|
|
254
296
|
stopMeasure
|
|
255
297
|
} = this.transactionTracker.getMeasureHelpers(this.transactionTracking);
|
|
256
298
|
startMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
|
|
299
|
+
|
|
300
|
+
if (this.transactionTracker.shouldTrackTransaction(this.transactionTracking)) {
|
|
301
|
+
var _this$experienceStore;
|
|
302
|
+
|
|
303
|
+
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.start(EditorExperience.interaction);
|
|
304
|
+
}
|
|
305
|
+
|
|
257
306
|
const nodes = findChangedNodesFromTransaction(transaction);
|
|
258
307
|
const changedNodesValid = validateNodes(nodes);
|
|
259
308
|
|
|
@@ -265,7 +314,11 @@ export default class ReactEditorView extends React.Component {
|
|
|
265
314
|
state: editorState,
|
|
266
315
|
transactions
|
|
267
316
|
} = this.view.state.applyTransaction(transaction);
|
|
268
|
-
stopMeasure(EVENT_NAME_STATE_APPLY)
|
|
317
|
+
stopMeasure(EVENT_NAME_STATE_APPLY, (duration, startTime) => {
|
|
318
|
+
var _this$experienceStore2;
|
|
319
|
+
|
|
320
|
+
(_this$experienceStore2 = this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.mark(EditorExperience.interaction, 'stateApply', startTime + duration);
|
|
321
|
+
});
|
|
269
322
|
this.trackValidTransactions();
|
|
270
323
|
|
|
271
324
|
if (editorState === oldEditorState) {
|
|
@@ -274,7 +327,11 @@ export default class ReactEditorView extends React.Component {
|
|
|
274
327
|
|
|
275
328
|
startMeasure(EVENT_NAME_UPDATE_STATE);
|
|
276
329
|
this.view.updateState(editorState);
|
|
277
|
-
stopMeasure(EVENT_NAME_UPDATE_STATE)
|
|
330
|
+
stopMeasure(EVENT_NAME_UPDATE_STATE, (duration, startTime) => {
|
|
331
|
+
var _this$experienceStore3;
|
|
332
|
+
|
|
333
|
+
(_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
334
|
+
});
|
|
278
335
|
startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
|
|
279
336
|
this.onEditorViewStateUpdated({
|
|
280
337
|
originalTransaction: transaction,
|
|
@@ -282,7 +339,11 @@ export default class ReactEditorView extends React.Component {
|
|
|
282
339
|
oldEditorState,
|
|
283
340
|
newEditorState: editorState
|
|
284
341
|
});
|
|
285
|
-
stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED)
|
|
342
|
+
stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED, (duration, startTime) => {
|
|
343
|
+
var _this$experienceStore4;
|
|
344
|
+
|
|
345
|
+
(_this$experienceStore4 = this.experienceStore) === null || _this$experienceStore4 === void 0 ? void 0 : _this$experienceStore4.mark(EditorExperience.interaction, 'onEditorViewStateUpdated', startTime + duration);
|
|
346
|
+
});
|
|
286
347
|
|
|
287
348
|
if (this.props.editorProps.onChange && transaction.docChanged) {
|
|
288
349
|
const source = transaction.getMeta('isRemote') ? 'remote' : 'local';
|
|
@@ -291,9 +352,11 @@ export default class ReactEditorView extends React.Component {
|
|
|
291
352
|
source
|
|
292
353
|
});
|
|
293
354
|
stopMeasure(EVENT_NAME_ON_CHANGE, (duration, startTime) => {
|
|
294
|
-
var _this$props$
|
|
355
|
+
var _this$experienceStore5, _this$props$editorPro5, _this$props$editorPro6;
|
|
356
|
+
|
|
357
|
+
(_this$experienceStore5 = this.experienceStore) === null || _this$experienceStore5 === void 0 ? void 0 : _this$experienceStore5.mark(EditorExperience.interaction, 'onChange', startTime + duration);
|
|
295
358
|
|
|
296
|
-
if (((_this$props$
|
|
359
|
+
if (((_this$props$editorPro5 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro5 === void 0 ? void 0 : (_this$props$editorPro6 = _this$props$editorPro5.onChangeCallbackTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.enabled) !== true) {
|
|
297
360
|
return;
|
|
298
361
|
}
|
|
299
362
|
|
|
@@ -310,7 +373,15 @@ export default class ReactEditorView extends React.Component {
|
|
|
310
373
|
}
|
|
311
374
|
|
|
312
375
|
this.editorState = editorState;
|
|
376
|
+
stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION, (duration, startTime) => {
|
|
377
|
+
var _this$experienceStore6, _this$experienceStore7;
|
|
378
|
+
|
|
379
|
+
(_this$experienceStore6 = this.experienceStore) === null || _this$experienceStore6 === void 0 ? void 0 : _this$experienceStore6.mark(EditorExperience.interaction, 'dispatchTransaction', startTime + duration);
|
|
380
|
+
(_this$experienceStore7 = this.experienceStore) === null || _this$experienceStore7 === void 0 ? void 0 : _this$experienceStore7.success(EditorExperience.interaction);
|
|
381
|
+
});
|
|
313
382
|
} else {
|
|
383
|
+
var _this$experienceStore8;
|
|
384
|
+
|
|
314
385
|
const invalidNodes = nodes.filter(node => !validNode(node)).map(node => getDocStructure(node, {
|
|
315
386
|
compact: true
|
|
316
387
|
}));
|
|
@@ -323,9 +394,11 @@ export default class ReactEditorView extends React.Component {
|
|
|
323
394
|
invalidNodes
|
|
324
395
|
}
|
|
325
396
|
});
|
|
397
|
+
(_this$experienceStore8 = this.experienceStore) === null || _this$experienceStore8 === void 0 ? void 0 : _this$experienceStore8.fail(EditorExperience.interaction, {
|
|
398
|
+
reason: 'invalid transaction',
|
|
399
|
+
invalidNodes: invalidNodes.toString()
|
|
400
|
+
});
|
|
326
401
|
}
|
|
327
|
-
|
|
328
|
-
stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
|
|
329
402
|
});
|
|
330
403
|
|
|
331
404
|
_defineProperty(this, "getDirectEditorProps", state => {
|
|
@@ -349,28 +422,35 @@ export default class ReactEditorView extends React.Component {
|
|
|
349
422
|
|
|
350
423
|
_defineProperty(this, "createEditorView", node => {
|
|
351
424
|
measureRender(measurements.PROSEMIRROR_RENDERED, (duration, startTime) => {
|
|
352
|
-
var _this$props$
|
|
425
|
+
var _this$props$editorPro7, _this$props$editorPro8, _proseMirrorRenderedT, _proseMirrorRenderedT2;
|
|
353
426
|
|
|
354
|
-
const proseMirrorRenderedTracking = (_this$props$
|
|
427
|
+
const proseMirrorRenderedTracking = (_this$props$editorPro7 = this.props.editorProps) === null || _this$props$editorPro7 === void 0 ? void 0 : (_this$props$editorPro8 = _this$props$editorPro7.performanceTracking) === null || _this$props$editorPro8 === void 0 ? void 0 : _this$props$editorPro8.proseMirrorRenderedTracking;
|
|
355
428
|
const forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && shouldForceTracking();
|
|
356
429
|
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;
|
|
357
430
|
|
|
358
431
|
if (this.view) {
|
|
359
|
-
var _getContextIdentifier;
|
|
432
|
+
var _getContextIdentifier, _this$experienceStore9, _this$experienceStore10;
|
|
360
433
|
|
|
434
|
+
const nodes = getNodesCount(this.view.state.doc);
|
|
435
|
+
const ttfb = getResponseEndTime();
|
|
361
436
|
this.dispatchAnalyticsEvent({
|
|
362
437
|
action: ACTION.PROSEMIRROR_RENDERED,
|
|
363
438
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
364
439
|
attributes: {
|
|
365
440
|
duration,
|
|
366
441
|
startTime,
|
|
367
|
-
nodes
|
|
368
|
-
ttfb
|
|
442
|
+
nodes,
|
|
443
|
+
ttfb,
|
|
369
444
|
severity: this.proseMirrorRenderedSeverity,
|
|
370
445
|
objectId: (_getContextIdentifier = getContextIdentifier(this.editorState)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId
|
|
371
446
|
},
|
|
372
447
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
373
448
|
});
|
|
449
|
+
(_this$experienceStore9 = this.experienceStore) === null || _this$experienceStore9 === void 0 ? void 0 : _this$experienceStore9.mark(EditorExperience.loadEditor, ACTION.PROSEMIRROR_RENDERED, startTime + duration);
|
|
450
|
+
(_this$experienceStore10 = this.experienceStore) === null || _this$experienceStore10 === void 0 ? void 0 : _this$experienceStore10.addMetadata(EditorExperience.loadEditor, {
|
|
451
|
+
nodes,
|
|
452
|
+
ttfb
|
|
453
|
+
});
|
|
374
454
|
}
|
|
375
455
|
}); // Creates the editor-view from this.editorState. If an editor has been mounted
|
|
376
456
|
// previously, this will contain the previous state of the editor.
|
|
@@ -391,8 +471,26 @@ export default class ReactEditorView extends React.Component {
|
|
|
391
471
|
transformer: this.contentTransformer
|
|
392
472
|
});
|
|
393
473
|
|
|
474
|
+
if (this.featureFlags.ufo) {
|
|
475
|
+
this.reliabilityInterval = window.setInterval(() => {
|
|
476
|
+
const reliabilityEvent = {
|
|
477
|
+
action: ACTION.UFO_SESSION_COMPLETE,
|
|
478
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
479
|
+
attributes: {
|
|
480
|
+
interval: RELIABILITY_INTERVAL
|
|
481
|
+
},
|
|
482
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
483
|
+
};
|
|
484
|
+
this.dispatchAnalyticsEvent(reliabilityEvent);
|
|
485
|
+
}, RELIABILITY_INTERVAL);
|
|
486
|
+
}
|
|
487
|
+
|
|
394
488
|
if (this.props.editorProps.shouldFocus && view.props.editable && view.props.editable(view.state)) {
|
|
395
489
|
this.focusTimeoutId = handleEditorFocus(view);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (this.featureFlags.ufo) {
|
|
493
|
+
this.experienceStore = ExperienceStore.getInstance(view);
|
|
396
494
|
} // Force React to re-render so consumers get a reference to the editor view
|
|
397
495
|
|
|
398
496
|
|
|
@@ -447,10 +545,13 @@ export default class ReactEditorView extends React.Component {
|
|
|
447
545
|
|
|
448
546
|
|
|
449
547
|
this.eventDispatcher.on(analyticsEventKey, this.handleAnalyticsEvent);
|
|
548
|
+
this.eventDispatcher.on('resetEditorState', this.resetEditorState);
|
|
450
549
|
this.editorState = this.createEditorState({
|
|
451
550
|
props: _props,
|
|
452
551
|
context,
|
|
453
|
-
|
|
552
|
+
doc: _props.editorProps.defaultValue,
|
|
553
|
+
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
554
|
+
selectionAtStart: isFullPage(_props.editorProps.appearance)
|
|
454
555
|
});
|
|
455
556
|
this.dispatchAnalyticsEvent({
|
|
456
557
|
action: ACTION.STARTED,
|
|
@@ -538,6 +639,11 @@ export default class ReactEditorView extends React.Component {
|
|
|
538
639
|
this.canDispatchTransactions = false;
|
|
539
640
|
this.eventDispatcher.destroy();
|
|
540
641
|
clearTimeout(this.focusTimeoutId);
|
|
642
|
+
|
|
643
|
+
if (this.reliabilityInterval) {
|
|
644
|
+
clearInterval(this.reliabilityInterval);
|
|
645
|
+
}
|
|
646
|
+
|
|
541
647
|
this.pluginPerformanceObserver.disconnect();
|
|
542
648
|
|
|
543
649
|
if (this.view) {
|
|
@@ -554,6 +660,7 @@ export default class ReactEditorView extends React.Component {
|
|
|
554
660
|
|
|
555
661
|
|
|
556
662
|
this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
|
|
663
|
+
this.eventDispatcher.off('resetEditorState', this.resetEditorState);
|
|
557
664
|
} // Helper to allow tests to inject plugins directly
|
|
558
665
|
|
|
559
666
|
|
|
@@ -571,9 +678,9 @@ export default class ReactEditorView extends React.Component {
|
|
|
571
678
|
}
|
|
572
679
|
|
|
573
680
|
render() {
|
|
574
|
-
var _this$props$
|
|
681
|
+
var _this$props$editorPro9, _this$props$editorPro10;
|
|
575
682
|
|
|
576
|
-
const renderTracking = (_this$props$
|
|
683
|
+
const 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;
|
|
577
684
|
const renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
578
685
|
const useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
579
686
|
return /*#__PURE__*/React.createElement(React.Fragment, null, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tablesPlugin, tasksAndDecisionsPlugin, textColorPlugin, cardPlugin, gridPlugin, statusPlugin, alignmentPlugin, indentationPlugin, analyticsPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin } from '../plugins';
|
|
1
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tablesPlugin, tasksAndDecisionsPlugin, textColorPlugin, cardPlugin, gridPlugin, statusPlugin, alignmentPlugin, indentationPlugin, analyticsPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, codeBidiWarningPlugin } from '../plugins';
|
|
2
2
|
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
3
3
|
import { GUTTER_SIZE_MOBILE_IN_PX } from '../plugins/base/pm-plugins/scroll-gutter';
|
|
4
4
|
import { createFeatureFlagsFromProps } from '../plugins/feature-flags-context/feature-flags-from-props';
|
|
@@ -57,7 +57,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
57
57
|
allowInlineCursorTarget: !isMobile,
|
|
58
58
|
allowScrollGutter: getScrollGutterOptions(props),
|
|
59
59
|
inputTracking,
|
|
60
|
-
browserFreezeTracking: (_props$performanceTra2 = props.performanceTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.bFreezeTracking
|
|
60
|
+
browserFreezeTracking: (_props$performanceTra2 = props.performanceTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.bFreezeTracking,
|
|
61
|
+
ufo: createFeatureFlagsFromProps(props).ufo
|
|
61
62
|
},
|
|
62
63
|
blockType: {
|
|
63
64
|
lastNodeMustBeParagraph: appearance === 'comment' || appearance === 'chromeless',
|
|
@@ -271,7 +272,8 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
271
272
|
if (props.allowPanel) {
|
|
272
273
|
preset.add([panelPlugin, {
|
|
273
274
|
useLongPressSelection: false,
|
|
274
|
-
UNSAFE_allowCustomPanel: props.allowPanel.UNSAFE_allowCustomPanel
|
|
275
|
+
UNSAFE_allowCustomPanel: props.allowPanel.UNSAFE_allowCustomPanel,
|
|
276
|
+
UNSAFE_allowCustomPanelEdit: props.allowPanel.UNSAFE_allowCustomPanelEdit
|
|
275
277
|
}]);
|
|
276
278
|
}
|
|
277
279
|
|
|
@@ -387,6 +389,10 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
387
389
|
preset.add([viewUpdateSubscriptionPlugin]);
|
|
388
390
|
}
|
|
389
391
|
|
|
392
|
+
if (featureFlags.codeBidiWarnings) {
|
|
393
|
+
preset.add(codeBidiWarningPlugin);
|
|
394
|
+
}
|
|
395
|
+
|
|
390
396
|
const excludes = new Set();
|
|
391
397
|
|
|
392
398
|
if (!isCodeBlockAllowed({
|