@contentful/field-editor-rich-text 0.24.0-next → 0.24.1-next
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 +684 -0
- package/dist/field-editor-rich-text.cjs.development.js +29 -3
- 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 +29 -3
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/plugins/Table/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3764,7 +3764,34 @@ function createWithTableEvents(tracking) {
|
|
|
3764
3764
|
|
|
3765
3765
|
var createTablePlugin = function createTablePlugin(tracking) {
|
|
3766
3766
|
return _extends({}, plateTable.createTablePlugin(), {
|
|
3767
|
-
onKeyDown: createWithTableEvents(tracking)
|
|
3767
|
+
onKeyDown: createWithTableEvents(tracking),
|
|
3768
|
+
withOverrides: function withOverrides(editor) {
|
|
3769
|
+
var insertFragment = editor.insertFragment;
|
|
3770
|
+
|
|
3771
|
+
editor.insertFragment = function (fragments) {
|
|
3772
|
+
// We need to make sure we have a new, empty and clean paragraph in order to paste tables as-is due to how Slate behaves
|
|
3773
|
+
// More info: https://github.com/ianstormtaylor/slate/pull/4489 and https://github.com/ianstormtaylor/slate/issues/4542
|
|
3774
|
+
var fragmentHasTable = fragments.some(function (fragment) {
|
|
3775
|
+
return fragment.type === Contentful.BLOCKS.TABLE;
|
|
3776
|
+
});
|
|
3777
|
+
|
|
3778
|
+
if (fragmentHasTable) {
|
|
3779
|
+
var emptyParagraph = {
|
|
3780
|
+
type: Contentful.BLOCKS.PARAGRAPH,
|
|
3781
|
+
children: [{
|
|
3782
|
+
text: ''
|
|
3783
|
+
}],
|
|
3784
|
+
data: {},
|
|
3785
|
+
isVoid: false
|
|
3786
|
+
};
|
|
3787
|
+
slate.Transforms.insertNodes(editor, emptyParagraph);
|
|
3788
|
+
}
|
|
3789
|
+
|
|
3790
|
+
insertFragment(fragments);
|
|
3791
|
+
};
|
|
3792
|
+
|
|
3793
|
+
return editor;
|
|
3794
|
+
}
|
|
3768
3795
|
});
|
|
3769
3796
|
};
|
|
3770
3797
|
function ToolbarTableButton(props) {
|
|
@@ -4857,9 +4884,8 @@ function createParagraphPlugin() {
|
|
|
4857
4884
|
type: Contentful.BLOCKS.PARAGRAPH,
|
|
4858
4885
|
deserialize: function deserialize(element) {
|
|
4859
4886
|
var isParagraphText = element.nodeName === 'P';
|
|
4860
|
-
var isDivText = element.nodeName === 'DIV' && !element.getAttribute('data-entity-type');
|
|
4861
4887
|
var isNotEmpty = element.textContent !== '';
|
|
4862
|
-
var isText =
|
|
4888
|
+
var isText = isParagraphText && isNotEmpty;
|
|
4863
4889
|
if (!isText) return;
|
|
4864
4890
|
return {
|
|
4865
4891
|
type: Contentful.BLOCKS.PARAGRAPH
|