diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index 6cc5c824c5..afbdfa9222 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Sumit // Guillaume // James Garbutt +// Aniello Falcone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Blot } from 'parchment/dist/src/blot/abstract/blot'; @@ -142,6 +143,7 @@ export class Quill implements EventEmitter { root: HTMLDivElement; clipboard: ClipboardStatic; scroll: Blot; + keyboard: KeyboardStatic; constructor(container: string | Element, options?: QuillOptionsStatic); deleteText(index: number, length: number, source?: Sources): DeltaStatic; disable(): void; @@ -173,6 +175,8 @@ export class Quill implements EventEmitter { formatText(index: number, length: number, source?: Sources): DeltaStatic; formatText(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; formatText(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; + formatText(range: RangeStatic, format: string, value: any, source?: Sources): DeltaStatic; + formatText(range: RangeStatic, formats: StringMap, source?: Sources): DeltaStatic; getFormat(range?: RangeStatic): StringMap; getFormat(index: number, length?: number): StringMap; removeFormat(index: number, length: number, source?: Sources): DeltaStatic; diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index bda294251d..d0bc3a2189 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -79,6 +79,21 @@ function test_formatText2() { }); } +function test_formatText3() { + const quillEditor = new Quill('#editor'); + const range = {index: 0, length: 5}; + quillEditor.formatText(range, 'bold', true); +} + +function test_formatText4() { + const quillEditor = new Quill('#editor'); + const range = {index: 0, length: 5}; + quillEditor.formatText(range, { + bold: false, + color: 'rgb(0, 0, 255)' + }); +} + function test_formatLine1() { const quillEditor = new Quill('#editor'); quillEditor.formatLine(1, 3, 'api');