@atlaskit/editor-core 185.13.0 → 185.14.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 +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +4 -4
- package/dist/cjs/editor-next/index.js +29 -41
- package/dist/cjs/editor.js +3 -29
- package/dist/cjs/labs/next/presets/universal.js +6 -14
- package/dist/cjs/labs/next/presets/useUniversalPreset.js +2 -5
- package/dist/cjs/plugins/analytics/plugin.js +13 -7
- package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +27 -22
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -4
- package/dist/cjs/plugins/card/toolbar.js +8 -5
- package/dist/cjs/plugins/collab-edit/analytics.js +8 -6
- package/dist/cjs/plugins/collab-edit/events/handlers.js +4 -4
- package/dist/cjs/plugins/collab-edit/events/initialize.js +3 -2
- package/dist/cjs/plugins/collab-edit/index.js +3 -2
- package/dist/cjs/plugins/collab-edit/plugin.js +7 -4
- package/dist/cjs/plugins/emoji/index.js +17 -7
- package/dist/cjs/plugins/mentions/index.js +14 -12
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +4 -4
- package/dist/es2019/editor-next/index.js +25 -39
- package/dist/es2019/editor.js +2 -25
- package/dist/es2019/labs/next/presets/universal.js +6 -16
- package/dist/es2019/labs/next/presets/useUniversalPreset.js +2 -6
- package/dist/es2019/plugins/analytics/plugin.js +13 -9
- package/dist/es2019/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/es2019/plugins/card/pm-plugins/main.js +27 -22
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -4
- package/dist/es2019/plugins/card/toolbar.js +8 -5
- package/dist/es2019/plugins/collab-edit/analytics.js +17 -13
- package/dist/es2019/plugins/collab-edit/events/handlers.js +4 -4
- package/dist/es2019/plugins/collab-edit/events/initialize.js +3 -2
- package/dist/es2019/plugins/collab-edit/index.js +3 -2
- package/dist/es2019/plugins/collab-edit/plugin.js +7 -4
- package/dist/es2019/plugins/emoji/index.js +17 -7
- package/dist/es2019/plugins/mentions/index.js +7 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +4 -4
- package/dist/esm/editor-next/index.js +28 -42
- package/dist/esm/editor.js +3 -29
- package/dist/esm/labs/next/presets/universal.js +6 -14
- package/dist/esm/labs/next/presets/useUniversalPreset.js +2 -5
- package/dist/esm/plugins/analytics/plugin.js +13 -7
- package/dist/esm/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/esm/plugins/card/pm-plugins/main.js +27 -22
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -4
- package/dist/esm/plugins/card/toolbar.js +8 -5
- package/dist/esm/plugins/collab-edit/analytics.js +8 -6
- package/dist/esm/plugins/collab-edit/events/handlers.js +4 -4
- package/dist/esm/plugins/collab-edit/events/initialize.js +3 -2
- package/dist/esm/plugins/collab-edit/index.js +3 -2
- package/dist/esm/plugins/collab-edit/plugin.js +7 -4
- package/dist/esm/plugins/emoji/index.js +17 -7
- package/dist/esm/plugins/mentions/index.js +14 -12
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +2 -2
- package/dist/types/editor-next/index.d.ts +1 -0
- package/dist/types/editor.d.ts +0 -1
- package/dist/types/labs/next/presets/universal.d.ts +2 -2
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -1
- package/dist/types/plugins/card/types.d.ts +1 -3
- package/dist/types/plugins/collab-edit/analytics.d.ts +4 -3
- package/dist/types/plugins/collab-edit/events/handlers.d.ts +3 -2
- package/dist/types/plugins/collab-edit/events/initialize.d.ts +4 -2
- package/dist/types/plugins/collab-edit/index.d.ts +6 -2
- package/dist/types/plugins/collab-edit/plugin.d.ts +3 -1
- package/dist/types/plugins/collab-edit/types.d.ts +0 -2
- package/dist/types/plugins/emoji/index.d.ts +3 -1
- package/dist/types/plugins/emoji/types.d.ts +1 -3
- package/dist/types/plugins/mentions/types.d.ts +2 -4
- package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +2 -2
- package/dist/types-ts4.5/editor-next/index.d.ts +1 -0
- package/dist/types-ts4.5/editor.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/universal.d.ts +2 -2
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -1
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -3
- package/dist/types-ts4.5/plugins/collab-edit/analytics.d.ts +4 -3
- package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +3 -2
- package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +4 -2
- package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +3 -1
- package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +0 -2
- package/dist/types-ts4.5/plugins/emoji/index.d.ts +5 -1
- package/dist/types-ts4.5/plugins/emoji/types.d.ts +1 -3
- package/dist/types-ts4.5/plugins/mentions/types.d.ts +2 -4
- package/package.json +10 -7
- package/report.api.md +2 -2
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +0 -79
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +0 -69
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +0 -72
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +0 -13
- package/dist/types-ts4.5/labs/next/presets/create-stub-internal-apis.d.ts +0 -13
- package/tmp/api-report-tmp.d.ts +0 -2364
|
@@ -15,6 +15,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
|
|
|
15
15
|
import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
|
|
16
16
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
17
17
|
export { pluginKey } from './plugin-key';
|
|
18
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
18
19
|
export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryParams => {
|
|
19
20
|
const {
|
|
20
21
|
lpAnalyticsEventsNext
|
|
@@ -26,9 +27,16 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
26
27
|
allowResizing,
|
|
27
28
|
useAlternativePreloader,
|
|
28
29
|
fullWidthMode,
|
|
29
|
-
createAnalyticsEvent,
|
|
30
30
|
showServerActions
|
|
31
31
|
} = options;
|
|
32
|
+
const inlineCardViewProducer = getInlineNodeViewProducer({
|
|
33
|
+
pmPluginFactoryParams,
|
|
34
|
+
Component: InlineCardNodeView,
|
|
35
|
+
extraComponentProps: {
|
|
36
|
+
useAlternativePreloader,
|
|
37
|
+
showServerActions
|
|
38
|
+
}
|
|
39
|
+
});
|
|
32
40
|
return new SafePlugin({
|
|
33
41
|
state: {
|
|
34
42
|
init() {
|
|
@@ -39,7 +47,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
39
47
|
showLinkingToolbar: false,
|
|
40
48
|
smartLinkEvents: undefined,
|
|
41
49
|
smartLinkEventsNext: undefined,
|
|
42
|
-
createAnalyticsEvent,
|
|
43
50
|
editorAppearance,
|
|
44
51
|
showDatasourceModal: false,
|
|
45
52
|
datasourceTableRef: undefined,
|
|
@@ -127,8 +134,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
127
134
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
128
135
|
*/
|
|
129
136
|
const invoke = rafSchedule(() => {
|
|
130
|
-
var _pluginInjectionApi$d;
|
|
131
|
-
return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions);
|
|
137
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
138
|
+
return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.sharedState.currentState()) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.createAnalyticsEvent) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : undefined);
|
|
132
139
|
});
|
|
133
140
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
134
141
|
invoke();
|
|
@@ -145,15 +152,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
145
152
|
},
|
|
146
153
|
props: {
|
|
147
154
|
nodeViews: {
|
|
148
|
-
inlineCard:
|
|
149
|
-
|
|
150
|
-
Component: InlineCardNodeView,
|
|
151
|
-
extraComponentProps: {
|
|
152
|
-
useAlternativePreloader,
|
|
153
|
-
showServerActions
|
|
154
|
-
}
|
|
155
|
-
}),
|
|
156
|
-
blockCard: (node, view, getPos) => {
|
|
155
|
+
inlineCard: inlineCardViewProducer,
|
|
156
|
+
blockCard: (node, view, getPos, decorations) => {
|
|
157
157
|
var _node$attrs3;
|
|
158
158
|
const {
|
|
159
159
|
portalProviderAPI,
|
|
@@ -166,15 +166,20 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
166
166
|
const hasIntlContext = true;
|
|
167
167
|
const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
|
|
168
168
|
if (isDatasource) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
169
|
+
var _node$attrs4;
|
|
170
|
+
if (canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.datasource)) {
|
|
171
|
+
return new Datasource({
|
|
172
|
+
node,
|
|
173
|
+
view,
|
|
174
|
+
getPos,
|
|
175
|
+
portalProviderAPI,
|
|
176
|
+
eventDispatcher,
|
|
177
|
+
hasIntlContext,
|
|
178
|
+
pluginInjectionApi
|
|
179
|
+
}).init();
|
|
180
|
+
} else {
|
|
181
|
+
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
182
|
+
}
|
|
178
183
|
}
|
|
179
184
|
return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
180
185
|
},
|
|
@@ -5,14 +5,14 @@ import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
|
|
|
5
5
|
// ============================================================================ //
|
|
6
6
|
// Used for all interactions with the EditorCardProvider.
|
|
7
7
|
// ============================================================================ //
|
|
8
|
-
export const resolveWithProvider = (view, provider, request, options, editorAnalyticsApi) => {
|
|
8
|
+
export const resolveWithProvider = (view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) => {
|
|
9
9
|
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
10
10
|
let shouldForceAppearance =
|
|
11
11
|
// This flag is set to true only in one place atm:
|
|
12
12
|
// packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
|
|
13
13
|
// Which is used when user switching from URL to smart link appearance.
|
|
14
14
|
!!request.shouldReplaceLink;
|
|
15
|
-
const handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, options), handleRejected(view, request, editorAnalyticsApi));
|
|
15
|
+
const handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
16
16
|
return handleResolve;
|
|
17
17
|
};
|
|
18
18
|
const updateCardType = (resolvedCard, options) => {
|
|
@@ -24,9 +24,9 @@ const updateCardType = (resolvedCard, options) => {
|
|
|
24
24
|
resolvedCard.type = 'inlineCard';
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
const handleResolved = (view, request, editorAnalyticsApi, options) => resolvedCard => {
|
|
27
|
+
const handleResolved = (view, request, editorAnalyticsApi, createAnalyticsEvent, options) => resolvedCard => {
|
|
28
28
|
updateCardType(resolvedCard, options);
|
|
29
|
-
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi)(view.state, view.dispatch);
|
|
29
|
+
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi, createAnalyticsEvent)(view.state, view.dispatch);
|
|
30
30
|
return resolvedCard;
|
|
31
31
|
};
|
|
32
32
|
const handleRejected = (view, request, editorAnalyticsApi) => () => {
|
|
@@ -19,6 +19,7 @@ import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
19
19
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
20
20
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
21
21
|
import { SmallerEditIcon } from './ui/SmallerEditIcon';
|
|
22
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
22
23
|
export const removeCard = editorAnalyticsApi => commandWithMetadata((state, dispatch) => {
|
|
23
24
|
if (!(state.selection instanceof NodeSelection)) {
|
|
24
25
|
return false;
|
|
@@ -164,7 +165,7 @@ const withToolbarMetadata = command => commandWithMetadata(command, {
|
|
|
164
165
|
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
165
166
|
});
|
|
166
167
|
const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) => node => {
|
|
167
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs;
|
|
168
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2;
|
|
168
169
|
const {
|
|
169
170
|
url
|
|
170
171
|
} = titleUrlPairFromNode(node);
|
|
@@ -189,6 +190,9 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
|
|
|
189
190
|
hoverDecoration
|
|
190
191
|
} = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.decorations) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {};
|
|
191
192
|
const isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
|
|
193
|
+
const shouldRenderDatasourceToolbar = isDatasource &&
|
|
194
|
+
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
195
|
+
platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.datasource);
|
|
192
196
|
|
|
193
197
|
/* mobile builds toolbar natively using toolbarItems */
|
|
194
198
|
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -205,8 +209,7 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
|
|
|
205
209
|
node,
|
|
206
210
|
editorAnalyticsApi
|
|
207
211
|
})];
|
|
208
|
-
|
|
209
|
-
} else if (isDatasource && platform !== 'mobile') {
|
|
212
|
+
} else if (shouldRenderDatasourceToolbar) {
|
|
210
213
|
return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
|
|
211
214
|
} else {
|
|
212
215
|
const {
|
|
@@ -323,7 +326,7 @@ const getSettingsButtonGroup = (state, featureFlags, intl, editorAnalyticsApi) =
|
|
|
323
326
|
}] : [];
|
|
324
327
|
};
|
|
325
328
|
const getDatasourceButtonGroup = (state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) => {
|
|
326
|
-
var _node$
|
|
329
|
+
var _node$attrs3;
|
|
327
330
|
const toolbarItems = [{
|
|
328
331
|
id: 'editor.edit.datasource',
|
|
329
332
|
type: 'button',
|
|
@@ -333,7 +336,7 @@ const getDatasourceButtonGroup = (state, metadata, intl, editorAnalyticsApi, nod
|
|
|
333
336
|
title: intl.formatMessage(linkToolbarMessages.editDatasource),
|
|
334
337
|
onClick: editDatasource(editorAnalyticsApi)
|
|
335
338
|
}];
|
|
336
|
-
if (node !== null && node !== void 0 && (_node$
|
|
339
|
+
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
337
340
|
toolbarItems.push({
|
|
338
341
|
type: 'separator'
|
|
339
342
|
}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { addAnalytics, ACTION, EVENT_TYPE, ACTION_SUBJECT } from '../analytics';
|
|
2
1
|
import { getDocStructure } from '../../utils/document-logger';
|
|
3
2
|
import { sniffUserBrowserExtensions } from '@atlaskit/editor-common/utils';
|
|
4
|
-
|
|
3
|
+
import { ACTION, EVENT_TYPE, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
export const addSynchronyErrorAnalytics = (state, tr, featureFlags, editorAnalyticsApi) => {
|
|
5
5
|
return error => {
|
|
6
6
|
const browserExtensions = sniffUserBrowserExtensions({
|
|
7
7
|
extensions: ['grammarly']
|
|
@@ -20,18 +20,22 @@ export const addSynchronyErrorAnalytics = (state, tr, featureFlags) => {
|
|
|
20
20
|
compact: true
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
|
|
24
|
+
return tr;
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
27
|
export const addSynchronyEntityAnalytics = (state, tr) => {
|
|
27
|
-
return type =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
return (type, editorAnalyticsApi) => {
|
|
29
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
30
|
+
action: type === 'error' ? ACTION.SYNCHRONY_ENTITY_ERROR : ACTION.SYNCHRONY_DISCONNECTED,
|
|
31
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
32
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
33
|
+
attributes: {
|
|
34
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine
|
|
35
|
+
onLine: navigator.onLine,
|
|
36
|
+
visibilityState: document.visibilityState
|
|
37
|
+
}
|
|
38
|
+
})(tr);
|
|
39
|
+
return tr;
|
|
40
|
+
};
|
|
37
41
|
};
|
|
@@ -12,14 +12,14 @@ const effect = (fn, eq) => {
|
|
|
12
12
|
return cleanup;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export const subscribe = effect((view, provider, options, featureFlags, _providerFactory) => {
|
|
15
|
+
export const subscribe = effect((view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) => {
|
|
16
16
|
let entityRef;
|
|
17
17
|
const entityHandlers = {
|
|
18
18
|
disconnectedHandler: () => {
|
|
19
|
-
addSynchronyEntityAnalytics(view.state, view.state.tr)('disconnected');
|
|
19
|
+
addSynchronyEntityAnalytics(view.state, view.state.tr)('disconnected', editorAnalyticsApi);
|
|
20
20
|
},
|
|
21
21
|
errorHandler: () => {
|
|
22
|
-
addSynchronyEntityAnalytics(view.state, view.state.tr)('error');
|
|
22
|
+
addSynchronyEntityAnalytics(view.state, view.state.tr)('error', editorAnalyticsApi);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
const unsubscribeSynchronyEntity = () => {
|
|
@@ -51,7 +51,7 @@ export const subscribe = effect((view, provider, options, featureFlags, _provide
|
|
|
51
51
|
view.dispatch(tr);
|
|
52
52
|
},
|
|
53
53
|
errorHandler: error => {
|
|
54
|
-
addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags)(error);
|
|
54
|
+
addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags, editorAnalyticsApi)(error);
|
|
55
55
|
},
|
|
56
56
|
entityHandler: ({
|
|
57
57
|
entity
|
|
@@ -18,14 +18,15 @@ export const initialize = ({
|
|
|
18
18
|
options,
|
|
19
19
|
providerFactory,
|
|
20
20
|
view,
|
|
21
|
-
featureFlags
|
|
21
|
+
featureFlags,
|
|
22
|
+
editorAnalyticsApi
|
|
22
23
|
}) => provider => {
|
|
23
24
|
let cleanup;
|
|
24
25
|
const pluginState = pluginKey.getState(view.state);
|
|
25
26
|
if (pluginState !== null && pluginState !== void 0 && pluginState.isReady && cleanup) {
|
|
26
27
|
cleanup();
|
|
27
28
|
}
|
|
28
|
-
cleanup = subscribe(view, provider, options, featureFlags, providerFactory);
|
|
29
|
+
cleanup = subscribe(view, provider, options, featureFlags, providerFactory, editorAnalyticsApi);
|
|
29
30
|
|
|
30
31
|
// Initialize provider
|
|
31
32
|
if (options.useNativePlugin) {
|
|
@@ -50,12 +50,13 @@ const collabEditPlugin = (options, api) => {
|
|
|
50
50
|
dispatch,
|
|
51
51
|
providerFactory
|
|
52
52
|
}) => {
|
|
53
|
-
return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags);
|
|
53
|
+
return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
|
|
54
54
|
}
|
|
55
55
|
}];
|
|
56
56
|
},
|
|
57
57
|
onEditorViewStateUpdated(props) {
|
|
58
|
-
|
|
58
|
+
var _api$dependencies$ana;
|
|
59
|
+
const addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
59
60
|
executeProviderCode(sendTransaction({
|
|
60
61
|
originalTransaction: props.originalTransaction,
|
|
61
62
|
transactions: props.transactions,
|
|
@@ -5,8 +5,7 @@ import { pluginKey } from './plugin-key';
|
|
|
5
5
|
import { addSynchronyErrorAnalytics } from './analytics';
|
|
6
6
|
import { fireAnalyticsEvent, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
export { PluginState, pluginKey };
|
|
8
|
-
export const createPlugin = (dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags) => {
|
|
9
|
-
const fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
|
|
8
|
+
export const createPlugin = (dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) => {
|
|
10
9
|
return new SafePlugin({
|
|
11
10
|
key: pluginKey,
|
|
12
11
|
state: {
|
|
@@ -40,8 +39,11 @@ export const createPlugin = (dispatch, providerFactory, providerResolver, collab
|
|
|
40
39
|
return true;
|
|
41
40
|
},
|
|
42
41
|
view(view) {
|
|
43
|
-
|
|
42
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d5;
|
|
43
|
+
const addErrorAnalytics = addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions);
|
|
44
44
|
const onSyncUpError = attributes => {
|
|
45
|
+
var _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
46
|
+
const fireAnalyticsCallback = fireAnalyticsEvent((_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.sharedState.currentState()) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.createAnalyticsEvent) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : undefined);
|
|
45
47
|
fireAnalyticsCallback({
|
|
46
48
|
payload: {
|
|
47
49
|
action: ACTION.NEW_COLLAB_SYNC_UP_ERROR_NO_STEPS,
|
|
@@ -56,7 +58,8 @@ export const createPlugin = (dispatch, providerFactory, providerResolver, collab
|
|
|
56
58
|
view,
|
|
57
59
|
options,
|
|
58
60
|
providerFactory,
|
|
59
|
-
featureFlags
|
|
61
|
+
featureFlags,
|
|
62
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions
|
|
60
63
|
}), addErrorAnalytics);
|
|
61
64
|
providerFactory && providerFactory.subscribe('collabEditProvider', (_name, providerPromise) => {
|
|
62
65
|
if (providerPromise) {
|
|
@@ -7,7 +7,7 @@ import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
|
7
7
|
import { EmojiTypeAheadItem, SearchSort, recordSelectionSucceededSli, recordSelectionFailedSli } from '@atlaskit/emoji';
|
|
8
8
|
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
9
9
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
10
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
10
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
11
|
import { IconEmoji } from '../quick-insert/assets';
|
|
12
12
|
import { EmojiNodeView } from './nodeviews/emoji';
|
|
13
13
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
@@ -54,7 +54,7 @@ const memoizedToItem = memoize(emojiToTypeaheadItem);
|
|
|
54
54
|
export const defaultListLimit = 50;
|
|
55
55
|
const isFullShortName = query => query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
56
56
|
const TRIGGER = ':';
|
|
57
|
-
const emojiPlugin = options => {
|
|
57
|
+
const emojiPlugin = (options, api) => {
|
|
58
58
|
const typeAhead = {
|
|
59
59
|
id: TypeAheadAvailableNodes.EMOJI,
|
|
60
60
|
trigger: TRIGGER,
|
|
@@ -116,6 +116,7 @@ const emojiPlugin = options => {
|
|
|
116
116
|
selectItem(state, item, insert, {
|
|
117
117
|
mode
|
|
118
118
|
}) {
|
|
119
|
+
var _api$dependencies$ana7;
|
|
119
120
|
const {
|
|
120
121
|
id = '',
|
|
121
122
|
fallback,
|
|
@@ -124,7 +125,12 @@ const emojiPlugin = options => {
|
|
|
124
125
|
const text = fallback || shortName;
|
|
125
126
|
const emojiPluginState = emojiPluginKey.getState(state);
|
|
126
127
|
if (emojiPluginState.emojiProvider && emojiPluginState.emojiProvider.recordSelection && item.emoji) {
|
|
127
|
-
|
|
128
|
+
var _api$dependencies$ana, _api$dependencies$ana2, _api$dependencies$ana3, _api$dependencies$ana4, _api$dependencies$ana5, _api$dependencies$ana6;
|
|
129
|
+
emojiPluginState.emojiProvider.recordSelection(item.emoji).then(recordSelectionSucceededSli({
|
|
130
|
+
createAnalyticsEvent: (_api$dependencies$ana = api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : (_api$dependencies$ana3 = _api$dependencies$ana2.sharedState.currentState()) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.createAnalyticsEvent) !== null && _api$dependencies$ana !== void 0 ? _api$dependencies$ana : undefined
|
|
131
|
+
})).catch(recordSelectionFailedSli({
|
|
132
|
+
createAnalyticsEvent: (_api$dependencies$ana4 = api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : (_api$dependencies$ana6 = _api$dependencies$ana5.sharedState.currentState()) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.createAnalyticsEvent) !== null && _api$dependencies$ana4 !== void 0 ? _api$dependencies$ana4 : undefined
|
|
133
|
+
}));
|
|
128
134
|
}
|
|
129
135
|
const emojiNode = state.schema.nodes.emoji.createChecked({
|
|
130
136
|
shortName,
|
|
@@ -132,7 +138,8 @@ const emojiPlugin = options => {
|
|
|
132
138
|
text
|
|
133
139
|
});
|
|
134
140
|
const space = state.schema.text(' ');
|
|
135
|
-
|
|
141
|
+
const tr = insert(Fragment.from([emojiNode, space]));
|
|
142
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana7 = api.dependencies.analytics) === null || _api$dependencies$ana7 === void 0 ? void 0 : _api$dependencies$ana7.actions.attachAnalyticsEvent({
|
|
136
143
|
action: ACTION.INSERTED,
|
|
137
144
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
138
145
|
actionSubjectId: ACTION_SUBJECT_ID.EMOJI,
|
|
@@ -140,7 +147,8 @@ const emojiPlugin = options => {
|
|
|
140
147
|
inputMethod: INPUT_METHOD.TYPEAHEAD
|
|
141
148
|
},
|
|
142
149
|
eventType: EVENT_TYPE.TRACK
|
|
143
|
-
});
|
|
150
|
+
})(tr);
|
|
151
|
+
return tr;
|
|
144
152
|
}
|
|
145
153
|
};
|
|
146
154
|
return {
|
|
@@ -175,12 +183,13 @@ const emojiPlugin = options => {
|
|
|
175
183
|
keyshortcut: ':',
|
|
176
184
|
icon: () => /*#__PURE__*/React.createElement(IconEmoji, null),
|
|
177
185
|
action(insert, state) {
|
|
186
|
+
var _api$dependencies$ana8;
|
|
178
187
|
const tr = insert(undefined);
|
|
179
188
|
openTypeAheadAtCursor({
|
|
180
189
|
triggerHandler: typeAhead,
|
|
181
190
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
182
191
|
})(tr);
|
|
183
|
-
|
|
192
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions.attachAnalyticsEvent({
|
|
184
193
|
action: ACTION.INVOKED,
|
|
185
194
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
186
195
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
@@ -188,7 +197,8 @@ const emojiPlugin = options => {
|
|
|
188
197
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
189
198
|
},
|
|
190
199
|
eventType: EVENT_TYPE.UI
|
|
191
|
-
});
|
|
200
|
+
})(tr);
|
|
201
|
+
return tr;
|
|
192
202
|
}
|
|
193
203
|
}],
|
|
194
204
|
typeAhead
|
|
@@ -16,12 +16,13 @@ export { mentionPluginKey };
|
|
|
16
16
|
const mentionsPlugin = (options, api) => {
|
|
17
17
|
let sessionId = uuid();
|
|
18
18
|
const fireEvent = payload => {
|
|
19
|
-
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
19
|
+
var _api$dependencies$ana, _api$dependencies$ana2;
|
|
22
20
|
const {
|
|
23
21
|
createAnalyticsEvent
|
|
24
|
-
} =
|
|
22
|
+
} = (_api$dependencies$ana = api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.sharedState.currentState()) !== null && _api$dependencies$ana !== void 0 ? _api$dependencies$ana : {};
|
|
23
|
+
if (!createAnalyticsEvent) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
25
26
|
if (payload.attributes && !payload.attributes.sessionId) {
|
|
26
27
|
payload.attributes.sessionId = sessionId;
|
|
27
28
|
}
|
|
@@ -76,13 +77,13 @@ const mentionsPlugin = (options, api) => {
|
|
|
76
77
|
keyshortcut: '@',
|
|
77
78
|
icon: () => /*#__PURE__*/React.createElement(IconMention, null),
|
|
78
79
|
action(insert, state) {
|
|
79
|
-
var _api$dependencies$
|
|
80
|
+
var _api$dependencies$ana3;
|
|
80
81
|
const tr = insert(undefined);
|
|
81
82
|
openTypeAheadAtCursor({
|
|
82
83
|
triggerHandler: typeAhead,
|
|
83
84
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
84
85
|
})(tr);
|
|
85
|
-
api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
86
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
|
|
86
87
|
action: ACTION.INVOKED,
|
|
87
88
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
88
89
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|
package/dist/es2019/version.json
CHANGED
|
@@ -107,8 +107,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
107
107
|
* Note: The order that presets are added determines
|
|
108
108
|
* their placement in the editor toolbar
|
|
109
109
|
*/
|
|
110
|
-
export default function createPluginsList(props, prevProps
|
|
111
|
-
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props
|
|
110
|
+
export default function createPluginsList(props, prevProps) {
|
|
111
|
+
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
112
112
|
var excludes = new Set();
|
|
113
113
|
if (!isCodeBlockAllowed({
|
|
114
114
|
allowBlockType: props.allowBlockType
|
|
@@ -138,8 +138,8 @@ function withDangerouslyAppendPlugins(preset) {
|
|
|
138
138
|
return presetWithAppendedPlugins;
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
export function createPreset(props, prevProps
|
|
141
|
+
export function createPreset(props, prevProps) {
|
|
142
142
|
var _props$dangerouslyApp;
|
|
143
|
-
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props
|
|
143
|
+
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
144
144
|
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
145
145
|
}
|
|
@@ -12,14 +12,13 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
|
|
14
14
|
import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
|
|
15
|
-
|
|
15
|
+
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
16
16
|
import { jsx } from '@emotion/react';
|
|
17
17
|
import PropTypes from 'prop-types';
|
|
18
18
|
import React from 'react';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// import uuid from 'uuid/v4';
|
|
19
|
+
import { name, version } from '../version-wrapper';
|
|
20
|
+
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
21
|
+
import uuid from 'uuid/v4';
|
|
23
22
|
import EditorActions from '../actions';
|
|
24
23
|
import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
25
24
|
import EditorInternal from './editor-internal';
|
|
@@ -32,8 +31,6 @@ import { basePlugin } from '../plugins';
|
|
|
32
31
|
var EditorNext = /*#__PURE__*/function (_React$Component) {
|
|
33
32
|
_inherits(EditorNext, _React$Component);
|
|
34
33
|
var _super = _createSuper(EditorNext);
|
|
35
|
-
// private editorSessionId: string;
|
|
36
|
-
|
|
37
34
|
function EditorNext(props, context) {
|
|
38
35
|
var _this;
|
|
39
36
|
_classCallCheck(this, EditorNext);
|
|
@@ -53,7 +50,7 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
|
|
|
53
50
|
});
|
|
54
51
|
deprecationWarnings(props);
|
|
55
52
|
_this.editorActions = (context || {}).editorActions || new EditorActions();
|
|
56
|
-
|
|
53
|
+
_this.editorSessionId = uuid();
|
|
57
54
|
_this.startTime = performance.now();
|
|
58
55
|
_this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
|
|
59
56
|
_this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
|
|
@@ -96,40 +93,29 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
|
|
|
96
93
|
key: "render",
|
|
97
94
|
value: function render() {
|
|
98
95
|
var _this3 = this;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
preset: _this3.props.preset,
|
|
123
|
-
handleSave: _this3.handleSave,
|
|
124
|
-
editorActions: _this3.editorActions,
|
|
125
|
-
getExperienceStore: _this3.getExperienceStore,
|
|
126
|
-
onEditorCreated: _this3.onEditorCreated,
|
|
127
|
-
onEditorDestroyed: _this3.onEditorDestroyed
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
// </FabricEditorAnalyticsContext>
|
|
132
|
-
);
|
|
96
|
+
return jsx(FabricEditorAnalyticsContext, {
|
|
97
|
+
data: {
|
|
98
|
+
packageName: name,
|
|
99
|
+
packageVersion: version,
|
|
100
|
+
componentName: 'editorCore',
|
|
101
|
+
appearance: getAnalyticsAppearance(this.props.appearance),
|
|
102
|
+
editorSessionId: this.editorSessionId
|
|
103
|
+
}
|
|
104
|
+
}, jsx(WithCreateAnalyticsEvent, {
|
|
105
|
+
render: function render(createAnalyticsEvent) {
|
|
106
|
+
return (_this3.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
|
|
107
|
+
props: _this3.props,
|
|
108
|
+
handleAnalyticsEvent: _this3.handleAnalyticsEvent,
|
|
109
|
+
createAnalyticsEvent: _this3.createAnalyticsEvent,
|
|
110
|
+
preset: _this3.props.preset,
|
|
111
|
+
handleSave: _this3.handleSave,
|
|
112
|
+
editorActions: _this3.editorActions,
|
|
113
|
+
getExperienceStore: _this3.getExperienceStore,
|
|
114
|
+
onEditorCreated: _this3.onEditorCreated,
|
|
115
|
+
onEditorDestroyed: _this3.onEditorDestroyed
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
133
119
|
}
|
|
134
120
|
}]);
|
|
135
121
|
return EditorNext;
|
package/dist/esm/editor.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
@@ -14,10 +13,6 @@ import React from 'react';
|
|
|
14
13
|
import { defaultProps } from './editor-next/utils/editorPropTypes';
|
|
15
14
|
import EditorNext from './editor-next';
|
|
16
15
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
17
|
-
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
18
|
-
import { name, version } from './version-wrapper';
|
|
19
|
-
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
20
|
-
import uuid from 'uuid/v4';
|
|
21
16
|
var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
22
17
|
var props = _ref.props;
|
|
23
18
|
var preset = useUniversalPreset({
|
|
@@ -31,36 +26,15 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
31
26
|
_inherits(Editor, _React$Component);
|
|
32
27
|
var _super = _createSuper(Editor);
|
|
33
28
|
function Editor() {
|
|
34
|
-
var _this;
|
|
35
29
|
_classCallCheck(this, Editor);
|
|
36
|
-
|
|
37
|
-
args[_key] = arguments[_key];
|
|
38
|
-
}
|
|
39
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "editorSessionId", uuid());
|
|
41
|
-
return _this;
|
|
30
|
+
return _super.apply(this, arguments);
|
|
42
31
|
}
|
|
43
32
|
_createClass(Editor, [{
|
|
44
33
|
key: "render",
|
|
45
34
|
value: function render() {
|
|
46
|
-
|
|
47
|
-
// Move `FabricEditorAnalyticsContext` back into `EditorNext`
|
|
48
|
-
// This was moved out here to workaround the issue that the analytics
|
|
49
|
-
// context does not wrap the Preset (and therefore does not pass this context
|
|
50
|
-
// information to analytics calls within plugins). After this cleanup task ^ we will
|
|
51
|
-
// not have to generate the `createAnalyticsEvent` outside the Preset
|
|
52
|
-
// and we can move this back into `EditorNext`.
|
|
53
|
-
return jsx(FabricEditorAnalyticsContext, {
|
|
54
|
-
data: {
|
|
55
|
-
packageName: name,
|
|
56
|
-
packageVersion: version,
|
|
57
|
-
componentName: 'editorCore',
|
|
58
|
-
appearance: getAnalyticsAppearance(this.props.appearance),
|
|
59
|
-
editorSessionId: this.editorSessionId
|
|
60
|
-
}
|
|
61
|
-
}, jsx(EditorNextWrapper, {
|
|
35
|
+
return jsx(EditorNextWrapper, {
|
|
62
36
|
props: this.props
|
|
63
|
-
})
|
|
37
|
+
});
|
|
64
38
|
}
|
|
65
39
|
}]);
|
|
66
40
|
return Editor;
|