@atlaskit/editor-core 185.13.1 → 185.14.2
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 +2 -4
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -4
- 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 +2 -4
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -4
- 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 +2 -4
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -4
- 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 +8 -8
- 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
|
@@ -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;
|
|
@@ -2,6 +2,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
import { createEditorSelectionAPI } from '../../../selection-api/api';
|
|
5
6
|
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
|
|
6
7
|
import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
7
8
|
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
@@ -12,7 +13,6 @@ import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
|
|
|
12
13
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
13
14
|
import { createDefaultPreset } from './default';
|
|
14
15
|
import { shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
15
|
-
import { createStubInternalApis } from './create-stub-internal-apis';
|
|
16
16
|
/**
|
|
17
17
|
* Creates a preset with all of the available plugins.
|
|
18
18
|
* Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
|
|
@@ -24,17 +24,14 @@ import { createStubInternalApis } from './create-stub-internal-apis';
|
|
|
24
24
|
* @param prevAppearance The appearance of the editor in the previous render
|
|
25
25
|
* @returns a full featured preset configured according to the provided props - basis for create-plugins-list
|
|
26
26
|
*/
|
|
27
|
-
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
27
|
+
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
|
|
28
28
|
var isMobile = appearance === 'mobile';
|
|
29
29
|
var isComment = appearance === 'comment';
|
|
30
30
|
var isFullPage = fullPageCheck(appearance);
|
|
31
31
|
var getEditorFeatureFlags = function getEditorFeatureFlags() {
|
|
32
32
|
return featureFlags;
|
|
33
33
|
};
|
|
34
|
-
var
|
|
35
|
-
var editorSelectionAPI = stubs.editorSelectionAPI,
|
|
36
|
-
stubInternalApisPlugin = stubs.stubInternalApisPlugin;
|
|
37
|
-
var createAnalyticsEvent = maybeCreateAnalyticsEvent ? maybeCreateAnalyticsEvent : stubs.createAnalyticsEvent;
|
|
34
|
+
var editorSelectionAPI = createEditorSelectionAPI();
|
|
38
35
|
var defaultPreset = createDefaultPreset(_objectSpread(_objectSpread({}, props), {}, {
|
|
39
36
|
createAnalyticsEvent: createAnalyticsEvent
|
|
40
37
|
}));
|
|
@@ -45,7 +42,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
45
42
|
}
|
|
46
43
|
return false;
|
|
47
44
|
};
|
|
48
|
-
var finalPreset = defaultPreset.add(
|
|
45
|
+
var finalPreset = defaultPreset.add(dataConsumerMarkPlugin).add(contentInsertionPlugin).maybeAdd(breakoutPlugin, function (plugin, builder) {
|
|
49
46
|
if (props.allowBreakout && isFullPage) {
|
|
50
47
|
return builder.add([plugin, {
|
|
51
48
|
allowBreakoutButton: appearance === 'full-page'
|
|
@@ -121,7 +118,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
121
118
|
if (props.mentionProvider) {
|
|
122
119
|
var _props$mention$insert, _props$mention, _props$mention2;
|
|
123
120
|
return builder.add([plugin, {
|
|
124
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
125
121
|
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
126
122
|
insertDisplayName: (_props$mention$insert = (_props$mention = props.mention) === null || _props$mention === void 0 ? void 0 : _props$mention.insertDisplayName) !== null && _props$mention$insert !== void 0 ? _props$mention$insert : props.mentionInsertDisplayName,
|
|
127
123
|
allowZeroWidthSpaceAfter: !isMobile,
|
|
@@ -131,9 +127,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
131
127
|
return builder;
|
|
132
128
|
}).maybeAdd(emojiPlugin, function (plugin, builder) {
|
|
133
129
|
if (props.emojiProvider) {
|
|
134
|
-
return builder.add(
|
|
135
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
136
|
-
}]);
|
|
130
|
+
return builder.add(plugin);
|
|
137
131
|
}
|
|
138
132
|
return builder;
|
|
139
133
|
}).maybeAdd(tablesPlugin, function (plugin, builder) {
|
|
@@ -195,8 +189,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
195
189
|
if (props.collabEdit || props.collabEditProvider) {
|
|
196
190
|
var _collabEditOptions$EX;
|
|
197
191
|
var collabEditOptions = {
|
|
198
|
-
sanitizePrivateContent: props.sanitizePrivateContent
|
|
199
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
192
|
+
sanitizePrivateContent: props.sanitizePrivateContent
|
|
200
193
|
};
|
|
201
194
|
if (props.collabEdit) {
|
|
202
195
|
collabEditOptions = _objectSpread(_objectSpread({}, props.collabEdit), collabEditOptions);
|
|
@@ -285,7 +278,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
285
278
|
return builder.add([plugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.smartLinks), {}, {
|
|
286
279
|
platform: isMobile ? 'mobile' : 'web',
|
|
287
280
|
fullWidthMode: fullWidthMode,
|
|
288
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
289
281
|
linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker,
|
|
290
282
|
editorAppearance: appearance
|
|
291
283
|
})]);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useLayoutEffect, useState } from 'react';
|
|
3
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
3
|
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
5
4
|
import { createPreset } from '../../../create-editor/create-plugins-list';
|
|
6
5
|
import { shouldRecreatePreset } from '../../../create-editor/preset-utils';
|
|
7
6
|
export default function useUniversalPreset(_ref) {
|
|
8
7
|
var props = _ref.props;
|
|
9
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
10
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
11
8
|
var previousEditorProps = usePreviousState(props);
|
|
12
9
|
var _useState = useState(function () {
|
|
13
10
|
return createPreset(props, previousEditorProps);
|
|
@@ -23,7 +20,7 @@ export default function useUniversalPreset(_ref) {
|
|
|
23
20
|
if (!recreate) {
|
|
24
21
|
return;
|
|
25
22
|
}
|
|
26
|
-
setPreset(createPreset(props, previousEditorProps
|
|
27
|
-
}, [props, previousEditorProps
|
|
23
|
+
setPreset(createPreset(props, previousEditorProps));
|
|
24
|
+
}, [props, previousEditorProps]);
|
|
28
25
|
return preset;
|
|
29
26
|
}
|
|
@@ -9,25 +9,32 @@ import { isPerformanceAPIAvailable, measureRender } from '@atlaskit/editor-commo
|
|
|
9
9
|
import { ACTION, EVENT_TYPE } from './types';
|
|
10
10
|
import { analyticsPluginKey } from './plugin-key';
|
|
11
11
|
import { fireAnalyticsEvent, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
12
|
-
function createPlugin(options, featureFlags,
|
|
13
|
-
if (!options
|
|
12
|
+
function createPlugin(options, featureFlags, pluginInjectionApi) {
|
|
13
|
+
if (!options) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
var hasRequiredPerformanceAPIs = isPerformanceAPIAvailable();
|
|
17
|
+
var getCreateAnalyticsEvent = function getCreateAnalyticsEvent() {
|
|
18
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
19
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.sharedState.currentState()) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.createAnalyticsEvent;
|
|
20
|
+
};
|
|
17
21
|
return new SafePlugin({
|
|
18
22
|
key: analyticsPluginKey,
|
|
19
23
|
state: {
|
|
20
24
|
init: function init() {
|
|
25
|
+
var _pluginInjectionApi$d3;
|
|
21
26
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
27
|
+
createAnalyticsEvent: getCreateAnalyticsEvent(),
|
|
22
28
|
fireAnalytics: fireAnalyticsEvent(options.createAnalyticsEvent),
|
|
23
|
-
editorAnalyticsApi:
|
|
29
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions
|
|
24
30
|
});
|
|
25
31
|
},
|
|
26
32
|
apply: function apply(tr, pluginState, _, state) {
|
|
27
|
-
if (pluginState.createAnalyticsEvent !==
|
|
33
|
+
if (pluginState.createAnalyticsEvent !== getCreateAnalyticsEvent()) {
|
|
34
|
+
var _options$createAnalyt;
|
|
28
35
|
// When the plugin state is reconfigured, the init function isn't called again
|
|
29
36
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
30
|
-
createAnalyticsEvent: options.createAnalyticsEvent
|
|
37
|
+
createAnalyticsEvent: (_options$createAnalyt = options.createAnalyticsEvent) !== null && _options$createAnalyt !== void 0 ? _options$createAnalyt : getCreateAnalyticsEvent()
|
|
31
38
|
});
|
|
32
39
|
}
|
|
33
40
|
if (featureFlags.catchAllTracking) {
|
|
@@ -93,8 +100,7 @@ var analyticsPlugin = function analyticsPlugin(options, api) {
|
|
|
93
100
|
return [{
|
|
94
101
|
name: 'analyticsPlugin',
|
|
95
102
|
plugin: function plugin() {
|
|
96
|
-
|
|
97
|
-
return createPlugin(options, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$ana = _api$dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
103
|
+
return createPlugin(options, featureFlags, api);
|
|
98
104
|
}
|
|
99
105
|
}];
|
|
100
106
|
}
|
|
@@ -14,7 +14,6 @@ import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
|
14
14
|
import { queueCards, resolveCard, hideDatasourceModal } from './actions';
|
|
15
15
|
import { pluginKey } from './plugin-key';
|
|
16
16
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* Attempt to replace the link into the respective card.
|
|
20
19
|
*/
|
|
@@ -45,7 +44,7 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
45
44
|
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
46
45
|
return $pos.node($pos.depth - 1).type.name;
|
|
47
46
|
}
|
|
48
|
-
export var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi) {
|
|
47
|
+
export var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) {
|
|
49
48
|
return function (editorState, dispatch) {
|
|
50
49
|
var state = pluginKey.getState(editorState);
|
|
51
50
|
if (!state) {
|
|
@@ -81,7 +80,7 @@ export var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, car
|
|
|
81
80
|
_url$split2 = _slicedToArray(_url$split, 3),
|
|
82
81
|
domainName = _url$split2[2];
|
|
83
82
|
if (state.smartLinkEvents) {
|
|
84
|
-
state.smartLinkEvents.insertSmartLink(domainName, 'inline',
|
|
83
|
+
state.smartLinkEvents.insertSmartLink(domainName, 'inline', createAnalyticsEvent);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
/**
|
|
@@ -26,7 +26,6 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
26
26
|
allowResizing = options.allowResizing,
|
|
27
27
|
useAlternativePreloader = options.useAlternativePreloader,
|
|
28
28
|
fullWidthMode = options.fullWidthMode,
|
|
29
|
-
createAnalyticsEvent = options.createAnalyticsEvent,
|
|
30
29
|
showServerActions = options.showServerActions;
|
|
31
30
|
var inlineCardViewProducer = getInlineNodeViewProducer({
|
|
32
31
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
@@ -46,7 +45,6 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
46
45
|
showLinkingToolbar: false,
|
|
47
46
|
smartLinkEvents: undefined,
|
|
48
47
|
smartLinkEventsNext: undefined,
|
|
49
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
50
48
|
editorAppearance: editorAppearance,
|
|
51
49
|
showDatasourceModal: false,
|
|
52
50
|
datasourceTableRef: undefined,
|
|
@@ -128,8 +126,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
128
126
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
129
127
|
*/
|
|
130
128
|
var invoke = rafSchedule(function () {
|
|
131
|
-
var _pluginInjectionApi$d;
|
|
132
|
-
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);
|
|
129
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
130
|
+
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);
|
|
133
131
|
});
|
|
134
132
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
135
133
|
invoke();
|