Skip to content

Commit

Permalink
Modules toolbar typings (zenoamaro#298)
Browse files Browse the repository at this point in the history
* Added Formats type and toolbar types.

* Format changes.

* Aligned modules with Quill.StringMap

The modules now inherit from Quill.
  • Loading branch information
Juan Bernal authored and alexkrolick committed Dec 4, 2017
1 parent d4c9b3c commit b871de5
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
import * as React from "react";
import * as Quill from "quill";

type ToolbarOptionItem = string | string[] | Object[];

interface ToolbarOptionObject {
container: string;
handlers?: {
[key: string]: Function;
};
}

export interface Modules {
/**
* @deprecated
* 'Since v1.0.0, React Quill will not create a custom toolbar for you anymore.
* Create a toolbar explictly, or let Quill create one.
* See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100
*/
toolbar?: never;
}

export interface UnprivilegedEditor {
getLength(): number;
getText(index?: number, length?: number): string;
getText(index?: number, length?: number): string;
getHTML(): string;
getBounds(index: number, length?: number): Quill.BoundsStatic;
getSelection(focus?: boolean): Quill.RangeStatic;
getContents(index?: number, length?: number): Quill.DeltaStatic;}
getSelection(focus?: boolean): Quill.RangeStatic;
getContents(index?: number, length?: number): Quill.DeltaStatic;
}

export interface ComponentProps {
id?: string;
Expand All @@ -48,7 +30,7 @@ export interface ComponentProps {
onKeyUp?: React.EventHandler<any>;
formats?: string[];
children?: React.ReactElement<any>;
modules?: Modules;
modules?: Quill.StringMap;

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

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

export interface ToolbarItem {
type: string;
label?: string;
value?: string;
items?: ToolbarItem[];
}

export interface ToolbarProps {
id?: string;
className?: string;
style?: Object;
items?: ToolbarItem[];
}

export class Toolbar extends React.Component<ToolbarProps> {}

export interface Mixin {
createEditor(element: HTMLElement, config: Quill.QuillOptionsStatic): Quill.Quill;
hookEditor(editor: Quill.Quill): void;
Expand Down

0 comments on commit b871de5

Please sign in to comment.