Skip to content

Commit b871de5

Browse files
Juan Bernalalexkrolick
authored andcommitted
Modules toolbar typings (zenoamaro#298)
* Added Formats type and toolbar types. * Format changes. * Aligned modules with Quill.StringMap The modules now inherit from Quill.
1 parent d4c9b3c commit b871de5

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

types.d.ts

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,14 @@
11
import * as React from "react";
22
import * as Quill from "quill";
33

4-
type ToolbarOptionItem = string | string[] | Object[];
5-
6-
interface ToolbarOptionObject {
7-
container: string;
8-
handlers?: {
9-
[key: string]: Function;
10-
};
11-
}
12-
13-
export interface Modules {
14-
/**
15-
* @deprecated
16-
* 'Since v1.0.0, React Quill will not create a custom toolbar for you anymore.
17-
* Create a toolbar explictly, or let Quill create one.
18-
* See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100
19-
*/
20-
toolbar?: never;
21-
}
22-
234
export interface UnprivilegedEditor {
245
getLength(): number;
25-
getText(index?: number, length?: number): string;
6+
getText(index?: number, length?: number): string;
267
getHTML(): string;
278
getBounds(index: number, length?: number): Quill.BoundsStatic;
28-
getSelection(focus?: boolean): Quill.RangeStatic;
29-
getContents(index?: number, length?: number): Quill.DeltaStatic;}
9+
getSelection(focus?: boolean): Quill.RangeStatic;
10+
getContents(index?: number, length?: number): Quill.DeltaStatic;
11+
}
3012

3113
export interface ComponentProps {
3214
id?: string;
@@ -48,7 +30,7 @@ export interface ComponentProps {
4830
onKeyUp?: React.EventHandler<any>;
4931
formats?: string[];
5032
children?: React.ReactElement<any>;
51-
modules?: Modules;
33+
modules?: Quill.StringMap;
5234

5335
/** @deprecated
5436
* The `toolbar` prop has been deprecated. Use `modules.toolbar` instead.
@@ -61,7 +43,7 @@ export interface ComponentProps {
6143
* See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100
6244
*/
6345

64-
styles?: never;
46+
styles?: never;
6547
/**
6648
* @deprecated
6749
* The `pollInterval` property does not have any effect anymore.
@@ -77,22 +59,6 @@ export default class Component extends React.Component<ComponentProps> {
7759
getEditor(): Quill.Quill;
7860
}
7961

80-
export interface ToolbarItem {
81-
type: string;
82-
label?: string;
83-
value?: string;
84-
items?: ToolbarItem[];
85-
}
86-
87-
export interface ToolbarProps {
88-
id?: string;
89-
className?: string;
90-
style?: Object;
91-
items?: ToolbarItem[];
92-
}
93-
94-
export class Toolbar extends React.Component<ToolbarProps> {}
95-
9662
export interface Mixin {
9763
createEditor(element: HTMLElement, config: Quill.QuillOptionsStatic): Quill.Quill;
9864
hookEditor(editor: Quill.Quill): void;

0 commit comments

Comments
 (0)