@atlaskit/editor-core 185.13.1 → 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 +10 -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 +7 -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
|
@@ -20,7 +20,7 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
|
20
20
|
var _emoji2 = require("@atlaskit/emoji");
|
|
21
21
|
var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
|
|
22
22
|
var _asciiInputRules = require("./pm-plugins/ascii-input-rules");
|
|
23
|
-
var _analytics = require("
|
|
23
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
24
24
|
var _assets = require("../quick-insert/assets");
|
|
25
25
|
var _emoji3 = require("./nodeviews/emoji");
|
|
26
26
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
@@ -74,7 +74,7 @@ var isFullShortName = function isFullShortName(query) {
|
|
|
74
74
|
return query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
75
75
|
};
|
|
76
76
|
var TRIGGER = ':';
|
|
77
|
-
var emojiPlugin = function emojiPlugin(options) {
|
|
77
|
+
var emojiPlugin = function emojiPlugin(options, api) {
|
|
78
78
|
var typeAhead = {
|
|
79
79
|
id: _typeAhead.TypeAheadAvailableNodes.EMOJI,
|
|
80
80
|
trigger: TRIGGER,
|
|
@@ -135,6 +135,7 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
135
135
|
return matchedItem;
|
|
136
136
|
},
|
|
137
137
|
selectItem: function selectItem(state, item, insert, _ref5) {
|
|
138
|
+
var _api$dependencies$ana7;
|
|
138
139
|
var mode = _ref5.mode;
|
|
139
140
|
var _item$emoji = item.emoji,
|
|
140
141
|
_item$emoji$id = _item$emoji.id,
|
|
@@ -144,7 +145,12 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
144
145
|
var text = fallback || shortName;
|
|
145
146
|
var emojiPluginState = emojiPluginKey.getState(state);
|
|
146
147
|
if (emojiPluginState.emojiProvider && emojiPluginState.emojiProvider.recordSelection && item.emoji) {
|
|
147
|
-
|
|
148
|
+
var _api$dependencies$ana, _api$dependencies$ana2, _api$dependencies$ana3, _api$dependencies$ana4, _api$dependencies$ana5, _api$dependencies$ana6;
|
|
149
|
+
emojiPluginState.emojiProvider.recordSelection(item.emoji).then((0, _emoji2.recordSelectionSucceededSli)({
|
|
150
|
+
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
|
|
151
|
+
})).catch((0, _emoji2.recordSelectionFailedSli)({
|
|
152
|
+
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
|
|
153
|
+
}));
|
|
148
154
|
}
|
|
149
155
|
var emojiNode = state.schema.nodes.emoji.createChecked({
|
|
150
156
|
shortName: shortName,
|
|
@@ -152,7 +158,8 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
152
158
|
text: text
|
|
153
159
|
});
|
|
154
160
|
var space = state.schema.text(' ');
|
|
155
|
-
|
|
161
|
+
var tr = insert(_prosemirrorModel.Fragment.from([emojiNode, space]));
|
|
162
|
+
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({
|
|
156
163
|
action: _analytics.ACTION.INSERTED,
|
|
157
164
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
158
165
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.EMOJI,
|
|
@@ -160,7 +167,8 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
160
167
|
inputMethod: _analytics.INPUT_METHOD.TYPEAHEAD
|
|
161
168
|
},
|
|
162
169
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
163
|
-
});
|
|
170
|
+
})(tr);
|
|
171
|
+
return tr;
|
|
164
172
|
}
|
|
165
173
|
};
|
|
166
174
|
return {
|
|
@@ -200,12 +208,13 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
200
208
|
return /*#__PURE__*/_react.default.createElement(_assets.IconEmoji, null);
|
|
201
209
|
},
|
|
202
210
|
action: function action(insert, state) {
|
|
211
|
+
var _api$dependencies$ana8;
|
|
203
212
|
var tr = insert(undefined);
|
|
204
213
|
(0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
|
|
205
214
|
triggerHandler: typeAhead,
|
|
206
215
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
207
216
|
})(tr);
|
|
208
|
-
|
|
217
|
+
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({
|
|
209
218
|
action: _analytics.ACTION.INVOKED,
|
|
210
219
|
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
211
220
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
@@ -213,7 +222,8 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
213
222
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
214
223
|
},
|
|
215
224
|
eventType: _analytics.EVENT_TYPE.UI
|
|
216
|
-
});
|
|
225
|
+
})(tr);
|
|
226
|
+
return tr;
|
|
217
227
|
}
|
|
218
228
|
}];
|
|
219
229
|
},
|
|
@@ -28,10 +28,12 @@ var _main = require("./pm-plugins/main");
|
|
|
28
28
|
var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
29
29
|
var sessionId = (0, _uuid.default)();
|
|
30
30
|
var fireEvent = function fireEvent(payload) {
|
|
31
|
-
|
|
31
|
+
var _api$dependencies$ana, _api$dependencies$ana2;
|
|
32
|
+
var _ref = (_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 : {},
|
|
33
|
+
createAnalyticsEvent = _ref.createAnalyticsEvent;
|
|
34
|
+
if (!createAnalyticsEvent) {
|
|
32
35
|
return;
|
|
33
36
|
}
|
|
34
|
-
var createAnalyticsEvent = options.createAnalyticsEvent;
|
|
35
37
|
if (payload.attributes && !payload.attributes.sessionId) {
|
|
36
38
|
payload.attributes.sessionId = sessionId;
|
|
37
39
|
}
|
|
@@ -59,17 +61,17 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
59
61
|
}
|
|
60
62
|
}];
|
|
61
63
|
},
|
|
62
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
63
|
-
var editorView =
|
|
64
|
-
disabled =
|
|
64
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref2) {
|
|
65
|
+
var editorView = _ref2.editorView,
|
|
66
|
+
disabled = _ref2.disabled;
|
|
65
67
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
66
68
|
editorView: editorView,
|
|
67
69
|
plugins: {
|
|
68
70
|
mentionState: _key.mentionPluginKey
|
|
69
71
|
},
|
|
70
|
-
render: function render(
|
|
71
|
-
var
|
|
72
|
-
mentionState =
|
|
72
|
+
render: function render(_ref3) {
|
|
73
|
+
var _ref3$mentionState = _ref3.mentionState,
|
|
74
|
+
mentionState = _ref3$mentionState === void 0 ? {} : _ref3$mentionState;
|
|
73
75
|
return !mentionState.mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
74
76
|
editorView: editorView,
|
|
75
77
|
isDisabled: disabled || (0, _utils.isTypeAheadAllowed)(editorView.state)
|
|
@@ -78,8 +80,8 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
78
80
|
});
|
|
79
81
|
},
|
|
80
82
|
pluginsOptions: {
|
|
81
|
-
quickInsert: function quickInsert(
|
|
82
|
-
var formatMessage =
|
|
83
|
+
quickInsert: function quickInsert(_ref4) {
|
|
84
|
+
var formatMessage = _ref4.formatMessage;
|
|
83
85
|
return [{
|
|
84
86
|
id: 'mention',
|
|
85
87
|
title: formatMessage(_messages.messages.mention),
|
|
@@ -91,13 +93,13 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
91
93
|
return /*#__PURE__*/_react.default.createElement(_assets.IconMention, null);
|
|
92
94
|
},
|
|
93
95
|
action: function action(insert, state) {
|
|
94
|
-
var _api$dependencies$
|
|
96
|
+
var _api$dependencies$ana3;
|
|
95
97
|
var tr = insert(undefined);
|
|
96
98
|
(0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
|
|
97
99
|
triggerHandler: typeAhead,
|
|
98
100
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
99
101
|
})(tr);
|
|
100
|
-
api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
102
|
+
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({
|
|
101
103
|
action: _analytics.ACTION.INVOKED,
|
|
102
104
|
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
103
105
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.
|
|
9
|
+
var version = "185.14.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -105,8 +105,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
105
105
|
* Note: The order that presets are added determines
|
|
106
106
|
* their placement in the editor toolbar
|
|
107
107
|
*/
|
|
108
|
-
export default function createPluginsList(props, prevProps
|
|
109
|
-
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props
|
|
108
|
+
export default function createPluginsList(props, prevProps) {
|
|
109
|
+
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
110
110
|
const excludes = new Set();
|
|
111
111
|
if (!isCodeBlockAllowed({
|
|
112
112
|
allowBlockType: props.allowBlockType
|
|
@@ -132,8 +132,8 @@ function withDangerouslyAppendPlugins(preset) {
|
|
|
132
132
|
return presetWithAppendedPlugins;
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
export function createPreset(props, prevProps
|
|
135
|
+
export function createPreset(props, prevProps) {
|
|
136
136
|
var _props$dangerouslyApp;
|
|
137
|
-
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props
|
|
137
|
+
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
138
138
|
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
139
139
|
}
|
|
@@ -2,14 +2,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
|
|
4
4
|
import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
|
|
5
|
-
|
|
5
|
+
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// import uuid from 'uuid/v4';
|
|
9
|
+
import { name, version } from '../version-wrapper';
|
|
10
|
+
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
11
|
+
import uuid from 'uuid/v4';
|
|
13
12
|
import EditorActions from '../actions';
|
|
14
13
|
import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
15
14
|
import EditorInternal from './editor-internal';
|
|
@@ -20,8 +19,6 @@ import deprecationWarnings from './utils/deprecationWarnings';
|
|
|
20
19
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
21
20
|
import { basePlugin } from '../plugins';
|
|
22
21
|
export default class EditorNext extends React.Component {
|
|
23
|
-
// private editorSessionId: string;
|
|
24
|
-
|
|
25
22
|
constructor(props, context) {
|
|
26
23
|
super(props);
|
|
27
24
|
_defineProperty(this, "handleSave", view => {
|
|
@@ -35,7 +32,7 @@ export default class EditorNext extends React.Component {
|
|
|
35
32
|
_defineProperty(this, "getExperienceStore", () => this.experienceStore);
|
|
36
33
|
deprecationWarnings(props);
|
|
37
34
|
this.editorActions = (context || {}).editorActions || new EditorActions();
|
|
38
|
-
|
|
35
|
+
this.editorSessionId = uuid();
|
|
39
36
|
this.startTime = performance.now();
|
|
40
37
|
this.onEditorCreated = this.onEditorCreated.bind(this);
|
|
41
38
|
this.onEditorDestroyed = this.onEditorDestroyed.bind(this);
|
|
@@ -57,38 +54,27 @@ export default class EditorNext extends React.Component {
|
|
|
57
54
|
this.editorActions._privateUnregisterEditor();
|
|
58
55
|
}
|
|
59
56
|
render() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
props: this.props,
|
|
80
|
-
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
81
|
-
createAnalyticsEvent: this.createAnalyticsEvent,
|
|
82
|
-
preset: this.props.preset,
|
|
83
|
-
handleSave: this.handleSave,
|
|
84
|
-
editorActions: this.editorActions,
|
|
85
|
-
getExperienceStore: this.getExperienceStore,
|
|
86
|
-
onEditorCreated: this.onEditorCreated,
|
|
87
|
-
onEditorDestroyed: this.onEditorDestroyed
|
|
88
|
-
})
|
|
57
|
+
return jsx(FabricEditorAnalyticsContext, {
|
|
58
|
+
data: {
|
|
59
|
+
packageName: name,
|
|
60
|
+
packageVersion: version,
|
|
61
|
+
componentName: 'editorCore',
|
|
62
|
+
appearance: getAnalyticsAppearance(this.props.appearance),
|
|
63
|
+
editorSessionId: this.editorSessionId
|
|
64
|
+
}
|
|
65
|
+
}, jsx(WithCreateAnalyticsEvent, {
|
|
66
|
+
render: createAnalyticsEvent => (this.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
|
|
67
|
+
props: this.props,
|
|
68
|
+
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
69
|
+
createAnalyticsEvent: this.createAnalyticsEvent,
|
|
70
|
+
preset: this.props.preset,
|
|
71
|
+
handleSave: this.handleSave,
|
|
72
|
+
editorActions: this.editorActions,
|
|
73
|
+
getExperienceStore: this.getExperienceStore,
|
|
74
|
+
onEditorCreated: this.onEditorCreated,
|
|
75
|
+
onEditorDestroyed: this.onEditorDestroyed
|
|
89
76
|
})
|
|
90
|
-
|
|
91
|
-
);
|
|
77
|
+
}));
|
|
92
78
|
}
|
|
93
79
|
}
|
|
94
80
|
_defineProperty(EditorNext, "defaultProps", {
|
package/dist/es2019/editor.js
CHANGED
|
@@ -6,10 +6,6 @@ import React from 'react';
|
|
|
6
6
|
import { defaultProps } from './editor-next/utils/editorPropTypes';
|
|
7
7
|
import EditorNext from './editor-next';
|
|
8
8
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
9
|
-
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
10
|
-
import { name, version } from './version-wrapper';
|
|
11
|
-
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
12
|
-
import uuid from 'uuid/v4';
|
|
13
9
|
const EditorNextWrapper = ({
|
|
14
10
|
props
|
|
15
11
|
}) => {
|
|
@@ -21,29 +17,10 @@ const EditorNextWrapper = ({
|
|
|
21
17
|
}, props));
|
|
22
18
|
};
|
|
23
19
|
export default class Editor extends React.Component {
|
|
24
|
-
constructor(...args) {
|
|
25
|
-
super(...args);
|
|
26
|
-
_defineProperty(this, "editorSessionId", uuid());
|
|
27
|
-
}
|
|
28
20
|
render() {
|
|
29
|
-
|
|
30
|
-
// Move `FabricEditorAnalyticsContext` back into `EditorNext`
|
|
31
|
-
// This was moved out here to workaround the issue that the analytics
|
|
32
|
-
// context does not wrap the Preset (and therefore does not pass this context
|
|
33
|
-
// information to analytics calls within plugins). After this cleanup task ^ we will
|
|
34
|
-
// not have to generate the `createAnalyticsEvent` outside the Preset
|
|
35
|
-
// and we can move this back into `EditorNext`.
|
|
36
|
-
return jsx(FabricEditorAnalyticsContext, {
|
|
37
|
-
data: {
|
|
38
|
-
packageName: name,
|
|
39
|
-
packageVersion: version,
|
|
40
|
-
componentName: 'editorCore',
|
|
41
|
-
appearance: getAnalyticsAppearance(this.props.appearance),
|
|
42
|
-
editorSessionId: this.editorSessionId
|
|
43
|
-
}
|
|
44
|
-
}, jsx(EditorNextWrapper, {
|
|
21
|
+
return jsx(EditorNextWrapper, {
|
|
45
22
|
props: this.props
|
|
46
|
-
})
|
|
23
|
+
});
|
|
47
24
|
}
|
|
48
25
|
}
|
|
49
26
|
_defineProperty(Editor, "defaultProps", defaultProps);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createEditorSelectionAPI } from '../../../selection-api/api';
|
|
1
2
|
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';
|
|
2
3
|
import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
3
4
|
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
@@ -8,7 +9,6 @@ import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
|
|
|
8
9
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
9
10
|
import { createDefaultPreset } from './default';
|
|
10
11
|
import { shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
11
|
-
import { createStubInternalApis } from './create-stub-internal-apis';
|
|
12
12
|
/**
|
|
13
13
|
* Creates a preset with all of the available plugins.
|
|
14
14
|
* Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
|
|
@@ -20,17 +20,12 @@ import { createStubInternalApis } from './create-stub-internal-apis';
|
|
|
20
20
|
* @param prevAppearance The appearance of the editor in the previous render
|
|
21
21
|
* @returns a full featured preset configured according to the provided props - basis for create-plugins-list
|
|
22
22
|
*/
|
|
23
|
-
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
23
|
+
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
|
|
24
24
|
const isMobile = appearance === 'mobile';
|
|
25
25
|
const isComment = appearance === 'comment';
|
|
26
26
|
const isFullPage = fullPageCheck(appearance);
|
|
27
27
|
const getEditorFeatureFlags = () => featureFlags;
|
|
28
|
-
const
|
|
29
|
-
const {
|
|
30
|
-
editorSelectionAPI,
|
|
31
|
-
stubInternalApisPlugin
|
|
32
|
-
} = stubs;
|
|
33
|
-
const createAnalyticsEvent = maybeCreateAnalyticsEvent ? maybeCreateAnalyticsEvent : stubs.createAnalyticsEvent;
|
|
28
|
+
const editorSelectionAPI = createEditorSelectionAPI();
|
|
34
29
|
const defaultPreset = createDefaultPreset({
|
|
35
30
|
...props,
|
|
36
31
|
createAnalyticsEvent
|
|
@@ -42,7 +37,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
42
37
|
}
|
|
43
38
|
return false;
|
|
44
39
|
};
|
|
45
|
-
const finalPreset = defaultPreset.add(
|
|
40
|
+
const finalPreset = defaultPreset.add(dataConsumerMarkPlugin).add(contentInsertionPlugin).maybeAdd(breakoutPlugin, (plugin, builder) => {
|
|
46
41
|
if (props.allowBreakout && isFullPage) {
|
|
47
42
|
return builder.add([plugin, {
|
|
48
43
|
allowBreakoutButton: appearance === 'full-page'
|
|
@@ -119,7 +114,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
119
114
|
if (props.mentionProvider) {
|
|
120
115
|
var _props$mention$insert, _props$mention, _props$mention2;
|
|
121
116
|
return builder.add([plugin, {
|
|
122
|
-
createAnalyticsEvent,
|
|
123
117
|
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
124
118
|
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,
|
|
125
119
|
allowZeroWidthSpaceAfter: !isMobile,
|
|
@@ -129,9 +123,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
129
123
|
return builder;
|
|
130
124
|
}).maybeAdd(emojiPlugin, (plugin, builder) => {
|
|
131
125
|
if (props.emojiProvider) {
|
|
132
|
-
return builder.add(
|
|
133
|
-
createAnalyticsEvent
|
|
134
|
-
}]);
|
|
126
|
+
return builder.add(plugin);
|
|
135
127
|
}
|
|
136
128
|
return builder;
|
|
137
129
|
}).maybeAdd(tablesPlugin, (plugin, builder) => {
|
|
@@ -193,8 +185,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
193
185
|
if (props.collabEdit || props.collabEditProvider) {
|
|
194
186
|
var _collabEditOptions$EX;
|
|
195
187
|
let collabEditOptions = {
|
|
196
|
-
sanitizePrivateContent: props.sanitizePrivateContent
|
|
197
|
-
createAnalyticsEvent
|
|
188
|
+
sanitizePrivateContent: props.sanitizePrivateContent
|
|
198
189
|
};
|
|
199
190
|
if (props.collabEdit) {
|
|
200
191
|
collabEditOptions = {
|
|
@@ -291,7 +282,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
291
282
|
...((_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.smartLinks),
|
|
292
283
|
platform: isMobile ? 'mobile' : 'web',
|
|
293
284
|
fullWidthMode,
|
|
294
|
-
createAnalyticsEvent,
|
|
295
285
|
linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker,
|
|
296
286
|
editorAppearance: appearance
|
|
297
287
|
}]);
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { useLayoutEffect, useState } from 'react';
|
|
2
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
2
|
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { createPreset } from '../../../create-editor/create-plugins-list';
|
|
5
4
|
import { shouldRecreatePreset } from '../../../create-editor/preset-utils';
|
|
6
5
|
export default function useUniversalPreset({
|
|
7
6
|
props
|
|
8
7
|
}) {
|
|
9
|
-
const {
|
|
10
|
-
createAnalyticsEvent
|
|
11
|
-
} = useAnalyticsEvents();
|
|
12
8
|
const previousEditorProps = usePreviousState(props);
|
|
13
9
|
const [preset, setPreset] = useState(() => createPreset(props, previousEditorProps));
|
|
14
10
|
useLayoutEffect(() => {
|
|
@@ -19,7 +15,7 @@ export default function useUniversalPreset({
|
|
|
19
15
|
if (!recreate) {
|
|
20
16
|
return;
|
|
21
17
|
}
|
|
22
|
-
setPreset(createPreset(props, previousEditorProps
|
|
23
|
-
}, [props, previousEditorProps
|
|
18
|
+
setPreset(createPreset(props, previousEditorProps));
|
|
19
|
+
}, [props, previousEditorProps]);
|
|
24
20
|
return preset;
|
|
25
21
|
}
|
|
@@ -3,27 +3,34 @@ import { isPerformanceAPIAvailable, measureRender } from '@atlaskit/editor-commo
|
|
|
3
3
|
import { ACTION, EVENT_TYPE } from './types';
|
|
4
4
|
import { analyticsPluginKey } from './plugin-key';
|
|
5
5
|
import { fireAnalyticsEvent, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
function createPlugin(options, featureFlags,
|
|
7
|
-
if (!options
|
|
6
|
+
function createPlugin(options, featureFlags, pluginInjectionApi) {
|
|
7
|
+
if (!options) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
const hasRequiredPerformanceAPIs = isPerformanceAPIAvailable();
|
|
11
|
+
const getCreateAnalyticsEvent = () => {
|
|
12
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
13
|
+
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;
|
|
14
|
+
};
|
|
11
15
|
return new SafePlugin({
|
|
12
16
|
key: analyticsPluginKey,
|
|
13
17
|
state: {
|
|
14
18
|
init: () => {
|
|
19
|
+
var _pluginInjectionApi$d3;
|
|
15
20
|
return {
|
|
16
21
|
...options,
|
|
22
|
+
createAnalyticsEvent: getCreateAnalyticsEvent(),
|
|
17
23
|
fireAnalytics: fireAnalyticsEvent(options.createAnalyticsEvent),
|
|
18
|
-
editorAnalyticsApi
|
|
24
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions
|
|
19
25
|
};
|
|
20
26
|
},
|
|
21
27
|
apply: (tr, pluginState, _, state) => {
|
|
22
|
-
if (pluginState.createAnalyticsEvent !==
|
|
28
|
+
if (pluginState.createAnalyticsEvent !== getCreateAnalyticsEvent()) {
|
|
29
|
+
var _options$createAnalyt;
|
|
23
30
|
// When the plugin state is reconfigured, the init function isn't called again
|
|
24
31
|
return {
|
|
25
32
|
...pluginState,
|
|
26
|
-
createAnalyticsEvent: options.createAnalyticsEvent
|
|
33
|
+
createAnalyticsEvent: (_options$createAnalyt = options.createAnalyticsEvent) !== null && _options$createAnalyt !== void 0 ? _options$createAnalyt : getCreateAnalyticsEvent()
|
|
27
34
|
};
|
|
28
35
|
}
|
|
29
36
|
if (featureFlags.catchAllTracking) {
|
|
@@ -78,10 +85,7 @@ const analyticsPlugin = (options, api) => {
|
|
|
78
85
|
pmPlugins() {
|
|
79
86
|
return [{
|
|
80
87
|
name: 'analyticsPlugin',
|
|
81
|
-
plugin: () =>
|
|
82
|
-
var _api$dependencies, _api$dependencies$ana;
|
|
83
|
-
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);
|
|
84
|
-
}
|
|
88
|
+
plugin: () => createPlugin(options, featureFlags, api)
|
|
85
89
|
}];
|
|
86
90
|
}
|
|
87
91
|
};
|
|
@@ -10,7 +10,6 @@ import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
|
10
10
|
import { queueCards, resolveCard, hideDatasourceModal } from './actions';
|
|
11
11
|
import { pluginKey } from './plugin-key';
|
|
12
12
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* Attempt to replace the link into the respective card.
|
|
16
15
|
*/
|
|
@@ -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 const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorAnalyticsApi) => (editorState, dispatch) => {
|
|
47
|
+
export const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) => (editorState, dispatch) => {
|
|
49
48
|
const state = pluginKey.getState(editorState);
|
|
50
49
|
if (!state) {
|
|
51
50
|
return false;
|
|
@@ -70,7 +69,7 @@ export const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorA
|
|
|
70
69
|
const nodeType = 'inlineCard';
|
|
71
70
|
const [,, domainName] = url.split('/');
|
|
72
71
|
if (state.smartLinkEvents) {
|
|
73
|
-
state.smartLinkEvents.insertSmartLink(domainName, 'inline',
|
|
72
|
+
state.smartLinkEvents.insertSmartLink(domainName, 'inline', createAnalyticsEvent);
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -27,7 +27,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
27
27
|
allowResizing,
|
|
28
28
|
useAlternativePreloader,
|
|
29
29
|
fullWidthMode,
|
|
30
|
-
createAnalyticsEvent,
|
|
31
30
|
showServerActions
|
|
32
31
|
} = options;
|
|
33
32
|
const inlineCardViewProducer = getInlineNodeViewProducer({
|
|
@@ -48,7 +47,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
48
47
|
showLinkingToolbar: false,
|
|
49
48
|
smartLinkEvents: undefined,
|
|
50
49
|
smartLinkEventsNext: undefined,
|
|
51
|
-
createAnalyticsEvent,
|
|
52
50
|
editorAppearance,
|
|
53
51
|
showDatasourceModal: false,
|
|
54
52
|
datasourceTableRef: undefined,
|
|
@@ -136,8 +134,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
136
134
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
137
135
|
*/
|
|
138
136
|
const invoke = rafSchedule(() => {
|
|
139
|
-
var _pluginInjectionApi$d;
|
|
140
|
-
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);
|
|
141
139
|
});
|
|
142
140
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
143
141
|
invoke();
|
|
@@ -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) => () => {
|
|
@@ -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
|
};
|