Merge pull request #26698 from AnielloFalcone/master

Added range case for formatText method and Keyboard module in QuillJs types
This commit is contained in:
Paul van Brenk
2018-06-26 10:41:29 -07:00
committed by GitHub
2 changed files with 19 additions and 0 deletions
+4
View File
@@ -3,6 +3,7 @@
// Definitions by: Sumit <https://github.com/sumitkm>
// Guillaume <https://github.com/guillaume-ro-fr>
// James Garbutt <https://github.com/43081j>
// Aniello Falcone <https://github.com/AnielloFalcone>
// 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;
+15
View File
@@ -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');