mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 23:59:25 +08:00
Add enableCoreExtensions flag (#1923)
This commit is contained in:
parent
5cb63406a8
commit
2785278e83
@ -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)
|
||||
})
|
||||
|
@ -1,3 +1,6 @@
|
||||
import * as extensions from './extensions'
|
||||
|
||||
export { extensions }
|
||||
export * from './Editor'
|
||||
export * from './Extension'
|
||||
export * from './Node'
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user