@atlaskit/editor-plugin-paste 1.0.1 → 1.0.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,18 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#75368](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75368) [`0a0d45e03ecf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0a0d45e03ecf) - ED-22245: Fixing the bug to paste links inside nested codeblock
8
+
9
+ ## 1.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#74284](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74284) [`c88cf104546f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c88cf104546f) - fix copy paste issue in excel and numbers that paste table results in screenshot of table pasted
14
+ - Updated dependencies
15
+
3
16
  ## 1.0.1
4
17
 
5
18
  ### Patch Changes
@@ -101,10 +101,18 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
101
101
  taskList = _schema$nodes.taskList,
102
102
  listItem = _schema$nodes.listItem,
103
103
  expand = _schema$nodes.expand,
104
- heading = _schema$nodes.heading;
104
+ heading = _schema$nodes.heading,
105
+ codeBlock = _schema$nodes.codeBlock;
105
106
  var selectionIsValidNode = state.selection instanceof _state.NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
106
107
  var selectionHasValidParentNode = (0, _utils2.hasParentNodeOfType)([decisionItem, taskItem, panel])(state.selection);
107
108
  var selectionIsPanel = (0, _utils2.hasParentNodeOfType)([panel])(state.selection);
109
+ var selectionIsCodeBlock = (0, _utils2.hasParentNodeOfType)([codeBlock])(state.selection);
110
+
111
+ // we avoid handling codeBlock-in-panel use case in this function
112
+ // returning false will allow code to flow into `handleCodeBlock` function
113
+ if (selectionIsPanel && selectionIsCodeBlock) {
114
+ return false;
115
+ }
108
116
 
109
117
  // Some types of content should be handled by the default handler, not this function.
110
118
  // Check through slice content to see if it contains an invalid node.
@@ -27,6 +27,7 @@ var _editorMarkdownTransformer = require("@atlaskit/editor-markdown-transformer"
27
27
  var _model = require("@atlaskit/editor-prosemirror/model");
28
28
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
29
29
  var _utils3 = require("@atlaskit/editor-tables/utils");
30
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
31
  var _actions = require("../actions");
31
32
  var _commands = require("../commands");
32
33
  var _handlers = require("../handlers");
@@ -175,7 +176,13 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
175
176
  if ((0, _util.htmlContainsSingleFile)(html)) {
176
177
  return true;
177
178
  }
178
- event.stopImmediatePropagation();
179
+
180
+ /**
181
+ * https://product-fabric.atlassian.net/browse/ED-21993
182
+ * stopImmediatePropagation will run the first event attached to the same element
183
+ * Which chould have race condition issue
184
+ */
185
+ (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
179
186
  }
180
187
  var state = view.state;
181
188
  var analyticsPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 || (_pluginInjectionApi$a2 = _pluginInjectionApi$a2.sharedState) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.currentState();
@@ -74,12 +74,20 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
74
74
  taskList,
75
75
  listItem,
76
76
  expand,
77
- heading
77
+ heading,
78
+ codeBlock
78
79
  }
79
80
  } = schema;
80
81
  const selectionIsValidNode = state.selection instanceof NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
81
82
  const selectionHasValidParentNode = hasParentNodeOfType([decisionItem, taskItem, panel])(state.selection);
82
83
  const selectionIsPanel = hasParentNodeOfType([panel])(state.selection);
84
+ const selectionIsCodeBlock = hasParentNodeOfType([codeBlock])(state.selection);
85
+
86
+ // we avoid handling codeBlock-in-panel use case in this function
87
+ // returning false will allow code to flow into `handleCodeBlock` function
88
+ if (selectionIsPanel && selectionIsCodeBlock) {
89
+ return false;
90
+ }
83
91
 
84
92
  // Some types of content should be handled by the default handler, not this function.
85
93
  // Check through slice content to see if it contains an invalid node.
@@ -11,6 +11,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
11
11
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
12
12
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
13
13
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
14
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
15
  import { PastePluginActionTypes } from '../actions';
15
16
  import { splitParagraphs, upgradeTextToLists } from '../commands';
16
17
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
@@ -139,7 +140,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
139
140
  if (htmlContainsSingleFile(html)) {
140
141
  return true;
141
142
  }
142
- event.stopImmediatePropagation();
143
+
144
+ /**
145
+ * https://product-fabric.atlassian.net/browse/ED-21993
146
+ * stopImmediatePropagation will run the first event attached to the same element
147
+ * Which chould have race condition issue
148
+ */
149
+ getBooleanFF('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
143
150
  }
144
151
  const {
145
152
  state
@@ -79,10 +79,18 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
79
79
  taskList = _schema$nodes.taskList,
80
80
  listItem = _schema$nodes.listItem,
81
81
  expand = _schema$nodes.expand,
82
- heading = _schema$nodes.heading;
82
+ heading = _schema$nodes.heading,
83
+ codeBlock = _schema$nodes.codeBlock;
83
84
  var selectionIsValidNode = state.selection instanceof NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
84
85
  var selectionHasValidParentNode = hasParentNodeOfType([decisionItem, taskItem, panel])(state.selection);
85
86
  var selectionIsPanel = hasParentNodeOfType([panel])(state.selection);
87
+ var selectionIsCodeBlock = hasParentNodeOfType([codeBlock])(state.selection);
88
+
89
+ // we avoid handling codeBlock-in-panel use case in this function
90
+ // returning false will allow code to flow into `handleCodeBlock` function
91
+ if (selectionIsPanel && selectionIsCodeBlock) {
92
+ return false;
93
+ }
86
94
 
87
95
  // Some types of content should be handled by the default handler, not this function.
88
96
  // Check through slice content to see if it contains an invalid node.
@@ -13,6 +13,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
13
13
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
14
14
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
15
15
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
16
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
17
  import { PastePluginActionTypes } from '../actions';
17
18
  import { splitParagraphs, upgradeTextToLists } from '../commands';
18
19
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
@@ -162,7 +163,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
162
163
  if (htmlContainsSingleFile(html)) {
163
164
  return true;
164
165
  }
165
- event.stopImmediatePropagation();
166
+
167
+ /**
168
+ * https://product-fabric.atlassian.net/browse/ED-21993
169
+ * stopImmediatePropagation will run the first event attached to the same element
170
+ * Which chould have race condition issue
171
+ */
172
+ getBooleanFF('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
166
173
  }
167
174
  var state = view.state;
168
175
  var analyticsPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 || (_pluginInjectionApi$a2 = _pluginInjectionApi$a2.sharedState) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.currentState();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^78.0.0",
36
+ "@atlaskit/editor-common": "^78.3.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.3.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^1.0.0",
@@ -122,6 +122,9 @@
122
122
  },
123
123
  "platform.editor.allow-action-in-list": {
124
124
  "type": "boolean"
125
+ },
126
+ "platform.editor.media.fix-copy-paste-excel_62g4s": {
127
+ "type": "boolean"
125
128
  }
126
129
  }
127
130
  }