From 0e2815b31767fc475b75955d3f2686c770e0ca62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 16 Nov 2020 17:25:55 +0100 Subject: [PATCH] fix some bugs --- packages/core/src/CommandManager.ts | 3 ++- packages/core/src/Editor.ts | 5 +++-- packages/core/src/index.ts | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/src/CommandManager.ts b/packages/core/src/CommandManager.ts index b9fef148..08134770 100644 --- a/packages/core/src/CommandManager.ts +++ b/packages/core/src/CommandManager.ts @@ -2,6 +2,7 @@ import { EditorState, Transaction } from 'prosemirror-state' import { SingleCommands, ChainedCommands, + CanCommands, Editor, CommandSpec, } from './Editor' @@ -110,7 +111,7 @@ export default class CommandManager { return { ...formattedCommands, chain: () => this.createChain(tr, dispatch), - } + } as CanCommands } public buildProps(tr: Transaction, shouldDispatch = true) { diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 5791204a..61f61767 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -20,6 +20,7 @@ import { Mark } from './Mark' import { Extensions, UnionToIntersection } from './types' import * as extensions from './extensions' import style from './style' +import { AllExtensions } from '.' export { extensions } @@ -40,8 +41,6 @@ export interface CommandsSpec { [key: string]: CommandSpec } -export interface AllExtensions {} - export type UnfilteredCommands = { [Item in keyof AllExtensions]: AllExtensions[Item] extends Extension ? ExtensionCommands @@ -70,6 +69,8 @@ export type ChainedCommands = { run: () => boolean } +export type CanCommands = SingleCommands & { chain: () => ChainedCommands } + type EditorContent = string | JSON | null interface HTMLElement { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index a1aa1c85..6e211607 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,3 +1,5 @@ +export interface AllExtensions {} + export * from './Editor' export * from './Extension' export * from './Node'