@atlaskit/editor-plugin-paste 3.1.3 → 3.1.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 3.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#129464](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/129464)
8
+ [`d5aeeb5947ae5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d5aeeb5947ae5) -
9
+ Cleans up feature flag that fixes pasting action items in a list
10
+
11
+ ## 3.1.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [#128182](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128182)
16
+ [`7ff8302c0c02e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ff8302c0c02e) -
17
+ Replace experiment with gate
18
+
3
19
  ## 3.1.3
4
20
 
5
21
  ### Patch Changes
@@ -371,7 +371,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
371
371
 
372
372
  // get editor-tables to handle pasting tables if it can
373
373
  // otherwise, just the replace the selection with the content
374
- if ((0, _utils3.handlePaste)(view, null, slice)) {
374
+ if ((0, _utils3.handlePaste)(view, event, slice, {
375
+ pasteSource: (0, _util.getPasteSource)(event)
376
+ })) {
375
377
  (0, _analytics2.sendPasteAnalyticsEvent)(editorAnalyticsAPI)(view, event, slice, {
376
378
  type: _analytics.PasteTypes.richText
377
379
  });
@@ -508,9 +510,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
508
510
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
509
511
  slice = new _model.Slice(slice.content, 0, 0);
510
512
  }
511
- if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_2')) {
512
- slice = (0, _transforms.transformSingleColumnLayout)(slice, schema);
513
- }
513
+ slice = (0, _transforms.transformSingleColumnLayout)(slice, schema);
514
514
  if ((0, _platformFeatureFlags.fg)('platform_editor_macroid_reset_for_ext_on_paste')) {
515
515
  slice = (0, _transforms.transformSliceToRemoveMacroId)(slice, schema);
516
516
  }
