@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
|
@@ -3757,7 +3757,34 @@ function createWithTableEvents(tracking) {
|
|
|
3757
3757
|
|
|
3758
3758
|
var createTablePlugin = function createTablePlugin(tracking) {
|
|
3759
3759
|
return _extends({}, createTablePlugin$1(), {
|
|
3760
|
-
onKeyDown: createWithTableEvents(tracking)
|
|
3760
|
+
onKeyDown: createWithTableEvents(tracking),
|
|
3761
|
+
withOverrides: function withOverrides(editor) {
|
|
3762
|
+
var insertFragment = editor.insertFragment;
|
|
3763
|
+
|
|
3764
|
+
editor.insertFragment = function (fragments) {
|
|
3765
|
+
// 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
|
|
3766
|
+
// More info: https://github.com/ianstormtaylor/slate/pull/4489 and https://github.com/ianstormtaylor/slate/issues/4542
|
|
3767
|
+
var fragmentHasTable = fragments.some(function (fragment) {
|
|
3768
|
+
return fragment.type === BLOCKS.TABLE;
|
|
3769
|
+
});
|
|
3770
|
+
|
|
3771
|
+
if (fragmentHasTable) {
|
|
3772
|
+
var emptyParagraph = {
|
|
3773
|
+
type: BLOCKS.PARAGRAPH,
|
|
3774
|
+
children: [{
|
|
3775
|
+
text: ''
|
|
3776
|
+
}],
|
|
3777
|
+
data: {},
|
|
3778
|
+
isVoid: false
|
|
3779
|
+
};
|
|
3780
|
+
Transforms.insertNodes(editor, emptyParagraph);
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
insertFragment(fragments);
|
|
3784
|
+
};
|
|
3785
|
+
|
|
3786
|
+
return editor;
|
|
3787
|
+
}
|
|
3761
3788
|
});
|
|
3762
3789
|
};
|
|
3763
3790
|
function ToolbarTableButton(props) {
|
|
@@ -4850,9 +4877,8 @@ function createParagraphPlugin() {
|
|
|
4850
4877
|
type: BLOCKS.PARAGRAPH,
|
|
4851
4878
|
deserialize: function deserialize(element) {
|
|
4852
4879
|
var isParagraphText = element.nodeName === 'P';
|
|
4853
|
-
var isDivText = element.nodeName === 'DIV' && !element.getAttribute('data-entity-type');
|
|
4854
4880
|
var isNotEmpty = element.textContent !== '';
|
|
4855
|
-
var isText =
|
|
4881
|
+
var isText = isParagraphText && isNotEmpty;
|
|
4856
4882
|
if (!isText) return;
|
|
4857
4883
|
return {
|
|
4858
4884
|
type: BLOCKS.PARAGRAPH
|