@atlaskit/editor-plugin-paste 0.2.1 → 0.2.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 +15 -0
- package/dist/cjs/edge-cases/index.js +5 -1
- package/dist/cjs/handlers.js +9 -4
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/es2019/edge-cases/index.js +8 -2
- package/dist/es2019/handlers.js +10 -5
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/esm/edge-cases/index.js +6 -2
- package/dist/esm/handlers.js +10 -5
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/types/edge-cases/index.d.ts +3 -3
- package/dist/types-ts4.5/edge-cases/index.d.ts +3 -3
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#64592](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64592) [`21e21d79ce84`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/21e21d79ce84) - fix copy pasting content from expands inside a table so only selected content is pasted
|
|
8
|
+
- [#65031](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65031) [`a00094111b5a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a00094111b5a) - ED-21609 Update adf-schema to 35.3.0
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 0.2.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#64216](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64216) [`582a3eef15ae`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/582a3eef15ae) - ED-20824 Fix copy paste issues with multi-level list inside blockquote
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 0.2.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.insertSliceForLists = insertSliceForLists;
|
|
7
7
|
exports.insertSliceForListsInsideBlockquote = insertSliceForListsInsideBlockquote;
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
11
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
12
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -66,7 +67,9 @@ function insertSliceForLists(_ref) {
|
|
|
66
67
|
function insertSliceForListsInsideBlockquote(_ref3) {
|
|
67
68
|
var tr = _ref3.tr,
|
|
68
69
|
slice = _ref3.slice;
|
|
69
|
-
|
|
70
|
+
//insert blockquote explicitly and set the selection in blockquote since replaceSelection will only insert the list
|
|
71
|
+
var schema = tr.doc.type.schema;
|
|
72
|
+
tr.replaceSelection(new _model.Slice(_model.Fragment.from(schema.nodes.blockquote.createAndFill()), 0, 0));
|
|
70
73
|
// ProseMirror doesn't give a proper way to tell us where something was inserted.
|
|
71
74
|
// However, we can know "how" it inserted something.
|
|
72
75
|
//
|
|
@@ -85,4 +88,5 @@ function insertSliceForListsInsideBlockquote(_ref3) {
|
|
|
85
88
|
if (nextSelection) {
|
|
86
89
|
tr.setSelection(nextSelection);
|
|
87
90
|
}
|
|
91
|
+
tr.replaceSelection(slice);
|
|
88
92
|
}
|
package/dist/cjs/handlers.js
CHANGED
|
@@ -154,7 +154,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
154
154
|
}
|
|
155
155
|
function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
156
156
|
return function (state, dispatch) {
|
|
157
|
-
var _tr$doc$nodeAt, _sliceContent$firstCh, _findParentNodeOfType;
|
|
157
|
+
var _tr$doc$nodeAt, _slice$content$firstC2, _sliceContent$firstCh, _findParentNodeOfType;
|
|
158
158
|
var tr = state.tr;
|
|
159
159
|
var selection = tr.selection;
|
|
160
160
|
var $from = selection.$from,
|
|
@@ -229,7 +229,12 @@ function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
// handle the insertion of the slice
|
|
232
|
-
if (
|
|
232
|
+
if (((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type.name) === 'blockquote' && (0, _utils2.contains)(slice.content.firstChild, state.schema.nodes.listItem)) {
|
|
233
|
+
(0, _edgeCases.insertSliceForListsInsideBlockquote)({
|
|
234
|
+
tr: tr,
|
|
235
|
+
slice: slice
|
|
236
|
+
});
|
|
237
|
+
} else if (sliceContainsNodeThatPastesAsPlainText || nodeAfterInsertPositionIsListItem || sliceContent.childCount > 1 && ((_sliceContent$firstCh = sliceContent.firstChild) === null || _sliceContent$firstCh === void 0 ? void 0 : _sliceContent$firstCh.type.name) !== 'paragraph') {
|
|
233
238
|
tr.replaceWith(from, replaceTo, sliceContent).scrollIntoView();
|
|
234
239
|
} else {
|
|
235
240
|
// When the selection is not at the end of a list item
|
|
@@ -600,7 +605,7 @@ function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
|
|
|
600
605
|
var checkExpand = function checkExpand(slice) {
|
|
601
606
|
var hasExpand = false;
|
|
602
607
|
slice.content.forEach(function (node) {
|
|
603
|
-
if (node.type.name === 'expand') {
|
|
608
|
+
if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
|
|
604
609
|
hasExpand = true;
|
|
605
610
|
}
|
|
606
611
|
});
|
|
@@ -619,7 +624,7 @@ function handleExpandPasteInTable(slice) {
|
|
|
619
624
|
var tr = state.tr;
|
|
620
625
|
var hasExpand = false;
|
|
621
626
|
var newSlice = (0, _utils.mapSlice)(slice, function (maybeNode) {
|
|
622
|
-
if (maybeNode.type === expand) {
|
|
627
|
+
if (maybeNode.type === expand || maybeNode.type === nestedExpand) {
|
|
623
628
|
hasExpand = true;
|
|
624
629
|
try {
|
|
625
630
|
return nestedExpand.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
|
|
@@ -331,10 +331,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
331
331
|
if (isRichText && isInsideBlockQuote(state)) {
|
|
332
332
|
//If pasting inside blockquote
|
|
333
333
|
//Skip the blockquote node and keep remaining nodes as they are
|
|
334
|
+
//prevent doing this if there is list inside blockquote as the list is pasted incorrectly inside blockquote due to wrong openStart and openEnd
|
|
334
335
|
var blockquote = schema.nodes.blockquote;
|
|
335
336
|
var children = [];
|
|
336
337
|
(0, _utils.mapChildren)(slice.content, function (node) {
|
|
337
|
-
if (node.type === blockquote) {
|
|
338
|
+
if (node.type === blockquote && !(0, _utils2.contains)(node, state.schema.nodes.listItem)) {
|
|
338
339
|
for (var i = 0; i < node.childCount; i++) {
|
|
339
340
|
children.push(node.child(i));
|
|
340
341
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
-
import { findParentNodeOfType
|
|
5
|
+
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
6
|
import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../util';
|
|
6
7
|
import { insertSliceAtNodeEdge, insertSliceInsideOfPanelNodeSelected, insertSliceIntoEmptyNode, insertSliceIntoRangeSelectionInsideList } from './lists';
|
|
7
8
|
export function insertSliceForLists({
|
|
@@ -65,7 +66,11 @@ export function insertSliceForListsInsideBlockquote({
|
|
|
65
66
|
tr,
|
|
66
67
|
slice
|
|
67
68
|
}) {
|
|
68
|
-
|
|
69
|
+
//insert blockquote explicitly and set the selection in blockquote since replaceSelection will only insert the list
|
|
70
|
+
const {
|
|
71
|
+
schema
|
|
72
|
+
} = tr.doc.type;
|
|
73
|
+
tr.replaceSelection(new Slice(Fragment.from(schema.nodes.blockquote.createAndFill()), 0, 0));
|
|
69
74
|
// ProseMirror doesn't give a proper way to tell us where something was inserted.
|
|
70
75
|
// However, we can know "how" it inserted something.
|
|
71
76
|
//
|
|
@@ -84,4 +89,5 @@ export function insertSliceForListsInsideBlockquote({
|
|
|
84
89
|
if (nextSelection) {
|
|
85
90
|
tr.setSelection(nextSelection);
|
|
86
91
|
}
|
|
92
|
+
tr.replaceSelection(slice);
|
|
87
93
|
}
|
package/dist/es2019/handlers.js
CHANGED
|
@@ -7,7 +7,7 @@ import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isL
|
|
|
7
7
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
8
8
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
import { canInsert, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
+
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
11
11
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
12
12
|
// TODO: ED-20519 Needs Macro extraction
|
|
13
13
|
|
|
@@ -130,7 +130,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
130
130
|
}
|
|
131
131
|
export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
132
132
|
return (state, dispatch) => {
|
|
133
|
-
var _tr$doc$nodeAt, _sliceContent$firstCh, _findParentNodeOfType;
|
|
133
|
+
var _tr$doc$nodeAt, _slice$content$firstC2, _sliceContent$firstCh, _findParentNodeOfType;
|
|
134
134
|
const {
|
|
135
135
|
tr
|
|
136
136
|
} = state;
|
|
@@ -212,7 +212,12 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// handle the insertion of the slice
|
|
215
|
-
if (
|
|
215
|
+
if (((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type.name) === 'blockquote' && contains(slice.content.firstChild, state.schema.nodes.listItem)) {
|
|
216
|
+
insertSliceForListsInsideBlockquote({
|
|
217
|
+
tr,
|
|
218
|
+
slice
|
|
219
|
+
});
|
|
220
|
+
} else if (sliceContainsNodeThatPastesAsPlainText || nodeAfterInsertPositionIsListItem || sliceContent.childCount > 1 && ((_sliceContent$firstCh = sliceContent.firstChild) === null || _sliceContent$firstCh === void 0 ? void 0 : _sliceContent$firstCh.type.name) !== 'paragraph') {
|
|
216
221
|
tr.replaceWith(from, replaceTo, sliceContent).scrollIntoView();
|
|
217
222
|
} else {
|
|
218
223
|
// When the selection is not at the end of a list item
|
|
@@ -586,7 +591,7 @@ export function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
|
|
|
586
591
|
const checkExpand = slice => {
|
|
587
592
|
let hasExpand = false;
|
|
588
593
|
slice.content.forEach(node => {
|
|
589
|
-
if (node.type.name === 'expand') {
|
|
594
|
+
if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
|
|
590
595
|
hasExpand = true;
|
|
591
596
|
}
|
|
592
597
|
});
|
|
@@ -608,7 +613,7 @@ export function handleExpandPasteInTable(slice) {
|
|
|
608
613
|
} = state;
|
|
609
614
|
let hasExpand = false;
|
|
610
615
|
const newSlice = mapSlice(slice, maybeNode => {
|
|
611
|
-
if (maybeNode.type === expand) {
|
|
616
|
+
if (maybeNode.type === expand || maybeNode.type === nestedExpand) {
|
|
612
617
|
hasExpand = true;
|
|
613
618
|
try {
|
|
614
619
|
return nestedExpand.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
|
|
@@ -9,7 +9,7 @@ import { transformSingleLineCodeBlockToCodeMark, transformSliceNestedExpandToExp
|
|
|
9
9
|
import { containsAnyAnnotations, extractSliceFromStep, linkifyContent, mapChildren, measureRender } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
11
11
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
12
|
-
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
+
import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
14
14
|
import { PastePluginActionTypes } from '../actions';
|
|
15
15
|
import { splitParagraphs, upgradeTextToLists } from '../commands';
|
|
@@ -300,12 +300,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
300
300
|
if (isRichText && isInsideBlockQuote(state)) {
|
|
301
301
|
//If pasting inside blockquote
|
|
302
302
|
//Skip the blockquote node and keep remaining nodes as they are
|
|
303
|
+
//prevent doing this if there is list inside blockquote as the list is pasted incorrectly inside blockquote due to wrong openStart and openEnd
|
|
303
304
|
const {
|
|
304
305
|
blockquote
|
|
305
306
|
} = schema.nodes;
|
|
306
307
|
const children = [];
|
|
307
308
|
mapChildren(slice.content, node => {
|
|
308
|
-
if (node.type === blockquote) {
|
|
309
|
+
if (node.type === blockquote && !contains(node, state.schema.nodes.listItem)) {
|
|
309
310
|
for (let i = 0; i < node.childCount; i++) {
|
|
310
311
|
children.push(node.child(i));
|
|
311
312
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
-
import { findParentNodeOfType
|
|
5
|
+
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
6
|
import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../util';
|
|
6
7
|
import { insertSliceAtNodeEdge, insertSliceInsideOfPanelNodeSelected, insertSliceIntoEmptyNode, insertSliceIntoRangeSelectionInsideList } from './lists';
|
|
7
8
|
export function insertSliceForLists(_ref) {
|
|
@@ -59,7 +60,9 @@ export function insertSliceForLists(_ref) {
|
|
|
59
60
|
export function insertSliceForListsInsideBlockquote(_ref3) {
|
|
60
61
|
var tr = _ref3.tr,
|
|
61
62
|
slice = _ref3.slice;
|
|
62
|
-
|
|
63
|
+
//insert blockquote explicitly and set the selection in blockquote since replaceSelection will only insert the list
|
|
64
|
+
var schema = tr.doc.type.schema;
|
|
65
|
+
tr.replaceSelection(new Slice(Fragment.from(schema.nodes.blockquote.createAndFill()), 0, 0));
|
|
63
66
|
// ProseMirror doesn't give a proper way to tell us where something was inserted.
|
|
64
67
|
// However, we can know "how" it inserted something.
|
|
65
68
|
//
|
|
@@ -78,4 +81,5 @@ export function insertSliceForListsInsideBlockquote(_ref3) {
|
|
|
78
81
|
if (nextSelection) {
|
|
79
82
|
tr.setSelection(nextSelection);
|
|
80
83
|
}
|
|
84
|
+
tr.replaceSelection(slice);
|
|
81
85
|
}
|
package/dist/esm/handlers.js
CHANGED
|
@@ -15,7 +15,7 @@ import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isL
|
|
|
15
15
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
16
16
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
17
17
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
18
|
-
import { canInsert, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
18
|
+
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
19
19
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
20
20
|
// TODO: ED-20519 Needs Macro extraction
|
|
21
21
|
|
|
@@ -133,7 +133,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
133
133
|
}
|
|
134
134
|
export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
135
135
|
return function (state, dispatch) {
|
|
136
|
-
var _tr$doc$nodeAt, _sliceContent$firstCh, _findParentNodeOfType;
|
|
136
|
+
var _tr$doc$nodeAt, _slice$content$firstC2, _sliceContent$firstCh, _findParentNodeOfType;
|
|
137
137
|
var tr = state.tr;
|
|
138
138
|
var selection = tr.selection;
|
|
139
139
|
var $from = selection.$from,
|
|
@@ -208,7 +208,12 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// handle the insertion of the slice
|
|
211
|
-
if (
|
|
211
|
+
if (((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type.name) === 'blockquote' && contains(slice.content.firstChild, state.schema.nodes.listItem)) {
|
|
212
|
+
insertSliceForListsInsideBlockquote({
|
|
213
|
+
tr: tr,
|
|
214
|
+
slice: slice
|
|
215
|
+
});
|
|
216
|
+
} else if (sliceContainsNodeThatPastesAsPlainText || nodeAfterInsertPositionIsListItem || sliceContent.childCount > 1 && ((_sliceContent$firstCh = sliceContent.firstChild) === null || _sliceContent$firstCh === void 0 ? void 0 : _sliceContent$firstCh.type.name) !== 'paragraph') {
|
|
212
217
|
tr.replaceWith(from, replaceTo, sliceContent).scrollIntoView();
|
|
213
218
|
} else {
|
|
214
219
|
// When the selection is not at the end of a list item
|
|
@@ -579,7 +584,7 @@ export function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
|
|
|
579
584
|
var checkExpand = function checkExpand(slice) {
|
|
580
585
|
var hasExpand = false;
|
|
581
586
|
slice.content.forEach(function (node) {
|
|
582
|
-
if (node.type.name === 'expand') {
|
|
587
|
+
if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
|
|
583
588
|
hasExpand = true;
|
|
584
589
|
}
|
|
585
590
|
});
|
|
@@ -598,7 +603,7 @@ export function handleExpandPasteInTable(slice) {
|
|
|
598
603
|
var tr = state.tr;
|
|
599
604
|
var hasExpand = false;
|
|
600
605
|
var newSlice = mapSlice(slice, function (maybeNode) {
|
|
601
|
-
if (maybeNode.type === expand) {
|
|
606
|
+
if (maybeNode.type === expand || maybeNode.type === nestedExpand) {
|
|
602
607
|
hasExpand = true;
|
|
603
608
|
try {
|
|
604
609
|
return nestedExpand.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
|
|
@@ -11,7 +11,7 @@ import { transformSingleLineCodeBlockToCodeMark, transformSliceNestedExpandToExp
|
|
|
11
11
|
import { containsAnyAnnotations, extractSliceFromStep, linkifyContent, mapChildren, measureRender } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
13
13
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
14
|
-
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
14
|
+
import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
15
15
|
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { PastePluginActionTypes } from '../actions';
|
|
17
17
|
import { splitParagraphs, upgradeTextToLists } from '../commands';
|
|
@@ -318,10 +318,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
318
318
|
if (isRichText && isInsideBlockQuote(state)) {
|
|
319
319
|
//If pasting inside blockquote
|
|
320
320
|
//Skip the blockquote node and keep remaining nodes as they are
|
|
321
|
+
//prevent doing this if there is list inside blockquote as the list is pasted incorrectly inside blockquote due to wrong openStart and openEnd
|
|
321
322
|
var blockquote = schema.nodes.blockquote;
|
|
322
323
|
var children = [];
|
|
323
324
|
mapChildren(slice.content, function (node) {
|
|
324
|
-
if (node.type === blockquote) {
|
|
325
|
+
if (node.type === blockquote && !contains(node, state.schema.nodes.listItem)) {
|
|
325
326
|
for (var i = 0; i < node.childCount; i++) {
|
|
326
327
|
children.push(node.child(i));
|
|
327
328
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Slice as PMSlice, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
export declare function insertSliceForLists({ tr, slice, schema, }: {
|
|
4
4
|
tr: Transaction;
|
|
5
|
-
slice:
|
|
5
|
+
slice: PMSlice;
|
|
6
6
|
schema: Schema;
|
|
7
7
|
}): void | Transaction;
|
|
8
8
|
export declare function insertSliceForListsInsideBlockquote({ tr, slice, }: {
|
|
9
9
|
tr: Transaction;
|
|
10
|
-
slice:
|
|
10
|
+
slice: PMSlice;
|
|
11
11
|
}): Transaction | undefined;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Slice as PMSlice, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
export declare function insertSliceForLists({ tr, slice, schema, }: {
|
|
4
4
|
tr: Transaction;
|
|
5
|
-
slice:
|
|
5
|
+
slice: PMSlice;
|
|
6
6
|
schema: Schema;
|
|
7
7
|
}): void | Transaction;
|
|
8
8
|
export declare function insertSliceForListsInsideBlockquote({ tr, slice, }: {
|
|
9
9
|
tr: Transaction;
|
|
10
|
-
slice:
|
|
10
|
+
slice: PMSlice;
|
|
11
11
|
}): Transaction | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^76.
|
|
35
|
+
"@atlaskit/editor-common": "^76.35.0",
|
|
36
36
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
38
38
|
"@atlaskit/editor-plugin-annotation": "^0.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-better-type-history": "^0.1.0",
|
|
40
|
-
"@atlaskit/editor-plugin-card": "^0.
|
|
40
|
+
"@atlaskit/editor-plugin-card": "^0.15.0",
|
|
41
41
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
42
|
-
"@atlaskit/editor-plugin-list": "^3.
|
|
43
|
-
"@atlaskit/editor-plugin-media": "^0.
|
|
42
|
+
"@atlaskit/editor-plugin-list": "^3.1.0",
|
|
43
|
+
"@atlaskit/editor-plugin-media": "^0.10.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.3.0",
|
|
46
46
|
"@atlaskit/media-client": "^26.1.0",
|
|
@@ -55,13 +55,15 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@af/visual-regression": "*",
|
|
58
|
-
"@atlaskit/adf-schema": "^35.
|
|
58
|
+
"@atlaskit/adf-schema": "^35.3.0",
|
|
59
|
+
"@atlaskit/editor-plugin-block-type": "^3.0.0",
|
|
59
60
|
"@atlaskit/editor-plugin-history": "^0.1.0",
|
|
60
|
-
"@atlaskit/editor-plugin-type-ahead": "^0.
|
|
61
|
+
"@atlaskit/editor-plugin-type-ahead": "^0.9.0",
|
|
61
62
|
"@atlaskit/ssr": "*",
|
|
62
63
|
"@atlaskit/visual-regression": "*",
|
|
63
64
|
"@atlaskit/webdriver-runner": "*",
|
|
64
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
66
|
+
"@atlassian/feature-flags-test-utils": "^0.1.1",
|
|
65
67
|
"@testing-library/react": "^12.1.5",
|
|
66
68
|
"react-dom": "^16.8.0",
|
|
67
69
|
"typescript": "~4.9.5",
|