diff --git a/packages/core/src/Extension.ts b/packages/core/src/Extension.ts index 48d4a0b0..c03f725e 100644 --- a/packages/core/src/Extension.ts +++ b/packages/core/src/Extension.ts @@ -352,20 +352,13 @@ export class Extension { console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`) } - // TODO: remove `addOptions` fallback - extension.options = extendedConfig.defaultOptions - ? extendedConfig.defaultOptions - : extension.parent.options - - if (extendedConfig.addOptions) { - extension.options = callOrReturn(getExtensionField( - extension, - 'addOptions', - { - name: extension.name, - }, - )) - } + extension.options = callOrReturn(getExtensionField( + extension, + 'addOptions', + { + name: extension.name, + }, + )) extension.storage = callOrReturn(getExtensionField( extension, diff --git a/packages/core/src/Mark.ts b/packages/core/src/Mark.ts index 4cd38816..9372f4fc 100644 --- a/packages/core/src/Mark.ts +++ b/packages/core/src/Mark.ts @@ -466,20 +466,13 @@ export class Mark { console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`) } - // TODO: remove `addOptions` fallback - extension.options = extendedConfig.defaultOptions - ? extendedConfig.defaultOptions - : extension.parent.options - - if (extendedConfig.addOptions) { - extension.options = callOrReturn(getExtensionField( - extension, - 'addOptions', - { - name: extension.name, - }, - )) - } + extension.options = callOrReturn(getExtensionField( + extension, + 'addOptions', + { + name: extension.name, + }, + )) extension.storage = callOrReturn(getExtensionField( extension, diff --git a/packages/core/src/Node.ts b/packages/core/src/Node.ts index fe51bd8b..9eaf3499 100644 --- a/packages/core/src/Node.ts +++ b/packages/core/src/Node.ts @@ -546,20 +546,13 @@ export class Node { console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`) } - // TODO: remove `addOptions` fallback - extension.options = extendedConfig.defaultOptions - ? extendedConfig.defaultOptions - : extension.parent.options - - if (extendedConfig.addOptions) { - extension.options = callOrReturn(getExtensionField( - extension, - 'addOptions', - { - name: extension.name, - }, - )) - } + extension.options = callOrReturn(getExtensionField( + extension, + 'addOptions', + { + name: extension.name, + }, + )) extension.storage = callOrReturn(getExtensionField( extension, diff --git a/tests/cypress/integration/core/extensionOptions.spec.ts b/tests/cypress/integration/core/extensionOptions.spec.ts index 46031526..ba911357 100644 --- a/tests/cypress/integration/core/extensionOptions.spec.ts +++ b/tests/cypress/integration/core/extensionOptions.spec.ts @@ -3,20 +3,6 @@ import { Extension } from '@tiptap/core/src/Extension' describe('extension options', () => { - it('should set options (deprecated)', () => { - const extension = Extension.create({ - defaultOptions: { - foo: 1, - bar: 1, - }, - }) - - expect(extension.options).to.deep.eq({ - foo: 1, - bar: 1, - }) - }) - it('should set options', () => { const extension = Extension.create({ addOptions() { @@ -33,23 +19,6 @@ describe('extension options', () => { }) }) - it('should pass through (deprecated)', () => { - const extension = Extension - .create({ - defaultOptions: { - foo: 1, - bar: 1, - }, - }) - .extend() - .configure() - - expect(extension.options).to.deep.eq({ - foo: 1, - bar: 1, - }) - }) - it('should pass through', () => { const extension = Extension .create({ @@ -69,24 +38,6 @@ describe('extension options', () => { }) }) - it('should be configurable (deprecated)', () => { - const extension = Extension - .create({ - defaultOptions: { - foo: 1, - bar: 1, - }, - }) - .configure({ - bar: 2, - }) - - expect(extension.options).to.deep.eq({ - foo: 1, - bar: 2, - }) - }) - it('should be configurable', () => { const extension = Extension .create({ @@ -107,28 +58,6 @@ describe('extension options', () => { }) }) - it('should be extendable (deprecated)', () => { - const extension = Extension.create({ - defaultOptions: { - foo: 1, - bar: 1, - }, - }) - - const newExtension = extension.extend({ - defaultOptions: { - ...extension.options, - baz: 1, - }, - }) - - expect(newExtension.options).to.deep.eq({ - foo: 1, - bar: 1, - baz: 1, - }) - }) - it('should be extendable', () => { const extension = Extension.create({ addOptions() { @@ -155,25 +84,6 @@ describe('extension options', () => { }) }) - it('should be overwritable (deprecated)', () => { - const extension = Extension - .create({ - defaultOptions: { - foo: 1, - bar: 1, - }, - }) - .extend({ - defaultOptions: { - baz: 1, - }, - }) - - expect(extension.options).to.deep.eq({ - baz: 1, - }) - }) - it('should be overwritable', () => { const extension = Extension .create({ @@ -197,35 +107,6 @@ describe('extension options', () => { }) }) - it('should configure nested objects (deprecated)', () => { - const extension = Extension - .create<{ - foo: number[], - HTMLAttributes: Record, - }>({ - defaultOptions: { - foo: [1, 2, 3], - HTMLAttributes: { - class: 'foo', - }, - }, - }) - .configure({ - foo: [1], - HTMLAttributes: { - id: 'bar', - }, - }) - - expect(extension.options).to.deep.eq({ - foo: [1], - HTMLAttributes: { - class: 'foo', - id: 'bar', - }, - }) - }) - it('should configure nested objects', () => { const extension = Extension .create<{ @@ -257,35 +138,6 @@ describe('extension options', () => { }) }) - it('should create its own instance on configure (deprecated)', () => { - const extension = Extension - .create({ - defaultOptions: { - foo: 1, - bar: 2, - }, - }) - - const extension1 = extension.configure({ - foo: 2, - bar: 4, - }) - - const extension2 = extension.configure({ - foo: 3, - }) - - expect(extension1.options).to.deep.eq({ - foo: 2, - bar: 4, - }) - - expect(extension2.options).to.deep.eq({ - foo: 3, - bar: 2, - }) - }) - it('should create its own instance on configure', () => { const extension = Extension .create({