@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
|
@@ -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
|
/**
|
|
@@ -16,6 +16,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
|
|
|
16
16
|
import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
|
|
17
17
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
18
18
|
export { pluginKey } from './plugin-key';
|
|
19
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
19
20
|
export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
20
21
|
return function (pmPluginFactoryParams) {
|
|
21
22
|
var lpAnalyticsEventsNext = pmPluginFactoryParams.featureFlags.lpAnalyticsEventsNext;
|
|
@@ -25,8 +26,15 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
25
26
|
allowResizing = options.allowResizing,
|
|
26
27
|
useAlternativePreloader = options.useAlternativePreloader,
|
|
27
28
|
fullWidthMode = options.fullWidthMode,
|
|
28
|
-
createAnalyticsEvent = options.createAnalyticsEvent,
|
|
29
29
|
showServerActions = options.showServerActions;
|
|
30
|
+
var inlineCardViewProducer = getInlineNodeViewProducer({
|
|
31
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
32
|
+
Component: InlineCardNodeView,
|
|
33
|
+
extraComponentProps: {
|
|
34
|
+
useAlternativePreloader: useAlternativePreloader,
|
|
35
|
+
showServerActions: showServerActions
|
|
36
|
+
}
|
|
37
|
+
});
|
|
30
38
|
return new SafePlugin({
|
|
31
39
|
state: {
|
|
32
40
|
init: function init() {
|
|
@@ -37,7 +45,6 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
37
45
|
showLinkingToolbar: false,
|
|
38
46
|
smartLinkEvents: undefined,
|
|
39
47
|
smartLinkEventsNext: undefined,
|
|
40
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
41
48
|
editorAppearance: editorAppearance,
|
|
42
49
|
showDatasourceModal: false,
|
|
43
50
|
datasourceTableRef: undefined,
|
|
@@ -119,8 +126,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
119
126
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
120
127
|
*/
|
|
121
128
|
var invoke = rafSchedule(function () {
|
|
122
|
-
var _pluginInjectionApi$d;
|
|
123
|
-
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);
|
|
124
131
|
});
|
|
125
132
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
126
133
|
invoke();
|
|
@@ -139,15 +146,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
139
146
|
},
|
|
140
147
|
props: {
|
|
141
148
|
nodeViews: {
|
|
142
|
-
inlineCard:
|
|
143
|
-
|
|
144
|
-
Component: InlineCardNodeView,
|
|
145
|
-
extraComponentProps: {
|
|
146
|
-
useAlternativePreloader: useAlternativePreloader,
|
|
147
|
-
showServerActions: showServerActions
|
|
148
|
-
}
|
|
149
|
-
}),
|
|
150
|
-
blockCard: function blockCard(node, view, getPos) {
|
|
149
|
+
inlineCard: inlineCardViewProducer,
|
|
150
|
+
blockCard: function blockCard(node, view, getPos, decorations) {
|
|
151
151
|
var _node$attrs3;
|
|
152
152
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
153
153
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
@@ -158,15 +158,20 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
158
158
|
var hasIntlContext = true;
|
|
159
159
|
var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
|
|
160
160
|
if (isDatasource) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
var _node$attrs4;
|
|
162
|
+
if (canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.datasource)) {
|
|
163
|
+
return new Datasource({
|
|
164
|
+
node: node,
|
|
165
|
+
view: view,
|
|
166
|
+
getPos: getPos,
|
|
167
|
+
portalProviderAPI: portalProviderAPI,
|
|
168
|
+
eventDispatcher: eventDispatcher,
|
|
169
|
+
hasIntlContext: hasIntlContext,
|
|
170
|
+
pluginInjectionApi: pluginInjectionApi
|
|
171
|
+
}).init();
|
|
172
|
+
} else {
|
|
173
|
+
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
174
|
+
}
|
|
170
175
|
}
|
|
171
176
|
return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
172
177
|
},
|
|
@@ -5,14 +5,14 @@ import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
|
|
|
5
5
|
// ============================================================================ //
|
|
6
6
|
// Used for all interactions with the EditorCardProvider.
|
|
7
7
|
// ============================================================================ //
|
|
8
|
-
export var resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi) {
|
|
8
|
+
export var resolveWithProvider = function 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
|
var 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
|
-
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, options), handleRejected(view, request, editorAnalyticsApi));
|
|
15
|
+
var 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
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
|
@@ -24,10 +24,10 @@ var updateCardType = function updateCardType(resolvedCard, options) {
|
|
|
24
24
|
resolvedCard.type = 'inlineCard';
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
var handleResolved = function handleResolved(view, request, editorAnalyticsApi, options) {
|
|
27
|
+
var handleResolved = function handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options) {
|
|
28
28
|
return function (resolvedCard) {
|
|
29
29
|
updateCardType(resolvedCard, options);
|
|
30
|
-
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi)(view.state, view.dispatch);
|
|
30
|
+
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi, createAnalyticsEvent)(view.state, view.dispatch);
|
|
31
31
|
return resolvedCard;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
@@ -23,6 +23,7 @@ import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
23
23
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
24
24
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
25
25
|
import { SmallerEditIcon } from './ui/SmallerEditIcon';
|
|
26
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
26
27
|
export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
27
28
|
return commandWithMetadata(function (state, dispatch) {
|
|
28
29
|
if (!(state.selection instanceof NodeSelection)) {
|
|
@@ -162,7 +163,7 @@ var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
|
162
163
|
};
|
|
163
164
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
164
165
|
return function (node) {
|
|
165
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs;
|
|
166
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2;
|
|
166
167
|
var _titleUrlPairFromNode2 = titleUrlPairFromNode(node),
|
|
167
168
|
url = _titleUrlPairFromNode2.url;
|
|
168
169
|
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.analytics) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
@@ -183,6 +184,9 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
183
184
|
var _ref2 = (_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 : {},
|
|
184
185
|
hoverDecoration = _ref2.hoverDecoration;
|
|
185
186
|
var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
|
|
187
|
+
var shouldRenderDatasourceToolbar = isDatasource &&
|
|
188
|
+
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
189
|
+
platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.datasource);
|
|
186
190
|
|
|
187
191
|
/* mobile builds toolbar natively using toolbarItems */
|
|
188
192
|
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -199,8 +203,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
199
203
|
node: node,
|
|
200
204
|
editorAnalyticsApi: editorAnalyticsApi
|
|
201
205
|
})];
|
|
202
|
-
|
|
203
|
-
} else if (isDatasource && platform !== 'mobile') {
|
|
206
|
+
} else if (shouldRenderDatasourceToolbar) {
|
|
204
207
|
return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
|
|
205
208
|
} else {
|
|
206
209
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
@@ -314,7 +317,7 @@ var getSettingsButtonGroup = function getSettingsButtonGroup(state, featureFlags
|
|
|
314
317
|
}] : [];
|
|
315
318
|
};
|
|
316
319
|
var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) {
|
|
317
|
-
var _node$
|
|
320
|
+
var _node$attrs3;
|
|
318
321
|
var toolbarItems = [{
|
|
319
322
|
id: 'editor.edit.datasource',
|
|
320
323
|
type: 'button',
|
|
@@ -324,7 +327,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata
|
|
|
324
327
|
title: intl.formatMessage(linkToolbarMessages.editDatasource),
|
|
325
328
|
onClick: editDatasource(editorAnalyticsApi)
|
|
326
329
|
}];
|
|
327
|
-
if (node !== null && node !== void 0 && (_node$
|
|
330
|
+
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
328
331
|
toolbarItems.push({
|
|
329
332
|
type: 'separator'
|
|
330
333
|
}, {
|
|
@@ -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 var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags, editorAnalyticsApi) {
|
|
5
5
|
return function (error) {
|
|
6
6
|
var browserExtensions = sniffUserBrowserExtensions({
|
|
7
7
|
extensions: ['grammarly']
|
|
@@ -20,12 +20,13 @@ export var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(stat
|
|
|
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 var addSynchronyEntityAnalytics = function addSynchronyEntityAnalytics(state, tr) {
|
|
27
|
-
return function (type) {
|
|
28
|
-
|
|
28
|
+
return function (type, editorAnalyticsApi) {
|
|
29
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
29
30
|
action: type === 'error' ? ACTION.SYNCHRONY_ENTITY_ERROR : ACTION.SYNCHRONY_DISCONNECTED,
|
|
30
31
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
31
32
|
eventType: EVENT_TYPE.OPERATIONAL,
|
|
@@ -34,6 +35,7 @@ export var addSynchronyEntityAnalytics = function addSynchronyEntityAnalytics(st
|
|
|
34
35
|
onLine: navigator.onLine,
|
|
35
36
|
visibilityState: document.visibilityState
|
|
36
37
|
}
|
|
37
|
-
});
|
|
38
|
+
})(tr);
|
|
39
|
+
return tr;
|
|
38
40
|
};
|
|
39
41
|
};
|
|
@@ -15,14 +15,14 @@ var effect = function effect(fn, eq) {
|
|
|
15
15
|
return cleanup;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export var subscribe = effect(function (view, provider, options, featureFlags, _providerFactory) {
|
|
18
|
+
export var subscribe = effect(function (view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) {
|
|
19
19
|
var entityRef;
|
|
20
20
|
var entityHandlers = {
|
|
21
21
|
disconnectedHandler: function disconnectedHandler() {
|
|
22
|
-
addSynchronyEntityAnalytics(view.state, view.state.tr)('disconnected');
|
|
22
|
+
addSynchronyEntityAnalytics(view.state, view.state.tr)('disconnected', editorAnalyticsApi);
|
|
23
23
|
},
|
|
24
24
|
errorHandler: function errorHandler() {
|
|
25
|
-
addSynchronyEntityAnalytics(view.state, view.state.tr)('error');
|
|
25
|
+
addSynchronyEntityAnalytics(view.state, view.state.tr)('error', editorAnalyticsApi);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
var unsubscribeSynchronyEntity = function unsubscribeSynchronyEntity() {
|
|
@@ -58,7 +58,7 @@ export var subscribe = effect(function (view, provider, options, featureFlags, _
|
|
|
58
58
|
view.dispatch(tr);
|
|
59
59
|
},
|
|
60
60
|
errorHandler: function errorHandler(error) {
|
|
61
|
-
addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags)(error);
|
|
61
|
+
addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags, editorAnalyticsApi)(error);
|
|
62
62
|
},
|
|
63
63
|
entityHandler: function entityHandler(_ref) {
|
|
64
64
|
var entity = _ref.entity;
|
|
@@ -24,14 +24,15 @@ export var initialize = function initialize(_ref) {
|
|
|
24
24
|
var options = _ref.options,
|
|
25
25
|
providerFactory = _ref.providerFactory,
|
|
26
26
|
view = _ref.view,
|
|
27
|
-
featureFlags = _ref.featureFlags
|
|
27
|
+
featureFlags = _ref.featureFlags,
|
|
28
|
+
editorAnalyticsApi = _ref.editorAnalyticsApi;
|
|
28
29
|
return function (provider) {
|
|
29
30
|
var cleanup;
|
|
30
31
|
var pluginState = pluginKey.getState(view.state);
|
|
31
32
|
if (pluginState !== null && pluginState !== void 0 && pluginState.isReady && cleanup) {
|
|
32
33
|
cleanup();
|
|
33
34
|
}
|
|
34
|
-
cleanup = subscribe(view, provider, options, featureFlags, providerFactory);
|
|
35
|
+
cleanup = subscribe(view, provider, options, featureFlags, providerFactory, editorAnalyticsApi);
|
|
35
36
|
|
|
36
37
|
// Initialize provider
|
|
37
38
|
if (options.useNativePlugin) {
|
|
@@ -82,12 +82,13 @@ var collabEditPlugin = function collabEditPlugin(options, api) {
|
|
|
82
82
|
plugin: function plugin(_ref3) {
|
|
83
83
|
var dispatch = _ref3.dispatch,
|
|
84
84
|
providerFactory = _ref3.providerFactory;
|
|
85
|
-
return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags);
|
|
85
|
+
return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
|
|
86
86
|
}
|
|
87
87
|
}]);
|
|
88
88
|
},
|
|
89
89
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
90
|
-
var
|
|
90
|
+
var _api$dependencies$ana;
|
|
91
|
+
var 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);
|
|
91
92
|
executeProviderCode(sendTransaction({
|
|
92
93
|
originalTransaction: props.originalTransaction,
|
|
93
94
|
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 var createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags) {
|
|
9
|
-
var fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
|
|
8
|
+
export var createPlugin = function 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 var createPlugin = function createPlugin(dispatch, providerFactory, provi
|
|
|
40
39
|
return true;
|
|
41
40
|
},
|
|
42
41
|
view: function view(_view) {
|
|
43
|
-
var
|
|
42
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d5;
|
|
43
|
+
var 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
|
var onSyncUpError = function onSyncUpError(attributes) {
|
|
45
|
+
var _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
46
|
+
var 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 var createPlugin = function createPlugin(dispatch, providerFactory, provi
|
|
|
56
58
|
view: _view,
|
|
57
59
|
options: options,
|
|
58
60
|
providerFactory: providerFactory,
|
|
59
|
-
featureFlags: featureFlags
|
|
61
|
+
featureFlags: 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', function (_name, providerPromise) {
|
|
62
65
|
if (providerPromise) {
|
|
@@ -10,7 +10,7 @@ import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
|
10
10
|
import { EmojiTypeAheadItem, SearchSort, recordSelectionSucceededSli, recordSelectionFailedSli } from '@atlaskit/emoji';
|
|
11
11
|
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
12
12
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
13
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
13
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import { IconEmoji } from '../quick-insert/assets';
|
|
15
15
|
import { EmojiNodeView } from './nodeviews/emoji';
|
|
16
16
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
@@ -60,7 +60,7 @@ var isFullShortName = function isFullShortName(query) {
|
|
|
60
60
|
return query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
61
61
|
};
|
|
62
62
|
var TRIGGER = ':';
|
|
63
|
-
var emojiPlugin = function emojiPlugin(options) {
|
|
63
|
+
var emojiPlugin = function emojiPlugin(options, api) {
|
|
64
64
|
var typeAhead = {
|
|
65
65
|
id: TypeAheadAvailableNodes.EMOJI,
|
|
66
66
|
trigger: TRIGGER,
|
|
@@ -121,6 +121,7 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
121
121
|
return matchedItem;
|
|
122
122
|
},
|
|
123
123
|
selectItem: function selectItem(state, item, insert, _ref5) {
|
|
124
|
+
var _api$dependencies$ana7;
|
|
124
125
|
var mode = _ref5.mode;
|
|
125
126
|
var _item$emoji = item.emoji,
|
|
126
127
|
_item$emoji$id = _item$emoji.id,
|
|
@@ -130,7 +131,12 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
130
131
|
var text = fallback || shortName;
|
|
131
132
|
var emojiPluginState = emojiPluginKey.getState(state);
|
|
132
133
|
if (emojiPluginState.emojiProvider && emojiPluginState.emojiProvider.recordSelection && item.emoji) {
|
|
133
|
-
|
|
134
|
+
var _api$dependencies$ana, _api$dependencies$ana2, _api$dependencies$ana3, _api$dependencies$ana4, _api$dependencies$ana5, _api$dependencies$ana6;
|
|
135
|
+
emojiPluginState.emojiProvider.recordSelection(item.emoji).then(recordSelectionSucceededSli({
|
|
136
|
+
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
|
|
137
|
+
})).catch(recordSelectionFailedSli({
|
|
138
|
+
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
|
|
139
|
+
}));
|
|
134
140
|
}
|
|
135
141
|
var emojiNode = state.schema.nodes.emoji.createChecked({
|
|
136
142
|
shortName: shortName,
|
|
@@ -138,7 +144,8 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
138
144
|
text: text
|
|
139
145
|
});
|
|
140
146
|
var space = state.schema.text(' ');
|
|
141
|
-
|
|
147
|
+
var tr = insert(Fragment.from([emojiNode, space]));
|
|
148
|
+
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({
|
|
142
149
|
action: ACTION.INSERTED,
|
|
143
150
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
144
151
|
actionSubjectId: ACTION_SUBJECT_ID.EMOJI,
|
|
@@ -146,7 +153,8 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
146
153
|
inputMethod: INPUT_METHOD.TYPEAHEAD
|
|
147
154
|
},
|
|
148
155
|
eventType: EVENT_TYPE.TRACK
|
|
149
|
-
});
|
|
156
|
+
})(tr);
|
|
157
|
+
return tr;
|
|
150
158
|
}
|
|
151
159
|
};
|
|
152
160
|
return {
|
|
@@ -186,12 +194,13 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
186
194
|
return /*#__PURE__*/React.createElement(IconEmoji, null);
|
|
187
195
|
},
|
|
188
196
|
action: function action(insert, state) {
|
|
197
|
+
var _api$dependencies$ana8;
|
|
189
198
|
var tr = insert(undefined);
|
|
190
199
|
openTypeAheadAtCursor({
|
|
191
200
|
triggerHandler: typeAhead,
|
|
192
201
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
193
202
|
})(tr);
|
|
194
|
-
|
|
203
|
+
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({
|
|
195
204
|
action: ACTION.INVOKED,
|
|
196
205
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
197
206
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
@@ -199,7 +208,8 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
199
208
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
200
209
|
},
|
|
201
210
|
eventType: EVENT_TYPE.UI
|
|
202
|
-
});
|
|
211
|
+
})(tr);
|
|
212
|
+
return tr;
|
|
203
213
|
}
|
|
204
214
|
}];
|
|
205
215
|
},
|