@atlaskit/editor-core 150.0.0 → 151.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -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 +4 -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-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 +8 -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/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/status/styles.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- 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 +4 -2
- 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-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 +8 -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/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/status/styles.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- 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 +4 -2
- 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-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 +8 -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/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/status/styles.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- 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/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/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 +8 -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 +20 -17
- 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
|
@@ -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, {
|
|
@@ -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
|
|
package/dist/es2019/editor.js
CHANGED
|
@@ -7,6 +7,7 @@ import memoizeOne from 'memoize-one';
|
|
|
7
7
|
import uuid from 'uuid/v4';
|
|
8
8
|
import { name, version } from './version-wrapper';
|
|
9
9
|
import { ProviderFactory, BaseTheme, getAnalyticsAppearance, WithCreateAnalyticsEvent, startMeasure, stopMeasure, clearMeasure, measureTTI, getTTISeverity, combineExtensionProviders, WidthProvider } from '@atlaskit/editor-common';
|
|
10
|
+
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
10
11
|
import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
|
|
11
12
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
12
13
|
import { getUiComponent } from './create-editor';
|
|
@@ -27,6 +28,8 @@ const WidthProviderFullHeight = styled(WidthProvider)`
|
|
|
27
28
|
`;
|
|
28
29
|
export default class Editor extends React.Component {
|
|
29
30
|
constructor(props, context) {
|
|
31
|
+
var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
|
|
32
|
+
|
|
30
33
|
super(props);
|
|
31
34
|
|
|
32
35
|
_defineProperty(this, "prepareExtensionProvider", memoizeOne(extensionProviders => {
|
|
@@ -64,11 +67,16 @@ export default class Editor extends React.Component {
|
|
|
64
67
|
this.editorActions = (context || {}).editorActions || new EditorActions();
|
|
65
68
|
this.trackEditorActions(this.editorActions, props);
|
|
66
69
|
this.editorSessionId = uuid();
|
|
70
|
+
this.startTime = performance.now();
|
|
67
71
|
startMeasure(measurements.EDITOR_MOUNTED);
|
|
68
72
|
|
|
69
|
-
if (props.performanceTracking &&
|
|
73
|
+
if ((_props$performanceTra = props.performanceTracking) !== null && _props$performanceTra !== void 0 && (_props$performanceTra2 = _props$performanceTra.ttiTracking) !== null && _props$performanceTra2 !== void 0 && _props$performanceTra2.enabled || (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
74
|
+
var _props$performanceTra5, _props$performanceTra6, _props$performanceTra7, _props$performanceTra8;
|
|
75
|
+
|
|
70
76
|
measureTTI((tti, ttiFromInvocation, canceled) => {
|
|
71
|
-
|
|
77
|
+
var _props$performanceTra3, _props$performanceTra4, _props$featureFlags2;
|
|
78
|
+
|
|
79
|
+
if ((_props$performanceTra3 = props.performanceTracking) !== null && _props$performanceTra3 !== void 0 && (_props$performanceTra4 = _props$performanceTra3.ttiTracking) !== null && _props$performanceTra4 !== void 0 && _props$performanceTra4.enabled && this.createAnalyticsEvent) {
|
|
72
80
|
var _ttiTracking;
|
|
73
81
|
|
|
74
82
|
const ttiEvent = {
|
|
@@ -101,7 +109,14 @@ export default class Editor extends React.Component {
|
|
|
101
109
|
|
|
102
110
|
fireAnalyticsEvent(this.createAnalyticsEvent)(ttiEvent);
|
|
103
111
|
}
|
|
104
|
-
|
|
112
|
+
|
|
113
|
+
if ((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.ufo) {
|
|
114
|
+
var _this$experienceStore, _this$experienceStore2;
|
|
115
|
+
|
|
116
|
+
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.mark(EditorExperience.loadEditor, ACTION.EDITOR_TTI, tti);
|
|
117
|
+
(_this$experienceStore2 = this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.success(EditorExperience.loadEditor);
|
|
118
|
+
}
|
|
119
|
+
}, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiIdleThreshold, (_props$performanceTra7 = props.performanceTracking) === null || _props$performanceTra7 === void 0 ? void 0 : (_props$performanceTra8 = _props$performanceTra7.ttiTracking) === null || _props$performanceTra8 === void 0 ? void 0 : _props$performanceTra8.ttiCancelTimeout);
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
const _extensionProvider = this.prepareExtensionProvider(props.extensionProviders);
|
|
@@ -139,18 +154,26 @@ export default class Editor extends React.Component {
|
|
|
139
154
|
}
|
|
140
155
|
|
|
141
156
|
componentWillUnmount() {
|
|
142
|
-
var _this$props, _this$props$performan, _this$props$performan2;
|
|
157
|
+
var _this$props, _this$props$performan, _this$props$performan2, _this$props$featureFl;
|
|
143
158
|
|
|
144
159
|
this.unregisterEditorFromActions();
|
|
145
160
|
this.providerFactory.destroy();
|
|
146
161
|
clearMeasure(measurements.EDITOR_MOUNTED);
|
|
147
162
|
((_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$performan = _this$props.performanceTracking) === null || _this$props$performan === void 0 ? void 0 : (_this$props$performan2 = _this$props$performan.onEditorReadyCallbackTracking) === null || _this$props$performan2 === void 0 ? void 0 : _this$props$performan2.enabled) && clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
163
|
+
|
|
164
|
+
if ((_this$props$featureFl = this.props.featureFlags) !== null && _this$props$featureFl !== void 0 && _this$props$featureFl.ufo) {
|
|
165
|
+
var _this$experienceStore3;
|
|
166
|
+
|
|
167
|
+
(_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.abortAll({
|
|
168
|
+
reason: 'editor component unmounted'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
148
171
|
}
|
|
149
172
|
|
|
150
173
|
trackEditorActions(editorActions, props) {
|
|
151
|
-
var _props$
|
|
174
|
+
var _props$performanceTra9, _props$performanceTra10;
|
|
152
175
|
|
|
153
|
-
if (props !== null && props !== void 0 && (_props$
|
|
176
|
+
if (props !== null && props !== void 0 && (_props$performanceTra9 = props.performanceTracking) !== null && _props$performanceTra9 !== void 0 && (_props$performanceTra10 = _props$performanceTra9.contentRetrievalTracking) !== null && _props$performanceTra10 !== void 0 && _props$performanceTra10.enabled) {
|
|
154
177
|
const DEFAULT_SAMPLING_RATE = 100;
|
|
155
178
|
const getValue = editorActions.getValue.bind(editorActions);
|
|
156
179
|
|
|
@@ -174,11 +197,11 @@ export default class Editor extends React.Component {
|
|
|
174
197
|
if (!getValueTracked) {
|
|
175
198
|
const getValueWithTracking = async () => {
|
|
176
199
|
try {
|
|
177
|
-
var _props$
|
|
200
|
+
var _props$performanceTra11, _props$performanceTra12, _props$performanceTra13;
|
|
178
201
|
|
|
179
202
|
const value = await getValue();
|
|
180
203
|
|
|
181
|
-
if (samplingCounters.success === ((_props$
|
|
204
|
+
if (samplingCounters.success === ((_props$performanceTra11 = props === null || props === void 0 ? void 0 : (_props$performanceTra12 = props.performanceTracking) === null || _props$performanceTra12 === void 0 ? void 0 : (_props$performanceTra13 = _props$performanceTra12.contentRetrievalTracking) === null || _props$performanceTra13 === void 0 ? void 0 : _props$performanceTra13.successSamplingRate) !== null && _props$performanceTra11 !== void 0 ? _props$performanceTra11 : DEFAULT_SAMPLING_RATE)) {
|
|
182
205
|
this.handleAnalyticsEvent({
|
|
183
206
|
payload: {
|
|
184
207
|
action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
|
|
@@ -195,10 +218,10 @@ export default class Editor extends React.Component {
|
|
|
195
218
|
samplingCounters.success++;
|
|
196
219
|
return value;
|
|
197
220
|
} catch (err) {
|
|
198
|
-
var _props$
|
|
221
|
+
var _props$performanceTra14, _props$performanceTra15, _props$performanceTra16;
|
|
199
222
|
|
|
200
|
-
if (samplingCounters.failure === ((_props$
|
|
201
|
-
var _props$
|
|
223
|
+
if (samplingCounters.failure === ((_props$performanceTra14 = props === null || props === void 0 ? void 0 : (_props$performanceTra15 = props.performanceTracking) === null || _props$performanceTra15 === void 0 ? void 0 : (_props$performanceTra16 = _props$performanceTra15.contentRetrievalTracking) === null || _props$performanceTra16 === void 0 ? void 0 : _props$performanceTra16.failureSamplingRate) !== null && _props$performanceTra14 !== void 0 ? _props$performanceTra14 : DEFAULT_SAMPLING_RATE)) {
|
|
224
|
+
var _props$performanceTra17, _props$performanceTra18;
|
|
202
225
|
|
|
203
226
|
this.handleAnalyticsEvent({
|
|
204
227
|
payload: {
|
|
@@ -207,7 +230,7 @@ export default class Editor extends React.Component {
|
|
|
207
230
|
attributes: {
|
|
208
231
|
success: false,
|
|
209
232
|
errorInfo: err.toString(),
|
|
210
|
-
errorStack: props !== null && props !== void 0 && (_props$
|
|
233
|
+
errorStack: props !== null && props !== void 0 && (_props$performanceTra17 = props.performanceTracking) !== null && _props$performanceTra17 !== void 0 && (_props$performanceTra18 = _props$performanceTra17.contentRetrievalTracking) !== null && _props$performanceTra18 !== void 0 && _props$performanceTra18.reportErrorStack ? err.stack : undefined
|
|
211
234
|
},
|
|
212
235
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
213
236
|
}
|
|
@@ -229,38 +252,54 @@ export default class Editor extends React.Component {
|
|
|
229
252
|
}
|
|
230
253
|
|
|
231
254
|
onEditorCreated(instance) {
|
|
255
|
+
var _this$props$featureFl2;
|
|
256
|
+
|
|
232
257
|
this.registerEditorForActions(instance.view, instance.eventDispatcher, instance.transformer);
|
|
233
258
|
|
|
259
|
+
if ((_this$props$featureFl2 = this.props.featureFlags) !== null && _this$props$featureFl2 !== void 0 && _this$props$featureFl2.ufo) {
|
|
260
|
+
this.experienceStore = ExperienceStore.getInstance(instance.view);
|
|
261
|
+
this.experienceStore.start(EditorExperience.loadEditor, this.startTime);
|
|
262
|
+
}
|
|
263
|
+
|
|
234
264
|
if (this.props.onEditorReady) {
|
|
235
|
-
var _this$props2, _this$props2$performa, _this$props2$performa2, _this$
|
|
265
|
+
var _this$props2, _this$props2$performa, _this$props2$performa2, _this$props$featureFl3;
|
|
236
266
|
|
|
237
|
-
((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$performa = _this$props2.performanceTracking) === null || _this$props2$performa === void 0 ? void 0 : (_this$props2$performa2 = _this$props2$performa.onEditorReadyCallbackTracking) === null || _this$props2$performa2 === void 0 ? void 0 : _this$props2$performa2.enabled)
|
|
267
|
+
const measureEditorReady = ((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$performa = _this$props2.performanceTracking) === null || _this$props2$performa === void 0 ? void 0 : (_this$props2$performa2 = _this$props2$performa.onEditorReadyCallbackTracking) === null || _this$props2$performa2 === void 0 ? void 0 : _this$props2$performa2.enabled) || ((_this$props$featureFl3 = this.props.featureFlags) === null || _this$props$featureFl3 === void 0 ? void 0 : _this$props$featureFl3.ufo);
|
|
268
|
+
measureEditorReady && startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
238
269
|
this.props.onEditorReady(this.editorActions);
|
|
239
|
-
|
|
270
|
+
measureEditorReady && stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, this.sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK));
|
|
240
271
|
}
|
|
241
272
|
}
|
|
242
273
|
|
|
243
274
|
sendDurationAnalytics(action) {
|
|
244
|
-
return (duration, startTime) => {
|
|
275
|
+
return async (duration, startTime) => {
|
|
276
|
+
var _this$props$featureFl4;
|
|
277
|
+
|
|
278
|
+
const contextIdentifier = await this.props.contextIdentifierProvider;
|
|
279
|
+
const objectId = contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId;
|
|
280
|
+
|
|
245
281
|
if (this.createAnalyticsEvent) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
282
|
+
fireAnalyticsEvent(this.createAnalyticsEvent)({
|
|
283
|
+
payload: {
|
|
284
|
+
action,
|
|
285
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
286
|
+
attributes: {
|
|
287
|
+
duration,
|
|
288
|
+
startTime,
|
|
289
|
+
objectId
|
|
290
|
+
},
|
|
291
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if ((_this$props$featureFl4 = this.props.featureFlags) !== null && _this$props$featureFl4 !== void 0 && _this$props$featureFl4.ufo) {
|
|
297
|
+
var _this$experienceStore4, _this$experienceStore5;
|
|
260
298
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
299
|
+
(_this$experienceStore4 = this.experienceStore) === null || _this$experienceStore4 === void 0 ? void 0 : _this$experienceStore4.mark(EditorExperience.loadEditor, action, startTime + duration);
|
|
300
|
+
(_this$experienceStore5 = this.experienceStore) === null || _this$experienceStore5 === void 0 ? void 0 : _this$experienceStore5.addMetadata(EditorExperience.loadEditor, {
|
|
301
|
+
objectId
|
|
302
|
+
});
|
|
264
303
|
}
|
|
265
304
|
};
|
|
266
305
|
}
|
|
@@ -417,7 +456,7 @@ export default class Editor extends React.Component {
|
|
|
417
456
|
config,
|
|
418
457
|
dispatchAnalyticsEvent
|
|
419
458
|
}) => {
|
|
420
|
-
var _this$props$
|
|
459
|
+
var _this$props$featureFl5, _this$props$featureFl6;
|
|
421
460
|
|
|
422
461
|
return /*#__PURE__*/React.createElement(BaseTheme, {
|
|
423
462
|
dynamicTextSizing: this.props.allowDynamicTextSizing && this.props.appearance !== 'full-width',
|
|
@@ -449,7 +488,7 @@ export default class Editor extends React.Component {
|
|
|
449
488
|
collabEdit: this.props.collabEdit,
|
|
450
489
|
allowAnnotation: !!this.props.annotationProviders,
|
|
451
490
|
persistScrollGutter: this.props.persistScrollGutter,
|
|
452
|
-
enableToolbarMinWidth: ((_this$props$
|
|
491
|
+
enableToolbarMinWidth: ((_this$props$featureFl5 = this.props.featureFlags) === null || _this$props$featureFl5 === void 0 ? void 0 : _this$props$featureFl5.toolbarMinWidthOverflow) != null ? !!((_this$props$featureFl6 = this.props.featureFlags) !== null && _this$props$featureFl6 !== void 0 && _this$props$featureFl6.toolbarMinWidthOverflow) : this.props.UNSAFE_allowUndoRedoButtons,
|
|
453
492
|
useStickyToolbar: this.props.useStickyToolbar,
|
|
454
493
|
featureFlags: featureFlags
|
|
455
494
|
}));
|
|
@@ -94,6 +94,7 @@ export let ACTION;
|
|
|
94
94
|
ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
|
|
95
95
|
ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
|
|
96
96
|
ACTION["REMOVE_ICON"] = "removedIcon";
|
|
97
|
+
ACTION["UFO_SESSION_COMPLETE"] = "ufoSessionComplete";
|
|
97
98
|
})(ACTION || (ACTION = {}));
|
|
98
99
|
|
|
99
100
|
export let INPUT_METHOD;
|
|
@@ -234,8 +235,9 @@ export let ACTION_SUBJECT_ID;
|
|
|
234
235
|
ACTION_SUBJECT_ID["LINK"] = "link";
|
|
235
236
|
ACTION_SUBJECT_ID["LINK_PREVIEW"] = "linkPreview";
|
|
236
237
|
ACTION_SUBJECT_ID["MEDIA"] = "media";
|
|
237
|
-
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
238
238
|
ACTION_SUBJECT_ID["MEDIA_GROUP"] = "mediaGroup";
|
|
239
|
+
ACTION_SUBJECT_ID["MEDIA_INLINE"] = "mediaInline";
|
|
240
|
+
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
239
241
|
ACTION_SUBJECT_ID["MEDIA_LINK"] = "mediaLink";
|
|
240
242
|
ACTION_SUBJECT_ID["MENTION"] = "mention";
|
|
241
243
|
ACTION_SUBJECT_ID["NESTED_EXPAND"] = "nestedExpand";
|
|
@@ -43,10 +43,11 @@ const basePlugin = options => ({
|
|
|
43
43
|
}, {
|
|
44
44
|
name: 'frozenEditor',
|
|
45
45
|
plugin: ({
|
|
46
|
-
dispatchAnalyticsEvent
|
|
47
|
-
providerFactory
|
|
46
|
+
dispatchAnalyticsEvent
|
|
48
47
|
}) => {
|
|
49
|
-
|
|
48
|
+
var _options$inputTrackin;
|
|
49
|
+
|
|
50
|
+
return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? frozenEditor(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
|
|
50
51
|
}
|
|
51
52
|
}, {
|
|
52
53
|
name: 'decorationPlugin',
|