@tiptap/core 2.0.0-rc.2 → 2.0.0-rc.3

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.cjs CHANGED
@@ -412,14 +412,16 @@ function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
412
412
  }
413
413
 
414
414
  function cleanUpSchemaItem(data) {
415
- return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
415
+ return Object.fromEntries(
416
+ // @ts-ignore
417
+ Object.entries(data).filter(([key, value]) => {
416
418
  if (key === 'attrs' && isEmptyObject(value)) {
417
419
  return false;
418
420
  }
419
421
  return value !== null && value !== undefined;
420
422
  }));
421
423
  }
422
- function getSchemaByResolvedExtensions(extensions) {
424
+ function getSchemaByResolvedExtensions(extensions, editor) {
423
425
  var _a;
424
426
  const allAttributes = getAttributesFromExtensions(extensions);
425
427
  const { nodeExtensions, markExtensions } = splitExtensions(extensions);
@@ -430,6 +432,7 @@ function getSchemaByResolvedExtensions(extensions) {
430
432
  name: extension.name,
431
433
  options: extension.options,
432
434
  storage: extension.storage,
435
+ editor,
433
436
  };
434
437
  const extraNodeFields = extensions.reduce((fields, e) => {
435
438
  const extendNodeSchema = getExtensionField(e, 'extendNodeSchema', context);
@@ -478,6 +481,7 @@ function getSchemaByResolvedExtensions(extensions) {
478
481
  name: extension.name,
479
482
  options: extension.options,
480
483
  storage: extension.storage,
484
+ editor,
481
485
  };
482
486
  const extraMarkFields = extensions.reduce((fields, e) => {
483
487
  const extendMarkSchema = getExtensionField(e, 'extendMarkSchema', context);
@@ -880,7 +884,7 @@ class ExtensionManager {
880
884
  this.splittableMarks = [];
881
885
  this.editor = editor;
882
886
  this.extensions = ExtensionManager.resolve(extensions);
883
- this.schema = getSchemaByResolvedExtensions(this.extensions);
887
+ this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
884
888
  this.extensions.forEach(extension => {
885
889
  var _a;
886
890
  // store extension storage in editor
@@ -2032,9 +2036,9 @@ function getHTMLFromFragment(fragment, schema) {
2032
2036
  return container.innerHTML;
2033
2037
  }
2034
2038
 
2035
- function getSchema(extensions) {
2039
+ function getSchema(extensions, editor) {
2036
2040
  const resolvedExtensions = ExtensionManager.resolve(extensions);
2037
- return getSchemaByResolvedExtensions(resolvedExtensions);
2041
+ return getSchemaByResolvedExtensions(resolvedExtensions, editor);
2038
2042
  }
2039
2043
 
2040
2044
  function generateHTML(doc, extensions) {