diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index a6d122b85..3878321b6 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -59,6 +59,7 @@ export class Editor extends EventEmitter { parseOptions: {}, enableInputRules: true, enablePasteRules: true, + enableCoreExtensions: true, onBeforeCreate: () => null, onCreate: () => null, onUpdate: () => null, @@ -218,7 +219,9 @@ export class Editor extends EventEmitter { * Creates an extension manager. */ private createExtensionManager(): void { - const coreExtensions = Object.entries(extensions).map(([, extension]) => extension) + const coreExtensions = this.options.enableCoreExtensions + ? Object.entries(extensions).map(([, extension]) => extension) + : [] const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => { return ['extension', 'node', 'mark'].includes(extension?.type) }) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 184b9dd62..fbb4f12fe 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,3 +1,6 @@ +import * as extensions from './extensions' + +export { extensions } export * from './Editor' export * from './Extension' export * from './Node' diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index b039d458e..25682574b 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -50,6 +50,7 @@ export interface EditorOptions { parseOptions: ParseOptions, enableInputRules: boolean, enablePasteRules: boolean, + enableCoreExtensions: boolean, onBeforeCreate: (props: { editor: Editor }) => void, onCreate: (props: { editor: Editor }) => void, onUpdate: (props: { editor: Editor, transaction: Transaction }) => void,