@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
|
@@ -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
|
@@ -593,6 +593,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
593
593
|
eventDispatcher: eventDispatcher,
|
|
594
594
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
595
595
|
maxHeight: _this5.props.maxHeight,
|
|
596
|
+
minHeight: _this5.props.minHeight,
|
|
596
597
|
onSave: _this5.props.onSave ? _this5.handleSave : undefined,
|
|
597
598
|
onCancel: _this5.props.onCancel,
|
|
598
599
|
popupsMountPoint: _this5.props.popupsMountPoint,
|
|
@@ -636,6 +637,19 @@ _defineProperty(Editor, "defaultProps", {
|
|
|
636
637
|
quickInsert: true
|
|
637
638
|
});
|
|
638
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
|
+
|
|
639
653
|
_defineProperty(Editor, "contextTypes", {
|
|
640
654
|
editorActions: PropTypes.object
|
|
641
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
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import { getTimeSince } from '../../../utils/performance/get-performance-timing';
|
|
5
|
+
import { getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils';
|
|
6
|
+
|
|
7
|
+
var InputLatencyTracker = /*#__PURE__*/function () {
|
|
8
|
+
function InputLatencyTracker(_ref) {
|
|
9
|
+
var samplingRate = _ref.samplingRate,
|
|
10
|
+
slowThreshold = _ref.slowThreshold,
|
|
11
|
+
normalThreshold = _ref.normalThreshold,
|
|
12
|
+
degradedThreshold = _ref.degradedThreshold,
|
|
13
|
+
dispatchAverage = _ref.dispatchAverage,
|
|
14
|
+
dispatchSample = _ref.dispatchSample,
|
|
15
|
+
onSampleStart = _ref.onSampleStart,
|
|
16
|
+
onSampleEnd = _ref.onSampleEnd,
|
|
17
|
+
onSlowInput = _ref.onSlowInput;
|
|
18
|
+
|
|
19
|
+
_classCallCheck(this, InputLatencyTracker);
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "samples", []);
|
|
22
|
+
|
|
23
|
+
_defineProperty(this, "total", 0);
|
|
24
|
+
|
|
25
|
+
this.currentStart = null;
|
|
26
|
+
this.samplingRate = samplingRate;
|
|
27
|
+
this.slowThreshold = slowThreshold;
|
|
28
|
+
this.normalThreshold = normalThreshold;
|
|
29
|
+
this.degradedThreshold = degradedThreshold;
|
|
30
|
+
this.dispatchAverage = dispatchAverage;
|
|
31
|
+
this.dispatchSample = dispatchSample;
|
|
32
|
+
this.onSampleStart = onSampleStart;
|
|
33
|
+
this.onSampleEnd = onSampleEnd;
|
|
34
|
+
this.onSlowInput = onSlowInput;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_createClass(InputLatencyTracker, [{
|
|
38
|
+
key: "start",
|
|
39
|
+
value: function start() {
|
|
40
|
+
this.currentStart = performance.now();
|
|
41
|
+
|
|
42
|
+
if (this.samples.length + 1 === this.samplingRate) {
|
|
43
|
+
var _this$onSampleStart;
|
|
44
|
+
|
|
45
|
+
(_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "end",
|
|
50
|
+
value: function end() {
|
|
51
|
+
if (this.currentStart === null) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var isSlow = false;
|
|
56
|
+
var time = getTimeSince(this.currentStart);
|
|
57
|
+
this.push(time);
|
|
58
|
+
|
|
59
|
+
if (time > this.slowThreshold) {
|
|
60
|
+
var _this$onSlowInput;
|
|
61
|
+
|
|
62
|
+
(_this$onSlowInput = this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(this, time);
|
|
63
|
+
isSlow = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.samples.length === this.samplingRate) {
|
|
67
|
+
var _this$onSampleEnd;
|
|
68
|
+
|
|
69
|
+
this.flush();
|
|
70
|
+
(_this$onSampleEnd = this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(this, time, {
|
|
71
|
+
isSlow: isSlow,
|
|
72
|
+
severity: this.severity(time)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "flush",
|
|
78
|
+
value: function flush() {
|
|
79
|
+
if (this.samples.length === 0) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.dispatch();
|
|
84
|
+
this.samples = [];
|
|
85
|
+
this.total = 0;
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "dispatch",
|
|
89
|
+
value: function dispatch() {
|
|
90
|
+
var _this$dispatchSample, _this$dispatchAverage;
|
|
91
|
+
|
|
92
|
+
(_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 ? void 0 : _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast())); // cache
|
|
93
|
+
|
|
94
|
+
var median = this.getMedian();
|
|
95
|
+
(_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 ? void 0 : _this$dispatchAverage.call(this, {
|
|
96
|
+
mean: this.getMean(),
|
|
97
|
+
median: median,
|
|
98
|
+
sampleSize: this.samples.length
|
|
99
|
+
}, this.severity(median));
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "push",
|
|
103
|
+
value: function push(latency) {
|
|
104
|
+
this.samples.push(latency);
|
|
105
|
+
this.total += latency;
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "severity",
|
|
109
|
+
value: function severity(time) {
|
|
110
|
+
return getAnalyticsEventSeverity(time, this.normalThreshold, this.degradedThreshold);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "getLast",
|
|
114
|
+
value: function getLast() {
|
|
115
|
+
return this.samples[this.samples.length - 1];
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "getMean",
|
|
119
|
+
value: function getMean() {
|
|
120
|
+
return this.total / this.samples.length;
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "getMedian",
|
|
124
|
+
value: function getMedian() {
|
|
125
|
+
if (this.samples.length === 1) {
|
|
126
|
+
return this.samples[0];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this.samples.sort(function (a, b) {
|
|
130
|
+
return a - b;
|
|
131
|
+
});
|
|
132
|
+
var middle = (this.samples.length + 1) / 2;
|
|
133
|
+
var floorMiddle = Math.floor(middle);
|
|
134
|
+
var remainder = middle % floorMiddle;
|
|
135
|
+
|
|
136
|
+
if (remainder === 0) {
|
|
137
|
+
return this.samples[middle - 1];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var left = this.samples[floorMiddle - 1];
|
|
141
|
+
var right = this.samples[floorMiddle];
|
|
142
|
+
return (left + right) / 2;
|
|
143
|
+
}
|
|
144
|
+
}]);
|
|
145
|
+
|
|
146
|
+
return InputLatencyTracker;
|
|
147
|
+
}();
|
|
148
|
+
|
|
149
|
+
export { InputLatencyTracker as default };
|
|
@@ -7,4 +7,5 @@ import { SelectionStyle, getSelectionStyles, akEditorDeleteBorder, akEditorDelet
|
|
|
7
7
|
import { N20 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
9
9
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, token('color.border.danger', akEditorDeleteBorder), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, N20, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, token('color.border.danger', akEditorDeleteBorder), SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), token('color.border.danger', akEditorDeleteBorder), token('color.background.danger', akEditorDeleteBackground), token('color.border.danger', akEditorDeleteBorder));
|
|
@@ -6,10 +6,11 @@ import { css } from '@emotion/react';
|
|
|
6
6
|
import { themed } from '@atlaskit/theme/components';
|
|
7
7
|
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
8
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
9
10
|
import { blockNodesVerticalMargin, akEditorTableCellMinWidth, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorCodeFontFamily, akEditorSelectedNodeClassName, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
10
11
|
import { codeBlockClassNames } from './ui/class-names';
|
|
11
12
|
export var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(props) {
|
|
12
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px
|
|
13
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
|
|
13
14
|
background: themed({
|
|
14
15
|
light: colors.N20,
|
|
15
16
|
dark: colors.DN50
|
|
@@ -30,10 +31,10 @@ export var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(pr
|
|
|
30
31
|
})(props), codeBlockClassNames.highlighting, relativeFontSizeToBase16(fontSize()), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), borderRadius(), gridSize(), codeBlockClassNames.highlighting, themed({
|
|
31
32
|
light: colors.N800,
|
|
32
33
|
dark: colors.DN500
|
|
33
|
-
})(props), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
34
|
+
})(props), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, token('color.border.danger', akEditorDeleteBorder), codeBlockClassNames.gutter, colors.R75, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content, token('color.background.danger', akEditorDeleteBackground), codeBlockClassNames.gutter, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content);
|
|
34
35
|
};
|
|
35
36
|
export var codeBlockStyles = function codeBlockStyles(props) {
|
|
36
|
-
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-color: ", ";\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px
|
|
37
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-color: ", ";\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
|
|
37
38
|
background: themed({
|
|
38
39
|
light: colors.N20,
|
|
39
40
|
dark: colors.DN50
|
|
@@ -51,5 +52,5 @@ export var codeBlockStyles = function codeBlockStyles(props) {
|
|
|
51
52
|
})(props), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), themed({
|
|
52
53
|
light: colors.N800,
|
|
53
54
|
dark: colors.DN800
|
|
54
|
-
})(props), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
55
|
+
})(props), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, token('color.border.danger', akEditorDeleteBorder), codeBlockClassNames.gutter, colors.R75, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content, token('color.background.danger', akEditorDeleteBackground), codeBlockClassNames.gutter, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content);
|
|
55
56
|
};
|
|
@@ -16,14 +16,19 @@ export var TELEPOINTER_DIM_CLASS = 'telepointer-dim';
|
|
|
16
16
|
* Returns position where it's possible to place a decoration.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
var getValidPos = function getValidPos(tr, pos) {
|
|
20
|
-
var
|
|
21
|
-
var backwardSelection = Selection.findFrom(resolvedPos, -1, true); // if there's no correct cursor position before the `pos`, we try to find it after the `pos`
|
|
19
|
+
export var getValidPos = function getValidPos(tr, pos) {
|
|
20
|
+
var endOfDocPos = tr.doc.nodeSize - 2;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (pos <= endOfDocPos) {
|
|
23
|
+
var resolvedPos = tr.doc.resolve(pos);
|
|
24
|
+
var backwardSelection = Selection.findFrom(resolvedPos, -1, true); // if there's no correct cursor position before the `pos`, we try to find it after the `pos`
|
|
25
|
+
|
|
26
|
+
var forwardSelection = Selection.findFrom(resolvedPos, 1, true);
|
|
27
|
+
return backwardSelection ? backwardSelection.from : forwardSelection ? forwardSelection.from : pos;
|
|
28
|
+
}
|
|
26
29
|
|
|
30
|
+
return endOfDocPos;
|
|
31
|
+
};
|
|
27
32
|
export var PluginState = /*#__PURE__*/function () {
|
|
28
33
|
function PluginState(decorations, participants, sessionId) {
|
|
29
34
|
var collabInitalised = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -117,11 +122,21 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
117
122
|
remove = remove.concat(oldPointers);
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
var endOfDocPos = tr.doc.nodeSize - 2;
|
|
120
126
|
var _telepointerData$sele = telepointerData.selection,
|
|
121
127
|
anchor = _telepointerData$sele.anchor,
|
|
122
128
|
head = _telepointerData$sele.head;
|
|
123
129
|
var rawFrom = anchor < head ? anchor : head;
|
|
124
130
|
var rawTo = anchor >= head ? anchor : head;
|
|
131
|
+
|
|
132
|
+
if (rawFrom > endOfDocPos) {
|
|
133
|
+
rawFrom = endOfDocPos;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (rawTo > endOfDocPos) {
|
|
137
|
+
rawTo = endOfDocPos;
|
|
138
|
+
}
|
|
139
|
+
|
|
125
140
|
var isSelection = rawTo - rawFrom > 0;
|
|
126
141
|
var from = 1;
|
|
127
142
|
var to = 1;
|