@contentful/field-editor-rich-text 2.0.0-next.34 → 2.0.0-next.35
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/dist/field-editor-rich-text.cjs.development.js +25 -5
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +26 -6
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/test-utils/jsx.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5443,7 +5443,8 @@ var createSelectOnBackspacePlugin = function createSelectOnBackspacePlugin() {
|
|
|
5443
5443
|
return plateSelect.createSelectOnBackspacePlugin({
|
|
5444
5444
|
options: {
|
|
5445
5445
|
query: {
|
|
5446
|
-
|
|
5446
|
+
// `createTextPlugin` is taking care of block elements
|
|
5447
|
+
allow: [Contentful.INLINES.EMBEDDED_ENTRY]
|
|
5447
5448
|
}
|
|
5448
5449
|
}
|
|
5449
5450
|
});
|
|
@@ -6606,11 +6607,11 @@ function createTextPlugin() {
|
|
|
6606
6607
|
deleteBackward = editor.deleteBackward;
|
|
6607
6608
|
|
|
6608
6609
|
editor.deleteBackward = function (unit) {
|
|
6609
|
-
|
|
6610
|
+
deleteEmptyParagraph(unit, editor, deleteBackward);
|
|
6610
6611
|
};
|
|
6611
6612
|
|
|
6612
6613
|
editor.deleteForward = function (unit) {
|
|
6613
|
-
|
|
6614
|
+
deleteEmptyParagraph(unit, editor, deleteForward);
|
|
6614
6615
|
};
|
|
6615
6616
|
|
|
6616
6617
|
return editor;
|
|
@@ -6618,7 +6619,7 @@ function createTextPlugin() {
|
|
|
6618
6619
|
};
|
|
6619
6620
|
}
|
|
6620
6621
|
|
|
6621
|
-
function
|
|
6622
|
+
function deleteEmptyParagraph(unit, editor, deleteFunction) {
|
|
6622
6623
|
var entry = plateCore.getAbove(editor, {
|
|
6623
6624
|
match: {
|
|
6624
6625
|
type: Contentful.TEXT_CONTAINERS
|
|
@@ -6633,10 +6634,29 @@ function deleteFirstEmptyParagraph(unit, editor, deleteFunction) {
|
|
|
6633
6634
|
var isRootLevel = path.length === 1;
|
|
6634
6635
|
var hasSiblings = editor.children.length > 1; // prevent editor from losing focus
|
|
6635
6636
|
|
|
6636
|
-
if (isTextEmpty && isRootLevel &&
|
|
6637
|
+
if (isTextEmpty && isRootLevel && hasSiblings) {
|
|
6637
6638
|
slate.Transforms.removeNodes(editor, {
|
|
6638
6639
|
at: path
|
|
6639
6640
|
});
|
|
6641
|
+
var prevNode = slate.Editor.before(editor, editor.selection, {
|
|
6642
|
+
unit: unit
|
|
6643
|
+
});
|
|
6644
|
+
|
|
6645
|
+
if (prevNode) {
|
|
6646
|
+
var _Editor$nodes = slate.Editor.nodes(editor, {
|
|
6647
|
+
match: function match(node) {
|
|
6648
|
+
return plateCore.queryNode([node, prevNode.path], {
|
|
6649
|
+
allow: [Contentful.BLOCKS.EMBEDDED_ASSET, Contentful.BLOCKS.EMBEDDED_ENTRY, Contentful.BLOCKS.HR]
|
|
6650
|
+
});
|
|
6651
|
+
},
|
|
6652
|
+
at: prevNode
|
|
6653
|
+
}),
|
|
6654
|
+
prevCell = _Editor$nodes[0];
|
|
6655
|
+
|
|
6656
|
+
if (prevCell) {
|
|
6657
|
+
slate.Transforms.select(editor, prevNode);
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6640
6660
|
} else {
|
|
6641
6661
|
deleteFunction(unit);
|
|
6642
6662
|
}
|