@atlaskit/editor-core 166.0.2 → 166.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 +6 -0
- package/dist/cjs/plugins/paste/handlers.js +21 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/paste/handlers.js +22 -7
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/paste/handlers.js +22 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 166.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`56238fdc70e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56238fdc70e) - ED-14998 Fix paste issue in a table inside a bodied extension. Copying and pasting inline nodes inside the table should not create a new table during paste
|
|
8
|
+
|
|
3
9
|
## 166.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -700,7 +700,7 @@ function insertIntoPanel(tr, slice, panel) {
|
|
|
700
700
|
|
|
701
701
|
function handleRichText(slice) {
|
|
702
702
|
return function (state, dispatch) {
|
|
703
|
-
var _slice$content, _panelParentOverCurre;
|
|
703
|
+
var _slice$content, _slice$content2, _panelParentOverCurre;
|
|
704
704
|
|
|
705
705
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
706
706
|
codeBlock = _state$schema$nodes2.codeBlock,
|
|
@@ -708,7 +708,8 @@ function handleRichText(slice) {
|
|
|
708
708
|
paragraph = _state$schema$nodes2.paragraph,
|
|
709
709
|
panel = _state$schema$nodes2.panel;
|
|
710
710
|
var selection = state.selection;
|
|
711
|
-
var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
711
|
+
var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
712
|
+
var lastChildOfSlice = (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.lastChild; // In case user is pasting inline code,
|
|
712
713
|
// any backtick ` immediately preceding it should be removed.
|
|
713
714
|
|
|
714
715
|
var tr = state.tr;
|
|
@@ -723,7 +724,7 @@ function handleRichText(slice) {
|
|
|
723
724
|
|
|
724
725
|
(0, _prosemirrorHistory.closeHistory)(tr);
|
|
725
726
|
var isFirstChildListNode = (0, _node.isListNode)(firstChildOfSlice);
|
|
726
|
-
var isLastChildListNode = (0, _node.isListNode)(
|
|
727
|
+
var isLastChildListNode = (0, _node.isListNode)(lastChildOfSlice);
|
|
727
728
|
var isSliceContentListNodes = isFirstChildListNode || isLastChildListNode; // We want to use safeInsert to insert invalid content, as it inserts at the closest non schema violating position
|
|
728
729
|
// rather than spliting the selection parent node in half (which is what replaceSelection does)
|
|
729
730
|
// Exception is paragraph and heading nodes, these should be split, provided their parent supports the pasted content
|
|
@@ -742,9 +743,23 @@ function handleRichText(slice) {
|
|
|
742
743
|
} else if (noNeedForSafeInsert) {
|
|
743
744
|
tr.replaceSelection(slice);
|
|
744
745
|
} else {
|
|
745
|
-
// need
|
|
746
|
-
|
|
747
|
-
|
|
746
|
+
// need to scan the slice if there's a block node inside it
|
|
747
|
+
var doesBlockNodeExist = false;
|
|
748
|
+
slice.content.nodesBetween(0, slice.content.size, function (node, start) {
|
|
749
|
+
if (start >= slice.openStart && start <= slice.content.size - slice.openEnd && node.isBlock) {
|
|
750
|
+
doesBlockNodeExist = true;
|
|
751
|
+
return false;
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
if ((0, _utils.insideTableCell)(state) && !doesBlockNodeExist) {
|
|
756
|
+
// bring back the old code for inline nodes
|
|
757
|
+
insertIntoPanel(tr, slice, panel);
|
|
758
|
+
} else {
|
|
759
|
+
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
760
|
+
// e.g. when pasting a layout into a table, replaceSelection splits the table in half and adds the layout in the middle
|
|
761
|
+
tr = (0, _prosemirrorUtils.safeInsert)(slice.content, tr.selection.$to.pos)(tr);
|
|
762
|
+
}
|
|
748
763
|
}
|
|
749
764
|
|
|
750
765
|
tr.setStoredMarks([]);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "166.0.
|
|
9
|
+
var version = "166.0.3";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
|
|
12
12
|
var nextMajorVersion = function nextMajorVersion() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,7 +2,7 @@ import { closeHistory } from 'prosemirror-history';
|
|
|
2
2
|
import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
|
|
3
3
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
4
4
|
import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
5
|
-
import { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue } from '../../utils';
|
|
5
|
+
import { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue, insideTableCell } from '../../utils';
|
|
6
6
|
import { mapSlice } from '../../utils/slice';
|
|
7
7
|
import { INPUT_METHOD } from '../analytics';
|
|
8
8
|
import { insertCard, queueCardsFromChangedTr } from '../card/pm-plugins/doc';
|
|
@@ -610,7 +610,7 @@ export function insertIntoPanel(tr, slice, panel) {
|
|
|
610
610
|
}
|
|
611
611
|
export function handleRichText(slice) {
|
|
612
612
|
return (state, dispatch) => {
|
|
613
|
-
var _slice$content, _panelParentOverCurre;
|
|
613
|
+
var _slice$content, _slice$content2, _panelParentOverCurre;
|
|
614
614
|
|
|
615
615
|
const {
|
|
616
616
|
codeBlock,
|
|
@@ -621,7 +621,8 @@ export function handleRichText(slice) {
|
|
|
621
621
|
const {
|
|
622
622
|
selection
|
|
623
623
|
} = state;
|
|
624
|
-
const firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
624
|
+
const firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
625
|
+
const lastChildOfSlice = (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.lastChild; // In case user is pasting inline code,
|
|
625
626
|
// any backtick ` immediately preceding it should be removed.
|
|
626
627
|
|
|
627
628
|
let tr = state.tr;
|
|
@@ -636,7 +637,7 @@ export function handleRichText(slice) {
|
|
|
636
637
|
|
|
637
638
|
closeHistory(tr);
|
|
638
639
|
const isFirstChildListNode = isListNode(firstChildOfSlice);
|
|
639
|
-
const isLastChildListNode = isListNode(
|
|
640
|
+
const isLastChildListNode = isListNode(lastChildOfSlice);
|
|
640
641
|
const isSliceContentListNodes = isFirstChildListNode || isLastChildListNode; // We want to use safeInsert to insert invalid content, as it inserts at the closest non schema violating position
|
|
641
642
|
// rather than spliting the selection parent node in half (which is what replaceSelection does)
|
|
642
643
|
// Exception is paragraph and heading nodes, these should be split, provided their parent supports the pasted content
|
|
@@ -655,9 +656,23 @@ export function handleRichText(slice) {
|
|
|
655
656
|
} else if (noNeedForSafeInsert) {
|
|
656
657
|
tr.replaceSelection(slice);
|
|
657
658
|
} else {
|
|
658
|
-
// need
|
|
659
|
-
|
|
660
|
-
|
|
659
|
+
// need to scan the slice if there's a block node inside it
|
|
660
|
+
let doesBlockNodeExist = false;
|
|
661
|
+
slice.content.nodesBetween(0, slice.content.size, (node, start) => {
|
|
662
|
+
if (start >= slice.openStart && start <= slice.content.size - slice.openEnd && node.isBlock) {
|
|
663
|
+
doesBlockNodeExist = true;
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
if (insideTableCell(state) && !doesBlockNodeExist) {
|
|
669
|
+
// bring back the old code for inline nodes
|
|
670
|
+
insertIntoPanel(tr, slice, panel);
|
|
671
|
+
} else {
|
|
672
|
+
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
673
|
+
// e.g. when pasting a layout into a table, replaceSelection splits the table in half and adds the layout in the middle
|
|
674
|
+
tr = safeInsert(slice.content, tr.selection.$to.pos)(tr);
|
|
675
|
+
}
|
|
661
676
|
}
|
|
662
677
|
|
|
663
678
|
tr.setStoredMarks([]);
|
package/dist/es2019/version.json
CHANGED
|
@@ -16,7 +16,7 @@ import { closeHistory } from 'prosemirror-history';
|
|
|
16
16
|
import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
|
|
17
17
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
18
18
|
import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
19
|
-
import { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue } from '../../utils';
|
|
19
|
+
import { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue, insideTableCell } from '../../utils';
|
|
20
20
|
import { mapSlice } from '../../utils/slice';
|
|
21
21
|
import { INPUT_METHOD } from '../analytics';
|
|
22
22
|
import { insertCard, queueCardsFromChangedTr } from '../card/pm-plugins/doc';
|
|
@@ -644,7 +644,7 @@ export function insertIntoPanel(tr, slice, panel) {
|
|
|
644
644
|
}
|
|
645
645
|
export function handleRichText(slice) {
|
|
646
646
|
return function (state, dispatch) {
|
|
647
|
-
var _slice$content, _panelParentOverCurre;
|
|
647
|
+
var _slice$content, _slice$content2, _panelParentOverCurre;
|
|
648
648
|
|
|
649
649
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
650
650
|
codeBlock = _state$schema$nodes2.codeBlock,
|
|
@@ -652,7 +652,8 @@ export function handleRichText(slice) {
|
|
|
652
652
|
paragraph = _state$schema$nodes2.paragraph,
|
|
653
653
|
panel = _state$schema$nodes2.panel;
|
|
654
654
|
var selection = state.selection;
|
|
655
|
-
var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
655
|
+
var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
656
|
+
var lastChildOfSlice = (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.lastChild; // In case user is pasting inline code,
|
|
656
657
|
// any backtick ` immediately preceding it should be removed.
|
|
657
658
|
|
|
658
659
|
var tr = state.tr;
|
|
@@ -667,7 +668,7 @@ export function handleRichText(slice) {
|
|
|
667
668
|
|
|
668
669
|
closeHistory(tr);
|
|
669
670
|
var isFirstChildListNode = isListNode(firstChildOfSlice);
|
|
670
|
-
var isLastChildListNode = isListNode(
|
|
671
|
+
var isLastChildListNode = isListNode(lastChildOfSlice);
|
|
671
672
|
var isSliceContentListNodes = isFirstChildListNode || isLastChildListNode; // We want to use safeInsert to insert invalid content, as it inserts at the closest non schema violating position
|
|
672
673
|
// rather than spliting the selection parent node in half (which is what replaceSelection does)
|
|
673
674
|
// Exception is paragraph and heading nodes, these should be split, provided their parent supports the pasted content
|
|
@@ -686,9 +687,23 @@ export function handleRichText(slice) {
|
|
|
686
687
|
} else if (noNeedForSafeInsert) {
|
|
687
688
|
tr.replaceSelection(slice);
|
|
688
689
|
} else {
|
|
689
|
-
// need
|
|
690
|
-
|
|
691
|
-
|
|
690
|
+
// need to scan the slice if there's a block node inside it
|
|
691
|
+
var doesBlockNodeExist = false;
|
|
692
|
+
slice.content.nodesBetween(0, slice.content.size, function (node, start) {
|
|
693
|
+
if (start >= slice.openStart && start <= slice.content.size - slice.openEnd && node.isBlock) {
|
|
694
|
+
doesBlockNodeExist = true;
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
if (insideTableCell(state) && !doesBlockNodeExist) {
|
|
700
|
+
// bring back the old code for inline nodes
|
|
701
|
+
insertIntoPanel(tr, slice, panel);
|
|
702
|
+
} else {
|
|
703
|
+
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
704
|
+
// e.g. when pasting a layout into a table, replaceSelection splits the table in half and adds the layout in the middle
|
|
705
|
+
tr = safeInsert(slice.content, tr.selection.$to.pos)(tr);
|
|
706
|
+
}
|
|
692
707
|
}
|
|
693
708
|
|
|
694
709
|
tr.setStoredMarks([]);
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "166.0.
|
|
3
|
+
"version": "166.0.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@atlaskit/radio": "^5.3.0",
|
|
70
70
|
"@atlaskit/section-message": "^6.1.0",
|
|
71
71
|
"@atlaskit/select": "^15.2.0",
|
|
72
|
-
"@atlaskit/smart-user-picker": "^5.0
|
|
72
|
+
"@atlaskit/smart-user-picker": "^5.1.0",
|
|
73
73
|
"@atlaskit/spinner": "^15.1.0",
|
|
74
74
|
"@atlaskit/status": "^1.1.0",
|
|
75
75
|
"@atlaskit/tabs": "^13.2.0",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"@atlaskit/section-message": "^6.1.0",
|
|
160
160
|
"@atlaskit/share": "*",
|
|
161
161
|
"@atlaskit/smart-card": "^19.1.0",
|
|
162
|
-
"@atlaskit/smart-user-picker": "^5.0
|
|
162
|
+
"@atlaskit/smart-user-picker": "^5.1.0",
|
|
163
163
|
"@atlaskit/synchrony-test-helpers": "^2.3.0",
|
|
164
164
|
"@atlaskit/textarea": "^4.3.0",
|
|
165
165
|
"@atlaskit/toggle": "^12.4.0",
|