@tiptap/core 2.13.0 → 2.14.0
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/Editor.d.ts.map +1 -1
- package/dist/commands/insertContentAt.d.ts.map +1 -1
- package/dist/index.cjs +29 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -11
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +29 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Editor.ts +1 -0
- package/src/commands/insertContentAt.ts +29 -10
- package/src/types.ts +9 -0
package/dist/index.umd.js
CHANGED
|
@@ -2067,25 +2067,42 @@
|
|
|
2067
2067
|
...options,
|
|
2068
2068
|
};
|
|
2069
2069
|
let content;
|
|
2070
|
-
|
|
2071
|
-
content = createNodeFromContent(value, editor.schema, {
|
|
2072
|
-
parseOptions: {
|
|
2073
|
-
preserveWhitespace: 'full',
|
|
2074
|
-
...options.parseOptions,
|
|
2075
|
-
},
|
|
2076
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck,
|
|
2077
|
-
});
|
|
2078
|
-
}
|
|
2079
|
-
catch (e) {
|
|
2070
|
+
const emitContentError = (error) => {
|
|
2080
2071
|
editor.emit('contentError', {
|
|
2081
2072
|
editor,
|
|
2082
|
-
error
|
|
2073
|
+
error,
|
|
2083
2074
|
disableCollaboration: () => {
|
|
2084
2075
|
if (editor.storage.collaboration) {
|
|
2085
2076
|
editor.storage.collaboration.isDisabled = true;
|
|
2086
2077
|
}
|
|
2087
2078
|
},
|
|
2088
2079
|
});
|
|
2080
|
+
};
|
|
2081
|
+
const parseOptions = {
|
|
2082
|
+
preserveWhitespace: 'full',
|
|
2083
|
+
...options.parseOptions,
|
|
2084
|
+
};
|
|
2085
|
+
// If `emitContentError` is enabled, we want to check the content for errors
|
|
2086
|
+
// but ignore them (do not remove the invalid content from the document)
|
|
2087
|
+
if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {
|
|
2088
|
+
try {
|
|
2089
|
+
createNodeFromContent(value, editor.schema, {
|
|
2090
|
+
parseOptions,
|
|
2091
|
+
errorOnInvalidContent: true,
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
catch (e) {
|
|
2095
|
+
emitContentError(e);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
try {
|
|
2099
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
2100
|
+
parseOptions,
|
|
2101
|
+
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck,
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
catch (e) {
|
|
2105
|
+
emitContentError(e);
|
|
2089
2106
|
return false;
|
|
2090
2107
|
}
|
|
2091
2108
|
let { from, to } = typeof position === 'number' ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
@@ -4392,6 +4409,7 @@ img.ProseMirror-separator {
|
|
|
4392
4409
|
enablePasteRules: true,
|
|
4393
4410
|
enableCoreExtensions: true,
|
|
4394
4411
|
enableContentCheck: false,
|
|
4412
|
+
emitContentError: false,
|
|
4395
4413
|
onBeforeCreate: () => null,
|
|
4396
4414
|
onCreate: () => null,
|
|
4397
4415
|
onUpdate: () => null,
|