@atlaskit/editor-core 164.0.3 → 166.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 +43 -0
- package/dist/cjs/actions/index.js +9 -0
- package/dist/cjs/create-editor/ReactEditorView.js +14 -6
- package/dist/cjs/create-editor/create-plugins-list.js +1 -2
- package/dist/cjs/editor.js +32 -1
- package/dist/cjs/event-dispatcher/index.js +9 -0
- package/dist/cjs/nodeviews/ReactNodeView.js +1 -11
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/cjs/nodeviews/getPerformanceOptions.js +1 -1
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +157 -0
- package/dist/cjs/plugins/card/styles.js +3 -1
- package/dist/cjs/plugins/code-block/styles.js +6 -4
- package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
- package/dist/cjs/plugins/date/styles.js +3 -1
- package/dist/cjs/plugins/emoji/index.js +30 -34
- package/dist/cjs/plugins/emoji/nodeviews/emoji.js +12 -66
- package/dist/cjs/plugins/emoji/styles.js +3 -17
- package/dist/cjs/plugins/expand/ui/styles.js +2 -2
- package/dist/cjs/plugins/extension/ui/styles.js +3 -1
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +1 -9
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +1 -9
- package/dist/cjs/plugins/layout/styles.js +3 -1
- package/dist/cjs/plugins/list/commands/indent-list.js +5 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +5 -1
- package/dist/cjs/plugins/list/transforms.js +11 -3
- package/dist/cjs/plugins/media/styles.js +3 -1
- package/dist/cjs/plugins/mentions/index.js +10 -14
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +15 -67
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +19 -10
- package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/cjs/plugins/panel/styles.js +3 -1
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/cjs/plugins/rule/styles.js +3 -1
- package/dist/cjs/plugins/selection/utils.js +39 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +24 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -4
- package/dist/cjs/plugins/tasks-and-decisions/styles.js +3 -1
- package/dist/cjs/plugins/type-ahead/index.js +6 -2
- package/dist/cjs/plugins/unsupported-content/index.js +22 -10
- package/dist/cjs/plugins/unsupported-content/styles.js +4 -2
- package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +21 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +6 -3
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/cjs/ui/ChromeCollapsed/styles.js +3 -1
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +57 -0
- package/dist/cjs/ui/PortalProvider/index.js +66 -19
- package/dist/cjs/utils/check-if-mobile-bridge.js +19 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +12 -1
- package/dist/es2019/create-editor/ReactEditorView.js +14 -6
- package/dist/es2019/create-editor/create-plugins-list.js +1 -2
- package/dist/es2019/editor.js +33 -2
- package/dist/es2019/event-dispatcher/index.js +8 -0
- package/dist/es2019/nodeviews/ReactNodeView.js +1 -10
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +9 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +138 -80
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +128 -0
- package/dist/es2019/plugins/card/styles.js +9 -5
- package/dist/es2019/plugins/code-block/styles.js +11 -8
- package/dist/es2019/plugins/collab-edit/plugin-state.js +23 -8
- package/dist/es2019/plugins/date/styles.js +3 -1
- package/dist/es2019/plugins/emoji/index.js +16 -21
- package/dist/es2019/plugins/emoji/nodeviews/emoji.js +12 -31
- package/dist/es2019/plugins/emoji/styles.js +1 -82
- package/dist/es2019/plugins/expand/ui/styles.js +2 -2
- package/dist/es2019/plugins/extension/ui/styles.js +4 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/es2019/plugins/layout/styles.js +3 -2
- package/dist/es2019/plugins/list/commands/indent-list.js +4 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +4 -1
- package/dist/es2019/plugins/list/transforms.js +9 -4
- package/dist/es2019/plugins/media/styles.js +9 -7
- package/dist/es2019/plugins/mentions/index.js +1 -6
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -35
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/es2019/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/es2019/plugins/panel/styles.js +5 -4
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/es2019/plugins/rule/styles.js +2 -1
- package/dist/es2019/plugins/selection/utils.js +35 -20
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +22 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +4 -0
- package/dist/es2019/plugins/table/ui/consts.js +5 -4
- package/dist/es2019/plugins/tasks-and-decisions/styles.js +4 -2
- package/dist/es2019/plugins/type-ahead/index.js +5 -1
- package/dist/es2019/plugins/unsupported-content/index.js +23 -12
- package/dist/es2019/plugins/unsupported-content/styles.js +5 -3
- package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +5 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -2
- package/dist/es2019/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/es2019/ui/ContentStyles/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +39 -0
- package/dist/es2019/ui/PortalProvider/index.js +39 -3
- package/dist/es2019/utils/check-if-mobile-bridge.js +12 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +8 -0
- package/dist/esm/create-editor/ReactEditorView.js +14 -6
- package/dist/esm/create-editor/create-plugins-list.js +1 -2
- package/dist/esm/editor.js +33 -2
- package/dist/esm/event-dispatcher/index.js +9 -0
- package/dist/esm/nodeviews/ReactNodeView.js +1 -10
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +149 -0
- package/dist/esm/plugins/card/styles.js +2 -1
- package/dist/esm/plugins/code-block/styles.js +5 -4
- package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
- package/dist/esm/plugins/date/styles.js +2 -1
- package/dist/esm/plugins/emoji/index.js +26 -29
- package/dist/esm/plugins/emoji/nodeviews/emoji.js +11 -56
- package/dist/esm/plugins/emoji/styles.js +3 -14
- package/dist/esm/plugins/expand/ui/styles.js +2 -2
- package/dist/esm/plugins/extension/ui/styles.js +2 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/esm/plugins/layout/styles.js +2 -1
- package/dist/esm/plugins/list/commands/indent-list.js +4 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +4 -1
- package/dist/esm/plugins/list/transforms.js +9 -4
- package/dist/esm/plugins/media/styles.js +2 -1
- package/dist/esm/plugins/mentions/index.js +10 -14
- package/dist/esm/plugins/mentions/nodeviews/mention.js +13 -58
- package/dist/esm/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/esm/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/esm/plugins/panel/styles.js +2 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/esm/plugins/rule/styles.js +2 -1
- package/dist/esm/plugins/selection/utils.js +35 -20
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +23 -0
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +5 -4
- package/dist/esm/plugins/tasks-and-decisions/styles.js +2 -1
- package/dist/esm/plugins/type-ahead/index.js +6 -2
- package/dist/esm/plugins/unsupported-content/index.js +21 -11
- package/dist/esm/plugins/unsupported-content/styles.js +3 -2
- package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/esm/ui/Appearance/Chromeless.js +6 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/esm/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +39 -0
- package/dist/esm/ui/PortalProvider/index.js +61 -19
- package/dist/esm/utils/check-if-mobile-bridge.js +12 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +3 -1
- package/dist/types/editor.d.ts +3 -0
- package/dist/types/event-dispatcher/index.d.ts +1 -0
- package/dist/types/nodeviews/ReactNodeView.d.ts +1 -5
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +10 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +44 -0
- package/dist/types/plugins/collab-edit/plugin-state.d.ts +4 -0
- package/dist/types/plugins/emoji/index.d.ts +2 -6
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +4 -14
- package/dist/types/plugins/emoji/styles.d.ts +0 -1
- package/dist/types/plugins/emoji/types.d.ts +0 -1
- package/dist/types/plugins/list/transforms.d.ts +10 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +6 -14
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +2 -5
- package/dist/types/plugins/selection/utils.d.ts +7 -15
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +3 -0
- package/dist/types/plugins/table/ui/consts.d.ts +2 -2
- package/dist/types/plugins/type-ahead/types.d.ts +1 -0
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +11 -0
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/editor-props.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +0 -14
- package/dist/types/ui/Appearance/Chromeless.d.ts +1 -0
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +6 -0
- package/dist/types/ui/PortalProvider/index.d.ts +5 -1
- package/dist/types/utils/check-if-mobile-bridge.d.ts +1 -0
- package/package.json +24 -23
- package/dist/cjs/plugins/emoji/nodeviews/emoji-next.js +0 -250
- package/dist/es2019/plugins/emoji/nodeviews/emoji-next.js +0 -177
- package/dist/esm/plugins/emoji/nodeviews/emoji-next.js +0 -234
- package/dist/types/plugins/emoji/nodeviews/emoji-next.d.ts +0 -31
|
@@ -8,9 +8,11 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
9
9
|
import { EventDispatcher } from '../../event-dispatcher';
|
|
10
10
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plugins/analytics/types/enums';
|
|
11
|
-
import {
|
|
11
|
+
import { useIntl, RawIntlProvider, injectIntl } from 'react-intl-next';
|
|
12
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
13
|
+
import { PortalProviderThemeProviders } from './PortalProviderThemesProvider';
|
|
12
14
|
export class PortalProviderAPI extends EventDispatcher {
|
|
13
|
-
constructor(intl, onAnalyticsEvent, analyticsContext) {
|
|
15
|
+
constructor(intl, onAnalyticsEvent, analyticsContext, themeMode) {
|
|
14
16
|
super();
|
|
15
17
|
|
|
16
18
|
_defineProperty(this, "portals", new Map());
|
|
@@ -22,9 +24,32 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
22
24
|
this.intl = intl;
|
|
23
25
|
this.onAnalyticsEvent = onAnalyticsEvent;
|
|
24
26
|
this.useAnalyticsContext = analyticsContext;
|
|
27
|
+
this.themeMode = themeMode;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
render(children, container, hasAnalyticsContext = false, hasIntlContext = false) {
|
|
31
|
+
if (this.themeMode) {
|
|
32
|
+
const childrenWithThemeProviders = () => /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
33
|
+
mode: this.themeMode
|
|
34
|
+
}, children());
|
|
35
|
+
|
|
36
|
+
this.portals.set(container, {
|
|
37
|
+
children: childrenWithThemeProviders,
|
|
38
|
+
hasAnalyticsContext,
|
|
39
|
+
hasIntlContext
|
|
40
|
+
});
|
|
41
|
+
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
|
|
42
|
+
|
|
43
|
+
if (hasIntlContext) {
|
|
44
|
+
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
45
|
+
value: this.intl
|
|
46
|
+
}, wrappedChildren);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
28
53
|
this.portals.set(container, {
|
|
29
54
|
children,
|
|
30
55
|
hasAnalyticsContext,
|
|
@@ -105,7 +130,7 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
105
130
|
class BasePortalProvider extends React.Component {
|
|
106
131
|
constructor(props) {
|
|
107
132
|
super(props);
|
|
108
|
-
this.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
|
|
133
|
+
this.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
|
|
109
134
|
}
|
|
110
135
|
|
|
111
136
|
render() {
|
|
@@ -123,6 +148,17 @@ class BasePortalProvider extends React.Component {
|
|
|
123
148
|
_defineProperty(BasePortalProvider, "displayName", 'PortalProvider');
|
|
124
149
|
|
|
125
150
|
export const PortalProvider = injectIntl(BasePortalProvider);
|
|
151
|
+
export const PortalProviderWithThemeProviders = props => {
|
|
152
|
+
const intl = useIntl();
|
|
153
|
+
const globalTheme = useGlobalTheme();
|
|
154
|
+
return /*#__PURE__*/React.createElement(BasePortalProvider, {
|
|
155
|
+
intl: intl,
|
|
156
|
+
themeMode: globalTheme.mode,
|
|
157
|
+
onAnalyticsEvent: props.onAnalyticsEvent,
|
|
158
|
+
useAnalyticsContext: props.useAnalyticsContext,
|
|
159
|
+
render: props.render
|
|
160
|
+
});
|
|
161
|
+
};
|
|
126
162
|
export class PortalRenderer extends React.Component {
|
|
127
163
|
constructor(props) {
|
|
128
164
|
super(props);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function checkIfMobileBridge() {
|
|
2
|
+
/**
|
|
3
|
+
* This variable is setup on mobile prior to the editor being
|
|
4
|
+
* rendered.
|
|
5
|
+
*
|
|
6
|
+
* -- packages/editor/editor-mobile-bridge/src/editor/native-to-web/bridge-initialiser.ts
|
|
7
|
+
* - packages/editor/editor-mobile-bridge/src/__tests__/integration-webview/_mocks/editor-component.tsx
|
|
8
|
+
*/
|
|
9
|
+
const isMobileBridge = typeof window !== 'undefined' && 'bridge' in window && // @ts-ignore
|
|
10
|
+
'mediaMap' in window.bridge;
|
|
11
|
+
return isMobileBridge;
|
|
12
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -14,6 +14,7 @@ import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
|
14
14
|
import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
15
15
|
import { getFeatureFlags } from '../plugins/feature-flags-context/get-feature-flags';
|
|
16
16
|
import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
|
|
17
|
+
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
17
18
|
|
|
18
19
|
var EditorActions = /*#__PURE__*/function () {
|
|
19
20
|
function EditorActions() {
|
|
@@ -300,6 +301,13 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
300
301
|
value: function replaceDocument(rawValue) {
|
|
301
302
|
var shouldScrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
302
303
|
var shouldAddToHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
304
|
+
deprecationWarnings('EditorActions.replaceDocument', {
|
|
305
|
+
shouldAddToHistory: shouldAddToHistory
|
|
306
|
+
}, [{
|
|
307
|
+
property: 'shouldAddToHistory',
|
|
308
|
+
description: '[ED-14158] EditorActions.replaceDocument does not use the shouldAddToHistory arg',
|
|
309
|
+
type: 'removed'
|
|
310
|
+
}]);
|
|
303
311
|
|
|
304
312
|
if (!this.editorView || rawValue === undefined || rawValue === null) {
|
|
305
313
|
return false;
|
|
@@ -580,11 +580,22 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
580
580
|
config: _this.config,
|
|
581
581
|
eventDispatcher: _this.eventDispatcher,
|
|
582
582
|
transformer: _this.contentTransformer
|
|
583
|
-
});
|
|
583
|
+
}); // Allows us to dispatch analytics within the plugin view.destory methods
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
var analyticsConnected = _this.eventDispatcher.has(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
587
|
+
|
|
588
|
+
if (!analyticsConnected) {
|
|
589
|
+
_this.eventDispatcher.on(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
590
|
+
}
|
|
584
591
|
|
|
585
592
|
_this.view.destroy(); // Destroys the dom node & all node views
|
|
586
593
|
|
|
587
594
|
|
|
595
|
+
if (!analyticsConnected) {
|
|
596
|
+
_this.eventDispatcher.off(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
597
|
+
}
|
|
598
|
+
|
|
588
599
|
_this.view = undefined;
|
|
589
600
|
}
|
|
590
601
|
});
|
|
@@ -755,7 +766,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
755
766
|
// This serves to avoid potential runtime exceptions which could arise
|
|
756
767
|
// from an async dispatched transaction after it's unmounted.
|
|
757
768
|
this.canDispatchTransactions = false;
|
|
758
|
-
this.eventDispatcher.destroy();
|
|
759
769
|
clearTimeout(this.focusTimeoutId);
|
|
760
770
|
|
|
761
771
|
if (this.reliabilityInterval) {
|
|
@@ -774,11 +784,9 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
774
784
|
state.destroy();
|
|
775
785
|
}
|
|
776
786
|
});
|
|
777
|
-
}
|
|
778
|
-
|
|
787
|
+
}
|
|
779
788
|
|
|
780
|
-
this.eventDispatcher.
|
|
781
|
-
this.eventDispatcher.off('resetEditorState', this.resetEditorState);
|
|
789
|
+
this.eventDispatcher.destroy(); // this.view will be destroyed when React unmounts in handleEditorViewRef
|
|
782
790
|
} // Helper to allow tests to inject plugins directly
|
|
783
791
|
|
|
784
792
|
}, {
|
|
@@ -199,8 +199,7 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
199
199
|
|
|
200
200
|
if (props.emojiProvider) {
|
|
201
201
|
preset.add([emojiPlugin, {
|
|
202
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
203
|
-
allowZeroWidthSpaceAfter: !isMobile
|
|
202
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
204
203
|
}]);
|
|
205
204
|
}
|
|
206
205
|
|
package/dist/esm/editor.js
CHANGED
|
@@ -37,7 +37,7 @@ import { getUiComponent } from './create-editor';
|
|
|
37
37
|
import EditorActions from './actions';
|
|
38
38
|
import { ReactEditorView } from './create-editor';
|
|
39
39
|
import EditorContext from './ui/EditorContext';
|
|
40
|
-
import { PortalProvider, PortalRenderer } from './ui/PortalProvider';
|
|
40
|
+
import { PortalProvider, PortalProviderWithThemeProviders, PortalRenderer } from './ui/PortalProvider';
|
|
41
41
|
import { nextMajorVersion } from './version-wrapper';
|
|
42
42
|
import { ContextAdapter } from './nodeviews/context-adapter';
|
|
43
43
|
import measurements from './utils/performance/measure-enum';
|
|
@@ -46,6 +46,7 @@ import { fireAnalyticsEvent, EVENT_TYPE, ACTION_SUBJECT, ACTION } from './plugin
|
|
|
46
46
|
import ErrorBoundary from './create-editor/ErrorBoundary';
|
|
47
47
|
import { createFeatureFlagsFromProps } from './plugins/feature-flags-context/feature-flags-from-props';
|
|
48
48
|
import { RenderTracking } from './utils/performance/components/RenderTracking';
|
|
49
|
+
import { checkIfMobileBridge } from './utils/check-if-mobile-bridge';
|
|
49
50
|
var fullHeight = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n"])));
|
|
50
51
|
|
|
51
52
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -518,6 +519,22 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
518
519
|
var renderTracking = (_this$props$performan = this.props.performanceTracking) === null || _this$props$performan === void 0 ? void 0 : (_this$props$performan2 = _this$props$performan.renderTracking) === null || _this$props$performan2 === void 0 ? void 0 : _this$props$performan2.editor;
|
|
519
520
|
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
520
521
|
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
522
|
+
/**
|
|
523
|
+
* The PortalProviderWithThemeProviders renders portals with atlaskit
|
|
524
|
+
* and the deprecated styled components theme providers.
|
|
525
|
+
*
|
|
526
|
+
* Without this the node views react trees;
|
|
527
|
+
* - do not have access to the atlaskit theme via the `useGlobalTheme` hook
|
|
528
|
+
* - do not have access to the theme when using the `styled`${({theme}) => theme.}` api.
|
|
529
|
+
*
|
|
530
|
+
* Added for a mobile regression, which needed to be fixed on master.
|
|
531
|
+
* Once this makes it's way to develop, we should consider making it the default
|
|
532
|
+
* behaviour.
|
|
533
|
+
*
|
|
534
|
+
* https://product-fabric.atlassian.net/browse/ED-14204
|
|
535
|
+
*/
|
|
536
|
+
|
|
537
|
+
var EnvironmentDrivenPortalProvider = checkIfMobileBridge() ? PortalProviderWithThemeProviders : PortalProvider;
|
|
521
538
|
return jsx(FabricEditorAnalyticsContext, {
|
|
522
539
|
data: {
|
|
523
540
|
packageName: name,
|
|
@@ -542,7 +559,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
542
559
|
css: fullHeight
|
|
543
560
|
}, jsx(EditorContext, {
|
|
544
561
|
editorActions: _this5.editorActions
|
|
545
|
-
}, jsx(ContextAdapter, null, jsx(
|
|
562
|
+
}, jsx(ContextAdapter, null, jsx(EnvironmentDrivenPortalProvider, {
|
|
546
563
|
onAnalyticsEvent: _this5.handleAnalyticsEvent,
|
|
547
564
|
useAnalyticsContext: _this5.props.UNSAFE_useAnalyticsContext,
|
|
548
565
|
render: function render(portalProviderAPI) {
|
|
@@ -576,6 +593,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
576
593
|
eventDispatcher: eventDispatcher,
|
|
577
594
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
578
595
|
maxHeight: _this5.props.maxHeight,
|
|
596
|
+
minHeight: _this5.props.minHeight,
|
|
579
597
|
onSave: _this5.props.onSave ? _this5.handleSave : undefined,
|
|
580
598
|
onCancel: _this5.props.onCancel,
|
|
581
599
|
popupsMountPoint: _this5.props.popupsMountPoint,
|
|
@@ -619,6 +637,19 @@ _defineProperty(Editor, "defaultProps", {
|
|
|
619
637
|
quickInsert: true
|
|
620
638
|
});
|
|
621
639
|
|
|
640
|
+
_defineProperty(Editor, "propTypes", {
|
|
641
|
+
minHeight: function minHeight(_ref4) {
|
|
642
|
+
var appearance = _ref4.appearance,
|
|
643
|
+
_minHeight = _ref4.minHeight;
|
|
644
|
+
|
|
645
|
+
if (_minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
|
|
646
|
+
return new Error('minHeight only supports editor appearance chromeless and comment');
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
return null;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
|
|
622
653
|
_defineProperty(Editor, "contextTypes", {
|
|
623
654
|
editorActions: PropTypes.object
|
|
624
655
|
});
|
|
@@ -17,6 +17,15 @@ export var EventDispatcher = /*#__PURE__*/function () {
|
|
|
17
17
|
|
|
18
18
|
this.listeners[event].add(cb);
|
|
19
19
|
}
|
|
20
|
+
}, {
|
|
21
|
+
key: "has",
|
|
22
|
+
value: function has(event, cb) {
|
|
23
|
+
if (!this.listeners[event]) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return this.listeners[event].has(cb);
|
|
28
|
+
}
|
|
20
29
|
}, {
|
|
21
30
|
key: "off",
|
|
22
31
|
value: function off(event, cb) {
|
|
@@ -6,7 +6,6 @@ import React from 'react';
|
|
|
6
6
|
import { createDispatch } from '../event-dispatcher';
|
|
7
7
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../plugins/analytics';
|
|
8
8
|
import { analyticsEventKey } from '../plugins/analytics/consts';
|
|
9
|
-
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
10
9
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
11
10
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from './getPerformanceOptions';
|
|
12
11
|
|
|
@@ -125,20 +124,12 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
125
124
|
}
|
|
126
125
|
}, {
|
|
127
126
|
key: "createDomRef",
|
|
128
|
-
value: function createDomRef(
|
|
127
|
+
value: function createDomRef() {
|
|
129
128
|
if (!this.node.isInline) {
|
|
130
129
|
return document.createElement('div');
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
var htmlElement = document.createElement('span');
|
|
134
|
-
var state = this.view.state;
|
|
135
|
-
var featureFlags = getFeatureFlags(state);
|
|
136
|
-
|
|
137
|
-
if (featureFlags && featureFlags.displayInlineBlockForInlineNodes && (options === null || options === void 0 ? void 0 : options.displayInlineBlockForInlineNodes) !== false) {
|
|
138
|
-
htmlElement.style.display = 'inline-block';
|
|
139
|
-
htmlElement.style.userSelect = 'all';
|
|
140
|
-
}
|
|
141
|
-
|
|
142
133
|
return htmlElement;
|
|
143
134
|
}
|
|
144
135
|
}, {
|
|
@@ -6,4 +6,4 @@ import { css } from '@emotion/react';
|
|
|
6
6
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils'; // For reasoning behind styles, see comments in:
|
|
7
7
|
// ./getInlineNodeViewProducer -> portalChildren()
|
|
8
8
|
|
|
9
|
-
export var InlineNodeViewSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .inlineNodeView {\n display: inline;\n user-select: all;\n }\n\n &.ua-chrome .inlineNodeView > span {\n user-select: none;\n }\n\n .inlineNodeViewAddZeroWidthSpace {\n ::after {\n content: '", "';\n }\n }\n"])), ZERO_WIDTH_SPACE);
|
|
9
|
+
export var InlineNodeViewSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .inlineNodeView {\n display: inline;\n user-select: all;\n /* Collapses zero width spaces inside the inline node view\n to prevent the node from line breaking too early.\n */\n white-space: nowrap;\n /* Then reset to the Editor default so we don't interfere\n with any component styling. */\n & > * {\n white-space: pre-wrap;\n }\n }\n\n &.ua-chrome .inlineNodeView > span {\n user-select: none;\n }\n\n .inlineNodeViewAddZeroWidthSpace {\n ::after {\n content: '", "';\n }\n }\n"])), ZERO_WIDTH_SPACE);
|
|
@@ -55,6 +55,7 @@ export var ACTION;
|
|
|
55
55
|
ACTION["INDENTED"] = "indented";
|
|
56
56
|
ACTION["INITIALISED"] = "initialised";
|
|
57
57
|
ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
|
|
58
|
+
ACTION["INPUT_PERF_SAMPLING_AVG"] = "inputPerfSamplingAvg";
|
|
58
59
|
ACTION["INSERTED"] = "inserted";
|
|
59
60
|
ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
|
|
60
61
|
ACTION["INVOKED"] = "invoked";
|
|
@@ -13,7 +13,7 @@ import { getParticipantsCount } from '../../collab-edit/get-participants-count';
|
|
|
13
13
|
import { countNodes } from '../../../utils/count-nodes';
|
|
14
14
|
import { getContextIdentifier } from './context-identifier';
|
|
15
15
|
import { setInteractionType } from '../utils/frozen-editor';
|
|
16
|
-
import
|
|
16
|
+
import InputLatencyTracker from '../utils/input-latency-tracking';
|
|
17
17
|
export var frozenEditorPluginKey = new PluginKey('frozenEditor');
|
|
18
18
|
var DEFAULT_KEYSTROKE_SAMPLING_LIMIT = 100;
|
|
19
19
|
var DEFAULT_SLOW_THRESHOLD = 300;
|
|
@@ -24,11 +24,11 @@ var DEFAULT_TRACK_SEVERITY_ENABLED = false;
|
|
|
24
24
|
export var DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
|
|
25
25
|
export var DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
|
|
26
26
|
|
|
27
|
-
var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEvent, view, time,
|
|
27
|
+
var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEvent, view, time, getNodeCount, interactionType, severity) {
|
|
28
28
|
var _getContextIdentifier;
|
|
29
29
|
|
|
30
30
|
var state = view.state;
|
|
31
|
-
var nodesCount =
|
|
31
|
+
var nodesCount = getNodeCount(state);
|
|
32
32
|
return dispatchAnalyticsEvent({
|
|
33
33
|
action: ACTION.BROWSER_FREEZE,
|
|
34
34
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
@@ -46,8 +46,8 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEven
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
|
|
49
|
-
var keystrokeCount = 0;
|
|
50
49
|
var interactionType;
|
|
50
|
+
var inputLatencyTracker = null;
|
|
51
51
|
|
|
52
52
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
53
53
|
interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.LOADING);
|
|
@@ -57,6 +57,20 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
57
57
|
var slowThreshold = inputTracking && typeof inputTracking.slowThreshold === 'number' ? inputTracking.slowThreshold : DEFAULT_SLOW_THRESHOLD;
|
|
58
58
|
var freezeThreshold = inputTracking && typeof inputTracking.freezeThreshold === 'number' ? inputTracking.freezeThreshold : DEFAULT_FREEZE_THRESHOLD;
|
|
59
59
|
var allowCountNodes = inputTracking && inputTracking.countNodes;
|
|
60
|
+
var prevNodeCountState = null;
|
|
61
|
+
var prevNodeCount = {}; // Cache the result as we were calling this multiple times
|
|
62
|
+
// and has potential to be expensive
|
|
63
|
+
|
|
64
|
+
var getNodeCount = function getNodeCount(state) {
|
|
65
|
+
if (state === prevNodeCountState) {
|
|
66
|
+
return prevNodeCount;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
prevNodeCount = allowCountNodes ? countNodes(state) : {};
|
|
70
|
+
prevNodeCountState = state;
|
|
71
|
+
return prevNodeCount;
|
|
72
|
+
};
|
|
73
|
+
|
|
60
74
|
var shouldTrackSeverity = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.trackSeverity) || DEFAULT_TRACK_SEVERITY_ENABLED;
|
|
61
75
|
var severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
|
|
62
76
|
var severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
|
|
@@ -64,84 +78,18 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
64
78
|
key: frozenEditorPluginKey,
|
|
65
79
|
props: isPerformanceAPIAvailable() ? {
|
|
66
80
|
handleTextInput: function handleTextInput(view) {
|
|
67
|
-
var
|
|
68
|
-
|
|
81
|
+
var _inputLatencyTracker;
|
|
82
|
+
|
|
83
|
+
(_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.start();
|
|
69
84
|
|
|
70
85
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
71
86
|
interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
72
87
|
}
|
|
73
88
|
|
|
74
|
-
var experienceStore = ufo ? ExperienceStore.getInstance(view) : undefined;
|
|
75
|
-
var trackTyping = samplingRate && ++keystrokeCount === samplingRate;
|
|
76
|
-
|
|
77
|
-
if (trackTyping) {
|
|
78
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
89
|
requestAnimationFrame(function () {
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
if (diff > slowThreshold) {
|
|
85
|
-
var nodesCount = allowCountNodes ? countNodes(view.state) : {};
|
|
86
|
-
|
|
87
|
-
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
88
|
-
var _getContextIdentifier2;
|
|
89
|
-
|
|
90
|
-
dispatchAnalyticsEvent({
|
|
91
|
-
action: ACTION.SLOW_INPUT,
|
|
92
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
93
|
-
attributes: _objectSpread(_objectSpread({
|
|
94
|
-
time: diff,
|
|
95
|
-
nodeSize: state.doc.nodeSize
|
|
96
|
-
}, nodesCount), {}, {
|
|
97
|
-
participants: getParticipantsCount(state),
|
|
98
|
-
objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
|
|
99
|
-
}),
|
|
100
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
101
|
-
});
|
|
102
|
-
}
|
|
90
|
+
var _inputLatencyTracker2;
|
|
103
91
|
|
|
104
|
-
|
|
105
|
-
slowInput: true
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (trackTyping) {
|
|
110
|
-
var _getContextIdentifier4;
|
|
111
|
-
|
|
112
|
-
var _nodesCount = allowCountNodes ? countNodes(view.state) : {};
|
|
113
|
-
|
|
114
|
-
keystrokeCount = 0;
|
|
115
|
-
var severity = shouldTrackSeverity ? getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded) : undefined;
|
|
116
|
-
|
|
117
|
-
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
118
|
-
var _getContextIdentifier3;
|
|
119
|
-
|
|
120
|
-
var payload = {
|
|
121
|
-
action: ACTION.INPUT_PERF_SAMPLING,
|
|
122
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
123
|
-
attributes: _objectSpread(_objectSpread({
|
|
124
|
-
time: diff,
|
|
125
|
-
nodeSize: state.doc.nodeSize
|
|
126
|
-
}, _nodesCount), {}, {
|
|
127
|
-
participants: getParticipantsCount(state),
|
|
128
|
-
objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
|
|
129
|
-
severity: severity
|
|
130
|
-
}),
|
|
131
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
132
|
-
};
|
|
133
|
-
dispatchAnalyticsEvent(payload);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, _objectSpread(_objectSpread({
|
|
137
|
-
nodeSize: state.doc.nodeSize
|
|
138
|
-
}, _nodesCount), {}, {
|
|
139
|
-
participants: getParticipantsCount(state),
|
|
140
|
-
objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
|
|
141
|
-
time: diff,
|
|
142
|
-
severity: severity
|
|
143
|
-
}));
|
|
144
|
-
}
|
|
92
|
+
(_inputLatencyTracker2 = inputLatencyTracker) === null || _inputLatencyTracker2 === void 0 ? void 0 : _inputLatencyTracker2.end();
|
|
145
93
|
});
|
|
146
94
|
return false;
|
|
147
95
|
},
|
|
@@ -161,6 +109,106 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
161
109
|
return {};
|
|
162
110
|
}
|
|
163
111
|
|
|
112
|
+
var experienceStore = ufo ? ExperienceStore.getInstance(_view) : undefined;
|
|
113
|
+
|
|
114
|
+
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
115
|
+
inputLatencyTracker = new InputLatencyTracker({
|
|
116
|
+
samplingRate: samplingRate,
|
|
117
|
+
slowThreshold: slowThreshold,
|
|
118
|
+
normalThreshold: severityThresholdNormal,
|
|
119
|
+
degradedThreshold: severityThresholdDegraded,
|
|
120
|
+
onSampleStart: function onSampleStart() {
|
|
121
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
|
|
122
|
+
},
|
|
123
|
+
onSampleEnd: function onSampleEnd(time, _ref) {
|
|
124
|
+
var _getContextIdentifier2;
|
|
125
|
+
|
|
126
|
+
var isSlow = _ref.isSlow,
|
|
127
|
+
severity = _ref.severity;
|
|
128
|
+
var state = _view.state;
|
|
129
|
+
var nodesCount = getNodeCount(state);
|
|
130
|
+
|
|
131
|
+
if (isSlow) {
|
|
132
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
|
|
133
|
+
slowInput: true
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, _objectSpread(_objectSpread({
|
|
138
|
+
nodeSize: state.doc.nodeSize
|
|
139
|
+
}, nodesCount), {}, {
|
|
140
|
+
participants: getParticipantsCount(state),
|
|
141
|
+
objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId,
|
|
142
|
+
time: time,
|
|
143
|
+
severity: shouldTrackSeverity ? severity : undefined
|
|
144
|
+
}));
|
|
145
|
+
},
|
|
146
|
+
dispatchSample: function dispatchSample(time, severity) {
|
|
147
|
+
var _getContextIdentifier3;
|
|
148
|
+
|
|
149
|
+
var state = _view.state;
|
|
150
|
+
var nodesCount = getNodeCount(state);
|
|
151
|
+
var samplePayload = {
|
|
152
|
+
action: ACTION.INPUT_PERF_SAMPLING,
|
|
153
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
154
|
+
attributes: _objectSpread(_objectSpread({
|
|
155
|
+
time: time,
|
|
156
|
+
nodeSize: state.doc.nodeSize
|
|
157
|
+
}, nodesCount), {}, {
|
|
158
|
+
participants: getParticipantsCount(state),
|
|
159
|
+
objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
|
|
160
|
+
severity: shouldTrackSeverity ? severity : undefined
|
|
161
|
+
}),
|
|
162
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
163
|
+
};
|
|
164
|
+
dispatchAnalyticsEvent(samplePayload);
|
|
165
|
+
},
|
|
166
|
+
dispatchAverage: function dispatchAverage(_ref2, severity) {
|
|
167
|
+
var _getContextIdentifier4;
|
|
168
|
+
|
|
169
|
+
var mean = _ref2.mean,
|
|
170
|
+
median = _ref2.median,
|
|
171
|
+
sampleSize = _ref2.sampleSize;
|
|
172
|
+
var state = _view.state;
|
|
173
|
+
var nodeCount = getNodeCount(state);
|
|
174
|
+
var averagePayload = {
|
|
175
|
+
action: ACTION.INPUT_PERF_SAMPLING_AVG,
|
|
176
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
177
|
+
attributes: _objectSpread(_objectSpread({
|
|
178
|
+
mean: mean,
|
|
179
|
+
median: median,
|
|
180
|
+
sampleSize: sampleSize
|
|
181
|
+
}, nodeCount), {}, {
|
|
182
|
+
nodeSize: state.doc.nodeSize,
|
|
183
|
+
severity: shouldTrackSeverity ? severity : undefined,
|
|
184
|
+
participants: getParticipantsCount(state),
|
|
185
|
+
objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId
|
|
186
|
+
}),
|
|
187
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
188
|
+
};
|
|
189
|
+
dispatchAnalyticsEvent(averagePayload);
|
|
190
|
+
},
|
|
191
|
+
onSlowInput: function onSlowInput(time) {
|
|
192
|
+
var _getContextIdentifier5;
|
|
193
|
+
|
|
194
|
+
var state = _view.state;
|
|
195
|
+
var nodesCount = getNodeCount(state);
|
|
196
|
+
dispatchAnalyticsEvent({
|
|
197
|
+
action: ACTION.SLOW_INPUT,
|
|
198
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
199
|
+
attributes: _objectSpread(_objectSpread({
|
|
200
|
+
time: time,
|
|
201
|
+
nodeSize: state.doc.nodeSize
|
|
202
|
+
}, nodesCount), {}, {
|
|
203
|
+
participants: getParticipantsCount(state),
|
|
204
|
+
objectId: (_getContextIdentifier5 = getContextIdentifier(state)) === null || _getContextIdentifier5 === void 0 ? void 0 : _getContextIdentifier5.objectId
|
|
205
|
+
}),
|
|
206
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
164
212
|
var observer;
|
|
165
213
|
|
|
166
214
|
try {
|
|
@@ -171,7 +219,7 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
171
219
|
var duration = perfEntries[i].duration;
|
|
172
220
|
|
|
173
221
|
if (duration > freezeThreshold) {
|
|
174
|
-
dispatchLongTaskEvent(dispatchAnalyticsEvent, _view, duration,
|
|
222
|
+
dispatchLongTaskEvent(dispatchAnalyticsEvent, _view, duration, getNodeCount, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? interactionType : undefined, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackSeverity ? getAnalyticsEventSeverity(duration, browserFreezeTracking.severityNormalThreshold || NORMAL_SEVERITY_THRESHOLD, browserFreezeTracking.severityDegradedThreshold || DEGRADED_SEVERITY_THRESHOLD) : undefined);
|
|
175
223
|
}
|
|
176
224
|
}
|
|
177
225
|
}); // register observer for long task notifications
|
|
@@ -184,9 +232,10 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
184
232
|
|
|
185
233
|
return {
|
|
186
234
|
destroy: function destroy() {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
235
|
+
var _inputLatencyTracker3;
|
|
236
|
+
|
|
237
|
+
(_inputLatencyTracker3 = inputLatencyTracker) === null || _inputLatencyTracker3 === void 0 ? void 0 : _inputLatencyTracker3.flush();
|
|
238
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
190
239
|
}
|
|
191
240
|
};
|
|
192
241
|
}
|