@contentful/field-editor-rich-text 2.0.0-next.24 → 2.0.0-next.25
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 +15 -6
- 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 +15 -6
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/plugins/Table/helpers.d.ts +2 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -410
|
@@ -5214,9 +5214,9 @@ var sanitizeHTML = function sanitizeHTML(html) {
|
|
|
5214
5214
|
// Parse the HTML string and pipe it through our transformers
|
|
5215
5215
|
var doc = transformers.reduce(function (value, cb) {
|
|
5216
5216
|
return cb(value);
|
|
5217
|
-
}, new DOMParser().parseFromString(html, 'text/html'));
|
|
5218
|
-
|
|
5219
|
-
|
|
5217
|
+
}, new DOMParser().parseFromString(html, 'text/html'));
|
|
5218
|
+
return doc.body.innerHTML.replace(/>\s+</g, '><') // Remove whitespace between tags
|
|
5219
|
+
.replace(/(.*)<div.*>(<table.*<\/table>)<\/div>(.*)/g, '$1$2$3'); // remove div containers from tables
|
|
5220
5220
|
};
|
|
5221
5221
|
|
|
5222
5222
|
/**
|
|
@@ -5757,6 +5757,9 @@ var isNotEmpty = function isNotEmpty(editor, _ref4) {
|
|
|
5757
5757
|
var path = _ref4[1];
|
|
5758
5758
|
return Array.from(Node.children(editor, path)).length !== 0;
|
|
5759
5759
|
};
|
|
5760
|
+
var isTable = function isTable(node) {
|
|
5761
|
+
return Element.isElement(node) && node.type === BLOCKS.TABLE;
|
|
5762
|
+
};
|
|
5760
5763
|
|
|
5761
5764
|
var styles$i = {
|
|
5762
5765
|
topRight: /*#__PURE__*/css({
|
|
@@ -5934,13 +5937,19 @@ var createTablePlugin = function createTablePlugin() {
|
|
|
5934
5937
|
var insertFragment = editor.insertFragment;
|
|
5935
5938
|
|
|
5936
5939
|
editor.insertFragment = function (fragments) {
|
|
5940
|
+
var _editor$selection;
|
|
5941
|
+
|
|
5937
5942
|
// 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
|
|
5938
5943
|
// More info: https://github.com/ianstormtaylor/slate/pull/4489 and https://github.com/ianstormtaylor/slate/issues/4542
|
|
5939
|
-
var
|
|
5940
|
-
return fragment
|
|
5944
|
+
var isInsertingTable = fragments.some(function (fragment) {
|
|
5945
|
+
return isTable(fragment);
|
|
5941
5946
|
});
|
|
5947
|
+
var isTableFirstFragment = fragments.findIndex(function (fragment) {
|
|
5948
|
+
return isTable(fragment);
|
|
5949
|
+
}) === 0;
|
|
5950
|
+
var currentLineHasText = getText(editor, (_editor$selection = editor.selection) == null ? void 0 : _editor$selection.focus.path) !== '';
|
|
5942
5951
|
|
|
5943
|
-
if (
|
|
5952
|
+
if (isInsertingTable && isTableFirstFragment && currentLineHasText) {
|
|
5944
5953
|
insertEmptyParagraph(editor);
|
|
5945
5954
|
}
|
|
5946
5955
|
|