@types/quill

  • Version 2.0.9
  • Published
  • 12.5 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/quill
yarn add @types/quill
pnpm add @types/quill

Overview

TypeScript definitions for Quill

Index

Classes

class Quill

class Quill implements EventEmitter {}

    constructor

    constructor(container: string | Element, options?: QuillOptionsStatic);

      property clipboard

      clipboard: ClipboardStatic;

        property keyboard

        keyboard: KeyboardStatic;

          property root

          root: HTMLDivElement;
          • Internal API

          property scroll

          scroll: any;

            property sources

            static readonly sources: SourceMap;

              method addContainer

              addContainer: (classNameOrDomNode: string | Node, refNode?: Node) => any;

                method blur

                blur: () => void;

                  method debug

                  static debug: (level: string | boolean) => void;

                    method deleteText

                    deleteText: (index: number, length: number, source?: Sources) => any;

                      method disable

                      disable: () => void;

                        method enable

                        enable: (enabled?: boolean) => void;

                          method find

                          static find: (domNode: Node, bubble?: boolean) => Quill | any;

                            method focus

                            focus: () => void;

                              method format

                              format: (name: string, value: any, source?: Sources) => any;

                                method formatLine

                                formatLine: {
                                (index: number, length: number, source?: Sources): any;
                                (
                                index: number,
                                length: number,
                                format: string,
                                value: any,
                                source?: Sources
                                ): any;
                                (index: number, length: number, formats: StringMap, source?: Sources): any;
                                };

                                  method formatText

                                  formatText: {
                                  (index: number, length: number, source?: Sources): any;
                                  (
                                  index: number,
                                  length: number,
                                  format: string,
                                  value: any,
                                  source?: Sources
                                  ): any;
                                  (index: number, length: number, formats: StringMap, source?: Sources): any;
                                  (range: RangeStatic, format: string, value: any, source?: Sources): any;
                                  (range: RangeStatic, formats: StringMap, source?: Sources): any;
                                  };

                                    method getBounds

                                    getBounds: (index: number, length?: number) => BoundsStatic;

                                      method getContents

                                      getContents: (index?: number, length?: number) => any;

                                        method getFormat

                                        getFormat: {
                                        (range?: RangeStatic): StringMap;
                                        (index: number, length?: number): StringMap;
                                        };

                                          method getIndex

                                          getIndex: (blot: any) => number;

                                            method getLeaf

                                            getLeaf: (index: number) => any;

                                              method getLength

                                              getLength: () => number;

                                                method getLine

                                                getLine: (index: number) => [any, number];

                                                  method getLines

                                                  getLines: {
                                                  (index?: number, length?: number): any[];
                                                  (range: RangeStatic): any[];
                                                  };

                                                    method getModule

                                                    getModule: (name: string) => any;

                                                      method getSelection

                                                      getSelection: { (focus: true): RangeStatic; (focus?: false): RangeStatic };

                                                        method getText

                                                        getText: (index?: number, length?: number) => string;

                                                          method hasFocus

                                                          hasFocus: () => boolean;

                                                            method import

                                                            static import: (path: string) => any;

                                                              method insertEmbed

                                                              insertEmbed: (index: number, type: string, value: any, source?: Sources) => any;

                                                                method insertText

                                                                insertText: {
                                                                (index: number, text: string, source?: Sources): any;
                                                                (
                                                                index: number,
                                                                text: string,
                                                                format: string,
                                                                value: any,
                                                                source?: Sources
                                                                ): any;
                                                                (index: number, text: string, formats: StringMap, source?: Sources): any;
                                                                };

                                                                  method isEnabled

                                                                  isEnabled: () => boolean;

                                                                    method off

                                                                    off: {
                                                                    (eventName: 'text-change', handler: TextChangeHandler): EventEmitter;
                                                                    (
                                                                    eventName: 'selection-change',
                                                                    handler: SelectionChangeHandler
                                                                    ): EventEmitter;
                                                                    (eventName: 'editor-change', handler: EditorChangeHandler): EventEmitter;
                                                                    };

                                                                      method on

                                                                      on: {
                                                                      (eventName: 'text-change', handler: TextChangeHandler): EventEmitter;
                                                                      (
                                                                      eventName: 'selection-change',
                                                                      handler: SelectionChangeHandler
                                                                      ): EventEmitter;
                                                                      (eventName: 'editor-change', handler: EditorChangeHandler): EventEmitter;
                                                                      };

                                                                        method once

                                                                        once: {
                                                                        (eventName: 'text-change', handler: TextChangeHandler): EventEmitter;
                                                                        (
                                                                        eventName: 'selection-change',
                                                                        handler: SelectionChangeHandler
                                                                        ): EventEmitter;
                                                                        (eventName: 'editor-change', handler: EditorChangeHandler): EventEmitter;
                                                                        };

                                                                          method pasteHTML

                                                                          pasteHTML: {
                                                                          (index: number, html: string, source?: Sources): string;
                                                                          (html: string, source?: Sources): string;
                                                                          };
                                                                          • Deprecated

                                                                            Remove in 2.0. Use clipboard.dangerouslyPasteHTML(index: number, html: string, source: Sources)

                                                                          • Deprecated

                                                                            Remove in 2.0. Use clipboard.dangerouslyPasteHTML(html: string, source: Sources): void;

                                                                          method register

                                                                          static register: {
                                                                          (path: string, def: any, suppressWarning?: boolean): void;
                                                                          (defs: StringMap, suppressWarning?: boolean): void;
                                                                          };

                                                                            method removeFormat

                                                                            removeFormat: (index: number, length: number, source?: Sources) => any;

                                                                              method setContents

                                                                              setContents: (delta: any, source?: Sources) => any;

                                                                                method setSelection

                                                                                setSelection: {
                                                                                (index: number, length: number, source?: Sources): void;
                                                                                (range: RangeStatic, source?: Sources): void;
                                                                                };

                                                                                  method setText

                                                                                  setText: (text: string, source?: Sources) => any;

                                                                                    method update

                                                                                    update: (source?: Sources) => void;

                                                                                      method updateContents

                                                                                      updateContents: (delta: any, source?: Sources) => any;

                                                                                        class RangeStatic

                                                                                        class RangeStatic implements RangeStatic {}

                                                                                          constructor

                                                                                          constructor();

                                                                                            property index

                                                                                            index: number;

                                                                                              property length

                                                                                              length: number;

                                                                                                Interfaces

                                                                                                interface BoundsStatic

                                                                                                interface BoundsStatic {}

                                                                                                  property bottom

                                                                                                  bottom: number;

                                                                                                    property height

                                                                                                    height: number;

                                                                                                      property left

                                                                                                      left: number;

                                                                                                        property right

                                                                                                        right: number;

                                                                                                          property top

                                                                                                          top: number;

                                                                                                            property width

                                                                                                            width: number;

                                                                                                              interface ClipboardStatic

                                                                                                              interface ClipboardStatic {}

                                                                                                                property matchers

                                                                                                                matchers: Array<[ClipboardMatcherNode, ClipboardMatcherCallback]>;

                                                                                                                  method addMatcher

                                                                                                                  addMatcher: (
                                                                                                                  selectorOrNodeType: ClipboardMatcherNode,
                                                                                                                  callback: ClipboardMatcherCallback
                                                                                                                  ) => void;

                                                                                                                    method convert

                                                                                                                    convert: (
                                                                                                                    content?: { html?: string | undefined; text?: string | undefined },
                                                                                                                    formats?: StringMap
                                                                                                                    ) => any;

                                                                                                                      method dangerouslyPasteHTML

                                                                                                                      dangerouslyPasteHTML: {
                                                                                                                      (html: string, source?: Sources): void;
                                                                                                                      (index: number, html: string, source?: Sources): void;
                                                                                                                      };

                                                                                                                        interface EventEmitter

                                                                                                                        interface EventEmitter {}

                                                                                                                          method off

                                                                                                                          off: {
                                                                                                                          (eventName: 'text-change', handler: TextChangeHandler): EventEmitter;
                                                                                                                          (
                                                                                                                          eventName: 'selection-change',
                                                                                                                          handler: SelectionChangeHandler
                                                                                                                          ): EventEmitter;
                                                                                                                          (eventName: 'editor-change', handler: EditorChangeHandler): EventEmitter;
                                                                                                                          };

                                                                                                                            method on

                                                                                                                            on: {
                                                                                                                            (eventName: 'text-change', handler: TextChangeHandler): EventEmitter;
                                                                                                                            (
                                                                                                                            eventName: 'selection-change',
                                                                                                                            handler: SelectionChangeHandler
                                                                                                                            ): EventEmitter;
                                                                                                                            (eventName: 'editor-change', handler: EditorChangeHandler): EventEmitter;
                                                                                                                            };

                                                                                                                              method once

                                                                                                                              once: {
                                                                                                                              (eventName: 'text-change', handler: TextChangeHandler): EventEmitter;
                                                                                                                              (
                                                                                                                              eventName: 'selection-change',
                                                                                                                              handler: SelectionChangeHandler
                                                                                                                              ): EventEmitter;
                                                                                                                              (eventName: 'editor-change', handler: EditorChangeHandler): EventEmitter;
                                                                                                                              };

                                                                                                                                interface Key

                                                                                                                                interface Key {}

                                                                                                                                  property altKey

                                                                                                                                  altKey?: boolean | null | undefined;

                                                                                                                                    property ctrlKey

                                                                                                                                    ctrlKey?: boolean | null | undefined;

                                                                                                                                      property key

                                                                                                                                      key: string | number;

                                                                                                                                        property metaKey

                                                                                                                                        metaKey?: boolean | null | undefined;

                                                                                                                                          property shiftKey

                                                                                                                                          shiftKey?: boolean | null | undefined;

                                                                                                                                            property shortKey

                                                                                                                                            shortKey?: boolean | null | undefined;

                                                                                                                                              interface KeyboardStatic

                                                                                                                                              interface KeyboardStatic {}

                                                                                                                                                method addBinding

                                                                                                                                                addBinding: {
                                                                                                                                                (key: Key, callback: (range: RangeStatic, context: any) => void): void;
                                                                                                                                                (
                                                                                                                                                key: Key,
                                                                                                                                                context: any,
                                                                                                                                                callback: (range: RangeStatic, context: any) => void
                                                                                                                                                ): void;
                                                                                                                                                };

                                                                                                                                                  interface OptionalAttributes

                                                                                                                                                  interface OptionalAttributes {}

                                                                                                                                                    property attributes

                                                                                                                                                    attributes?: StringMap | undefined;

                                                                                                                                                      interface QuillOptionsStatic

                                                                                                                                                      interface QuillOptionsStatic {}

                                                                                                                                                        property bounds

                                                                                                                                                        bounds?: HTMLElement | string | undefined;

                                                                                                                                                          property debug

                                                                                                                                                          debug?: string | boolean | undefined;

                                                                                                                                                            property formats

                                                                                                                                                            formats?: string[] | undefined;

                                                                                                                                                              property modules

                                                                                                                                                              modules?: StringMap | undefined;

                                                                                                                                                                property placeholder

                                                                                                                                                                placeholder?: string | undefined;

                                                                                                                                                                  property readOnly

                                                                                                                                                                  readOnly?: boolean | undefined;

                                                                                                                                                                    property scrollingContainer

                                                                                                                                                                    scrollingContainer?: HTMLElement | string | undefined;

                                                                                                                                                                      property strict

                                                                                                                                                                      strict?: boolean | undefined;

                                                                                                                                                                        property theme

                                                                                                                                                                        theme?: string | undefined;

                                                                                                                                                                          interface RangeStatic

                                                                                                                                                                          interface RangeStatic {}

                                                                                                                                                                            property index

                                                                                                                                                                            index: number;

                                                                                                                                                                              property length

                                                                                                                                                                              length: number;

                                                                                                                                                                                interface StringMap

                                                                                                                                                                                interface StringMap {}

                                                                                                                                                                                  index signature

                                                                                                                                                                                  [key: string]: any;

                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                    type ClipboardMatcherCallback

                                                                                                                                                                                    type ClipboardMatcherCallback = (node: any, delta: Delta) => Delta;

                                                                                                                                                                                      type ClipboardMatcherNode

                                                                                                                                                                                      type ClipboardMatcherNode = string | number;

                                                                                                                                                                                        type DeltaOperation

                                                                                                                                                                                        type DeltaOperation = {
                                                                                                                                                                                        insert?: any;
                                                                                                                                                                                        delete?: number | undefined;
                                                                                                                                                                                        retain?: number | undefined;
                                                                                                                                                                                        } & OptionalAttributes;
                                                                                                                                                                                        • A stricter type definition would be:

                                                                                                                                                                                          type DeltaOperation ({ insert: any } | { delete: number } | { retain: number }) & OptionalAttributes;

                                                                                                                                                                                          But this would break a lot of existing code as it would require manual discrimination of the union types.

                                                                                                                                                                                        type EditorChangeHandler

                                                                                                                                                                                        type EditorChangeHandler =
                                                                                                                                                                                        | ((
                                                                                                                                                                                        name: 'text-change',
                                                                                                                                                                                        delta: Delta,
                                                                                                                                                                                        oldContents: Delta,
                                                                                                                                                                                        source: Sources
                                                                                                                                                                                        ) => any)
                                                                                                                                                                                        | ((
                                                                                                                                                                                        name: 'selection-change',
                                                                                                                                                                                        range: RangeStatic,
                                                                                                                                                                                        oldRange: RangeStatic,
                                                                                                                                                                                        source: Sources
                                                                                                                                                                                        ) => any);

                                                                                                                                                                                          type SelectionChangeHandler

                                                                                                                                                                                          type SelectionChangeHandler = (
                                                                                                                                                                                          range: RangeStatic,
                                                                                                                                                                                          oldRange: RangeStatic,
                                                                                                                                                                                          source: Sources
                                                                                                                                                                                          ) => any;

                                                                                                                                                                                            type Sources

                                                                                                                                                                                            type Sources = 'api' | 'user' | 'silent';

                                                                                                                                                                                              type TextChangeHandler

                                                                                                                                                                                              type TextChangeHandler = (delta: Delta, oldContents: Delta, source: Sources) => any;

                                                                                                                                                                                                Package Files (1)

                                                                                                                                                                                                Dependencies (2)

                                                                                                                                                                                                Dev Dependencies (0)

                                                                                                                                                                                                No dev dependencies.

                                                                                                                                                                                                Peer Dependencies (0)

                                                                                                                                                                                                No peer dependencies.

                                                                                                                                                                                                Badge

                                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/quill.

                                                                                                                                                                                                • Markdown
                                                                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/quill)
                                                                                                                                                                                                • HTML
                                                                                                                                                                                                  <a href="https://www.jsdocs.io/package/@types/quill"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>