@atlaskit/editor-plugin-paste 1.0.2 → 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,11 @@
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
+
3
9
  ## 1.0.2
4
10
 
5
11
  ### 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.
@@ -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.
@@ -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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.0.2",
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",