Revert "use global namespace"
This reverts commit 24c3a9abd3.
# Conflicts:
# packages/core/src/Editor.ts
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { EditorState, Transaction } from 'prosemirror-state'
|
||||
import {
|
||||
Editor,
|
||||
CommandSpec,
|
||||
SingleCommands,
|
||||
ChainedCommands,
|
||||
Editor,
|
||||
CommandSpec,
|
||||
} from './Editor'
|
||||
import getAllMethodNames from './utils/getAllMethodNames'
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import { Extensions, UnionToIntersection } from './types'
|
||||
import * as extensions from './extensions'
|
||||
import style from './style'
|
||||
|
||||
export { extensions }
|
||||
|
||||
export type Command = (props: {
|
||||
editor: Editor,
|
||||
tr: Transaction,
|
||||
@@ -38,25 +40,21 @@ export interface CommandsSpec {
|
||||
[key: string]: CommandSpec
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace Tiptap {
|
||||
export interface AllExtensions {}
|
||||
}
|
||||
}
|
||||
export interface AllExtensions {}
|
||||
|
||||
type UnfilteredCommands = {
|
||||
[Item in keyof Tiptap.AllExtensions]: Tiptap.AllExtensions[Item] extends Extension<any, infer ExtensionCommands>
|
||||
export type UnfilteredCommands = {
|
||||
[Item in keyof AllExtensions]: AllExtensions[Item] extends Extension<any, infer ExtensionCommands>
|
||||
? ExtensionCommands
|
||||
: Tiptap.AllExtensions[Item] extends Node<any, infer NodeCommands>
|
||||
: AllExtensions[Item] extends Node<any, infer NodeCommands>
|
||||
? NodeCommands
|
||||
: Tiptap.AllExtensions[Item] extends Mark<any, infer MarkCommands>
|
||||
: AllExtensions[Item] extends Mark<any, infer MarkCommands>
|
||||
? MarkCommands
|
||||
: never
|
||||
}
|
||||
|
||||
type ValuesOf<T> = T[keyof T];
|
||||
type KeysWithTypeOf<T, Type> = ({[P in keyof T]: T[P] extends Type ? P : never })[keyof T]
|
||||
type AllCommands = UnionToIntersection<ValuesOf<Pick<UnfilteredCommands, KeysWithTypeOf<UnfilteredCommands, {}>>>>
|
||||
export type ValuesOf<T> = T[keyof T];
|
||||
export type KeysWithTypeOf<T, Type> = ({[P in keyof T]: T[P] extends Type ? P : never })[keyof T]
|
||||
export type AllCommands = UnionToIntersection<ValuesOf<Pick<UnfilteredCommands, KeysWithTypeOf<UnfilteredCommands, {}>>>>
|
||||
|
||||
export type SingleCommands = {
|
||||
[Item in keyof AllCommands]: AllCommands[Item] extends (...args: any[]) => any
|
||||
|
||||
@@ -147,10 +147,8 @@ export const Commands = Extension.create({
|
||||
},
|
||||
})
|
||||
|
||||
declare global {
|
||||
namespace Tiptap {
|
||||
interface AllExtensions {
|
||||
Commands: typeof Commands,
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
Commands: typeof Commands,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,8 @@ export const Editable = Extension.create({
|
||||
},
|
||||
})
|
||||
|
||||
declare global {
|
||||
namespace Tiptap {
|
||||
interface AllExtensions {
|
||||
Editable: typeof Editable,
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
Editable: typeof Editable,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,8 @@ export const FocusEvents = Extension.create({
|
||||
},
|
||||
})
|
||||
|
||||
declare global {
|
||||
namespace Tiptap {
|
||||
interface AllExtensions {
|
||||
FocusEvents: typeof FocusEvents,
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
FocusEvents: typeof FocusEvents,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +45,8 @@ export const Keymap = Extension.create({
|
||||
},
|
||||
})
|
||||
|
||||
declare global {
|
||||
namespace Tiptap {
|
||||
interface AllExtensions {
|
||||
Keymap: typeof Keymap,
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
Keymap: typeof Keymap,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
export {
|
||||
Editor,
|
||||
Command,
|
||||
CommandsSpec,
|
||||
} from './Editor'
|
||||
|
||||
export * from './Editor'
|
||||
export * from './Extension'
|
||||
export * from './Node'
|
||||
export * from './Mark'
|
||||
|
||||
Reference in New Issue
Block a user