@atlaskit/editor-plugin-paste 3.1.2 → 3.1.4
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 +14 -0
- package/dist/cjs/pm-plugins/analytics.js +1 -1
- package/dist/cjs/pm-plugins/main.js +3 -7
- package/dist/cjs/pm-plugins/media.js +3 -1
- package/dist/cjs/pm-plugins/move-analytics/plugin.js +4 -4
- package/dist/cjs/pm-plugins/util/handlers.js +1 -1
- package/dist/es2019/pm-plugins/analytics.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -7
- package/dist/es2019/pm-plugins/media.js +3 -1
- package/dist/es2019/pm-plugins/move-analytics/plugin.js +4 -4
- package/dist/es2019/pm-plugins/util/handlers.js +1 -1
- package/dist/esm/pm-plugins/analytics.js +1 -1
- package/dist/esm/pm-plugins/main.js +3 -7
- package/dist/esm/pm-plugins/media.js +3 -1
- package/dist/esm/pm-plugins/move-analytics/plugin.js +4 -4
- package/dist/esm/pm-plugins/util/handlers.js +1 -1
- package/dist/types/pm-plugins/media.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/media.d.ts +1 -1
- package/package.json +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 3.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#128182](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128182)
|
|
8
|
+
[`7ff8302c0c02e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ff8302c0c02e) -
|
|
9
|
+
Replace experiment with gate
|
|
10
|
+
|
|
11
|
+
## 3.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.1.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -256,7 +256,7 @@ function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
256
256
|
return createPasteAnalyticsPayloadBySelection(event, slice, pasteContext)(view.state.selection);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
// TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
259
|
+
// TODO: ED-6612 - We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
260
260
|
// However, handlers like handleMacroAutoConvert dispatch multiple time,
|
|
261
261
|
// so pasteCommandWithAnalytics is useless in this case.
|
|
262
262
|
var sendPasteAnalyticsEvent = exports.sendPasteAnalyticsEvent = function sendPasteAnalyticsEvent(editorAnalyticsAPI) {
|
|
@@ -328,7 +328,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
328
328
|
|
|
329
329
|
// run macro autoconvert prior to other conversions
|
|
330
330
|
if ((0, _handlers.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, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.extension) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.actions) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.runMacroAutoConvert, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
331
|
-
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
331
|
+
// TODO: ED-26959 - handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
332
332
|
(0, _analytics2.sendPasteAnalyticsEvent)(editorAnalyticsAPI)(view, event, markdownSlice, {
|
|
333
333
|
type: _analytics.PasteTypes.markdown
|
|
334
334
|
});
|
|
@@ -422,7 +422,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
422
422
|
|
|
423
423
|
// run macro autoconvert prior to other conversions
|
|
424
424
|
if ((0, _handlers.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, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.extension) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.actions) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.runMacroAutoConvert, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
425
|
-
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
425
|
+
// TODO: ED-26959 - handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
426
426
|
(0, _analytics2.sendPasteAnalyticsEvent)(editorAnalyticsAPI)(view, event, slice, {
|
|
427
427
|
type: _analytics.PasteTypes.richText
|
|
428
428
|
});
|
|
@@ -439,8 +439,6 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
439
439
|
var _pluginInjectionApi$a2;
|
|
440
440
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
|
|
441
441
|
}
|
|
442
|
-
|
|
443
|
-
// ED-4732
|
|
444
442
|
if ((0, _analytics2.handlePastePreservingMarksWithAnalytics)(view, event, slice, _analytics.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
445
443
|
return true;
|
|
446
444
|
}
|
|
@@ -510,9 +508,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
510
508
|
if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
|
|
511
509
|
slice = new _model.Slice(slice.content, 0, 0);
|
|
512
510
|
}
|
|
513
|
-
|
|
514
|
-
slice = (0, _transforms.transformSingleColumnLayout)(slice, schema);
|
|
515
|
-
}
|
|
511
|
+
slice = (0, _transforms.transformSingleColumnLayout)(slice, schema);
|
|
516
512
|
if ((0, _platformFeatureFlags.fg)('platform_editor_macroid_reset_for_ext_on_paste')) {
|
|
517
513
|
slice = (0, _transforms.transformSliceToRemoveMacroId)(slice, schema);
|
|
518
514
|
}
|
|
@@ -18,7 +18,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
18
18
|
/**
|
|
19
19
|
* Ensure correct layout in nested mode
|
|
20
20
|
*
|
|
21
|
-
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
21
|
+
* TODO: ED-26959 - this func is only used in handlePaste, so layout update won't work for drop event
|
|
22
22
|
*/
|
|
23
23
|
function transformSliceForMedia(slice, schema) {
|
|
24
24
|
var _schema$nodes = schema.nodes,
|
|
@@ -57,6 +57,8 @@ function transformSliceForMedia(slice, schema) {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// Ignored via go/ees007
|
|
61
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
60
62
|
// TODO move this to editor-common
|
|
61
63
|
var isImage = exports.isImage = function isImage(fileType) {
|
|
62
64
|
return !!fileType && (fileType.indexOf('image/') > -1 || fileType.indexOf('video/') > -1);
|
|
@@ -8,7 +8,7 @@ exports.createPlugin = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
-
var
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _commands = require("./commands");
|
|
13
13
|
var _pluginFactory = require("./plugin-factory");
|
|
14
14
|
var _pluginKey = require("./plugin-key");
|
|
@@ -91,12 +91,12 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
91
91
|
// the paragraph below the node. Visually only the node in between is selected, in reality, three nodes are
|
|
92
92
|
// in the slice.
|
|
93
93
|
// These cases are ignored and moveContent event won't be counted.
|
|
94
|
-
var
|
|
94
|
+
var isMultiSelectTrackingEnabled = (0, _platformFeatureFlags.fg)('platform_editor_track_node_types');
|
|
95
95
|
var nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
|
|
96
96
|
var nodeTypes,
|
|
97
97
|
hasSelectedMultipleNodes = false;
|
|
98
98
|
if (content.childCount > 1) {
|
|
99
|
-
if (
|
|
99
|
+
if (isMultiSelectTrackingEnabled) {
|
|
100
100
|
if ((0, _utils.containsExcludedNode)(content)) {
|
|
101
101
|
resetState = true;
|
|
102
102
|
} else {
|
|
@@ -134,7 +134,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
134
134
|
nodeName: nodeName,
|
|
135
135
|
nodeDepth: (0, _utils.getParentNodeDepth)(selection)
|
|
136
136
|
};
|
|
137
|
-
if (
|
|
137
|
+
if (isMultiSelectTrackingEnabled) {
|
|
138
138
|
var _nodeTypes;
|
|
139
139
|
newState = _objectSpread(_objectSpread({}, newState), {}, {
|
|
140
140
|
nodeTypes: (_nodeTypes = nodeTypes) !== null && _nodeTypes !== void 0 ? _nodeTypes : nodeName,
|
|
@@ -52,7 +52,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
52
52
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
53
53
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
54
54
|
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; }
|
|
55
|
-
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) { (0, _defineProperty2.default)(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; } // TODO: ED-20519 Needs Macro extraction
|
|
55
|
+
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) { (0, _defineProperty2.default)(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; } // TODO: ED-20519 - Needs Macro extraction
|
|
56
56
|
var insideExpand = function insideExpand(state) {
|
|
57
57
|
var _state$schema$nodes = state.schema.nodes,
|
|
58
58
|
expand = _state$schema$nodes.expand,
|
|
@@ -251,7 +251,7 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
251
251
|
return createPasteAnalyticsPayloadBySelection(event, slice, pasteContext)(view.state.selection);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
// TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
254
|
+
// TODO: ED-6612 - We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
255
255
|
// However, handlers like handleMacroAutoConvert dispatch multiple time,
|
|
256
256
|
// so pasteCommandWithAnalytics is useless in this case.
|
|
257
257
|
export const sendPasteAnalyticsEvent = editorAnalyticsAPI => (view, event, slice, pasteContext) => {
|
|
@@ -302,7 +302,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
302
302
|
|
|
303
303
|
// run macro autoconvert prior to other conversions
|
|
304
304
|
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, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.extension) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.actions) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.runMacroAutoConvert, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
305
|
-
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
305
|
+
// TODO: ED-26959 - handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
306
306
|
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, markdownSlice, {
|
|
307
307
|
type: PasteTypes.markdown
|
|
308
308
|
});
|
|
@@ -398,7 +398,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
398
398
|
|
|
399
399
|
// run macro autoconvert prior to other conversions
|
|
400
400
|
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, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e3 = pluginInjectionApi.extension) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : (_pluginInjectionApi$e4 = _pluginInjectionApi$e3.actions) === null || _pluginInjectionApi$e4 === void 0 ? void 0 : _pluginInjectionApi$e4.runMacroAutoConvert, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
401
|
-
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
401
|
+
// TODO: ED-26959 - handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
402
402
|
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
|
|
403
403
|
type: PasteTypes.richText
|
|
404
404
|
});
|
|
@@ -415,8 +415,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
415
415
|
var _pluginInjectionApi$a2;
|
|
416
416
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
|
|
417
417
|
}
|
|
418
|
-
|
|
419
|
-
// ED-4732
|
|
420
418
|
if (handlePastePreservingMarksWithAnalytics(view, event, slice, PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
421
419
|
return true;
|
|
422
420
|
}
|
|
@@ -484,9 +482,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
484
482
|
if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
|
|
485
483
|
slice = new Slice(slice.content, 0, 0);
|
|
486
484
|
}
|
|
487
|
-
|
|
488
|
-
slice = transformSingleColumnLayout(slice, schema);
|
|
489
|
-
}
|
|
485
|
+
slice = transformSingleColumnLayout(slice, schema);
|
|
490
486
|
if (fg('platform_editor_macroid_reset_for_ext_on_paste')) {
|
|
491
487
|
slice = transformSliceToRemoveMacroId(slice, schema);
|
|
492
488
|
}
|
|
@@ -6,7 +6,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
6
6
|
/**
|
|
7
7
|
* Ensure correct layout in nested mode
|
|
8
8
|
*
|
|
9
|
-
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
9
|
+
* TODO: ED-26959 - this func is only used in handlePaste, so layout update won't work for drop event
|
|
10
10
|
*/
|
|
11
11
|
export function transformSliceForMedia(slice, schema) {
|
|
12
12
|
const {
|
|
@@ -49,6 +49,8 @@ export function transformSliceForMedia(slice, schema) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// Ignored via go/ees007
|
|
53
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
52
54
|
// TODO move this to editor-common
|
|
53
55
|
export const isImage = fileType => {
|
|
54
56
|
return !!fileType && (fileType.indexOf('image/') > -1 || fileType.indexOf('video/') > -1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import {
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { resetContentMoved, resetContentMovedTransform, updateContentMoved } from './commands';
|
|
5
5
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
6
6
|
import { pluginKey } from './plugin-key';
|
|
@@ -93,12 +93,12 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
|
|
|
93
93
|
// the paragraph below the node. Visually only the node in between is selected, in reality, three nodes are
|
|
94
94
|
// in the slice.
|
|
95
95
|
// These cases are ignored and moveContent event won't be counted.
|
|
96
|
-
const
|
|
96
|
+
const isMultiSelectTrackingEnabled = fg('platform_editor_track_node_types');
|
|
97
97
|
const nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
|
|
98
98
|
let nodeTypes,
|
|
99
99
|
hasSelectedMultipleNodes = false;
|
|
100
100
|
if (content.childCount > 1) {
|
|
101
|
-
if (
|
|
101
|
+
if (isMultiSelectTrackingEnabled) {
|
|
102
102
|
if (containsExcludedNode(content)) {
|
|
103
103
|
resetState = true;
|
|
104
104
|
} else {
|
|
@@ -136,7 +136,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
|
|
|
136
136
|
nodeName: nodeName,
|
|
137
137
|
nodeDepth: getParentNodeDepth(selection)
|
|
138
138
|
};
|
|
139
|
-
if (
|
|
139
|
+
if (isMultiSelectTrackingEnabled) {
|
|
140
140
|
var _nodeTypes;
|
|
141
141
|
newState = {
|
|
142
142
|
...newState,
|
|
@@ -12,7 +12,7 @@ import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestT
|
|
|
12
12
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
|
-
// TODO: ED-20519 Needs Macro extraction
|
|
15
|
+
// TODO: ED-20519 - Needs Macro extraction
|
|
16
16
|
|
|
17
17
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from '../../editor-commands/commands';
|
|
18
18
|
import { getPluginState as getPastePluginState } from '../plugin-factory';
|
|
@@ -244,7 +244,7 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
244
244
|
return createPasteAnalyticsPayloadBySelection(event, slice, pasteContext)(view.state.selection);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
// TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
247
|
+
// TODO: ED-6612 - We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
248
248
|
// However, handlers like handleMacroAutoConvert dispatch multiple time,
|
|
249
249
|
// so pasteCommandWithAnalytics is useless in this case.
|
|
250
250
|
export var sendPasteAnalyticsEvent = function sendPasteAnalyticsEvent(editorAnalyticsAPI) {
|
|
@@ -320,7 +320,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
320
320
|
|
|
321
321
|
// run macro autoconvert prior to other conversions
|
|
322
322
|
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, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.extension) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.actions) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.runMacroAutoConvert, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
323
|
-
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
323
|
+
// TODO: ED-26959 - handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
324
324
|
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, markdownSlice, {
|
|
325
325
|
type: PasteTypes.markdown
|
|
326
326
|
});
|
|
@@ -414,7 +414,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
414
414
|
|
|
415
415
|
// run macro autoconvert prior to other conversions
|
|
416
416
|
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, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.extension) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.actions) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.runMacroAutoConvert, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
417
|
-
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
417
|
+
// TODO: ED-26959 - handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
418
418
|
sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
|
|
419
419
|
type: PasteTypes.richText
|
|
420
420
|
});
|
|
@@ -431,8 +431,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
431
431
|
var _pluginInjectionApi$a2;
|
|
432
432
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
|
|
433
433
|
}
|
|
434
|
-
|
|
435
|
-
// ED-4732
|
|
436
434
|
if (handlePastePreservingMarksWithAnalytics(view, event, slice, PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
437
435
|
return true;
|
|
438
436
|
}
|
|
@@ -502,9 +500,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
502
500
|
if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
|
|
503
501
|
slice = new Slice(slice.content, 0, 0);
|
|
504
502
|
}
|
|
505
|
-
|
|
506
|
-
slice = transformSingleColumnLayout(slice, schema);
|
|
507
|
-
}
|
|
503
|
+
slice = transformSingleColumnLayout(slice, schema);
|
|
508
504
|
if (fg('platform_editor_macroid_reset_for_ext_on_paste')) {
|
|
509
505
|
slice = transformSliceToRemoveMacroId(slice, schema);
|
|
510
506
|
}
|
|
@@ -9,7 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
9
9
|
/**
|
|
10
10
|
* Ensure correct layout in nested mode
|
|
11
11
|
*
|
|
12
|
-
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
12
|
+
* TODO: ED-26959 - this func is only used in handlePaste, so layout update won't work for drop event
|
|
13
13
|
*/
|
|
14
14
|
export function transformSliceForMedia(slice, schema) {
|
|
15
15
|
var _schema$nodes = schema.nodes,
|
|
@@ -48,6 +48,8 @@ export function transformSliceForMedia(slice, schema) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// Ignored via go/ees007
|
|
52
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
51
53
|
// TODO move this to editor-common
|
|
52
54
|
export var isImage = function isImage(fileType) {
|
|
53
55
|
return !!fileType && (fileType.indexOf('image/') > -1 || fileType.indexOf('video/') > -1);
|
|
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { resetContentMoved, resetContentMovedTransform, updateContentMoved } from './commands';
|
|
8
8
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
@@ -85,12 +85,12 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
85
85
|
// the paragraph below the node. Visually only the node in between is selected, in reality, three nodes are
|
|
86
86
|
// in the slice.
|
|
87
87
|
// These cases are ignored and moveContent event won't be counted.
|
|
88
|
-
var
|
|
88
|
+
var isMultiSelectTrackingEnabled = fg('platform_editor_track_node_types');
|
|
89
89
|
var nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
|
|
90
90
|
var nodeTypes,
|
|
91
91
|
hasSelectedMultipleNodes = false;
|
|
92
92
|
if (content.childCount > 1) {
|
|
93
|
-
if (
|
|
93
|
+
if (isMultiSelectTrackingEnabled) {
|
|
94
94
|
if (containsExcludedNode(content)) {
|
|
95
95
|
resetState = true;
|
|
96
96
|
} else {
|
|
@@ -128,7 +128,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
128
128
|
nodeName: nodeName,
|
|
129
129
|
nodeDepth: getParentNodeDepth(selection)
|
|
130
130
|
};
|
|
131
|
-
if (
|
|
131
|
+
if (isMultiSelectTrackingEnabled) {
|
|
132
132
|
var _nodeTypes;
|
|
133
133
|
newState = _objectSpread(_objectSpread({}, newState), {}, {
|
|
134
134
|
nodeTypes: (_nodeTypes = nodeTypes) !== null && _nodeTypes !== void 0 ? _nodeTypes : nodeName,
|
|
@@ -20,7 +20,7 @@ import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestT
|
|
|
20
20
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
23
|
-
// TODO: ED-20519 Needs Macro extraction
|
|
23
|
+
// TODO: ED-20519 - Needs Macro extraction
|
|
24
24
|
|
|
25
25
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from '../../editor-commands/commands';
|
|
26
26
|
import { getPluginState as getPastePluginState } from '../plugin-factory';
|
|
@@ -5,7 +5,7 @@ import type { PastePlugin } from '../pastePluginType';
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensure correct layout in nested mode
|
|
7
7
|
*
|
|
8
|
-
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
8
|
+
* TODO: ED-26959 - this func is only used in handlePaste, so layout update won't work for drop event
|
|
9
9
|
*/
|
|
10
10
|
export declare function transformSliceForMedia(slice: Slice, schema: Schema): (selection: Selection) => Slice;
|
|
11
11
|
export declare const isImage: (fileType?: string) => boolean;
|
|
@@ -5,7 +5,7 @@ import type { PastePlugin } from '../pastePluginType';
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensure correct layout in nested mode
|
|
7
7
|
*
|
|
8
|
-
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
8
|
+
* TODO: ED-26959 - this func is only used in handlePaste, so layout update won't work for drop event
|
|
9
9
|
*/
|
|
10
10
|
export declare function transformSliceForMedia(slice: Slice, schema: Schema): (selection: Selection) => Slice;
|
|
11
11
|
export declare const isImage: (fileType?: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
35
|
"@atlaskit/code": "^16.0.0",
|
|
36
|
-
"@atlaskit/editor-common": "^102.
|
|
36
|
+
"@atlaskit/editor-common": "^102.10.0",
|
|
37
37
|
"@atlaskit/editor-markdown-transformer": "^5.16.0",
|
|
38
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
38
|
+
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-annotation": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-better-type-history": "^2.1.0",
|
|
41
|
-
"@atlaskit/editor-plugin-card": "^5.
|
|
41
|
+
"@atlaskit/editor-plugin-card": "^5.3.0",
|
|
42
42
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
43
43
|
"@atlaskit/editor-plugin-list": "^4.1.0",
|
|
44
44
|
"@atlaskit/editor-plugin-media": "^2.3.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/media-client": "^32.0.0",
|
|
49
49
|
"@atlaskit/media-common": "^12.0.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^4.1.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"lodash": "^4.17.21",
|
|
54
54
|
"uuid": "^3.1.0"
|
|
@@ -120,9 +120,6 @@
|
|
|
120
120
|
"platform_editor_vs_code_block_paste": {
|
|
121
121
|
"type": "boolean"
|
|
122
122
|
},
|
|
123
|
-
"platform_editor_advanced_layouts_post_fix_patch_2": {
|
|
124
|
-
"type": "boolean"
|
|
125
|
-
},
|
|
126
123
|
"platform_editor_fix_captions_on_copy": {
|
|
127
124
|
"type": "boolean"
|
|
128
125
|
},
|