@atlaskit/editor-core 164.0.4 → 166.0.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 +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 +13 -0
- 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/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 +14 -0
- 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/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 +14 -0
- 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/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 +4 -4
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +23 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 166.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 166.0.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`2a04b47848b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2a04b47848b) - Removed unused emoji experiment (emojiNext).
|
|
14
|
+
- [`d86aa096946`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d86aa096946) - [ux] Added prop minHeight for editor appearance='comment' and 'chromeless'
|
|
15
|
+
- [`b6d47de3fd9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6d47de3fd9) - [MEX-1417] remove access to media file streams cache
|
|
16
|
+
- [`19486acfe8f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19486acfe8f) - [ED-14501] Add a new input latency performance analytics event `editor.inputPerfSamplingAvg`. Refactor the input latency tracking logic into a class.
|
|
17
|
+
- [`de9e3c28026`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de9e3c28026) - [ED-14689] Refactor getFinalAcknowledgedState to only wait for the unconfirmed steps at the time of calling it to be confirmed. It will no longer wait for there to be no unconfirmed steps at all.
|
|
18
|
+
- [`02bfb564e45`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02bfb564e45) - [ux] Instrumented `@atlaskit/editor-shared-styles` and partial `@atlaskit/editor-core` with the new theming package, `@atlaskit/tokens`.
|
|
19
|
+
|
|
20
|
+
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
21
|
+
These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [`74f39b3fcf8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/74f39b3fcf8) - [ux] EDM-2398: When a user types a link as opposed to pasting one, it will only be made into a link, not a smart card.
|
|
26
|
+
- [`ea41bc8a2ed`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ea41bc8a2ed) - [ux] ED-14577 add support for skipable tests for placeholder-text
|
|
27
|
+
- [`aec3f6e6d01`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aec3f6e6d01) - Add closeHistory() on indentList / outdentList at the beginning as for a undo restore point
|
|
28
|
+
- [`67ebd08a55c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/67ebd08a55c) - [ux] ED-14581 Reworks unsupportedInline and confluenceUnsupportedInline to use getInlineNodeViewProducer api.
|
|
29
|
+
- [`05502fa8c02`](https://bitbucket.org/atlassian/atlassian-frontend/commits/05502fa8c02) - [ux] ED-14572 Migrated Mention node view to use the new getInlineNodeViewProducer api.
|
|
30
|
+
- [`994b3c53e55`](https://bitbucket.org/atlassian/atlassian-frontend/commits/994b3c53e55) - ED-14373 Removed displayInlineBlockForInlineNodes feature flag as it is no longer required. Inline nodes now use the getInlineNodeViewProducer api which addresses issues that the feature flag was intended to fix.
|
|
31
|
+
- [`f0f5ea7e9b2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f0f5ea7e9b2) - [ux] ED-14050 Fixes mouse wheel not working when hovering table header row while its sticky
|
|
32
|
+
- [`6e7c648ddb7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6e7c648ddb7) - ED-14055: Fix out of range error during a collab session when deleting a paragraph at the end of the document and another user has a selection inside that paragraph.
|
|
33
|
+
- [`1b59c7df167`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b59c7df167) - [ED-14700] Checks if typeAhead was dismissed after inserting an item to make sure we don't sent cancelled analytics events when an item was inserted successfully
|
|
34
|
+
- [`b1f97a33e1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b1f97a33e1e) - [ux] Rework emoji to use getInlineNodeViewProducer api.
|
|
35
|
+
- [`a702917cbde`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a702917cbde) - [ux][ed-14725] Fixed duplicated line when pasted from google docs
|
|
36
|
+
- [`513476f63a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/513476f63a0) - ED-14158 deprecate shouldAddToHistory arg from EditorActions.replaceDocument
|
|
37
|
+
- [`702b032500c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/702b032500c) - [ux] Corrected ordering of the toolbar text colour picker's drop down menu, updated its rows to be from darkest to lightest.
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
|
|
40
|
+
## 165.0.0
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Updated dependencies
|
|
45
|
+
|
|
3
46
|
## 164.0.4
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -39,6 +39,8 @@ var _getFeatureFlags = require("../plugins/feature-flags-context/get-feature-fla
|
|
|
39
39
|
|
|
40
40
|
var _nativeCollabProviderPlugin = require("../plugins/collab-edit/native-collab-provider-plugin");
|
|
41
41
|
|
|
42
|
+
var _deprecationWarnings = _interopRequireDefault(require("../utils/deprecation-warnings"));
|
|
43
|
+
|
|
42
44
|
var EditorActions = /*#__PURE__*/function () {
|
|
43
45
|
function EditorActions() {
|
|
44
46
|
var _this = this;
|
|
@@ -321,6 +323,13 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
321
323
|
value: function replaceDocument(rawValue) {
|
|
322
324
|
var shouldScrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
323
325
|
var shouldAddToHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
326
|
+
(0, _deprecationWarnings.default)('EditorActions.replaceDocument', {
|
|
327
|
+
shouldAddToHistory: shouldAddToHistory
|
|
328
|
+
}, [{
|
|
329
|
+
property: 'shouldAddToHistory',
|
|
330
|
+
description: '[ED-14158] EditorActions.replaceDocument does not use the shouldAddToHistory arg',
|
|
331
|
+
type: 'removed'
|
|
332
|
+
}]);
|
|
324
333
|
|
|
325
334
|
if (!this.editorView || rawValue === undefined || rawValue === null) {
|
|
326
335
|
return false;
|
|
@@ -611,11 +611,22 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
611
611
|
config: _this.config,
|
|
612
612
|
eventDispatcher: _this.eventDispatcher,
|
|
613
613
|
transformer: _this.contentTransformer
|
|
614
|
-
});
|
|
614
|
+
}); // Allows us to dispatch analytics within the plugin view.destory methods
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
var analyticsConnected = _this.eventDispatcher.has(_utils.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
618
|
+
|
|
619
|
+
if (!analyticsConnected) {
|
|
620
|
+
_this.eventDispatcher.on(_utils.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
621
|
+
}
|
|
615
622
|
|
|
616
623
|
_this.view.destroy(); // Destroys the dom node & all node views
|
|
617
624
|
|
|
618
625
|
|
|
626
|
+
if (!analyticsConnected) {
|
|
627
|
+
_this.eventDispatcher.off(_utils.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
628
|
+
}
|
|
629
|
+
|
|
619
630
|
_this.view = undefined;
|
|
620
631
|
}
|
|
621
632
|
});
|
|
@@ -783,7 +794,6 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
783
794
|
// This serves to avoid potential runtime exceptions which could arise
|
|
784
795
|
// from an async dispatched transaction after it's unmounted.
|
|
785
796
|
this.canDispatchTransactions = false;
|
|
786
|
-
this.eventDispatcher.destroy();
|
|
787
797
|
clearTimeout(this.focusTimeoutId);
|
|
788
798
|
|
|
789
799
|
if (this.reliabilityInterval) {
|
|
@@ -802,11 +812,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
802
812
|
state.destroy();
|
|
803
813
|
}
|
|
804
814
|
});
|
|
805
|
-
}
|
|
806
|
-
|
|
815
|
+
}
|
|
807
816
|
|
|
808
|
-
this.eventDispatcher.
|
|
809
|
-
this.eventDispatcher.off('resetEditorState', this.resetEditorState);
|
|
817
|
+
this.eventDispatcher.destroy(); // this.view will be destroyed when React unmounts in handleEditorViewRef
|
|
810
818
|
} // Helper to allow tests to inject plugins directly
|
|
811
819
|
|
|
812
820
|
}, {
|
|
@@ -219,8 +219,7 @@ function createPluginsList(props, prevProps, createAnalyticsEvent) {
|
|
|
219
219
|
|
|
220
220
|
if (props.emojiProvider) {
|
|
221
221
|
preset.add([_plugins.emojiPlugin, {
|
|
222
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
223
|
-
allowZeroWidthSpaceAfter: !isMobile
|
|
222
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
224
223
|
}]);
|
|
225
224
|
}
|
|
226
225
|
|
package/dist/cjs/editor.js
CHANGED
|
@@ -633,6 +633,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
633
633
|
eventDispatcher: eventDispatcher,
|
|
634
634
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
635
635
|
maxHeight: _this5.props.maxHeight,
|
|
636
|
+
minHeight: _this5.props.minHeight,
|
|
636
637
|
onSave: _this5.props.onSave ? _this5.handleSave : undefined,
|
|
637
638
|
onCancel: _this5.props.onCancel,
|
|
638
639
|
popupsMountPoint: _this5.props.popupsMountPoint,
|
|
@@ -675,6 +676,18 @@ exports.default = Editor;
|
|
|
675
676
|
allowNewInsertionBehaviour: true,
|
|
676
677
|
quickInsert: true
|
|
677
678
|
});
|
|
679
|
+
(0, _defineProperty2.default)(Editor, "propTypes", {
|
|
680
|
+
minHeight: function minHeight(_ref4) {
|
|
681
|
+
var appearance = _ref4.appearance,
|
|
682
|
+
_minHeight = _ref4.minHeight;
|
|
683
|
+
|
|
684
|
+
if (_minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
|
|
685
|
+
return new Error('minHeight only supports editor appearance chromeless and comment');
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
});
|
|
678
691
|
(0, _defineProperty2.default)(Editor, "contextTypes", {
|
|
679
692
|
editorActions: _propTypes.default.object
|
|
680
693
|
});
|
|
@@ -29,6 +29,15 @@ var EventDispatcher = /*#__PURE__*/function () {
|
|
|
29
29
|
|
|
30
30
|
this.listeners[event].add(cb);
|
|
31
31
|
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "has",
|
|
34
|
+
value: function has(event, cb) {
|
|
35
|
+
if (!this.listeners[event]) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return this.listeners[event].has(cb);
|
|
40
|
+
}
|
|
32
41
|
}, {
|
|
33
42
|
key: "off",
|
|
34
43
|
value: function off(event, cb) {
|
|
@@ -23,8 +23,6 @@ var _analytics = require("../plugins/analytics");
|
|
|
23
23
|
|
|
24
24
|
var _consts = require("../plugins/analytics/consts");
|
|
25
25
|
|
|
26
|
-
var _featureFlagsContext = require("../plugins/feature-flags-context");
|
|
27
|
-
|
|
28
26
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
29
27
|
|
|
30
28
|
var _getPerformanceOptions = require("./getPerformanceOptions");
|
|
@@ -140,20 +138,12 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
140
138
|
}
|
|
141
139
|
}, {
|
|
142
140
|
key: "createDomRef",
|
|
143
|
-
value: function createDomRef(
|
|
141
|
+
value: function createDomRef() {
|
|
144
142
|
if (!this.node.isInline) {
|
|
145
143
|
return document.createElement('div');
|
|
146
144
|
}
|
|
147
145
|
|
|
148
146
|
var htmlElement = document.createElement('span');
|
|
149
|
-
var state = this.view.state;
|
|
150
|
-
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(state);
|
|
151
|
-
|
|
152
|
-
if (featureFlags && featureFlags.displayInlineBlockForInlineNodes && (options === null || options === void 0 ? void 0 : options.displayInlineBlockForInlineNodes) !== false) {
|
|
153
|
-
htmlElement.style.display = 'inline-block';
|
|
154
|
-
htmlElement.style.userSelect = 'all';
|
|
155
|
-
}
|
|
156
|
-
|
|
157
147
|
return htmlElement;
|
|
158
148
|
}
|
|
159
149
|
}, {
|
|
@@ -17,5 +17,5 @@ var _templateObject;
|
|
|
17
17
|
|
|
18
18
|
// For reasoning behind styles, see comments in:
|
|
19
19
|
// ./getInlineNodeViewProducer -> portalChildren()
|
|
20
|
-
var InlineNodeViewSharedStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _utils.ZERO_WIDTH_SPACE);
|
|
20
|
+
var InlineNodeViewSharedStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _utils.ZERO_WIDTH_SPACE);
|
|
21
21
|
exports.InlineNodeViewSharedStyles = InlineNodeViewSharedStyles;
|
|
@@ -48,7 +48,7 @@ function stopMeasureReactNodeViewRendered(_ref2) {
|
|
|
48
48
|
samplingRate = _ref2.samplingRate,
|
|
49
49
|
slowThreshold = _ref2.slowThreshold;
|
|
50
50
|
(0, _utils.stopMeasure)("\uD83E\uDD89".concat(nodeTypeName, "::ReactNodeView"), function (duration) {
|
|
51
|
-
if ((exports.nodeViewRenderedEventsCounter = nodeViewRenderedEventsCounter
|
|
51
|
+
if ((exports.nodeViewRenderedEventsCounter = ++nodeViewRenderedEventsCounter) % samplingRate === 0 && duration > slowThreshold) {
|
|
52
52
|
dispatchAnalyticsEvent({
|
|
53
53
|
action: _analytics.ACTION.REACT_NODEVIEW_RENDERED,
|
|
54
54
|
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
@@ -63,6 +63,7 @@ exports.ACTION = ACTION;
|
|
|
63
63
|
ACTION["INDENTED"] = "indented";
|
|
64
64
|
ACTION["INITIALISED"] = "initialised";
|
|
65
65
|
ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
|
|
66
|
+
ACTION["INPUT_PERF_SAMPLING_AVG"] = "inputPerfSamplingAvg";
|
|
66
67
|
ACTION["INSERTED"] = "inserted";
|
|
67
68
|
ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
|
|
68
69
|
ACTION["INVOKED"] = "invoked";
|
|
@@ -27,7 +27,7 @@ var _contextIdentifier = require("./context-identifier");
|
|
|
27
27
|
|
|
28
28
|
var _frozenEditor = require("../utils/frozen-editor");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _inputLatencyTracking = _interopRequireDefault(require("../utils/input-latency-tracking"));
|
|
31
31
|
|
|
32
32
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
33
|
|
|
@@ -49,11 +49,11 @@ exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = DEFAULT_TRACK_SEVERITY_THRESHO
|
|
|
49
49
|
var DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
|
|
50
50
|
exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
|
|
51
51
|
|
|
52
|
-
var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEvent, view, time,
|
|
52
|
+
var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEvent, view, time, getNodeCount, interactionType, severity) {
|
|
53
53
|
var _getContextIdentifier;
|
|
54
54
|
|
|
55
55
|
var state = view.state;
|
|
56
|
-
var nodesCount =
|
|
56
|
+
var nodesCount = getNodeCount(state);
|
|
57
57
|
return dispatchAnalyticsEvent({
|
|
58
58
|
action: _analytics.ACTION.BROWSER_FREEZE,
|
|
59
59
|
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
@@ -71,8 +71,8 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEven
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
|
|
74
|
-
var keystrokeCount = 0;
|
|
75
74
|
var interactionType;
|
|
75
|
+
var inputLatencyTracker = null;
|
|
76
76
|
|
|
77
77
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
78
78
|
interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.LOADING);
|
|
@@ -82,6 +82,20 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
82
82
|
var slowThreshold = inputTracking && typeof inputTracking.slowThreshold === 'number' ? inputTracking.slowThreshold : DEFAULT_SLOW_THRESHOLD;
|
|
83
83
|
var freezeThreshold = inputTracking && typeof inputTracking.freezeThreshold === 'number' ? inputTracking.freezeThreshold : DEFAULT_FREEZE_THRESHOLD;
|
|
84
84
|
var allowCountNodes = inputTracking && inputTracking.countNodes;
|
|
85
|
+
var prevNodeCountState = null;
|
|
86
|
+
var prevNodeCount = {}; // Cache the result as we were calling this multiple times
|
|
87
|
+
// and has potential to be expensive
|
|
88
|
+
|
|
89
|
+
var getNodeCount = function getNodeCount(state) {
|
|
90
|
+
if (state === prevNodeCountState) {
|
|
91
|
+
return prevNodeCount;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
prevNodeCount = allowCountNodes ? (0, _countNodes.countNodes)(state) : {};
|
|
95
|
+
prevNodeCountState = state;
|
|
96
|
+
return prevNodeCount;
|
|
97
|
+
};
|
|
98
|
+
|
|
85
99
|
var shouldTrackSeverity = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.trackSeverity) || DEFAULT_TRACK_SEVERITY_ENABLED;
|
|
86
100
|
var severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
|
|
87
101
|
var severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
|
|
@@ -89,84 +103,18 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
89
103
|
key: frozenEditorPluginKey,
|
|
90
104
|
props: (0, _utils.isPerformanceAPIAvailable)() ? {
|
|
91
105
|
handleTextInput: function handleTextInput(view) {
|
|
92
|
-
var
|
|
93
|
-
|
|
106
|
+
var _inputLatencyTracker;
|
|
107
|
+
|
|
108
|
+
(_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.start();
|
|
94
109
|
|
|
95
110
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
96
111
|
interactionType = _analytics.BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
97
112
|
}
|
|
98
113
|
|
|
99
|
-
var experienceStore = ufo ? _ufo.ExperienceStore.getInstance(view) : undefined;
|
|
100
|
-
var trackTyping = samplingRate && ++keystrokeCount === samplingRate;
|
|
101
|
-
|
|
102
|
-
if (trackTyping) {
|
|
103
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(_ufo.EditorExperience.typing);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
114
|
requestAnimationFrame(function () {
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
if (diff > slowThreshold) {
|
|
110
|
-
var nodesCount = allowCountNodes ? (0, _countNodes.countNodes)(view.state) : {};
|
|
111
|
-
|
|
112
|
-
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
113
|
-
var _getContextIdentifier2;
|
|
114
|
-
|
|
115
|
-
dispatchAnalyticsEvent({
|
|
116
|
-
action: _analytics.ACTION.SLOW_INPUT,
|
|
117
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
118
|
-
attributes: _objectSpread(_objectSpread({
|
|
119
|
-
time: diff,
|
|
120
|
-
nodeSize: state.doc.nodeSize
|
|
121
|
-
}, nodesCount), {}, {
|
|
122
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
123
|
-
objectId: (_getContextIdentifier2 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
|
|
124
|
-
}),
|
|
125
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
126
|
-
});
|
|
127
|
-
}
|
|
115
|
+
var _inputLatencyTracker2;
|
|
128
116
|
|
|
129
|
-
|
|
130
|
-
slowInput: true
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (trackTyping) {
|
|
135
|
-
var _getContextIdentifier4;
|
|
136
|
-
|
|
137
|
-
var _nodesCount = allowCountNodes ? (0, _countNodes.countNodes)(view.state) : {};
|
|
138
|
-
|
|
139
|
-
keystrokeCount = 0;
|
|
140
|
-
var severity = shouldTrackSeverity ? (0, _utils.getAnalyticsEventSeverity)(diff, severityThresholdNormal, severityThresholdDegraded) : undefined;
|
|
141
|
-
|
|
142
|
-
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
143
|
-
var _getContextIdentifier3;
|
|
144
|
-
|
|
145
|
-
var payload = {
|
|
146
|
-
action: _analytics.ACTION.INPUT_PERF_SAMPLING,
|
|
147
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
148
|
-
attributes: _objectSpread(_objectSpread({
|
|
149
|
-
time: diff,
|
|
150
|
-
nodeSize: state.doc.nodeSize
|
|
151
|
-
}, _nodesCount), {}, {
|
|
152
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
153
|
-
objectId: (_getContextIdentifier3 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
|
|
154
|
-
severity: severity
|
|
155
|
-
}),
|
|
156
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
157
|
-
};
|
|
158
|
-
dispatchAnalyticsEvent(payload);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
|
|
162
|
-
nodeSize: state.doc.nodeSize
|
|
163
|
-
}, _nodesCount), {}, {
|
|
164
|
-
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
165
|
-
objectId: (_getContextIdentifier4 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
|
|
166
|
-
time: diff,
|
|
167
|
-
severity: severity
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
117
|
+
(_inputLatencyTracker2 = inputLatencyTracker) === null || _inputLatencyTracker2 === void 0 ? void 0 : _inputLatencyTracker2.end();
|
|
170
118
|
});
|
|
171
119
|
return false;
|
|
172
120
|
},
|
|
@@ -186,6 +134,106 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
186
134
|
return {};
|
|
187
135
|
}
|
|
188
136
|
|
|
137
|
+
var experienceStore = ufo ? _ufo.ExperienceStore.getInstance(_view) : undefined;
|
|
138
|
+
|
|
139
|
+
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
140
|
+
inputLatencyTracker = new _inputLatencyTracking.default({
|
|
141
|
+
samplingRate: samplingRate,
|
|
142
|
+
slowThreshold: slowThreshold,
|
|
143
|
+
normalThreshold: severityThresholdNormal,
|
|
144
|
+
degradedThreshold: severityThresholdDegraded,
|
|
145
|
+
onSampleStart: function onSampleStart() {
|
|
146
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(_ufo.EditorExperience.typing);
|
|
147
|
+
},
|
|
148
|
+
onSampleEnd: function onSampleEnd(time, _ref) {
|
|
149
|
+
var _getContextIdentifier2;
|
|
150
|
+
|
|
151
|
+
var isSlow = _ref.isSlow,
|
|
152
|
+
severity = _ref.severity;
|
|
153
|
+
var state = _view.state;
|
|
154
|
+
var nodesCount = getNodeCount(state);
|
|
155
|
+
|
|
156
|
+
if (isSlow) {
|
|
157
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(_ufo.EditorExperience.typing, {
|
|
158
|
+
slowInput: true
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
|
|
163
|
+
nodeSize: state.doc.nodeSize
|
|
164
|
+
}, nodesCount), {}, {
|
|
165
|
+
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
166
|
+
objectId: (_getContextIdentifier2 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId,
|
|
167
|
+
time: time,
|
|
168
|
+
severity: shouldTrackSeverity ? severity : undefined
|
|
169
|
+
}));
|
|
170
|
+
},
|
|
171
|
+
dispatchSample: function dispatchSample(time, severity) {
|
|
172
|
+
var _getContextIdentifier3;
|
|
173
|
+
|
|
174
|
+
var state = _view.state;
|
|
175
|
+
var nodesCount = getNodeCount(state);
|
|
176
|
+
var samplePayload = {
|
|
177
|
+
action: _analytics.ACTION.INPUT_PERF_SAMPLING,
|
|
178
|
+
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
179
|
+
attributes: _objectSpread(_objectSpread({
|
|
180
|
+
time: time,
|
|
181
|
+
nodeSize: state.doc.nodeSize
|
|
182
|
+
}, nodesCount), {}, {
|
|
183
|
+
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
184
|
+
objectId: (_getContextIdentifier3 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
|
|
185
|
+
severity: shouldTrackSeverity ? severity : undefined
|
|
186
|
+
}),
|
|
187
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
188
|
+
};
|
|
189
|
+
dispatchAnalyticsEvent(samplePayload);
|
|
190
|
+
},
|
|
191
|
+
dispatchAverage: function dispatchAverage(_ref2, severity) {
|
|
192
|
+
var _getContextIdentifier4;
|
|
193
|
+
|
|
194
|
+
var mean = _ref2.mean,
|
|
195
|
+
median = _ref2.median,
|
|
196
|
+
sampleSize = _ref2.sampleSize;
|
|
197
|
+
var state = _view.state;
|
|
198
|
+
var nodeCount = getNodeCount(state);
|
|
199
|
+
var averagePayload = {
|
|
200
|
+
action: _analytics.ACTION.INPUT_PERF_SAMPLING_AVG,
|
|
201
|
+
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
202
|
+
attributes: _objectSpread(_objectSpread({
|
|
203
|
+
mean: mean,
|
|
204
|
+
median: median,
|
|
205
|
+
sampleSize: sampleSize
|
|
206
|
+
}, nodeCount), {}, {
|
|
207
|
+
nodeSize: state.doc.nodeSize,
|
|
208
|
+
severity: shouldTrackSeverity ? severity : undefined,
|
|
209
|
+
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
210
|
+
objectId: (_getContextIdentifier4 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId
|
|
211
|
+
}),
|
|
212
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
213
|
+
};
|
|
214
|
+
dispatchAnalyticsEvent(averagePayload);
|
|
215
|
+
},
|
|
216
|
+
onSlowInput: function onSlowInput(time) {
|
|
217
|
+
var _getContextIdentifier5;
|
|
218
|
+
|
|
219
|
+
var state = _view.state;
|
|
220
|
+
var nodesCount = getNodeCount(state);
|
|
221
|
+
dispatchAnalyticsEvent({
|
|
222
|
+
action: _analytics.ACTION.SLOW_INPUT,
|
|
223
|
+
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
224
|
+
attributes: _objectSpread(_objectSpread({
|
|
225
|
+
time: time,
|
|
226
|
+
nodeSize: state.doc.nodeSize
|
|
227
|
+
}, nodesCount), {}, {
|
|
228
|
+
participants: (0, _getParticipantsCount.getParticipantsCount)(state),
|
|
229
|
+
objectId: (_getContextIdentifier5 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier5 === void 0 ? void 0 : _getContextIdentifier5.objectId
|
|
230
|
+
}),
|
|
231
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
189
237
|
var observer;
|
|
190
238
|
|
|
191
239
|
try {
|
|
@@ -196,7 +244,7 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
196
244
|
var duration = perfEntries[i].duration;
|
|
197
245
|
|
|
198
246
|
if (duration > freezeThreshold) {
|
|
199
|
-
dispatchLongTaskEvent(dispatchAnalyticsEvent, _view, duration,
|
|
247
|
+
dispatchLongTaskEvent(dispatchAnalyticsEvent, _view, duration, getNodeCount, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? interactionType : undefined, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackSeverity ? (0, _utils.getAnalyticsEventSeverity)(duration, browserFreezeTracking.severityNormalThreshold || NORMAL_SEVERITY_THRESHOLD, browserFreezeTracking.severityDegradedThreshold || DEGRADED_SEVERITY_THRESHOLD) : undefined);
|
|
200
248
|
}
|
|
201
249
|
}
|
|
202
250
|
}); // register observer for long task notifications
|
|
@@ -209,9 +257,10 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
|
|
|
209
257
|
|
|
210
258
|
return {
|
|
211
259
|
destroy: function destroy() {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
260
|
+
var _inputLatencyTracker3;
|
|
261
|
+
|
|
262
|
+
(_inputLatencyTracker3 = inputLatencyTracker) === null || _inputLatencyTracker3 === void 0 ? void 0 : _inputLatencyTracker3.flush();
|
|
263
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
215
264
|
}
|
|
216
265
|
};
|
|
217
266
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _getPerformanceTiming = require("../../../utils/performance/get-performance-timing");
|
|
17
|
+
|
|
18
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
|
+
|
|
20
|
+
var InputLatencyTracker = /*#__PURE__*/function () {
|
|
21
|
+
function InputLatencyTracker(_ref) {
|
|
22
|
+
var samplingRate = _ref.samplingRate,
|
|
23
|
+
slowThreshold = _ref.slowThreshold,
|
|
24
|
+
normalThreshold = _ref.normalThreshold,
|
|
25
|
+
degradedThreshold = _ref.degradedThreshold,
|
|
26
|
+
dispatchAverage = _ref.dispatchAverage,
|
|
27
|
+
dispatchSample = _ref.dispatchSample,
|
|
28
|
+
onSampleStart = _ref.onSampleStart,
|
|
29
|
+
onSampleEnd = _ref.onSampleEnd,
|
|
30
|
+
onSlowInput = _ref.onSlowInput;
|
|
31
|
+
(0, _classCallCheck2.default)(this, InputLatencyTracker);
|
|
32
|
+
(0, _defineProperty2.default)(this, "samples", []);
|
|
33
|
+
(0, _defineProperty2.default)(this, "total", 0);
|
|
34
|
+
this.currentStart = null;
|
|
35
|
+
this.samplingRate = samplingRate;
|
|
36
|
+
this.slowThreshold = slowThreshold;
|
|
37
|
+
this.normalThreshold = normalThreshold;
|
|
38
|
+
this.degradedThreshold = degradedThreshold;
|
|
39
|
+
this.dispatchAverage = dispatchAverage;
|
|
40
|
+
this.dispatchSample = dispatchSample;
|
|
41
|
+
this.onSampleStart = onSampleStart;
|
|
42
|
+
this.onSampleEnd = onSampleEnd;
|
|
43
|
+
this.onSlowInput = onSlowInput;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
(0, _createClass2.default)(InputLatencyTracker, [{
|
|
47
|
+
key: "start",
|
|
48
|
+
value: function start() {
|
|
49
|
+
this.currentStart = performance.now();
|
|
50
|
+
|
|
51
|
+
if (this.samples.length + 1 === this.samplingRate) {
|
|
52
|
+
var _this$onSampleStart;
|
|
53
|
+
|
|
54
|
+
(_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "end",
|
|
59
|
+
value: function end() {
|
|
60
|
+
if (this.currentStart === null) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var isSlow = false;
|
|
65
|
+
var time = (0, _getPerformanceTiming.getTimeSince)(this.currentStart);
|
|
66
|
+
this.push(time);
|
|
67
|
+
|
|
68
|
+
if (time > this.slowThreshold) {
|
|
69
|
+
var _this$onSlowInput;
|
|
70
|
+
|
|
71
|
+
(_this$onSlowInput = this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(this, time);
|
|
72
|
+
isSlow = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (this.samples.length === this.samplingRate) {
|
|
76
|
+
var _this$onSampleEnd;
|
|
77
|
+
|
|
78
|
+
this.flush();
|
|
79
|
+
(_this$onSampleEnd = this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(this, time, {
|
|
80
|
+
isSlow: isSlow,
|
|
81
|
+
severity: this.severity(time)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "flush",
|
|
87
|
+
value: function flush() {
|
|
88
|
+
if (this.samples.length === 0) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.dispatch();
|
|
93
|
+
this.samples = [];
|
|
94
|
+
this.total = 0;
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "dispatch",
|
|
98
|
+
value: function dispatch() {
|
|
99
|
+
var _this$dispatchSample, _this$dispatchAverage;
|
|
100
|
+
|
|
101
|
+
(_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 ? void 0 : _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast())); // cache
|
|
102
|
+
|
|
103
|
+
var median = this.getMedian();
|
|
104
|
+
(_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 ? void 0 : _this$dispatchAverage.call(this, {
|
|
105
|
+
mean: this.getMean(),
|
|
106
|
+
median: median,
|
|
107
|
+
sampleSize: this.samples.length
|
|
108
|
+
}, this.severity(median));
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "push",
|
|
112
|
+
value: function push(latency) {
|
|
113
|
+
this.samples.push(latency);
|
|
114
|
+
this.total += latency;
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "severity",
|
|
118
|
+
value: function severity(time) {
|
|
119
|
+
return (0, _utils.getAnalyticsEventSeverity)(time, this.normalThreshold, this.degradedThreshold);
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "getLast",
|
|
123
|
+
value: function getLast() {
|
|
124
|
+
return this.samples[this.samples.length - 1];
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "getMean",
|
|
128
|
+
value: function getMean() {
|
|
129
|
+
return this.total / this.samples.length;
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "getMedian",
|
|
133
|
+
value: function getMedian() {
|
|
134
|
+
if (this.samples.length === 1) {
|
|
135
|
+
return this.samples[0];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.samples.sort(function (a, b) {
|
|
139
|
+
return a - b;
|
|
140
|
+
});
|
|
141
|
+
var middle = (this.samples.length + 1) / 2;
|
|
142
|
+
var floorMiddle = Math.floor(middle);
|
|
143
|
+
var remainder = middle % floorMiddle;
|
|
144
|
+
|
|
145
|
+
if (remainder === 0) {
|
|
146
|
+
return this.samples[middle - 1];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var left = this.samples[floorMiddle - 1];
|
|
150
|
+
var right = this.samples[floorMiddle];
|
|
151
|
+
return (left + right) / 2;
|
|
152
|
+
}
|
|
153
|
+
}]);
|
|
154
|
+
return InputLatencyTracker;
|
|
155
|
+
}();
|
|
156
|
+
|
|
157
|
+
exports.default = InputLatencyTracker;
|