@atlaskit/editor-plugin-paste 11.1.2 → 11.1.3

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,13 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 11.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ab837b5646256`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ab837b5646256) -
8
+ [ux] EDITOR-6274 Clean up platform_editor_element_drag_and_drop_multiselect
9
+ - Updated dependencies
10
+
3
11
  ## 11.1.2
4
12
 
5
13
  ### Patch Changes
@@ -16,7 +16,6 @@ var updateContentMoved = exports.updateContentMoved = function updateContentMove
16
16
  var data = {
17
17
  currentActions: [].concat((0, _toConsumableArray2.default)(contentMoved.currentActions), [nextAction]),
18
18
  size: (nextState === null || nextState === void 0 ? void 0 : nextState.size) || contentMoved.size,
19
- nodeName: nextState === null || nextState === void 0 ? void 0 : nextState.nodeName,
20
19
  nodeDepth: nextState === null || nextState === void 0 ? void 0 : nextState.nodeDepth,
21
20
  nodeTypes: nextState === null || nextState === void 0 ? void 0 : nextState.nodeTypes,
22
21
  hasSelectedMultipleNodes: nextState === null || nextState === void 0 ? void 0 : nextState.hasSelectedMultipleNodes
@@ -32,7 +32,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
32
32
  isCutEvent = true;
33
33
  }
34
34
  },
35
- handlePaste: function handlePaste(_ref, event, slice) {
35
+ handlePaste: function handlePaste(_ref, _event, slice) {
36
36
  var _content$firstChild;
37
37
  var state = _ref.state,
38
38
  dispatch = _ref.dispatch;
@@ -46,7 +46,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
46
46
  }
47
47
  var content = slice.content;
48
48
  var nodeName = (_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name;
49
- if (!nodeName || !(contentMoved !== null && contentMoved !== void 0 && contentMoved.nodeName) || !(0, _utils.isCursorSelectionAtTopLevel)(state.selection)) {
49
+ if (!nodeName || !(contentMoved !== null && contentMoved !== void 0 && contentMoved.nodeTypes) || !(0, _utils.isCursorSelectionAtTopLevel)(state.selection)) {
50
50
  return;
51
51
  }
52
52
  var tr = state.tr;
@@ -56,8 +56,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
56
56
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.NODE,
57
57
  eventType: _analytics.EVENT_TYPE.TRACK,
58
58
  attributes: {
59
- // keep nodeName from copied slice
60
- nodeType: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeName,
61
59
  nodeDepth: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeDepth,
62
60
  destinationNodeDepth: (0, _utils.getParentNodeDepth)(state.selection),
63
61
  nodeTypes: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeTypes,
@@ -81,16 +79,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
81
79
  var content = slice.content,
82
80
  size = slice.size;
83
81
  var selection = state.selection;
84
- // Note: the following is not the case once `platform_editor_element_drag_and_drop_multiselect` is enabled
85
- // we now want to track cut events for multiple nodes
86
- // Content should be just one node, so we added a check for slice.content.childCount === 1;
87
- // 1. It is possible to select a table by dragging the mouse over the table's rows.
88
- // As a result, slice will contain rows without tableNode itself and the childCount will be the number of rows.
89
- // From a user's perspective the whole table is selected and copied and on paste a table will indeed be created.
90
- // 2. Some block nodes can get selected when a user drags the mouse from the paragraph above the node to
91
- // the paragraph below the node. Visually only the node in between is selected, in reality, three nodes are
92
- // in the slice.
93
- // These cases are ignored and moveContent event won't be counted.
94
82
  var isMultiSelectTrackingEnabled = (0, _platformFeatureFlags.fg)('platform_editor_track_node_types');
95
83
  var nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
96
84
  var nodeTypes,
@@ -131,7 +119,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
131
119
  } else {
132
120
  var newState = {
133
121
  size: size,
134
- nodeName: nodeName,
122
+ nodeTypes: nodeTypes,
135
123
  nodeDepth: (0, _utils.getParentNodeDepth)(selection)
136
124
  };
137
125
  if (isMultiSelectTrackingEnabled) {
@@ -12,7 +12,6 @@ exports.defaultState = void 0;
12
12
 
13
13
  var defaultState = exports.defaultState = {
14
14
  contentMoved: {
15
- nodeName: undefined,
16
15
  size: undefined,
17
16
  nodeDepth: undefined,
18
17
  currentActions: [],
@@ -8,7 +8,6 @@ export const updateContentMoved = (nextState, nextAction) => createCommand(state
8
8
  const data = {
9
9
  currentActions: [...contentMoved.currentActions, nextAction],
10
10
  size: (nextState === null || nextState === void 0 ? void 0 : nextState.size) || contentMoved.size,
11
- nodeName: nextState === null || nextState === void 0 ? void 0 : nextState.nodeName,
12
11
  nodeDepth: nextState === null || nextState === void 0 ? void 0 : nextState.nodeDepth,
13
12
  nodeTypes: nextState === null || nextState === void 0 ? void 0 : nextState.nodeTypes,
14
13
  hasSelectedMultipleNodes: nextState === null || nextState === void 0 ? void 0 : nextState.hasSelectedMultipleNodes
@@ -26,7 +26,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
26
26
  handlePaste: ({
27
27
  state,
28
28
  dispatch
29
- }, event, slice) => {
29
+ }, _event, slice) => {
30
30
  var _content$firstChild;
31
31
  // The state was cleaned after previous paste. We don't need to update plugin state
32
32
  // with 'contentPasted' if currentActions array doesn't have 'copiedOrCut'.
@@ -41,7 +41,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
41
41
  content
42
42
  } = slice;
43
43
  const nodeName = (_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name;
44
- if (!nodeName || !(contentMoved !== null && contentMoved !== void 0 && contentMoved.nodeName) || !isCursorSelectionAtTopLevel(state.selection)) {
44
+ if (!nodeName || !(contentMoved !== null && contentMoved !== void 0 && contentMoved.nodeTypes) || !isCursorSelectionAtTopLevel(state.selection)) {
45
45
  return;
46
46
  }
47
47
  const {
@@ -53,8 +53,6 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
53
53
  actionSubjectId: ACTION_SUBJECT_ID.NODE,
54
54
  eventType: EVENT_TYPE.TRACK,
55
55
  attributes: {
56
- // keep nodeName from copied slice
57
- nodeType: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeName,
58
56
  nodeDepth: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeDepth,
59
57
  destinationNodeDepth: getParentNodeDepth(state.selection),
60
58
  nodeTypes: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeTypes,
@@ -83,16 +81,6 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
83
81
  const {
84
82
  selection
85
83
  } = state;
86
- // Note: the following is not the case once `platform_editor_element_drag_and_drop_multiselect` is enabled
87
- // we now want to track cut events for multiple nodes
88
- // Content should be just one node, so we added a check for slice.content.childCount === 1;
89
- // 1. It is possible to select a table by dragging the mouse over the table's rows.
90
- // As a result, slice will contain rows without tableNode itself and the childCount will be the number of rows.
91
- // From a user's perspective the whole table is selected and copied and on paste a table will indeed be created.
92
- // 2. Some block nodes can get selected when a user drags the mouse from the paragraph above the node to
93
- // the paragraph below the node. Visually only the node in between is selected, in reality, three nodes are
94
- // in the slice.
95
- // These cases are ignored and moveContent event won't be counted.
96
84
  const isMultiSelectTrackingEnabled = fg('platform_editor_track_node_types');
97
85
  const nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
98
86
  let nodeTypes,
@@ -133,7 +121,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
133
121
  } else {
134
122
  let newState = {
135
123
  size: size,
136
- nodeName: nodeName,
124
+ nodeTypes: nodeTypes,
137
125
  nodeDepth: getParentNodeDepth(selection)
138
126
  };
139
127
  if (isMultiSelectTrackingEnabled) {
@@ -6,7 +6,6 @@
6
6
 
7
7
  export const defaultState = {
8
8
  contentMoved: {
9
- nodeName: undefined,
10
9
  size: undefined,
11
10
  nodeDepth: undefined,
12
11
  currentActions: [],
@@ -9,7 +9,6 @@ export var updateContentMoved = function updateContentMoved(nextState, nextActio
9
9
  var data = {
10
10
  currentActions: [].concat(_toConsumableArray(contentMoved.currentActions), [nextAction]),
11
11
  size: (nextState === null || nextState === void 0 ? void 0 : nextState.size) || contentMoved.size,
12
- nodeName: nextState === null || nextState === void 0 ? void 0 : nextState.nodeName,
13
12
  nodeDepth: nextState === null || nextState === void 0 ? void 0 : nextState.nodeDepth,
14
13
  nodeTypes: nextState === null || nextState === void 0 ? void 0 : nextState.nodeTypes,
15
14
  hasSelectedMultipleNodes: nextState === null || nextState === void 0 ? void 0 : nextState.hasSelectedMultipleNodes
@@ -26,7 +26,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
26
26
  isCutEvent = true;
27
27
  }
28
28
  },
29
- handlePaste: function handlePaste(_ref, event, slice) {
29
+ handlePaste: function handlePaste(_ref, _event, slice) {
30
30
  var _content$firstChild;
31
31
  var state = _ref.state,
32
32
  dispatch = _ref.dispatch;
@@ -40,7 +40,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
40
40
  }
41
41
  var content = slice.content;
42
42
  var nodeName = (_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name;
43
- if (!nodeName || !(contentMoved !== null && contentMoved !== void 0 && contentMoved.nodeName) || !isCursorSelectionAtTopLevel(state.selection)) {
43
+ if (!nodeName || !(contentMoved !== null && contentMoved !== void 0 && contentMoved.nodeTypes) || !isCursorSelectionAtTopLevel(state.selection)) {
44
44
  return;
45
45
  }
46
46
  var tr = state.tr;
@@ -50,8 +50,6 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
50
50
  actionSubjectId: ACTION_SUBJECT_ID.NODE,
51
51
  eventType: EVENT_TYPE.TRACK,
52
52
  attributes: {
53
- // keep nodeName from copied slice
54
- nodeType: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeName,
55
53
  nodeDepth: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeDepth,
56
54
  destinationNodeDepth: getParentNodeDepth(state.selection),
57
55
  nodeTypes: contentMoved === null || contentMoved === void 0 ? void 0 : contentMoved.nodeTypes,
@@ -75,16 +73,6 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
75
73
  var content = slice.content,
76
74
  size = slice.size;
77
75
  var selection = state.selection;
78
- // Note: the following is not the case once `platform_editor_element_drag_and_drop_multiselect` is enabled
79
- // we now want to track cut events for multiple nodes
80
- // Content should be just one node, so we added a check for slice.content.childCount === 1;
81
- // 1. It is possible to select a table by dragging the mouse over the table's rows.
82
- // As a result, slice will contain rows without tableNode itself and the childCount will be the number of rows.
83
- // From a user's perspective the whole table is selected and copied and on paste a table will indeed be created.
84
- // 2. Some block nodes can get selected when a user drags the mouse from the paragraph above the node to
85
- // the paragraph below the node. Visually only the node in between is selected, in reality, three nodes are
86
- // in the slice.
87
- // These cases are ignored and moveContent event won't be counted.
88
76
  var isMultiSelectTrackingEnabled = fg('platform_editor_track_node_types');
89
77
  var nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
90
78
  var nodeTypes,
@@ -125,7 +113,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
125
113
  } else {
126
114
  var newState = {
127
115
  size: size,
128
- nodeName: nodeName,
116
+ nodeTypes: nodeTypes,
129
117
  nodeDepth: getParentNodeDepth(selection)
130
118
  };
131
119
  if (isMultiSelectTrackingEnabled) {
@@ -6,7 +6,6 @@
6
6
 
7
7
  export var defaultState = {
8
8
  contentMoved: {
9
- nodeName: undefined,
10
9
  size: undefined,
11
10
  nodeDepth: undefined,
12
11
  currentActions: [],
@@ -4,7 +4,6 @@ export type ContentMoved = {
4
4
  currentActions: Array<ActionType>;
5
5
  hasSelectedMultipleNodes?: boolean;
6
6
  nodeDepth?: number;
7
- nodeName?: NodeName;
8
7
  nodeTypes?: string;
9
8
  size?: number;
10
9
  };
@@ -4,7 +4,6 @@ export type ContentMoved = {
4
4
  currentActions: Array<ActionType>;
5
5
  hasSelectedMultipleNodes?: boolean;
6
6
  nodeDepth?: number;
7
- nodeName?: NodeName;
8
7
  nodeTypes?: string;
9
8
  size?: number;
10
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "11.1.2",
3
+ "version": "11.1.3",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
- "@atlaskit/adf-schema": "^52.6.0",
30
+ "@atlaskit/adf-schema": "^52.7.0",
31
31
  "@atlaskit/code": "^17.4.0",
32
32
  "@atlaskit/editor-markdown-transformer": "^5.20.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^10.0.0",
@@ -44,18 +44,18 @@
44
44
  "@atlaskit/flag": "^17.11.0",
45
45
  "@atlaskit/icon": "^34.3.0",
46
46
  "@atlaskit/insm": "^0.4.0",
47
- "@atlaskit/media-client": "^36.0.0",
48
- "@atlaskit/media-common": "^13.1.0",
47
+ "@atlaskit/media-client": "^36.1.0",
48
+ "@atlaskit/media-common": "^13.2.0",
49
49
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
50
  "@atlaskit/prosemirror-history": "^0.2.0",
51
- "@atlaskit/tmp-editor-statsig": "^73.0.0",
51
+ "@atlaskit/tmp-editor-statsig": "^74.0.0",
52
52
  "@atlaskit/tokens": "^13.0.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "lodash": "^4.17.21",
55
55
  "uuid": "^3.1.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^114.13.0",
58
+ "@atlaskit/editor-common": "^114.15.0",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"