mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
fix: custom slate types definition
This commit is contained in:
parent
66e779df2d
commit
d2d2a85efc
27
src/client/custom-slate-types.d.ts
vendored
Normal file
27
src/client/custom-slate-types.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// This example is for an Editor with `ReactEditor` and `HistoryEditor`
|
||||
import { BaseEditor, BaseRange } from 'slate'
|
||||
import { HistoryEditor } from 'slate-history'
|
||||
|
||||
export type CustomEditor = BaseEditor & HistoryEditor
|
||||
|
||||
export type CustomElement = {
|
||||
type?: string
|
||||
children: CustomText[]
|
||||
}
|
||||
|
||||
export type CustomRange = {
|
||||
isCaret?: boolean
|
||||
} & BaseRange
|
||||
|
||||
export type FormattedText = { text: string; bold?: boolean }
|
||||
|
||||
export type CustomText = FormattedText
|
||||
|
||||
declare module 'slate' {
|
||||
interface CustomTypes {
|
||||
Editor: CustomEditor
|
||||
Element: CustomElement
|
||||
Text: CustomText
|
||||
Range: CustomRange
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user