@atlaskit/editor-plugin-paste 16.0.11 → 16.0.13

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,19 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 16.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7d9913d23d739`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7d9913d23d739) -
8
+ Clean up feature gate `platform_editor_track_node_types`
9
+ - Updated dependencies
10
+
11
+ ## 16.0.12
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 16.0.11
4
18
 
5
19
  ### Patch Changes
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _analytics = require("@atlaskit/editor-common/analytics");
10
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
9
  var _commands = require("./commands");
13
10
  var _pluginFactory = require("./plugin-factory");
14
11
  var _pluginKey = require("./plugin-key");
15
12
  var _types = require("./types");
16
13
  var _utils = require("./utils");
17
- 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; }
18
- 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; }
19
14
  // This plugin exists only in FullPage/FullWidth Editor and is used to register an event that tells us
20
15
  // that a user cut and than pasted a node. This order of actions could be considered an alternative
21
16
  // to new Drag and Drop functionality. The event (document moved) is not accurate, but should be enough to be
@@ -79,21 +74,16 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
79
74
  var content = slice.content,
80
75
  size = slice.size;
81
76
  var selection = state.selection;
82
- var isMultiSelectTrackingEnabled = (0, _platformFeatureFlags.fg)('platform_editor_track_node_types');
83
77
  var nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
84
78
  var nodeTypes,
85
79
  hasSelectedMultipleNodes = false;
86
80
  if (content.childCount > 1) {
87
- if (isMultiSelectTrackingEnabled) {
88
- if ((0, _utils.containsExcludedNode)(content)) {
89
- resetState = true;
90
- } else {
91
- var attributes = (0, _utils.getMultipleSelectionAttributes)(content);
92
- nodeTypes = attributes.nodeTypes;
93
- hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
94
- }
95
- } else {
81
+ if ((0, _utils.containsExcludedNode)(content)) {
96
82
  resetState = true;
83
+ } else {
84
+ var attributes = (0, _utils.getMultipleSelectionAttributes)(content);
85
+ nodeTypes = attributes.nodeTypes;
86
+ hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
97
87
  }
98
88
  } else if (content.childCount === 1) {
99
89
  // Some nodes are not relevant as they are parts of nodes, not whole nodes (like tableCell, tableHeader instead of table node)
@@ -119,15 +109,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
119
109
  } else {
120
110
  var newState = {
121
111
  size: size,
122
- nodeTypes: nodeTypes,
123
- nodeDepth: (0, _utils.getParentNodeDepth)(selection)
112
+ nodeTypes: nodeTypes !== null && nodeTypes !== void 0 ? nodeTypes : nodeName,
113
+ nodeDepth: (0, _utils.getParentNodeDepth)(selection),
114
+ hasSelectedMultipleNodes: hasSelectedMultipleNodes
124
115
  };
125
- if (isMultiSelectTrackingEnabled) {
126
- newState = _objectSpread(_objectSpread({}, newState), {}, {
127
- nodeTypes: nodeTypes !== null && nodeTypes !== void 0 ? nodeTypes : nodeName,
128
- hasSelectedMultipleNodes: hasSelectedMultipleNodes
129
- });
130
- }
131
116
  (0, _commands.updateContentMoved)(newState, 'contentCut')(state, dispatch);
132
117
  }
133
118
  isCutEvent = false;
@@ -8,7 +8,6 @@ exports.isNestedInlineNode = exports.isNestedInTable = exports.isInlineNode = ex
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _utils = require("@atlaskit/editor-prosemirror/utils");
10
10
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var excludedNodes = ['caption', 'layoutColumn', 'listItem', 'tableHeader', 'tableCell', 'tableRow', 'text', 'placeholder', 'unsupportedBlock', 'unsupportedInline', 'hardBreak', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'taskItem', 'decisionItem'];
13
12
  var isExcludedNode = exports.isExcludedNode = function isExcludedNode(nodeName) {
14
13
  return excludedNodes.includes(nodeName);
@@ -91,7 +90,7 @@ var getMultipleSelectionAttributes = exports.getMultipleSelectionAttributes = fu
91
90
  });
92
91
  }
93
92
  return {
94
- nodeTypes: (0, _platformFeatureFlags.fg)('platform_editor_track_node_types') ? (0, _toConsumableArray2.default)(new Set(nodeTypes)).sort().join(',') : undefined,
93
+ nodeTypes: (0, _toConsumableArray2.default)(new Set(nodeTypes)).sort().join(','),
95
94
  hasSelectedMultipleNodes: nodeTypes.length > 1
96
95
  };
97
96
  };
@@ -1,6 +1,5 @@
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 { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { resetContentMoved, resetContentMovedTransform, updateContentMoved } from './commands';
5
4
  import { createPluginState, getPluginState } from './plugin-factory';
6
5
  import { pluginKey } from './plugin-key';
@@ -81,21 +80,16 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
81
80
  const {
82
81
  selection
83
82
  } = state;
84
- const isMultiSelectTrackingEnabled = fg('platform_editor_track_node_types');
85
83
  const nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
86
84
  let nodeTypes,
87
85
  hasSelectedMultipleNodes = false;
88
86
  if (content.childCount > 1) {
89
- if (isMultiSelectTrackingEnabled) {
90
- if (containsExcludedNode(content)) {
91
- resetState = true;
92
- } else {
93
- const attributes = getMultipleSelectionAttributes(content);
94
- nodeTypes = attributes.nodeTypes;
95
- hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
96
- }
97
- } else {
87
+ if (containsExcludedNode(content)) {
98
88
  resetState = true;
89
+ } else {
90
+ const attributes = getMultipleSelectionAttributes(content);
91
+ nodeTypes = attributes.nodeTypes;
92
+ hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
99
93
  }
100
94
  } else if (content.childCount === 1) {
101
95
  // Some nodes are not relevant as they are parts of nodes, not whole nodes (like tableCell, tableHeader instead of table node)
@@ -119,19 +113,13 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
119
113
  if (resetState) {
120
114
  resetContentMoved()(state, dispatch);
121
115
  } else {
122
- let newState = {
123
- size: size,
124
- nodeTypes: nodeTypes,
125
- nodeDepth: getParentNodeDepth(selection)
116
+ var _nodeTypes;
117
+ const newState = {
118
+ size,
119
+ nodeTypes: (_nodeTypes = nodeTypes) !== null && _nodeTypes !== void 0 ? _nodeTypes : nodeName,
120
+ nodeDepth: getParentNodeDepth(selection),
121
+ hasSelectedMultipleNodes
126
122
  };
127
- if (isMultiSelectTrackingEnabled) {
128
- var _nodeTypes;
129
- newState = {
130
- ...newState,
131
- nodeTypes: (_nodeTypes = nodeTypes) !== null && _nodeTypes !== void 0 ? _nodeTypes : nodeName,
132
- hasSelectedMultipleNodes
133
- };
134
- }
135
123
  updateContentMoved(newState, 'contentCut')(state, dispatch);
136
124
  }
137
125
  isCutEvent = false;
@@ -1,6 +1,5 @@
1
1
  import { findParentNodeClosestToPos, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  const excludedNodes = ['caption', 'layoutColumn', 'listItem', 'tableHeader', 'tableCell', 'tableRow', 'text', 'placeholder', 'unsupportedBlock', 'unsupportedInline', 'hardBreak', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'taskItem', 'decisionItem'];
5
4
  export const isExcludedNode = nodeName => excludedNodes.includes(nodeName);
6
5
  export const isCursorSelectionAtTopLevel = selection => {
@@ -87,7 +86,7 @@ export const getMultipleSelectionAttributes = content => {
87
86
  });
88
87
  }
89
88
  return {
90
- nodeTypes: fg('platform_editor_track_node_types') ? [...new Set(nodeTypes)].sort().join(',') : undefined,
89
+ nodeTypes: [...new Set(nodeTypes)].sort().join(','),
91
90
  hasSelectedMultipleNodes: nodeTypes.length > 1
92
91
  };
93
92
  };
@@ -1,9 +1,5 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
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
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
3
  import { resetContentMoved, resetContentMovedTransform, updateContentMoved } from './commands';
8
4
  import { createPluginState, getPluginState } from './plugin-factory';
9
5
  import { pluginKey } from './plugin-key';
@@ -73,21 +69,16 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
73
69
  var content = slice.content,
74
70
  size = slice.size;
75
71
  var selection = state.selection;
76
- var isMultiSelectTrackingEnabled = fg('platform_editor_track_node_types');
77
72
  var nodeName = ((_content$firstChild2 = content.firstChild) === null || _content$firstChild2 === void 0 ? void 0 : _content$firstChild2.type.name) || '';
78
73
  var nodeTypes,
79
74
  hasSelectedMultipleNodes = false;
80
75
  if (content.childCount > 1) {
81
- if (isMultiSelectTrackingEnabled) {
82
- if (containsExcludedNode(content)) {
83
- resetState = true;
84
- } else {
85
- var attributes = getMultipleSelectionAttributes(content);
86
- nodeTypes = attributes.nodeTypes;
87
- hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
88
- }
89
- } else {
76
+ if (containsExcludedNode(content)) {
90
77
  resetState = true;
78
+ } else {
79
+ var attributes = getMultipleSelectionAttributes(content);
80
+ nodeTypes = attributes.nodeTypes;
81
+ hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
91
82
  }
92
83
  } else if (content.childCount === 1) {
93
84
  // Some nodes are not relevant as they are parts of nodes, not whole nodes (like tableCell, tableHeader instead of table node)
@@ -113,15 +104,10 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
113
104
  } else {
114
105
  var newState = {
115
106
  size: size,
116
- nodeTypes: nodeTypes,
117
- nodeDepth: getParentNodeDepth(selection)
107
+ nodeTypes: nodeTypes !== null && nodeTypes !== void 0 ? nodeTypes : nodeName,
108
+ nodeDepth: getParentNodeDepth(selection),
109
+ hasSelectedMultipleNodes: hasSelectedMultipleNodes
118
110
  };
119
- if (isMultiSelectTrackingEnabled) {
120
- newState = _objectSpread(_objectSpread({}, newState), {}, {
121
- nodeTypes: nodeTypes !== null && nodeTypes !== void 0 ? nodeTypes : nodeName,
122
- hasSelectedMultipleNodes: hasSelectedMultipleNodes
123
- });
124
- }
125
111
  updateContentMoved(newState, 'contentCut')(state, dispatch);
126
112
  }
127
113
  isCutEvent = false;
@@ -1,7 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { findParentNodeClosestToPos, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  var excludedNodes = ['caption', 'layoutColumn', 'listItem', 'tableHeader', 'tableCell', 'tableRow', 'text', 'placeholder', 'unsupportedBlock', 'unsupportedInline', 'hardBreak', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'taskItem', 'decisionItem'];
6
5
  export var isExcludedNode = function isExcludedNode(nodeName) {
7
6
  return excludedNodes.includes(nodeName);
@@ -84,7 +83,7 @@ export var getMultipleSelectionAttributes = function getMultipleSelectionAttribu
84
83
  });
85
84
  }
86
85
  return {
87
- nodeTypes: fg('platform_editor_track_node_types') ? _toConsumableArray(new Set(nodeTypes)).sort().join(',') : undefined,
86
+ nodeTypes: _toConsumableArray(new Set(nodeTypes)).sort().join(','),
88
87
  hasSelectedMultipleNodes: nodeTypes.length > 1
89
88
  };
90
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "16.0.11",
3
+ "version": "16.0.13",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,19 +37,19 @@
37
37
  "@atlaskit/flag": "^18.3.0",
38
38
  "@atlaskit/icon": "^37.4.0",
39
39
  "@atlaskit/insm": "^2.0.0",
40
- "@atlaskit/media-client": "^37.3.0",
40
+ "@atlaskit/media-client": "^37.4.0",
41
41
  "@atlaskit/media-common": "^14.4.0",
42
42
  "@atlaskit/platform-feature-experiments": "^0.3.0",
43
43
  "@atlaskit/platform-feature-flags": "^2.1.0",
44
44
  "@atlaskit/prosemirror-history": "^1.2.0",
45
- "@atlaskit/tmp-editor-statsig": "^155.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^156.0.0",
46
46
  "@atlaskit/tokens": "^16.7.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "lodash": "^4.17.21",
49
49
  "uuid": "^3.1.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^119.10.0",
52
+ "@atlaskit/editor-common": "^119.13.0",
53
53
  "react": "^18.2.0 || ^19.2.0",
54
54
  "react-dom": "^18.2.0 || ^19.2.0",
55
55
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -101,9 +101,6 @@
101
101
  "platform_editor_legacy_content_macro_insert": {
102
102
  "type": "boolean"
103
103
  },
104
- "platform_editor_track_node_types": {
105
- "type": "boolean"
106
- },
107
104
  "platform_editor_sharepoint_url_smart_card_fallback": {
108
105
  "type": "boolean"
109
106
  },