@types/slate-react
Advanced tools
Comparing version 0.18.1 to 0.20.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for slate-react 0.18 | ||
// Type definitions for slate-react 0.20 | ||
// Project: https://github.com/ianstormtaylor/slate | ||
@@ -9,5 +9,16 @@ // Definitions by: Andy Kent <https://github.com/andykent> | ||
// Irwan Fario Subastian <https://github.com/isubasti> | ||
// Sebastian Greaves <https://github.com/sgreav> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.8 | ||
import { Mark, Node, Change, Schema, Value, Stack, Document } from "slate"; | ||
import { | ||
Document, | ||
Editor as Controller, | ||
Mark, | ||
Node, | ||
Operations, | ||
Schema, | ||
Stack, | ||
Value, | ||
Operation, | ||
} from "slate"; | ||
import * as Immutable from "immutable"; | ||
@@ -24,3 +35,3 @@ import * as React from "react"; | ||
children: React.ReactNode; | ||
editor: Editor; | ||
editor: Controller; | ||
mark: Mark; | ||
@@ -36,69 +47,48 @@ marks: Immutable.Set<Mark>; | ||
children: React.ReactNode; | ||
editor: Editor; | ||
editor: Controller; | ||
isFocused: boolean; | ||
isSelected: boolean; | ||
key: string; | ||
node: Node; | ||
parent: Node; | ||
readOnly: boolean; | ||
} | ||
export interface RenderPlaceholderProps { | ||
editor: Controller; | ||
readOnly: boolean; | ||
} | ||
export type EventHook = ( | ||
event: Event, | ||
editor: Controller, | ||
next: () => any | ||
) => any; | ||
export interface Plugin { | ||
onBeforeInput?: ( | ||
event: Event, | ||
change: Change, | ||
editor: Editor | ||
) => Change | void; | ||
onBlur?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onFocus?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onClick?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onCopy?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onCut?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onDragEnd?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onDragEnter?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onDragExit?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onDragLeave?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onDragOver?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onDragStart?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onDrop?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onInput?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onKeyDown?: ( | ||
event: Event, | ||
change: Change, | ||
editor?: Editor | ||
) => Change | void; | ||
onKeyUp?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onPaste?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onSelect?: (event: Event, change: Change, editor?: Editor) => Change | void; | ||
onChange?: (change: Change, editor?: Editor) => any; | ||
renderEditor?: (props: RenderAttributes, editor?: Editor) => object | void; | ||
schema?: Schema; | ||
decorateNode?: (node: Node) => Range[] | void; | ||
renderMark?: (props: RenderMarkProps, next: () => void) => any; | ||
renderNode?: (props: RenderNodeProps, next: () => void) => any; | ||
renderPlaceholder?: (props: RenderAttributes, next: () => void) => any; | ||
renderPortal?: (props: RenderAttributes) => any; | ||
validateNode?: (node: Node) => any; | ||
decorateNode?: (node: Node, editor: Controller, next: () => any) => any; | ||
renderEditor?: (props: EditorProps, editor: Controller, next: () => any) => any; | ||
renderMark?: (props: RenderMarkProps, editor: Controller, next: () => any) => any; | ||
renderNode?: (props: RenderNodeProps, editor: Controller, next: () => any) => any; | ||
renderPlaceholder?: (props: RenderPlaceholderProps, editor: Controller, next: () => any) => any; | ||
shouldNodeComponentUpdate?: (previousProps: RenderNodeProps, props: RenderNodeProps, editor: Controller, next: () => any) => any; | ||
onBeforeInput?: EventHook; | ||
onBlur?: EventHook; | ||
onClick?: EventHook; | ||
onCompositionEnd?: EventHook; | ||
onCompositionStart?: EventHook; | ||
onCopy?: EventHook; | ||
onCut?: EventHook; | ||
onDragEnd?: EventHook; | ||
onDragEnter?: EventHook; | ||
onDragExit?: EventHook; | ||
onDragLeave?: EventHook; | ||
onDragOver?: EventHook; | ||
onDragStart?: EventHook; | ||
onDrop?: EventHook; | ||
onFocus?: EventHook; | ||
onInput?: EventHook; | ||
onKeyDown?: EventHook; | ||
onPaste?: EventHook; | ||
onSelect?: EventHook; | ||
} | ||
@@ -111,3 +101,3 @@ | ||
className?: string; | ||
onChange?: (change: Change) => any; | ||
onChange?: (change: { operations: Immutable.List<Operation>, value: Value }) => any; | ||
placeholder?: any; | ||
@@ -123,3 +113,2 @@ plugins?: Plugin[]; | ||
// tsling:disable interface-over-type-literal | ||
export type EditorProps = BasicEditorProps & Plugin; | ||
@@ -130,17 +119,25 @@ | ||
value: Value; | ||
stack: Stack; // [TODO] define stack | ||
stack: Stack; | ||
} | ||
export class Editor extends React.Component<EditorProps, EditorState> { | ||
controller: Controller; | ||
schema: Schema; | ||
value: Value; | ||
stack: Stack; | ||
readonly plugins: Plugin[]; | ||
readonly operations: Immutable.List<Operation>; | ||
readonly readOnly: boolean; | ||
readonly value: Value; | ||
// Instance Methods | ||
applyOperation(...args: any[]): Controller; | ||
blur(): void; | ||
change(fn: (change: Change) => any): void; | ||
change(...args: any[]): void; | ||
command(...args: any[]): Controller; | ||
focus(): void; | ||
normalize(...args: any[]): Controller; | ||
query(...args: any[]): Controller; | ||
resolveController(plugins: Plugin[], schema: Schema, commands: any[], queries: any[]): void; | ||
run(...args: any[]): any; | ||
withoutNormalizing(...args: any[]): Controller; | ||
} | ||
@@ -147,0 +144,0 @@ |
{ | ||
"name": "@types/slate-react", | ||
"version": "0.18.1", | ||
"version": "0.20.0", | ||
"description": "TypeScript definitions for slate-react", | ||
@@ -36,6 +36,11 @@ "license": "MIT", | ||
"githubUsername": "isubasti" | ||
}, | ||
{ | ||
"name": "Sebastian Greaves", | ||
"url": "https://github.com/sgreav", | ||
"githubUsername": "sgreav" | ||
} | ||
], | ||
"main": "", | ||
"types": "", | ||
"types": "index", | ||
"repository": { | ||
@@ -51,4 +56,4 @@ "type": "git", | ||
}, | ||
"typesPublisherContentHash": "addcf1311cdefece6d8d0246a4ab19bc539d741be877d17f131d5224a4c6bd43", | ||
"typesPublisherContentHash": "e9ba062649252cb5145d7a9d3bb27864c8cb8cfbd30d042705e9955ae05543ca", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Mon, 29 Oct 2018 23:37:01 GMT | ||
* Last updated: Mon, 05 Nov 2018 20:43:45 GMT | ||
* Dependencies: slate, immutable, react | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Andy Kent <https://github.com/andykent>, Jamie Talbot <https://github.com/majelbstoat>, Jan Löbel <https://github.com/JanLoebel>, Patrick Sachs <https://github.com/PatrickSachs>, Brandon Shelton <https://github.com/YangusKhan>, Irwan Fario Subastian <https://github.com/isubasti>. | ||
These definitions were written by Andy Kent <https://github.com/andykent>, Jamie Talbot <https://github.com/majelbstoat>, Jan Löbel <https://github.com/JanLoebel>, Patrick Sachs <https://github.com/PatrickSachs>, Brandon Shelton <https://github.com/YangusKhan>, Irwan Fario Subastian <https://github.com/isubasti>, Sebastian Greaves <https://github.com/sgreav>. |
8430
148