@atlaskit/editor-core 150.0.3 → 151.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/cjs/actions/index.js +5 -23
- package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
- package/dist/cjs/create-editor/ReactEditorView.js +145 -31
- package/dist/cjs/create-editor/create-plugins-list.js +4 -2
- package/dist/cjs/editor.js +101 -40
- package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
- package/dist/cjs/plugins/analytics/types/enums.js +3 -1
- package/dist/cjs/plugins/base/index.js +4 -3
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/cjs/plugins/card/index.js +13 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
- package/dist/cjs/plugins/code-block/toolbar.js +1 -1
- package/dist/cjs/plugins/emoji/styles.js +1 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/cjs/plugins/extension/toolbar.js +28 -23
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +8 -3
- package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/cjs/plugins/hyperlink/utils.js +6 -69
- package/dist/cjs/plugins/media/index.js +14 -3
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
- package/dist/cjs/plugins/media/toolbar/index.js +49 -17
- package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
- package/dist/cjs/plugins/media/utils/media-files.js +67 -1
- package/dist/cjs/plugins/panel/index.js +2 -3
- package/dist/cjs/plugins/panel/message.js +47 -0
- package/dist/cjs/plugins/panel/toolbar.js +64 -84
- package/dist/cjs/plugins/panel/utils.js +2 -2
- package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
- package/dist/cjs/plugins/status/styles.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/cjs/profiler/render-count.js +82 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +6 -28
- package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
- package/dist/es2019/create-editor/ReactEditorView.js +130 -23
- package/dist/es2019/create-editor/create-plugins-list.js +4 -2
- package/dist/es2019/editor.js +74 -35
- package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
- package/dist/es2019/plugins/analytics/types/enums.js +3 -1
- package/dist/es2019/plugins/base/index.js +4 -3
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
- package/dist/es2019/plugins/card/index.js +7 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/es2019/plugins/code-block/toolbar.js +1 -1
- package/dist/es2019/plugins/emoji/styles.js +2 -0
- package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/es2019/plugins/extension/toolbar.js +30 -25
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
- package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/es2019/plugins/hyperlink/utils.js +3 -59
- package/dist/es2019/plugins/media/index.js +13 -4
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
- package/dist/es2019/plugins/media/toolbar/index.js +44 -15
- package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
- package/dist/es2019/plugins/media/utils/media-files.js +68 -2
- package/dist/es2019/plugins/panel/index.js +3 -4
- package/dist/es2019/plugins/panel/message.js +38 -0
- package/dist/es2019/plugins/panel/toolbar.js +52 -71
- package/dist/es2019/plugins/panel/utils.js +2 -2
- package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/es2019/plugins/status/styles.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/es2019/profiler/render-count.js +60 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +6 -24
- package/dist/esm/create-editor/ErrorBoundary.js +113 -78
- package/dist/esm/create-editor/ReactEditorView.js +146 -31
- package/dist/esm/create-editor/create-plugins-list.js +4 -2
- package/dist/esm/editor.js +100 -40
- package/dist/esm/labs/next/presets/cxhtml.js +2 -1
- package/dist/esm/plugins/analytics/types/enums.js +3 -1
- package/dist/esm/plugins/base/index.js +4 -3
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/esm/plugins/card/index.js +13 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/esm/plugins/code-block/toolbar.js +1 -1
- package/dist/esm/plugins/emoji/styles.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/esm/plugins/extension/toolbar.js +28 -23
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
- package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/esm/plugins/hyperlink/utils.js +3 -59
- package/dist/esm/plugins/media/index.js +14 -4
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
- package/dist/esm/plugins/media/toolbar/index.js +47 -19
- package/dist/esm/plugins/media/toolbar/utils.js +15 -1
- package/dist/esm/plugins/media/utils/media-files.js +60 -2
- package/dist/esm/plugins/panel/index.js +3 -4
- package/dist/esm/plugins/panel/message.js +38 -0
- package/dist/esm/plugins/panel/toolbar.js +57 -77
- package/dist/esm/plugins/panel/utils.js +2 -2
- package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/esm/plugins/status/styles.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/esm/profiler/render-count.js +57 -0
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
- package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
- package/dist/types/editor.d.ts +2 -0
- package/dist/types/plugins/analytics/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
- package/dist/types/plugins/analytics/types/events.d.ts +7 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
- package/dist/types/plugins/analytics/types/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -0
- package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
- package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/types.d.ts +6 -0
- package/dist/types/plugins/extension/types.d.ts +0 -2
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
- package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
- package/dist/types/plugins/panel/message.d.ts +37 -0
- package/dist/types/plugins/panel/toolbar.d.ts +4 -37
- package/dist/types/plugins/panel/types.d.ts +1 -0
- package/dist/types/profiler/render-count.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui/LinkSearch/types.d.ts +1 -0
- package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
- package/package.json +19 -16
- package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
- package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
- package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
- package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
- package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
- package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
- package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
- package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
- package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
- package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
- package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
- package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
- package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
- package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
- package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
- package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
- package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
- package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
- package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
- package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
- package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
- package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
- package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
- package/dist/esm/plugins/code-block/language-list.test.js +0 -71
- package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/esm/plugins/media/commands/captions.test.js +0 -135
- package/dist/esm/plugins/media/commands/linking.test.js +0 -268
- package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/esm/plugins/panel/toolbar.test.js +0 -230
- package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
- package/dist/esm/ui/PortalProvider/index.test.js +0 -129
|
@@ -57,7 +57,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
57
57
|
allowInlineCursorTarget: !isMobile,
|
|
58
58
|
allowScrollGutter: getScrollGutterOptions(props),
|
|
59
59
|
inputTracking,
|
|
60
|
-
browserFreezeTracking: (_props$performanceTra2 = props.performanceTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.bFreezeTracking
|
|
60
|
+
browserFreezeTracking: (_props$performanceTra2 = props.performanceTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.bFreezeTracking,
|
|
61
|
+
ufo: createFeatureFlagsFromProps(props).ufo
|
|
61
62
|
},
|
|
62
63
|
blockType: {
|
|
63
64
|
lastNodeMustBeParagraph: appearance === 'comment' || appearance === 'chromeless',
|
|
@@ -271,7 +272,8 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
271
272
|
if (props.allowPanel) {
|
|
272
273
|
preset.add([panelPlugin, {
|
|
273
274
|
useLongPressSelection: false,
|
|
274
|
-
UNSAFE_allowCustomPanel: props.allowPanel.UNSAFE_allowCustomPanel
|
|
275
|
+
UNSAFE_allowCustomPanel: props.allowPanel.UNSAFE_allowCustomPanel,
|
|
276
|
+
UNSAFE_allowCustomPanelEdit: props.allowPanel.UNSAFE_allowCustomPanelEdit
|
|
275
277
|
}]);
|
|
276
278
|
}
|
|
277
279
|
|
package/dist/es2019/editor.js
CHANGED
|
@@ -7,6 +7,7 @@ import memoizeOne from 'memoize-one';
|
|
|
7
7
|
import uuid from 'uuid/v4';
|
|
8
8
|
import { name, version } from './version-wrapper';
|
|
9
9
|
import { ProviderFactory, BaseTheme, getAnalyticsAppearance, WithCreateAnalyticsEvent, startMeasure, stopMeasure, clearMeasure, measureTTI, getTTISeverity, combineExtensionProviders, WidthProvider } from '@atlaskit/editor-common';
|
|
10
|
+
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
10
11
|
import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
|
|
11
12
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
12
13
|
import { getUiComponent } from './create-editor';
|
|
@@ -27,6 +28,8 @@ const WidthProviderFullHeight = styled(WidthProvider)`
|
|
|
27
28
|
`;
|
|
28
29
|
export default class Editor extends React.Component {
|
|
29
30
|
constructor(props, context) {
|
|
31
|
+
var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
|
|
32
|
+
|
|
30
33
|
super(props);
|
|
31
34
|
|
|
32
35
|
_defineProperty(this, "prepareExtensionProvider", memoizeOne(extensionProviders => {
|
|
@@ -64,11 +67,16 @@ export default class Editor extends React.Component {
|
|
|
64
67
|
this.editorActions = (context || {}).editorActions || new EditorActions();
|
|
65
68
|
this.trackEditorActions(this.editorActions, props);
|
|
66
69
|
this.editorSessionId = uuid();
|
|
70
|
+
this.startTime = performance.now();
|
|
67
71
|
startMeasure(measurements.EDITOR_MOUNTED);
|
|
68
72
|
|
|
69
|
-
if (props.performanceTracking &&
|
|
73
|
+
if ((_props$performanceTra = props.performanceTracking) !== null && _props$performanceTra !== void 0 && (_props$performanceTra2 = _props$performanceTra.ttiTracking) !== null && _props$performanceTra2 !== void 0 && _props$performanceTra2.enabled || (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
74
|
+
var _props$performanceTra5, _props$performanceTra6, _props$performanceTra7, _props$performanceTra8;
|
|
75
|
+
|
|
70
76
|
measureTTI((tti, ttiFromInvocation, canceled) => {
|
|
71
|
-
|
|
77
|
+
var _props$performanceTra3, _props$performanceTra4, _props$featureFlags2;
|
|
78
|
+
|
|
79
|
+
if ((_props$performanceTra3 = props.performanceTracking) !== null && _props$performanceTra3 !== void 0 && (_props$performanceTra4 = _props$performanceTra3.ttiTracking) !== null && _props$performanceTra4 !== void 0 && _props$performanceTra4.enabled && this.createAnalyticsEvent) {
|
|
72
80
|
var _ttiTracking;
|
|
73
81
|
|
|
74
82
|
const ttiEvent = {
|
|
@@ -101,7 +109,14 @@ export default class Editor extends React.Component {
|
|
|
101
109
|
|
|
102
110
|
fireAnalyticsEvent(this.createAnalyticsEvent)(ttiEvent);
|
|
103
111
|
}
|
|
104
|
-
|
|
112
|
+
|
|
113
|
+
if ((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.ufo) {
|
|
114
|
+
var _this$experienceStore, _this$experienceStore2;
|
|
115
|
+
|
|
116
|
+
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.mark(EditorExperience.loadEditor, ACTION.EDITOR_TTI, tti);
|
|
117
|
+
(_this$experienceStore2 = this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.success(EditorExperience.loadEditor);
|
|
118
|
+
}
|
|
119
|
+
}, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiIdleThreshold, (_props$performanceTra7 = props.performanceTracking) === null || _props$performanceTra7 === void 0 ? void 0 : (_props$performanceTra8 = _props$performanceTra7.ttiTracking) === null || _props$performanceTra8 === void 0 ? void 0 : _props$performanceTra8.ttiCancelTimeout);
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
const _extensionProvider = this.prepareExtensionProvider(props.extensionProviders);
|
|
@@ -139,18 +154,26 @@ export default class Editor extends React.Component {
|
|
|
139
154
|
}
|
|
140
155
|
|
|
141
156
|
componentWillUnmount() {
|
|
142
|
-
var _this$props, _this$props$performan, _this$props$performan2;
|
|
157
|
+
var _this$props, _this$props$performan, _this$props$performan2, _this$props$featureFl;
|
|
143
158
|
|
|
144
159
|
this.unregisterEditorFromActions();
|
|
145
160
|
this.providerFactory.destroy();
|
|
146
161
|
clearMeasure(measurements.EDITOR_MOUNTED);
|
|
147
162
|
((_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$performan = _this$props.performanceTracking) === null || _this$props$performan === void 0 ? void 0 : (_this$props$performan2 = _this$props$performan.onEditorReadyCallbackTracking) === null || _this$props$performan2 === void 0 ? void 0 : _this$props$performan2.enabled) && clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
163
|
+
|
|
164
|
+
if ((_this$props$featureFl = this.props.featureFlags) !== null && _this$props$featureFl !== void 0 && _this$props$featureFl.ufo) {
|
|
165
|
+
var _this$experienceStore3;
|
|
166
|
+
|
|
167
|
+
(_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.abortAll({
|
|
168
|
+
reason: 'editor component unmounted'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
148
171
|
}
|
|
149
172
|
|
|
150
173
|
trackEditorActions(editorActions, props) {
|
|
151
|
-
var _props$
|
|
174
|
+
var _props$performanceTra9, _props$performanceTra10;
|
|
152
175
|
|
|
153
|
-
if (props !== null && props !== void 0 && (_props$
|
|
176
|
+
if (props !== null && props !== void 0 && (_props$performanceTra9 = props.performanceTracking) !== null && _props$performanceTra9 !== void 0 && (_props$performanceTra10 = _props$performanceTra9.contentRetrievalTracking) !== null && _props$performanceTra10 !== void 0 && _props$performanceTra10.enabled) {
|
|
154
177
|
const DEFAULT_SAMPLING_RATE = 100;
|
|
155
178
|
const getValue = editorActions.getValue.bind(editorActions);
|
|
156
179
|
|
|
@@ -174,11 +197,11 @@ export default class Editor extends React.Component {
|
|
|
174
197
|
if (!getValueTracked) {
|
|
175
198
|
const getValueWithTracking = async () => {
|
|
176
199
|
try {
|
|
177
|
-
var _props$
|
|
200
|
+
var _props$performanceTra11, _props$performanceTra12, _props$performanceTra13;
|
|
178
201
|
|
|
179
202
|
const value = await getValue();
|
|
180
203
|
|
|
181
|
-
if (samplingCounters.success === ((_props$
|
|
204
|
+
if (samplingCounters.success === ((_props$performanceTra11 = props === null || props === void 0 ? void 0 : (_props$performanceTra12 = props.performanceTracking) === null || _props$performanceTra12 === void 0 ? void 0 : (_props$performanceTra13 = _props$performanceTra12.contentRetrievalTracking) === null || _props$performanceTra13 === void 0 ? void 0 : _props$performanceTra13.successSamplingRate) !== null && _props$performanceTra11 !== void 0 ? _props$performanceTra11 : DEFAULT_SAMPLING_RATE)) {
|
|
182
205
|
this.handleAnalyticsEvent({
|
|
183
206
|
payload: {
|
|
184
207
|
action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
|
|
@@ -195,10 +218,10 @@ export default class Editor extends React.Component {
|
|
|
195
218
|
samplingCounters.success++;
|
|
196
219
|
return value;
|
|
197
220
|
} catch (err) {
|
|
198
|
-
var _props$
|
|
221
|
+
var _props$performanceTra14, _props$performanceTra15, _props$performanceTra16;
|
|
199
222
|
|
|
200
|
-
if (samplingCounters.failure === ((_props$
|
|
201
|
-
var _props$
|
|
223
|
+
if (samplingCounters.failure === ((_props$performanceTra14 = props === null || props === void 0 ? void 0 : (_props$performanceTra15 = props.performanceTracking) === null || _props$performanceTra15 === void 0 ? void 0 : (_props$performanceTra16 = _props$performanceTra15.contentRetrievalTracking) === null || _props$performanceTra16 === void 0 ? void 0 : _props$performanceTra16.failureSamplingRate) !== null && _props$performanceTra14 !== void 0 ? _props$performanceTra14 : DEFAULT_SAMPLING_RATE)) {
|
|
224
|
+
var _props$performanceTra17, _props$performanceTra18;
|
|
202
225
|
|
|
203
226
|
this.handleAnalyticsEvent({
|
|
204
227
|
payload: {
|
|
@@ -207,7 +230,7 @@ export default class Editor extends React.Component {
|
|
|
207
230
|
attributes: {
|
|
208
231
|
success: false,
|
|
209
232
|
errorInfo: err.toString(),
|
|
210
|
-
errorStack: props !== null && props !== void 0 && (_props$
|
|
233
|
+
errorStack: props !== null && props !== void 0 && (_props$performanceTra17 = props.performanceTracking) !== null && _props$performanceTra17 !== void 0 && (_props$performanceTra18 = _props$performanceTra17.contentRetrievalTracking) !== null && _props$performanceTra18 !== void 0 && _props$performanceTra18.reportErrorStack ? err.stack : undefined
|
|
211
234
|
},
|
|
212
235
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
213
236
|
}
|
|
@@ -229,38 +252,54 @@ export default class Editor extends React.Component {
|
|
|
229
252
|
}
|
|
230
253
|
|
|
231
254
|
onEditorCreated(instance) {
|
|
255
|
+
var _this$props$featureFl2;
|
|
256
|
+
|
|
232
257
|
this.registerEditorForActions(instance.view, instance.eventDispatcher, instance.transformer);
|
|
233
258
|
|
|
259
|
+
if ((_this$props$featureFl2 = this.props.featureFlags) !== null && _this$props$featureFl2 !== void 0 && _this$props$featureFl2.ufo) {
|
|
260
|
+
this.experienceStore = ExperienceStore.getInstance(instance.view);
|
|
261
|
+
this.experienceStore.start(EditorExperience.loadEditor, this.startTime);
|
|
262
|
+
}
|
|
263
|
+
|
|
234
264
|
if (this.props.onEditorReady) {
|
|
235
|
-
var _this$props2, _this$props2$performa, _this$props2$performa2, _this$
|
|
265
|
+
var _this$props2, _this$props2$performa, _this$props2$performa2, _this$props$featureFl3;
|
|
236
266
|
|
|
237
|
-
((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$performa = _this$props2.performanceTracking) === null || _this$props2$performa === void 0 ? void 0 : (_this$props2$performa2 = _this$props2$performa.onEditorReadyCallbackTracking) === null || _this$props2$performa2 === void 0 ? void 0 : _this$props2$performa2.enabled)
|
|
267
|
+
const measureEditorReady = ((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$performa = _this$props2.performanceTracking) === null || _this$props2$performa === void 0 ? void 0 : (_this$props2$performa2 = _this$props2$performa.onEditorReadyCallbackTracking) === null || _this$props2$performa2 === void 0 ? void 0 : _this$props2$performa2.enabled) || ((_this$props$featureFl3 = this.props.featureFlags) === null || _this$props$featureFl3 === void 0 ? void 0 : _this$props$featureFl3.ufo);
|
|
268
|
+
measureEditorReady && startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
238
269
|
this.props.onEditorReady(this.editorActions);
|
|
239
|
-
|
|
270
|
+
measureEditorReady && stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, this.sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK));
|
|
240
271
|
}
|
|
241
272
|
}
|
|
242
273
|
|
|
243
274
|
sendDurationAnalytics(action) {
|
|
244
|
-
return (duration, startTime) => {
|
|
275
|
+
return async (duration, startTime) => {
|
|
276
|
+
var _this$props$featureFl4;
|
|
277
|
+
|
|
278
|
+
const contextIdentifier = await this.props.contextIdentifierProvider;
|
|
279
|
+
const objectId = contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId;
|
|
280
|
+
|
|
245
281
|
if (this.createAnalyticsEvent) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
282
|
+
fireAnalyticsEvent(this.createAnalyticsEvent)({
|
|
283
|
+
payload: {
|
|
284
|
+
action,
|
|
285
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
286
|
+
attributes: {
|
|
287
|
+
duration,
|
|
288
|
+
startTime,
|
|
289
|
+
objectId
|
|
290
|
+
},
|
|
291
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if ((_this$props$featureFl4 = this.props.featureFlags) !== null && _this$props$featureFl4 !== void 0 && _this$props$featureFl4.ufo) {
|
|
297
|
+
var _this$experienceStore4, _this$experienceStore5;
|
|
260
298
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
299
|
+
(_this$experienceStore4 = this.experienceStore) === null || _this$experienceStore4 === void 0 ? void 0 : _this$experienceStore4.mark(EditorExperience.loadEditor, action, startTime + duration);
|
|
300
|
+
(_this$experienceStore5 = this.experienceStore) === null || _this$experienceStore5 === void 0 ? void 0 : _this$experienceStore5.addMetadata(EditorExperience.loadEditor, {
|
|
301
|
+
objectId
|
|
302
|
+
});
|
|
264
303
|
}
|
|
265
304
|
};
|
|
266
305
|
}
|
|
@@ -417,7 +456,7 @@ export default class Editor extends React.Component {
|
|
|
417
456
|
config,
|
|
418
457
|
dispatchAnalyticsEvent
|
|
419
458
|
}) => {
|
|
420
|
-
var _this$props$
|
|
459
|
+
var _this$props$featureFl5, _this$props$featureFl6;
|
|
421
460
|
|
|
422
461
|
return /*#__PURE__*/React.createElement(BaseTheme, {
|
|
423
462
|
dynamicTextSizing: this.props.allowDynamicTextSizing && this.props.appearance !== 'full-width',
|
|
@@ -449,7 +488,7 @@ export default class Editor extends React.Component {
|
|
|
449
488
|
collabEdit: this.props.collabEdit,
|
|
450
489
|
allowAnnotation: !!this.props.annotationProviders,
|
|
451
490
|
persistScrollGutter: this.props.persistScrollGutter,
|
|
452
|
-
enableToolbarMinWidth: ((_this$props$
|
|
491
|
+
enableToolbarMinWidth: ((_this$props$featureFl5 = this.props.featureFlags) === null || _this$props$featureFl5 === void 0 ? void 0 : _this$props$featureFl5.toolbarMinWidthOverflow) != null ? !!((_this$props$featureFl6 = this.props.featureFlags) !== null && _this$props$featureFl6 !== void 0 && _this$props$featureFl6.toolbarMinWidthOverflow) : this.props.UNSAFE_allowUndoRedoButtons,
|
|
453
492
|
useStickyToolbar: this.props.useStickyToolbar,
|
|
454
493
|
featureFlags: featureFlags
|
|
455
494
|
}));
|
|
@@ -94,6 +94,7 @@ export let ACTION;
|
|
|
94
94
|
ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
|
|
95
95
|
ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
|
|
96
96
|
ACTION["REMOVE_ICON"] = "removedIcon";
|
|
97
|
+
ACTION["UFO_SESSION_COMPLETE"] = "ufoSessionComplete";
|
|
97
98
|
})(ACTION || (ACTION = {}));
|
|
98
99
|
|
|
99
100
|
export let INPUT_METHOD;
|
|
@@ -234,8 +235,9 @@ export let ACTION_SUBJECT_ID;
|
|
|
234
235
|
ACTION_SUBJECT_ID["LINK"] = "link";
|
|
235
236
|
ACTION_SUBJECT_ID["LINK_PREVIEW"] = "linkPreview";
|
|
236
237
|
ACTION_SUBJECT_ID["MEDIA"] = "media";
|
|
237
|
-
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
238
238
|
ACTION_SUBJECT_ID["MEDIA_GROUP"] = "mediaGroup";
|
|
239
|
+
ACTION_SUBJECT_ID["MEDIA_INLINE"] = "mediaInline";
|
|
240
|
+
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
239
241
|
ACTION_SUBJECT_ID["MEDIA_LINK"] = "mediaLink";
|
|
240
242
|
ACTION_SUBJECT_ID["MENTION"] = "mention";
|
|
241
243
|
ACTION_SUBJECT_ID["NESTED_EXPAND"] = "nestedExpand";
|
|
@@ -43,10 +43,11 @@ const basePlugin = options => ({
|
|
|
43
43
|
}, {
|
|
44
44
|
name: 'frozenEditor',
|
|
45
45
|
plugin: ({
|
|
46
|
-
dispatchAnalyticsEvent
|
|
47
|
-
providerFactory
|
|
46
|
+
dispatchAnalyticsEvent
|
|
48
47
|
}) => {
|
|
49
|
-
|
|
48
|
+
var _options$inputTrackin;
|
|
49
|
+
|
|
50
|
+
return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? frozenEditor(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
|
|
50
51
|
}
|
|
51
52
|
}, {
|
|
52
53
|
name: 'decorationPlugin',
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Plugin } from 'prosemirror-state';
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
2
|
import { isPerformanceObserverAvailable, isPerformanceAPIAvailable, getAnalyticsEventSeverity } from '@atlaskit/editor-common';
|
|
3
|
+
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
3
4
|
import { ACTION, ACTION_SUBJECT, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE } from '../../analytics';
|
|
4
5
|
import { getParticipantsCount } from '../../collab-edit/get-participants-count';
|
|
5
6
|
import { countNodes } from '../../../utils/count-nodes';
|
|
6
7
|
import { getContextIdentifier } from './context-identifier';
|
|
7
8
|
import { setInteractionType } from '../utils/frozen-editor';
|
|
8
9
|
import { getTimeSince } from '../../../utils/performance/get-performance-timing';
|
|
10
|
+
export const frozenEditorPluginKey = new PluginKey('frozenEditor');
|
|
9
11
|
const DEFAULT_KEYSTROKE_SAMPLING_LIMIT = 100;
|
|
10
12
|
const DEFAULT_SLOW_THRESHOLD = 300;
|
|
11
13
|
export const DEFAULT_FREEZE_THRESHOLD = 600;
|
|
@@ -38,7 +40,7 @@ const dispatchLongTaskEvent = (dispatchAnalyticsEvent, view, time, allowCountNod
|
|
|
38
40
|
});
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) => {
|
|
43
|
+
export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) => {
|
|
42
44
|
let keystrokeCount = 0;
|
|
43
45
|
let interactionType;
|
|
44
46
|
|
|
@@ -54,6 +56,7 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) =
|
|
|
54
56
|
const severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
|
|
55
57
|
const severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
|
|
56
58
|
return new Plugin({
|
|
59
|
+
key: frozenEditorPluginKey,
|
|
57
60
|
props: isPerformanceAPIAvailable() ? {
|
|
58
61
|
handleTextInput(view) {
|
|
59
62
|
const {
|
|
@@ -65,49 +68,74 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) =
|
|
|
65
68
|
interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
66
69
|
}
|
|
67
70
|
|
|
71
|
+
const experienceStore = ufo ? ExperienceStore.getInstance(view) : undefined;
|
|
72
|
+
const trackTyping = samplingRate && ++keystrokeCount === samplingRate;
|
|
73
|
+
|
|
74
|
+
if (trackTyping) {
|
|
75
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
requestAnimationFrame(() => {
|
|
69
79
|
const diff = getTimeSince(now);
|
|
70
80
|
|
|
71
|
-
if (
|
|
72
|
-
var _getContextIdentifier2;
|
|
73
|
-
|
|
81
|
+
if (diff > slowThreshold) {
|
|
74
82
|
const nodesCount = allowCountNodes ? countNodes(view.state) : {};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
|
|
84
|
+
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
85
|
+
var _getContextIdentifier2;
|
|
86
|
+
|
|
87
|
+
dispatchAnalyticsEvent({
|
|
88
|
+
action: ACTION.SLOW_INPUT,
|
|
89
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
90
|
+
attributes: {
|
|
91
|
+
time: diff,
|
|
92
|
+
nodeSize: state.doc.nodeSize,
|
|
93
|
+
...nodesCount,
|
|
94
|
+
participants: getParticipantsCount(state),
|
|
95
|
+
objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
|
|
96
|
+
},
|
|
97
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
98
|
+
});
|
|
91
99
|
}
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
|
|
102
|
+
slowInput: true
|
|
103
|
+
});
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
if (
|
|
97
|
-
var
|
|
106
|
+
if (trackTyping) {
|
|
107
|
+
var _getContextIdentifier4;
|
|
98
108
|
|
|
99
109
|
const nodesCount = allowCountNodes ? countNodes(view.state) : {};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
keystrokeCount = 0;
|
|
111
|
+
const severity = shouldTrackSeverity ? getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded) : undefined;
|
|
112
|
+
|
|
113
|
+
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
|
|
114
|
+
var _getContextIdentifier3;
|
|
115
|
+
|
|
116
|
+
const payload = {
|
|
117
|
+
action: ACTION.INPUT_PERF_SAMPLING,
|
|
118
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
119
|
+
attributes: {
|
|
120
|
+
time: diff,
|
|
121
|
+
nodeSize: state.doc.nodeSize,
|
|
122
|
+
...nodesCount,
|
|
123
|
+
participants: getParticipantsCount(state),
|
|
124
|
+
objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
|
|
125
|
+
severity
|
|
126
|
+
},
|
|
127
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
128
|
+
};
|
|
129
|
+
dispatchAnalyticsEvent(payload);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, {
|
|
133
|
+
nodeSize: state.doc.nodeSize,
|
|
134
|
+
...nodesCount,
|
|
135
|
+
participants: getParticipantsCount(state),
|
|
136
|
+
objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
|
|
137
|
+
time: diff,
|
|
138
|
+
severity
|
|
111
139
|
});
|
|
112
140
|
}
|
|
113
141
|
});
|
|
@@ -14,7 +14,8 @@ export const BlockTypeMenuItem = styled.div`
|
|
|
14
14
|
margin-top: 0;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
${props =>
|
|
17
|
+
${props => // TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
|
|
18
|
+
props.selected ? `${props.tagName} { color: white !important; }` : ''};
|
|
18
19
|
`;
|
|
19
20
|
export const KeyboardShortcut = styled(Shortcut)`
|
|
20
21
|
${props => props.selected ? `color: ${N400};` : ''}
|
|
@@ -28,13 +28,18 @@ const cardPlugin = options => {
|
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
pmPlugins() {
|
|
31
|
-
var _options$allowResizin, _options$useAlternati;
|
|
31
|
+
var _options$allowBlockCa, _options$allowResizin, _options$useAlternati;
|
|
32
32
|
|
|
33
|
+
const allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
|
|
33
34
|
const allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
|
|
34
35
|
const useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
|
|
35
36
|
return [{
|
|
36
37
|
name: 'card',
|
|
37
|
-
plugin: createPlugin(
|
|
38
|
+
plugin: createPlugin({ ...options,
|
|
39
|
+
allowBlockCards,
|
|
40
|
+
allowResizing,
|
|
41
|
+
useAlternativePreloader
|
|
42
|
+
})
|
|
38
43
|
}];
|
|
39
44
|
},
|
|
40
45
|
|
|
@@ -234,6 +234,7 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
234
234
|
const lineLength = this.getLineLength(view, pos, widthStateLineLength);
|
|
235
235
|
const containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
|
|
236
236
|
const smartCard = /*#__PURE__*/React.createElement(SmartCard, {
|
|
237
|
+
key: url,
|
|
237
238
|
url: url,
|
|
238
239
|
appearance: "embed",
|
|
239
240
|
onClick: this.onClick,
|
|
@@ -8,12 +8,19 @@ import { EmbedCard } from '../nodeviews/embedCard';
|
|
|
8
8
|
import { BlockCard } from '../nodeviews/blockCard';
|
|
9
9
|
import { InlineCard } from '../nodeviews/inlineCard';
|
|
10
10
|
export { pluginKey } from './plugin-key';
|
|
11
|
-
export const createPlugin =
|
|
11
|
+
export const createPlugin = options => ({
|
|
12
12
|
portalProviderAPI,
|
|
13
13
|
eventDispatcher,
|
|
14
14
|
providerFactory,
|
|
15
15
|
dispatchAnalyticsEvent
|
|
16
16
|
}) => {
|
|
17
|
+
const {
|
|
18
|
+
platform,
|
|
19
|
+
allowResizing,
|
|
20
|
+
useAlternativePreloader,
|
|
21
|
+
fullWidthMode,
|
|
22
|
+
createAnalyticsEvent
|
|
23
|
+
} = options;
|
|
17
24
|
return new Plugin({
|
|
18
25
|
state: {
|
|
19
26
|
init() {
|
|
@@ -73,7 +80,7 @@ export const createPlugin = (platform, allowResizing, useAlternativePreloader, f
|
|
|
73
80
|
* By using this approach, the browser is free to schedule the resolution of the promises below in between rendering/network/
|
|
74
81
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
75
82
|
*/
|
|
76
|
-
const invoke = rafSchedule(() => resolveWithProvider(view, outstandingRequests, provider, request));
|
|
83
|
+
const invoke = rafSchedule(() => resolveWithProvider(view, outstandingRequests, provider, request, options));
|
|
77
84
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
78
85
|
invoke();
|
|
79
86
|
});
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { setProvider } from '../actions';
|
|
2
|
-
import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
|
|
2
|
+
import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
|
|
3
|
+
// ============================================================================ //
|
|
3
4
|
// ============================== PROVIDER UTILS ============================== //
|
|
4
5
|
// ============================================================================ //
|
|
5
6
|
// Used for all interactions with the EditorCardProvider.
|
|
6
7
|
// ============================================================================ //
|
|
7
|
-
|
|
8
|
-
export const resolveWithProvider = (view, outstandingRequests, provider, request) => {
|
|
8
|
+
export const resolveWithProvider = (view, outstandingRequests, provider, request, options) => {
|
|
9
9
|
const handleResolve = provider.resolve(request.url, request.appearance).then(resolvedCard => {
|
|
10
10
|
delete outstandingRequests[request.url];
|
|
11
11
|
return resolvedCard;
|
|
12
|
-
}).then(handleResolved(view, request), handleRejected(view, request));
|
|
12
|
+
}).then(handleResolved(view, request, options), handleRejected(view, request));
|
|
13
13
|
outstandingRequests[request.url] = handleResolve;
|
|
14
14
|
return handleResolve;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const updateCardType = (resolvedCard, options) => {
|
|
18
|
+
if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
|
|
19
|
+
resolvedCard.type = 'inlineCard';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleResolved = (view, request, options) => resolvedCard => {
|
|
24
|
+
updateCardType(resolvedCard, options);
|
|
18
25
|
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction)(view.state, view.dispatch);
|
|
19
26
|
return resolvedCard;
|
|
20
27
|
};
|
|
@@ -41,7 +41,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false) => (state, {
|
|
|
41
41
|
alias: lang.alias
|
|
42
42
|
})); // If language is not undefined search for it in the value and then search in the aliases
|
|
43
43
|
|
|
44
|
-
const defaultValue = language ? options.find(option => option.value === language) || options.find(option => option.alias.includes(language)) :
|
|
44
|
+
const defaultValue = language ? options.find(option => option.value === language) || options.find(option => option.alias.includes(language)) : null;
|
|
45
45
|
const languageSelect = {
|
|
46
46
|
id: 'editor.codeBlock.languageOptions',
|
|
47
47
|
type: 'select',
|
|
@@ -5,6 +5,8 @@ import { EmojiSharedCssClassName } from '@atlaskit/editor-common';
|
|
|
5
5
|
import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
export const emojiStyles = css`
|
|
7
7
|
.${EmojiSharedCssClassName.EMOJI_CONTAINER} {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
|
|
8
10
|
.${EmojiSharedCssClassName.EMOJI_NODE} {
|
|
9
11
|
cursor: pointer;
|
|
10
12
|
|
|
@@ -97,7 +97,6 @@ export const createContextIdentifierProviderHandler = view => async (name, provi
|
|
|
97
97
|
|
|
98
98
|
const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, useLongPressSelection = false, options = {}) => {
|
|
99
99
|
const state = createPluginState(dispatch, {
|
|
100
|
-
layout: 'default',
|
|
101
100
|
showEditButton: false,
|
|
102
101
|
showContextPanel: false
|
|
103
102
|
});
|
|
@@ -155,14 +154,12 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
|
|
|
155
154
|
const showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
|
|
156
155
|
const updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(() => {// do nothing;
|
|
157
156
|
});
|
|
158
|
-
const layout = selectedExtension ? node.attrs.layout : 'default';
|
|
159
157
|
updateState({
|
|
160
158
|
localId: node.attrs.localId,
|
|
161
159
|
showContextPanel: false,
|
|
162
160
|
element: newElement,
|
|
163
161
|
showEditButton,
|
|
164
|
-
updateExtension
|
|
165
|
-
layout
|
|
162
|
+
updateExtension
|
|
166
163
|
})(state, dispatch);
|
|
167
164
|
} // New DOM element doesn't necessarily mean it's a new Node
|
|
168
165
|
else if (element !== newElement) {
|