From 9fa46bbe1cf82647e4a75f32dc228742d5e5e91d Mon Sep 17 00:00:00 2001 From: Aniello Falcone Date: Wed, 20 Jun 2018 15:01:23 +0200 Subject: [PATCH 1/3] Added range case for formatText method --- types/quill/index.d.ts | 3 +++ types/quill/quill-tests.ts | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index 6cc5c824c5..e4b11ca64e 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,7 @@ 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; 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..4a9d946161 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -79,6 +79,15 @@ function test_formatText2() { }); } +function test_formatText3() { + 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'); From f75193143721aa3e292e2fb87a34edc091ff4336 Mon Sep 17 00:00:00 2001 From: Aniello Falcone Date: Thu, 21 Jun 2018 11:13:39 +0200 Subject: [PATCH 2/3] Fix build issue --- types/quill/quill-tests.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index 4a9d946161..a648cfa082 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -82,10 +82,7 @@ function test_formatText2() { function test_formatText3() { const quillEditor = new Quill('#editor'); const range = {index: 0, length: 5}; - quillEditor.formatText(range, { - bold: false, - color: 'rgb(0, 0, 255)' - }); + quillEditor.formatText(range, 'bold', true); } function test_formatLine1() { From 8d36dce6aaee0b1a3440dc1322eaa4c05822ec0f Mon Sep 17 00:00:00 2001 From: Aniello Falcone Date: Thu, 21 Jun 2018 11:27:31 +0200 Subject: [PATCH 3/3] Added another formatText case and new test for it --- types/quill/index.d.ts | 1 + types/quill/quill-tests.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index e4b11ca64e..afbdfa9222 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -176,6 +176,7 @@ export class Quill implements EventEmitter { 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 a648cfa082..d0bc3a2189 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -85,6 +85,15 @@ function test_formatText3() { 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');