@atlaskit/editor-core 189.0.4 → 189.0.5
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 +6 -0
- package/dist/cjs/plugins/paste/handlers.js +15 -13
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +95 -73
- package/dist/cjs/plugins/paste/pm-plugins/main.js +15 -13
- package/dist/cjs/plugins/paste/util/index.js +4 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +4 -4
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +27 -26
- package/dist/es2019/plugins/paste/pm-plugins/main.js +15 -13
- package/dist/es2019/plugins/paste/util/index.js +4 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +15 -13
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +94 -71
- package/dist/esm/plugins/paste/pm-plugins/main.js +15 -13
- package/dist/esm/plugins/paste/util/index.js +4 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/paste/handlers.d.ts +3 -3
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +11 -11
- package/dist/types/plugins/paste/util/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +3 -3
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +11 -11
- package/dist/types-ts4.5/plugins/paste/util/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -26,6 +26,8 @@ export { pluginKey as stateKey } from './plugin-factory';
|
|
|
26
26
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
27
27
|
import { PastePluginActionTypes } from '../actions';
|
|
28
28
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
29
|
+
var _pluginInjectionApi$a;
|
|
30
|
+
const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
29
31
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
30
32
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
31
33
|
let textInput = text;
|
|
@@ -203,7 +205,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
203
205
|
};
|
|
204
206
|
slice = handleParagraphBlockMarks(state, slice);
|
|
205
207
|
const plainTextPasteSlice = linkifyContent(state.schema)(slice);
|
|
206
|
-
if (handlePasteAsPlainTextWithAnalytics(view, event, plainTextPasteSlice)(state, dispatch, view)) {
|
|
208
|
+
if (handlePasteAsPlainTextWithAnalytics(editorAnalyticsAPI)(view, event, plainTextPasteSlice)(state, dispatch, view)) {
|
|
207
209
|
return true;
|
|
208
210
|
}
|
|
209
211
|
|
|
@@ -223,14 +225,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
223
225
|
if (markdownSlice) {
|
|
224
226
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2;
|
|
225
227
|
// linkify text prior to converting to macro
|
|
226
|
-
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
228
|
+
if (handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI)(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
227
229
|
return true;
|
|
228
230
|
}
|
|
229
231
|
|
|
230
232
|
// run macro autoconvert prior to other conversions
|
|
231
233
|
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
232
234
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
233
|
-
sendPasteAnalyticsEvent(view, event, markdownSlice, {
|
|
235
|
+
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, markdownSlice, {
|
|
234
236
|
type: PasteTypes.markdown
|
|
235
237
|
});
|
|
236
238
|
return true;
|
|
@@ -257,13 +259,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
// If we're in a code block, append the text contents of clipboard inside it
|
|
260
|
-
if (handleCodeBlockWithAnalytics(view, event, slice, text)(state, dispatch)) {
|
|
262
|
+
if (handleCodeBlockWithAnalytics(editorAnalyticsAPI)(view, event, slice, text)(state, dispatch)) {
|
|
261
263
|
return true;
|
|
262
264
|
}
|
|
263
|
-
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.media) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.actions.insertMediaAsMediaSingle)(state, dispatch, view)) {
|
|
265
|
+
if (handleMediaSingleWithAnalytics(editorAnalyticsAPI)(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.media) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.actions.insertMediaAsMediaSingle)(state, dispatch, view)) {
|
|
264
266
|
return true;
|
|
265
267
|
}
|
|
266
|
-
if (handleSelectedTableWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
268
|
+
if (handleSelectedTableWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
|
|
267
269
|
return true;
|
|
268
270
|
}
|
|
269
271
|
|
|
@@ -298,14 +300,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
298
300
|
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$l;
|
|
299
301
|
// linkify the text where possible
|
|
300
302
|
slice = linkifyContent(state.schema)(slice);
|
|
301
|
-
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
303
|
+
if (handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
302
304
|
return true;
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
// run macro autoconvert prior to other conversions
|
|
306
308
|
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
307
309
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
308
|
-
sendPasteAnalyticsEvent(view, event, slice, {
|
|
310
|
+
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
|
|
309
311
|
type: PasteTypes.richText
|
|
310
312
|
});
|
|
311
313
|
return true;
|
|
@@ -314,7 +316,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
314
316
|
// get editor-tables to handle pasting tables if it can
|
|
315
317
|
// otherwise, just the replace the selection with the content
|
|
316
318
|
if (handlePasteTable(view, null, slice)) {
|
|
317
|
-
sendPasteAnalyticsEvent(view, event, slice, {
|
|
319
|
+
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
|
|
318
320
|
type: PasteTypes.richText
|
|
319
321
|
});
|
|
320
322
|
return true;
|
|
@@ -345,7 +347,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
345
347
|
});
|
|
346
348
|
slice = sliceCopy;
|
|
347
349
|
}
|
|
348
|
-
if (handleExpandWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
350
|
+
if (handleExpandWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
|
|
349
351
|
return true;
|
|
350
352
|
}
|
|
351
353
|
if (!insideTable(state)) {
|
|
@@ -355,13 +357,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
355
357
|
// Create a custom handler to avoid handling with handleRichText method
|
|
356
358
|
// As SafeInsert is used inside handleRichText which caused some bad UX like this:
|
|
357
359
|
// https://product-fabric.atlassian.net/browse/MEX-1520
|
|
358
|
-
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
360
|
+
if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
359
361
|
return true;
|
|
360
362
|
}
|
|
361
|
-
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
|
|
363
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(editorAnalyticsAPI)(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
|
|
362
364
|
return true;
|
|
363
365
|
}
|
|
364
|
-
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
366
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
|
|
365
367
|
return true;
|
|
366
368
|
}
|
|
367
369
|
return handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi)(state, dispatch);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slice, Mark, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { isMediaBlobUrl } from '@atlaskit/media-client';
|
|
3
|
-
import { ACTION_SUBJECT,
|
|
3
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
@@ -161,13 +161,13 @@ export const removeDuplicateInvalidLinks = html => {
|
|
|
161
161
|
}
|
|
162
162
|
return html;
|
|
163
163
|
};
|
|
164
|
-
export const addReplaceSelectedTableAnalytics = (state, tr) => {
|
|
164
|
+
export const addReplaceSelectedTableAnalytics = (state, tr, editorAnalyticsAPI) => {
|
|
165
165
|
if (isTableSelected(state.selection)) {
|
|
166
166
|
const {
|
|
167
167
|
totalRowCount,
|
|
168
168
|
totalColumnCount
|
|
169
169
|
} = getSelectedTableInfo(state.selection);
|
|
170
|
-
|
|
170
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
171
171
|
action: TABLE_ACTION.REPLACED,
|
|
172
172
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
173
173
|
attributes: {
|
|
@@ -176,7 +176,7 @@ export const addReplaceSelectedTableAnalytics = (state, tr) => {
|
|
|
176
176
|
inputMethod: INPUT_METHOD.CLIPBOARD
|
|
177
177
|
},
|
|
178
178
|
eventType: EVENT_TYPE.TRACK
|
|
179
|
-
});
|
|
179
|
+
})(tr);
|
|
180
180
|
return tr;
|
|
181
181
|
}
|
|
182
182
|
return state.tr;
|
|
@@ -331,7 +331,7 @@ export function handlePasteLinkOnSelectedText(slice) {
|
|
|
331
331
|
return false;
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
export function handlePasteAsPlainText(slice, _event) {
|
|
334
|
+
export function handlePasteAsPlainText(slice, _event, editorAnalyticsAPI) {
|
|
335
335
|
return function (state, dispatch, view) {
|
|
336
336
|
var _input;
|
|
337
337
|
if (!view) {
|
|
@@ -359,7 +359,7 @@ export function handlePasteAsPlainText(slice, _event) {
|
|
|
359
359
|
tr = replaceSelectedTable(state, slice);
|
|
360
360
|
|
|
361
361
|
// add analytics after replacing selected table
|
|
362
|
-
tr = addReplaceSelectedTableAnalytics(state, tr);
|
|
362
|
+
tr = addReplaceSelectedTableAnalytics(state, tr, editorAnalyticsAPI);
|
|
363
363
|
|
|
364
364
|
// otherwise just replace the selection
|
|
365
365
|
if (!tr.docChanged) {
|
|
@@ -897,18 +897,20 @@ export function handlePasteIntoCaption(slice) {
|
|
|
897
897
|
return false;
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
|
-
export var handleSelectedTable = function handleSelectedTable(
|
|
901
|
-
return function (
|
|
902
|
-
|
|
900
|
+
export var handleSelectedTable = function handleSelectedTable(editorAnalyticsAPI) {
|
|
901
|
+
return function (slice) {
|
|
902
|
+
return function (state, dispatch) {
|
|
903
|
+
var tr = replaceSelectedTable(state, slice);
|
|
903
904
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
905
|
+
// add analytics after replacing selected table
|
|
906
|
+
tr = addReplaceSelectedTableAnalytics(state, tr, editorAnalyticsAPI);
|
|
907
|
+
if (tr.docChanged) {
|
|
908
|
+
if (dispatch) {
|
|
909
|
+
dispatch(tr);
|
|
910
|
+
}
|
|
911
|
+
return true;
|
|
909
912
|
}
|
|
910
|
-
return
|
|
911
|
-
}
|
|
912
|
-
return false;
|
|
913
|
+
return false;
|
|
914
|
+
};
|
|
913
915
|
};
|
|
914
916
|
};
|
|
@@ -3,7 +3,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, PasteTypes, PasteContents } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import { addAnalytics } from '../../analytics';
|
|
7
6
|
import { getPasteSource } from '../util';
|
|
8
7
|
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
9
8
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -208,103 +207,127 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
208
207
|
// TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
209
208
|
// However, handlers like handleMacroAutoConvert dispatch multiple time,
|
|
210
209
|
// so pasteCommandWithAnalytics is useless in this case.
|
|
211
|
-
export
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
export var sendPasteAnalyticsEvent = function sendPasteAnalyticsEvent(editorAnalyticsAPI) {
|
|
211
|
+
return function (view, event, slice, pasteContext) {
|
|
212
|
+
var tr = view.state.tr;
|
|
213
|
+
var payload = createPasteAnalyticsPayload(view, event, slice, pasteContext);
|
|
214
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
215
|
+
view.dispatch(tr);
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
export var handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainTextWithAnalytics(editorAnalyticsAPI) {
|
|
219
|
+
return function (view, event, slice) {
|
|
220
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
221
|
+
type: PasteTypes.plain,
|
|
222
|
+
asPlain: true
|
|
223
|
+
}))(handlePasteAsPlainText(slice, event, editorAnalyticsAPI));
|
|
224
|
+
};
|
|
220
225
|
};
|
|
221
226
|
export var handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
222
|
-
var _pluginInjectionApi$c;
|
|
223
|
-
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
227
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$c;
|
|
228
|
+
return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
224
229
|
type: type
|
|
225
230
|
}))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.queueCardsFromChangedTr));
|
|
226
231
|
};
|
|
227
|
-
export var handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(
|
|
228
|
-
return
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
export var handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI) {
|
|
233
|
+
return function (view, event, slice, type) {
|
|
234
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
235
|
+
type: type
|
|
236
|
+
}))(handlePasteIntoCaption(slice));
|
|
237
|
+
};
|
|
231
238
|
};
|
|
232
|
-
export var handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(
|
|
233
|
-
return
|
|
234
|
-
|
|
235
|
-
|
|
239
|
+
export var handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(editorAnalyticsAPI) {
|
|
240
|
+
return function (view, event, slice, text) {
|
|
241
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
242
|
+
type: PasteTypes.plain
|
|
243
|
+
}))(handleCodeBlock(text));
|
|
244
|
+
};
|
|
236
245
|
};
|
|
237
|
-
export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(
|
|
238
|
-
return
|
|
239
|
-
|
|
240
|
-
|
|
246
|
+
export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(editorAnalyticsAPI) {
|
|
247
|
+
return function (view, event, slice, type, insertMediaAsMediaSingle) {
|
|
248
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
249
|
+
type: type
|
|
250
|
+
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD, insertMediaAsMediaSingle)(slice));
|
|
251
|
+
};
|
|
241
252
|
};
|
|
242
253
|
export var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
243
|
-
var _pluginInjectionApi$c2;
|
|
244
|
-
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
254
|
+
var _pluginInjectionApi$a2, _pluginInjectionApi$c2;
|
|
255
|
+
return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
245
256
|
type: type
|
|
246
257
|
}))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr));
|
|
247
258
|
};
|
|
248
259
|
export var handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice, pluginInjectionApi) {
|
|
249
|
-
var _pluginInjectionApi$c3;
|
|
250
|
-
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
260
|
+
var _pluginInjectionApi$a3, _pluginInjectionApi$c3;
|
|
261
|
+
return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
251
262
|
type: PasteTypes.markdown
|
|
252
263
|
}))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.queueCardsFromChangedTr));
|
|
253
264
|
};
|
|
254
265
|
export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi) {
|
|
255
|
-
var _pluginInjectionApi$c4;
|
|
256
|
-
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
266
|
+
var _pluginInjectionApi$a4, _pluginInjectionApi$c4;
|
|
267
|
+
return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
257
268
|
type: PasteTypes.richText
|
|
258
269
|
}))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.card) === null || _pluginInjectionApi$c4 === void 0 || (_pluginInjectionApi$c4 = _pluginInjectionApi$c4.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr));
|
|
259
270
|
};
|
|
260
|
-
function injectAnalyticsPayloadBeforeCommand(
|
|
261
|
-
return function (
|
|
262
|
-
return function (
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
271
|
+
var injectAnalyticsPayloadBeforeCommand = function injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI) {
|
|
272
|
+
return function (createPayloadByTransaction) {
|
|
273
|
+
return function (mainCommand) {
|
|
274
|
+
return function (state, dispatch, view) {
|
|
275
|
+
var originalTransaction = state.tr;
|
|
276
|
+
var fakeDispatch = function fakeDispatch(tr) {
|
|
277
|
+
originalTransaction = tr;
|
|
278
|
+
};
|
|
279
|
+
var result = mainCommand(state, fakeDispatch, view);
|
|
280
|
+
if (!result) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
if (dispatch && originalTransaction.docChanged) {
|
|
284
|
+
// it needs to know the selection before the changes
|
|
285
|
+
var payload = createPayloadByTransaction(state.selection);
|
|
286
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(originalTransaction);
|
|
287
|
+
dispatch(originalTransaction);
|
|
288
|
+
}
|
|
289
|
+
return true;
|
|
266
290
|
};
|
|
267
|
-
var result = mainCommand(state, fakeDispatch, view);
|
|
268
|
-
if (!result) {
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
if (dispatch && originalTransaction.docChanged) {
|
|
272
|
-
// it needs to know the selection before the changes
|
|
273
|
-
var payload = createPayloadByTransaction(state.selection);
|
|
274
|
-
addAnalytics(state, originalTransaction, payload);
|
|
275
|
-
dispatch(originalTransaction);
|
|
276
|
-
}
|
|
277
|
-
return true;
|
|
278
291
|
};
|
|
279
292
|
};
|
|
280
|
-
}
|
|
281
|
-
export var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, findRootParentListNode) {
|
|
282
|
-
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
283
|
-
type: PasteTypes.richText
|
|
284
|
-
}))(handlePastePanelOrDecisionContentIntoList(slice, findRootParentListNode));
|
|
285
293
|
};
|
|
286
|
-
export var
|
|
287
|
-
return
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
294
|
+
export var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(editorAnalyticsAPI) {
|
|
295
|
+
return function (view, event, slice, findRootParentListNode) {
|
|
296
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
297
|
+
type: PasteTypes.richText
|
|
298
|
+
}))(handlePastePanelOrDecisionContentIntoList(slice, findRootParentListNode));
|
|
299
|
+
};
|
|
291
300
|
};
|
|
292
|
-
export var
|
|
293
|
-
return
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
301
|
+
export var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function handlePasteNonNestableBlockNodesIntoListWithAnalytics(editorAnalyticsAPI) {
|
|
302
|
+
return function (view, event, slice) {
|
|
303
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
304
|
+
type: PasteTypes.richText,
|
|
305
|
+
pasteSplitList: true
|
|
306
|
+
}))(handlePasteNonNestableBlockNodesIntoList(slice));
|
|
307
|
+
};
|
|
297
308
|
};
|
|
298
|
-
export var
|
|
299
|
-
return
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
export var handleExpandWithAnalytics = function handleExpandWithAnalytics(editorAnalyticsAPI) {
|
|
310
|
+
return function (view, event, slice) {
|
|
311
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
312
|
+
type: PasteTypes.richText,
|
|
313
|
+
pasteSplitList: true
|
|
314
|
+
}))(handleExpandPasteInTable(slice));
|
|
315
|
+
};
|
|
302
316
|
};
|
|
303
|
-
export var
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
317
|
+
export var handleSelectedTableWithAnalytics = function handleSelectedTableWithAnalytics(editorAnalyticsAPI) {
|
|
318
|
+
return function (view, event, slice) {
|
|
319
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
320
|
+
type: PasteTypes.richText
|
|
321
|
+
}))(handleSelectedTable(editorAnalyticsAPI)(slice));
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
export var handlePasteLinkOnSelectedTextWithAnalytics = function handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI) {
|
|
325
|
+
return function (view, event, slice, type) {
|
|
326
|
+
return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
327
|
+
type: type,
|
|
328
|
+
hyperlinkPasteOnText: true
|
|
329
|
+
}))(handlePasteLinkOnSelectedText(slice));
|
|
330
|
+
};
|
|
308
331
|
};
|
|
309
332
|
export var createPasteMeasurePayload = function createPasteMeasurePayload(_ref3) {
|
|
310
333
|
var view = _ref3.view,
|
|
@@ -28,6 +28,8 @@ export { pluginKey as stateKey } from './plugin-factory';
|
|
|
28
28
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
29
29
|
import { PastePluginActionTypes } from '../actions';
|
|
30
30
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
31
|
+
var _pluginInjectionApi$a;
|
|
32
|
+
var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
31
33
|
var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
32
34
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
33
35
|
var textInput = text;
|
|
@@ -223,7 +225,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
223
225
|
};
|
|
224
226
|
slice = handleParagraphBlockMarks(state, slice);
|
|
225
227
|
var plainTextPasteSlice = linkifyContent(state.schema)(slice);
|
|
226
|
-
if (handlePasteAsPlainTextWithAnalytics(view, event, plainTextPasteSlice)(state, dispatch, view)) {
|
|
228
|
+
if (handlePasteAsPlainTextWithAnalytics(editorAnalyticsAPI)(view, event, plainTextPasteSlice)(state, dispatch, view)) {
|
|
227
229
|
return true;
|
|
228
230
|
}
|
|
229
231
|
|
|
@@ -243,14 +245,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
243
245
|
if (markdownSlice) {
|
|
244
246
|
var _pluginInjectionApi$c;
|
|
245
247
|
// linkify text prior to converting to macro
|
|
246
|
-
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
248
|
+
if (handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI)(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
247
249
|
return true;
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
// run macro autoconvert prior to other conversions
|
|
251
253
|
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
252
254
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
253
|
-
sendPasteAnalyticsEvent(view, event, markdownSlice, {
|
|
255
|
+
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, markdownSlice, {
|
|
254
256
|
type: PasteTypes.markdown
|
|
255
257
|
});
|
|
256
258
|
return true;
|
|
@@ -277,13 +279,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
277
279
|
}
|
|
278
280
|
|
|
279
281
|
// If we're in a code block, append the text contents of clipboard inside it
|
|
280
|
-
if (handleCodeBlockWithAnalytics(view, event, slice, text)(state, dispatch)) {
|
|
282
|
+
if (handleCodeBlockWithAnalytics(editorAnalyticsAPI)(view, event, slice, text)(state, dispatch)) {
|
|
281
283
|
return true;
|
|
282
284
|
}
|
|
283
|
-
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.media) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.actions.insertMediaAsMediaSingle)(state, dispatch, view)) {
|
|
285
|
+
if (handleMediaSingleWithAnalytics(editorAnalyticsAPI)(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.media) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.actions.insertMediaAsMediaSingle)(state, dispatch, view)) {
|
|
284
286
|
return true;
|
|
285
287
|
}
|
|
286
|
-
if (handleSelectedTableWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
288
|
+
if (handleSelectedTableWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
|
|
287
289
|
return true;
|
|
288
290
|
}
|
|
289
291
|
|
|
@@ -316,14 +318,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
316
318
|
var _pluginInjectionApi$c2, _pluginInjectionApi$l;
|
|
317
319
|
// linkify the text where possible
|
|
318
320
|
slice = linkifyContent(state.schema)(slice);
|
|
319
|
-
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
321
|
+
if (handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
320
322
|
return true;
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
// run macro autoconvert prior to other conversions
|
|
324
326
|
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
325
327
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
326
|
-
sendPasteAnalyticsEvent(view, event, slice, {
|
|
328
|
+
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
|
|
327
329
|
type: PasteTypes.richText
|
|
328
330
|
});
|
|
329
331
|
return true;
|
|
@@ -332,7 +334,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
332
334
|
// get editor-tables to handle pasting tables if it can
|
|
333
335
|
// otherwise, just the replace the selection with the content
|
|
334
336
|
if (handlePasteTable(view, null, slice)) {
|
|
335
|
-
sendPasteAnalyticsEvent(view, event, slice, {
|
|
337
|
+
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
|
|
336
338
|
type: PasteTypes.richText
|
|
337
339
|
});
|
|
338
340
|
return true;
|
|
@@ -365,7 +367,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
365
367
|
});
|
|
366
368
|
slice = sliceCopy;
|
|
367
369
|
}
|
|
368
|
-
if (handleExpandWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
370
|
+
if (handleExpandWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
|
|
369
371
|
return true;
|
|
370
372
|
}
|
|
371
373
|
if (!insideTable(state)) {
|
|
@@ -375,13 +377,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
375
377
|
// Create a custom handler to avoid handling with handleRichText method
|
|
376
378
|
// As SafeInsert is used inside handleRichText which caused some bad UX like this:
|
|
377
379
|
// https://product-fabric.atlassian.net/browse/MEX-1520
|
|
378
|
-
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
380
|
+
if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
379
381
|
return true;
|
|
380
382
|
}
|
|
381
|
-
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
|
|
383
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(editorAnalyticsAPI)(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
|
|
382
384
|
return true;
|
|
383
385
|
}
|
|
384
|
-
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
386
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
|
|
385
387
|
return true;
|
|
386
388
|
}
|
|
387
389
|
return handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi)(state, dispatch);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { Slice, Mark, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { isMediaBlobUrl } from '@atlaskit/media-client';
|
|
4
|
-
import { ACTION_SUBJECT,
|
|
4
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
@@ -148,12 +148,12 @@ export var removeDuplicateInvalidLinks = function removeDuplicateInvalidLinks(ht
|
|
|
148
148
|
}
|
|
149
149
|
return html;
|
|
150
150
|
};
|
|
151
|
-
export var addReplaceSelectedTableAnalytics = function addReplaceSelectedTableAnalytics(state, tr) {
|
|
151
|
+
export var addReplaceSelectedTableAnalytics = function addReplaceSelectedTableAnalytics(state, tr, editorAnalyticsAPI) {
|
|
152
152
|
if (isTableSelected(state.selection)) {
|
|
153
153
|
var _getSelectedTableInfo = getSelectedTableInfo(state.selection),
|
|
154
154
|
totalRowCount = _getSelectedTableInfo.totalRowCount,
|
|
155
155
|
totalColumnCount = _getSelectedTableInfo.totalColumnCount;
|
|
156
|
-
|
|
156
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
157
157
|
action: TABLE_ACTION.REPLACED,
|
|
158
158
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
159
159
|
attributes: {
|
|
@@ -162,7 +162,7 @@ export var addReplaceSelectedTableAnalytics = function addReplaceSelectedTableAn
|
|
|
162
162
|
inputMethod: INPUT_METHOD.CLIPBOARD
|
|
163
163
|
},
|
|
164
164
|
eventType: EVENT_TYPE.TRACK
|
|
165
|
-
});
|
|
165
|
+
})(tr);
|
|
166
166
|
return tr;
|
|
167
167
|
}
|
|
168
168
|
return state.tr;
|
|
@@ -3,7 +3,7 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { ExtensionAutoConvertHandler } from '@atlaskit/editor-common/extensions';
|
|
5
5
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import type { InputMethodInsertMedia, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { InsertMediaAsMediaSingle } from '@atlaskit/editor-plugin-media/types';
|
|
8
8
|
import type { QueueCardsFromTransactionAction, CardOptions } from '@atlaskit/editor-common/card';
|
|
9
9
|
import type { FindRootParentListNode } from '@atlaskit/editor-plugin-list';
|
|
@@ -13,7 +13,7 @@ export declare function handlePasteNonNestableBlockNodesIntoList(slice: Slice):
|
|
|
13
13
|
export declare const doesSelectionWhichStartsOrEndsInListContainEntireList: (selection: Selection, findRootParentListNode: FindRootParentListNode | undefined) => boolean;
|
|
14
14
|
export declare function handlePastePanelOrDecisionContentIntoList(slice: Slice, findRootParentListNode: FindRootParentListNode | undefined): Command;
|
|
15
15
|
export declare function handlePasteLinkOnSelectedText(slice: Slice): Command;
|
|
16
|
-
export declare function handlePasteAsPlainText(slice: Slice, _event: ClipboardEvent): Command;
|
|
16
|
+
export declare function handlePasteAsPlainText(slice: Slice, _event: ClipboardEvent, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): Command;
|
|
17
17
|
export declare function handlePastePreservingMarks(slice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined): Command;
|
|
18
18
|
export declare function handleMacroAutoConvert(text: string, slice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, cardsOptions?: CardOptions, extensionAutoConverter?: ExtensionAutoConvertHandler): Command;
|
|
19
19
|
export declare function handleCodeBlock(text: string): Command;
|
|
@@ -51,4 +51,4 @@ export declare function handleParagraphBlockMarks(state: EditorState, slice: Sli
|
|
|
51
51
|
export declare function flattenNestedListInSlice(slice: Slice): Slice;
|
|
52
52
|
export declare function handleRichText(slice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined): Command;
|
|
53
53
|
export declare function handlePasteIntoCaption(slice: Slice): Command;
|
|
54
|
-
export declare const handleSelectedTable: (slice: Slice) => Command;
|
|
54
|
+
export declare const handleSelectedTable: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (slice: Slice) => Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnalyticsEventPayload, PasteType, PasteContent } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { AnalyticsEventPayload, PasteType, PasteContent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { Slice, Fragment, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { ExtractInjectionAPI, Command } from '@atlaskit/editor-common/types';
|
|
@@ -20,20 +20,20 @@ type GetContentProps = {
|
|
|
20
20
|
export declare function getContent({ schema, slice }: GetContentProps): PasteContent;
|
|
21
21
|
export declare function getMediaTraceId(slice: Slice): undefined;
|
|
22
22
|
export declare function createPasteAnalyticsPayload(view: EditorView, event: ClipboardEvent, slice: Slice, pasteContext: PasteContext): AnalyticsEventPayload;
|
|
23
|
-
export declare
|
|
24
|
-
export declare const handlePasteAsPlainTextWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
23
|
+
export declare const sendPasteAnalyticsEvent: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, pasteContext: PasteContext) => void;
|
|
24
|
+
export declare const handlePasteAsPlainTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
25
25
|
export declare const handlePasteIntoTaskAndDecisionWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, pluginInjectionApi: ExtractInjectionAPI<typeof pastePlugin> | undefined) => Command;
|
|
26
|
-
export declare const handlePasteIntoCaptionWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
|
|
27
|
-
export declare const handleCodeBlockWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, text: string) => Command;
|
|
28
|
-
export declare const handleMediaSingleWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined) => Command;
|
|
26
|
+
export declare const handlePasteIntoCaptionWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
|
|
27
|
+
export declare const handleCodeBlockWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, text: string) => Command;
|
|
28
|
+
export declare const handleMediaSingleWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined) => Command;
|
|
29
29
|
export declare const handlePastePreservingMarksWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, pluginInjectionApi: ExtractInjectionAPI<typeof pastePlugin> | undefined) => Command;
|
|
30
30
|
export declare const handleMarkdownWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, pluginInjectionApi: ExtractInjectionAPI<typeof pastePlugin> | undefined) => Command;
|
|
31
31
|
export declare const handleRichTextWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, pluginInjectionApi: ExtractInjectionAPI<typeof pastePlugin> | undefined) => Command;
|
|
32
|
-
export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command;
|
|
33
|
-
export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
34
|
-
export declare const handleExpandWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
35
|
-
export declare const handleSelectedTableWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
36
|
-
export declare const handlePasteLinkOnSelectedTextWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
|
|
32
|
+
export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command;
|
|
33
|
+
export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
34
|
+
export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
35
|
+
export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
|
|
36
|
+
export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
|
|
37
37
|
export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
|
|
38
38
|
view: EditorView;
|
|
39
39
|
duration: number;
|