fix some bugs

This commit is contained in:
Philipp Kühn
2020-11-16 17:25:55 +01:00
parent 163c8f3034
commit 0e2815b317
3 changed files with 7 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { EditorState, Transaction } from 'prosemirror-state'
import { import {
SingleCommands, SingleCommands,
ChainedCommands, ChainedCommands,
CanCommands,
Editor, Editor,
CommandSpec, CommandSpec,
} from './Editor' } from './Editor'
@@ -110,7 +111,7 @@ export default class CommandManager {
return { return {
...formattedCommands, ...formattedCommands,
chain: () => this.createChain(tr, dispatch), chain: () => this.createChain(tr, dispatch),
} } as CanCommands
} }
public buildProps(tr: Transaction, shouldDispatch = true) { public buildProps(tr: Transaction, shouldDispatch = true) {

View File

@@ -20,6 +20,7 @@ import { Mark } from './Mark'
import { Extensions, UnionToIntersection } from './types' import { Extensions, UnionToIntersection } from './types'
import * as extensions from './extensions' import * as extensions from './extensions'
import style from './style' import style from './style'
import { AllExtensions } from '.'
export { extensions } export { extensions }
@@ -40,8 +41,6 @@ export interface CommandsSpec {
[key: string]: CommandSpec [key: string]: CommandSpec
} }
export interface AllExtensions {}
export type UnfilteredCommands = { export type UnfilteredCommands = {
[Item in keyof AllExtensions]: AllExtensions[Item] extends Extension<any, infer ExtensionCommands> [Item in keyof AllExtensions]: AllExtensions[Item] extends Extension<any, infer ExtensionCommands>
? ExtensionCommands ? ExtensionCommands
@@ -70,6 +69,8 @@ export type ChainedCommands = {
run: () => boolean run: () => boolean
} }
export type CanCommands = SingleCommands & { chain: () => ChainedCommands }
type EditorContent = string | JSON | null type EditorContent = string | JSON | null
interface HTMLElement { interface HTMLElement {

View File

@@ -1,3 +1,5 @@
export interface AllExtensions {}
export * from './Editor' export * from './Editor'
export * from './Extension' export * from './Extension'
export * from './Node' export * from './Node'