@@ -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 _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
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 isMultiSelectEnabled = (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true);
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 (isMultiSelectEnabled) {
99
+ if (isMultiSelectTrackingEnabled) {
100
100
  if ((0, _utils.containsExcludedNode)(content)) {
101
101
  resetState = true;
102
102
  } else {
@@ -134,10 +134,9 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
134
134
  nodeName: nodeName,
135
135
  nodeDepth: (0, _utils.getParentNodeDepth)(selection)
136
136
  };
137
- if (isMultiSelectEnabled) {
138
- var _nodeTypes;
137
+ if (isMultiSelectTrackingEnabled) {
139
138
  newState = _objectSpread(_objectSpread({}, newState), {}, {
140
- nodeTypes: (_nodeTypes = nodeTypes) !== null && _nodeTypes !== void 0 ? _nodeTypes : nodeName,
139
+ nodeTypes: nodeTypes !== null && nodeTypes !== void 0 ? nodeTypes : nodeName,
141
140
  hasSelectedMultipleNodes: hasSelectedMultipleNodes
142
141
  });
143
142
  }
@@ -12,7 +12,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _transform = require("@atlaskit/editor-prosemirror/transform");
14
14
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _index = require("../index");
17
16
  var _lists = require("./lists");
18
17
  function insertSliceForLists(_ref) {
@@ -108,13 +107,7 @@ function insertSliceForTaskInsideList(_ref5) {
108
107
  //To avoid the list being replaced with the tasklist, enclose the slice within a taskItem.
109
108
  var selectionBeforeReplace = tr.selection.from;
110
109
  tr.replaceSelection(new _model.Slice(_model.Fragment.from(schema.nodes.taskItem.createAndFill()), 0, 0));
111
- if ((0, _platformFeatureFlags.fg)('platform_editor_fix_paste_action_item_in_list')) {
112
- var nextSelection = _state.Selection.near(tr.doc.resolve(selectionBeforeReplace + 1));
113
- tr.setSelection(nextSelection);
114
- } else {
115
- updateSelectionAfterReplace({
116
- tr: tr
117
- });
118
- }
110
+ var nextSelection = _state.Selection.near(tr.doc.resolve(selectionBeforeReplace + 1));
111
+ tr.setSelection(nextSelection);
119
112
  tr.replaceSelection(slice);
120
113
  }
@@ -41,7 +41,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
41
41
  var _state = require("@atlaskit/editor-prosemirror/state");
42
42
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
43
43
  var _utils3 = require("@atlaskit/editor-tables/utils");
44
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
45
44
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
46
45
  var _commands = require("../../editor-commands/commands");
47
46
  var _pluginFactory = require("../plugin-factory");
@@ -266,22 +265,8 @@ function handlePasteNonNestableBlockNodesIntoList(slice) {
266
265
  var listItemWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth; // difference in depth between to position and list item node
267
266
 
268
267
  // Anything to do with nested lists should safeInsert and not be handled here
269
- if ((0, _platformFeatureFlags.fg)('platform_editor_fix_paste_action_item_in_list')) {
270
- if (checkIfSelectionInNestedList(state)) {
271
- return false;
272
- }
273
- } else {
274
- var grandParentListNode = (0, _utils2.findParentNodeOfTypeClosestToPos)(tr.doc.resolve(selectionParentListNodeWithPos.pos), [bulletList, orderedList]);
275
- var selectionIsInNestedList = !!grandParentListNode;
276
- var selectedListItemHasNestedList = false;
277
- selectionParentListItemNode.node.content.forEach(function (child) {
278
- if ((0, _utils.isListNode)(child)) {
279
- selectedListItemHasNestedList = true;
280
- }
281
- });
282
- if (selectedListItemHasNestedList || selectionIsInNestedList) {
283
- return false;
284
- }
268
+ if (checkIfSelectionInNestedList(state)) {
269
+ return false;
285
270
  }
286
271
 
287
272
  // Node after the insert position
@@ -1050,7 +1035,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
1050
1035
  });
1051
1036
  if ((0, _utils.insideTableCell)(state) && (0, _utils.isInListItem)(state) && (0, _utils2.canInsert)(selection.$from, slice.content) && (0, _utils2.canInsert)(selection.$to, slice.content) || sliceHasList) {
1052
1037
  tr.replaceSelection(slice);
1053
- } else if (checkTaskListInList(state, slice) && (!(0, _platformFeatureFlags.fg)('platform_editor_fix_paste_action_item_in_list') || !checkIfSelectionInNestedList(state))) {
1038
+ } else if (checkTaskListInList(state, slice) && !checkIfSelectionInNestedList(state)) {
1054
1039
  (0, _edgeCases.insertSliceForTaskInsideList)({
1055
1040
  tr: tr,
1056
1041
  slice: slice
@@ -1059,7 +1044,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
1059
1044
  // need safeInsert rather than replaceSelection, so that nodes aren't split in half
1060
1045
  // e.g. when pasting a layout into a table, replaceSelection splits the table in half and adds the layout in the middle
1061
1046
  tr = (0, _utils2.safeInsert)(slice.content, tr.selection.$to.pos)(tr);
1062
- if (checkTaskListInList(state, slice) && (0, _platformFeatureFlags.fg)('platform_editor_fix_paste_action_item_in_list')) {
1047
+ if (checkTaskListInList(state, slice)) {
1063
1048
  (0, _edgeCases.updateSelectionAfterReplace)({
1064
1049
  tr: tr
1065
1050
  });
@@ -345,7 +345,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
345
345
 
346
346
  // get editor-tables to handle pasting tables if it can
347
347
  // otherwise, just the replace the selection with the content
348
- if (handlePasteTable(view, null, slice)) {
348
+ if (handlePasteTable(view, event, slice, {
349
+ pasteSource: getPasteSource(event)
350
+ })) {
349
351
  sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
350
352
  type: PasteTypes.richText
351
353
  });
@@ -482,9 +484,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
482
484
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
483
485
  slice = new Slice(slice.content, 0, 0);
484
486
  }
485
- if (fg('platform_editor_advanced_layouts_post_fix_patch_2')) {
486
- slice = transformSingleColumnLayout(slice, schema);
487
- }
487
+ slice = transformSingleColumnLayout(slice, schema);
488
488
  if (fg('platform_editor_macroid_reset_for_ext_on_paste')) {
489
489
  slice = transformSliceToRemoveMacroId(slice, schema);
490
490
  }
@@ -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 { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
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 isMultiSelectEnabled = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
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 (isMultiSelectEnabled) {
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 (isMultiSelectEnabled) {
139
+ if (isMultiSelectTrackingEnabled) {
140
140
  var _nodeTypes;
141
141
  newState = {
142
142
  ...newState,
@@ -3,7 +3,6 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../index';
8
7
  import { insertSliceAtNodeEdge, insertSliceInsideOfPanelNodeSelected, insertSliceIntoEmptyNode, insertSliceIntoRangeSelectionInsideList } from './lists';
9
8
  export function insertSliceForLists({
@@ -111,13 +110,7 @@ export function insertSliceForTaskInsideList({
111
110
  //To avoid the list being replaced with the tasklist, enclose the slice within a taskItem.
112
111
  const selectionBeforeReplace = tr.selection.from;
113
112
  tr.replaceSelection(new Slice(Fragment.from(schema.nodes.taskItem.createAndFill()), 0, 0));
114
- if (fg('platform_editor_fix_paste_action_item_in_list')) {
115
- const nextSelection = Selection.near(tr.doc.resolve(selectionBeforeReplace + 1));
116
- tr.setSelection(nextSelection);
117
- } else {
118
- updateSelectionAfterReplace({
119
- tr
120
- });
121
- }
113
+ const nextSelection = Selection.near(tr.doc.resolve(selectionBeforeReplace + 1));
114
+ tr.setSelection(nextSelection);
122
115
  tr.replaceSelection(slice);
123
116
  }
@@ -10,7 +10,6 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
10
10
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
12
12
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
14
  // TODO: ED-20519 - Needs Macro extraction
16
15
 
@@ -243,22 +242,8 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
243
242
  const listItemWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth; // difference in depth between to position and list item node
244
243
 
245
244
  // Anything to do with nested lists should safeInsert and not be handled here
246
- if (fg('platform_editor_fix_paste_action_item_in_list')) {
247
- if (checkIfSelectionInNestedList(state)) {
248
- return false;
249
- }
250
- } else {
251
- const grandParentListNode = findParentNodeOfTypeClosestToPos(tr.doc.resolve(selectionParentListNodeWithPos.pos), [bulletList, orderedList]);
252
- const selectionIsInNestedList = !!grandParentListNode;
253
- let selectedListItemHasNestedList = false;
254
- selectionParentListItemNode.node.content.forEach(child => {
255
- if (isListNode(child)) {
256
- selectedListItemHasNestedList = true;
257
- }
258
- });
259
- if (selectedListItemHasNestedList || selectionIsInNestedList) {
260
- return false;
261
- }
245
+ if (checkIfSelectionInNestedList(state)) {
246
+ return false;
262
247
  }
263
248
 
264
249
  // Node after the insert position
@@ -1033,7 +1018,7 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
1033
1018
  });
1034
1019
  if (insideTableCell(state) && isInListItem(state) && canInsert(selection.$from, slice.content) && canInsert(selection.$to, slice.content) || sliceHasList) {
1035
1020
  tr.replaceSelection(slice);
1036
- } else if (checkTaskListInList(state, slice) && (!fg('platform_editor_fix_paste_action_item_in_list') || !checkIfSelectionInNestedList(state))) {
1021
+ } else if (checkTaskListInList(state, slice) && !checkIfSelectionInNestedList(state)) {
1037
1022
  insertSliceForTaskInsideList({
1038
1023
  tr,
1039
1024
  slice
@@ -1042,7 +1027,7 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
1042
1027
  // need safeInsert rather than replaceSelection, so that nodes aren't split in half
1043
1028
  // e.g. when pasting a layout into a table, replaceSelection splits the table in half and adds the layout in the middle
1044
1029
  tr = safeInsert(slice.content, tr.selection.$to.pos)(tr);
1045
- if (checkTaskListInList(state, slice) && fg('platform_editor_fix_paste_action_item_in_list')) {
1030
+ if (checkTaskListInList(state, slice)) {
1046
1031
  updateSelectionAfterReplace({
1047
1032
  tr
1048
1033
  });
@@ -363,7 +363,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
363
363
 
364
364
  // get editor-tables to handle pasting tables if it can
365
365
  // otherwise, just the replace the selection with the content
366
- if (handlePasteTable(view, null, slice)) {
366
+ if (handlePasteTable(view, event, slice, {
367
+ pasteSource: getPasteSource(event)
368
+ })) {
367
369
  sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
368
370
  type: PasteTypes.richText
369
371
  });
@@ -500,9 +502,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
500
502
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
501
503
  slice = new Slice(slice.content, 0, 0);
502
504
  }
503
- if (fg('platform_editor_advanced_layouts_post_fix_patch_2')) {
504
- slice = transformSingleColumnLayout(slice, schema);
505
- }
505
+ slice = transformSingleColumnLayout(slice, schema);
506
506
  if (fg('platform_editor_macroid_reset_for_ext_on_paste')) {
507
507
  slice = transformSliceToRemoveMacroId(slice, schema);
508
508
  }
@@ -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 { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
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 isMultiSelectEnabled = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
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 (isMultiSelectEnabled) {
93
+ if (isMultiSelectTrackingEnabled) {
94
94
  if (containsExcludedNode(content)) {
95
95
  resetState = true;
96
96
  } else {
@@ -128,10 +128,9 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
128
128
  nodeName: nodeName,
129
129
  nodeDepth: getParentNodeDepth(selection)
130
130
  };
131
- if (isMultiSelectEnabled) {
132
- var _nodeTypes;
131
+ if (isMultiSelectTrackingEnabled) {
133
132
  newState = _objectSpread(_objectSpread({}, newState), {}, {
134
- nodeTypes: (_nodeTypes = nodeTypes) !== null && _nodeTypes !== void 0 ? _nodeTypes : nodeName,
133
+ nodeTypes: nodeTypes !== null && nodeTypes !== void 0 ? nodeTypes : nodeName,
135
134
  hasSelectedMultipleNodes: hasSelectedMultipleNodes
136
135
  });
137
136
  }
@@ -3,7 +3,6 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../index';
8
7
  import { insertSliceAtNodeEdge, insertSliceInsideOfPanelNodeSelected, insertSliceIntoEmptyNode, insertSliceIntoRangeSelectionInsideList } from './lists';
9
8
  export function insertSliceForLists(_ref) {
@@ -99,13 +98,7 @@ export function insertSliceForTaskInsideList(_ref5) {
99
98
  //To avoid the list being replaced with the tasklist, enclose the slice within a taskItem.
100
99
  var selectionBeforeReplace = tr.selection.from;
101
100
  tr.replaceSelection(new Slice(Fragment.from(schema.nodes.taskItem.createAndFill()), 0, 0));
102
- if (fg('platform_editor_fix_paste_action_item_in_list')) {
103
- var nextSelection = Selection.near(tr.doc.resolve(selectionBeforeReplace + 1));
104
- tr.setSelection(nextSelection);
105
- } else {
106
- updateSelectionAfterReplace({
107
- tr: tr
108
- });
109
- }
101
+ var nextSelection = Selection.near(tr.doc.resolve(selectionBeforeReplace + 1));
102
+ tr.setSelection(nextSelection);
110
103
  tr.replaceSelection(slice);
111
104
  }
@@ -18,7 +18,6 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
18
18
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
19
19
  import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
20
20
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
21
- import { fg } from '@atlaskit/platform-feature-flags';
22
21
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
23
22
  // TODO: ED-20519 - Needs Macro extraction
24
23
 
@@ -240,22 +239,8 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
240
239
  var listItemWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth; // difference in depth between to position and list item node
241
240
 
242
241
  // Anything to do with nested lists should safeInsert and not be handled here
243
- if (fg('platform_editor_fix_paste_action_item_in_list')) {
244
- if (checkIfSelectionInNestedList(state)) {
245
- return false;
246
- }
247
- } else {
248
- var grandParentListNode = findParentNodeOfTypeClosestToPos(tr.doc.resolve(selectionParentListNodeWithPos.pos), [bulletList, orderedList]);
249
- var selectionIsInNestedList = !!grandParentListNode;
250
- var selectedListItemHasNestedList = false;
251
- selectionParentListItemNode.node.content.forEach(function (child) {
252
- if (isListNode(child)) {
253
- selectedListItemHasNestedList = true;
254
- }
255
- });
256
- if (selectedListItemHasNestedList || selectionIsInNestedList) {
257
- return false;
258
- }
242
+ if (checkIfSelectionInNestedList(state)) {
243
+ return false;
259
244
  }
260
245
 
261
246
  // Node after the insert position
@@ -1024,7 +1009,7 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
1024
1009
  });
1025
1010
  if (insideTableCell(state) && isInListItem(state) && canInsert(selection.$from, slice.content) && canInsert(selection.$to, slice.content) || sliceHasList) {
1026
1011
  tr.replaceSelection(slice);
1027
- } else if (checkTaskListInList(state, slice) && (!fg('platform_editor_fix_paste_action_item_in_list') || !checkIfSelectionInNestedList(state))) {
1012
+ } else if (checkTaskListInList(state, slice) && !checkIfSelectionInNestedList(state)) {
1028
1013
  insertSliceForTaskInsideList({
1029
1014
  tr: tr,
1030
1015
  slice: slice
@@ -1033,7 +1018,7 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
1033
1018
  // need safeInsert rather than replaceSelection, so that nodes aren't split in half
1034
1019
  // e.g. when pasting a layout into a table, replaceSelection splits the table in half and adds the layout in the middle
1035
1020
  tr = safeInsert(slice.content, tr.selection.$to.pos)(tr);
1036
- if (checkTaskListInList(state, slice) && fg('platform_editor_fix_paste_action_item_in_list')) {
1021
+ if (checkTaskListInList(state, slice)) {
1037
1022
  updateSelectionAfterReplace({
1038
1023
  tr: tr
1039
1024
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,15 +32,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.6.0",
35
- "@atlaskit/code": "^16.0.0",
36
- "@atlaskit/editor-common": "^102.8.0",
35
+ "@atlaskit/code": "^16.1.0",
36
+ "@atlaskit/editor-common": "^102.13.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.16.0",
38
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.3.0",
41
+ "@atlaskit/editor-plugin-card": "^5.4.0",
42
42
  "@atlaskit/editor-plugin-feature-flags": "^1.3.0",
43
- "@atlaskit/editor-plugin-list": "^4.1.0",
43
+ "@atlaskit/editor-plugin-list": "^4.2.0",
44
44
  "@atlaskit/editor-plugin-media": "^2.3.0",
45
45
  "@atlaskit/editor-plugin-mentions": "^4.1.0",
46
46
  "@atlaskit/editor-prosemirror": "7.0.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": "^4.0.0",
51
+ "@atlaskit/tmp-editor-statsig": "^4.3.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "lodash": "^4.17.21",
54
54
  "uuid": "^3.1.0"
@@ -61,7 +61,7 @@
61
61
  "@af/visual-regression": "^1.3.0",
62
62
  "@atlaskit/editor-plugin-block-type": "^5.1.0",
63
63
  "@atlaskit/editor-plugin-history": "^2.0.0",
64
- "@atlaskit/editor-plugin-type-ahead": "^2.1.0",
64
+ "@atlaskit/editor-plugin-type-ahead": "^2.2.0",
65
65
  "@atlaskit/ssr": "^0.4.0",
66
66
  "@atlaskit/visual-regression": "^0.10.0",
67
67
  "@testing-library/react": "^13.4.0",
@@ -120,15 +120,9 @@
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
  },
129
- "platform_editor_fix_paste_action_item_in_list": {
130
- "type": "boolean"
131
- },
132
126
  "platform_editor_legacy_content_macro": {
133
127
  "type": "boolean"
134
128
  },