@tiptap/core 2.0.0-rc.2 → 2.0.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/index.js CHANGED
@@ -408,14 +408,16 @@ function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
408
408
  }
409
409
 
410
410
  function cleanUpSchemaItem(data) {
411
- return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
411
+ return Object.fromEntries(
412
+ // @ts-ignore
413
+ Object.entries(data).filter(([key, value]) => {
412
414
  if (key === 'attrs' && isEmptyObject(value)) {
413
415
  return false;
414
416
  }
415
417
  return value !== null && value !== undefined;
416
418
  }));
417
419
  }
418
- function getSchemaByResolvedExtensions(extensions) {
420
+ function getSchemaByResolvedExtensions(extensions, editor) {
419
421
  var _a;
420
422
  const allAttributes = getAttributesFromExtensions(extensions);
421
423
  const { nodeExtensions, markExtensions } = splitExtensions(extensions);
@@ -426,6 +428,7 @@ function getSchemaByResolvedExtensions(extensions) {
426
428
  name: extension.name,
427
429
  options: extension.options,
428
430
  storage: extension.storage,
431
+ editor,
429
432
  };
430
433
  const extraNodeFields = extensions.reduce((fields, e) => {
431
434
  const extendNodeSchema = getExtensionField(e, 'extendNodeSchema', context);
@@ -474,6 +477,7 @@ function getSchemaByResolvedExtensions(extensions) {
474
477
  name: extension.name,
475
478
  options: extension.options,
476
479
  storage: extension.storage,
480
+ editor,
477
481
  };
478
482
  const extraMarkFields = extensions.reduce((fields, e) => {
479
483
  const extendMarkSchema = getExtensionField(e, 'extendMarkSchema', context);
@@ -876,7 +880,7 @@ class ExtensionManager {
876
880
  this.splittableMarks = [];
877
881
  this.editor = editor;
878
882
  this.extensions = ExtensionManager.resolve(extensions);
879
- this.schema = getSchemaByResolvedExtensions(this.extensions);
883
+ this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
880
884
  this.extensions.forEach(extension => {
881
885
  var _a;
882
886
  // store extension storage in editor
@@ -2028,9 +2032,9 @@ function getHTMLFromFragment(fragment, schema) {
2028
2032
  return container.innerHTML;
2029
2033
  }
2030
2034
 
2031
- function getSchema(extensions) {
2035
+ function getSchema(extensions, editor) {
2032
2036
  const resolvedExtensions = ExtensionManager.resolve(extensions);
2033
- return getSchemaByResolvedExtensions(resolvedExtensions);
2037
+ return getSchemaByResolvedExtensions(resolvedExtensions, editor);
2034
2038
  }
2035
2039
 
2036
2040
  function generateHTML(doc, extensions) {