@types/quill
Advanced tools
Comparing version 0.0.29 to 0.0.30
@@ -10,4 +10,18 @@ // Type definitions for Quill | ||
type Sources = "api" | "user" | "silent"; | ||
type Formats = { [key: string]: any }; | ||
type StringMap = { [key: string]: any }; | ||
type OptionalAttributes = { attributes?: StringMap }; | ||
/** | ||
* 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 DeltaOperation = { insert?: any, delete?: number, retain?: number } & OptionalAttributes; | ||
type TextChangeHandler = (delta: DeltaStatic, oldContents: DeltaStatic, source: Sources) => any; | ||
type SelectionChangeHandler = (range: RangeStatic, oldRange: RangeStatic, source: Sources) => any; | ||
type EditorChangeHandler = ((name: "text-change", delta: DeltaStatic, oldContents: DeltaStatic, source: Sources) => any) | ||
| ((name: "selection-change", range: RangeStatic, oldRange: RangeStatic, source: Sources) => any); | ||
export interface KeyboardStatic { | ||
@@ -27,3 +41,3 @@ addBinding(key: Key, callback: (range: RangeStatic, context: any) => void): void; | ||
debug?: string, | ||
modules?: Formats, | ||
modules?: StringMap, | ||
placeholder?: string, | ||
@@ -43,22 +57,22 @@ readOnly?: boolean, | ||
export interface DeltaStatic { | ||
new (ops: Array<any>) : DeltaStatic; | ||
new (ops: any) : DeltaStatic; | ||
ops?: Array<any>; | ||
retain(length: number, attributes: any) : DeltaStatic; | ||
new (ops?: DeltaOperation[] | { ops: DeltaOperation[] }) : DeltaStatic; | ||
ops?: DeltaOperation[]; | ||
retain(length: number, attributes?: StringMap) : DeltaStatic; | ||
delete(length: number) : DeltaStatic; | ||
filter(predicate: any) : DeltaStatic; | ||
forEach(predicate: any) : DeltaStatic; | ||
insert(text: any, attributes: any): DeltaStatic; | ||
map(predicate: any) : DeltaStatic; | ||
partition(predicate: any) : DeltaStatic; | ||
reduce(predicate: any, initial: number): DeltaStatic; | ||
filter(predicate: (op: DeltaOperation) => boolean) : DeltaOperation[]; | ||
forEach(predicate: (op: DeltaOperation) => void) : void; | ||
insert(text: any, attributes?: StringMap): DeltaStatic; | ||
map<T>(predicate: (op: DeltaOperation) => T) : T[]; | ||
partition(predicate: (op: DeltaOperation) => boolean) : [DeltaOperation[], DeltaOperation[]]; | ||
reduce<T>(predicate: (acc: T, curr: DeltaOperation, idx: number, arr: DeltaOperation[]) => T, initial: T): T; | ||
chop() : DeltaStatic; | ||
length(): number; | ||
slice(start: number, end: number): DeltaStatic; | ||
compose(other: any): DeltaStatic; | ||
slice(start?: number, end?: number): DeltaStatic; | ||
compose(other: DeltaStatic): DeltaStatic; | ||
concat(other: DeltaStatic): DeltaStatic; | ||
diff(other: DeltaStatic, index: number) : DeltaStatic; | ||
eachLine(predicate: any, newline: any) : DeltaStatic; | ||
transform(other: any, priority: any) : DeltaStatic; | ||
transformPosition(index: number, priority: any) : DeltaStatic; | ||
diff(other: DeltaStatic, index?: number) : DeltaStatic; | ||
eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string) : DeltaStatic; | ||
transform(index: number) : number; | ||
transform(other: DeltaStatic, priority: boolean) : DeltaStatic; | ||
transformPosition(index: number) : number; | ||
} | ||
@@ -72,3 +86,15 @@ | ||
export interface Quill { | ||
export interface EventEmitter { | ||
on(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
on(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
on(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
once(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
once(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
once(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
off(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
off(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
off(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
} | ||
export interface Quill extends EventEmitter { | ||
new (container: string | Element, options?: QuillOptionsStatic): Quill; | ||
@@ -84,3 +110,3 @@ deleteText(index: number, length: number, source?: Sources): void; | ||
insertText(index: number, text: string, format: string, value: any, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, formats: Formats, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, formats: StringMap, source?: Sources): DeltaStatic; | ||
/** | ||
@@ -102,8 +128,8 @@ * @deprecated Use clipboard.dangerouslyPasteHTML(index: number, html: string, source: Sources) | ||
formatLine(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, formats: Formats, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
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: Formats, source?: Sources): DeltaStatic; | ||
getFormat(range?: RangeStatic): Formats; | ||
getFormat(index: number, length?: number): Formats; | ||
formatText(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
getFormat(range?: RangeStatic): StringMap; | ||
getFormat(index: number, length?: number): StringMap; | ||
removeFormat(index: number, length: number, source?: Sources): void; | ||
@@ -119,11 +145,6 @@ | ||
on(eventName: string, callback: (<T>(delta: T, oldContents: T, source: string) => void) | | ||
((name: string, ...args: any[]) => void)): Quill; | ||
once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): Quill; | ||
off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): Quill; | ||
debug(level: string): void; | ||
import(path: string): any; | ||
register(path: string, def: any, suppressWarning?: boolean): void; | ||
register(defs: Formats, suppressWarning?: boolean): void; | ||
register(defs: StringMap, suppressWarning?: boolean): void; | ||
addContainer(className: string, refNode?: any): any; | ||
@@ -130,0 +151,0 @@ addContainer(domNode: any, refNode?: any): any; |
{ | ||
"name": "@types/quill", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"description": "TypeScript definitions for Quill", | ||
"license": "MIT", | ||
"author": "Sumit <https://github.com/sumitkm>", | ||
"contributors": [ | ||
{ | ||
"name": "Sumit", | ||
"url": "https://github.com/sumitkm" | ||
} | ||
], | ||
"main": "", | ||
@@ -15,4 +20,4 @@ "repository": { | ||
"peerDependencies": {}, | ||
"typings": "index.d.ts", | ||
"typesPublisherContentHash": "f14babc89da899543324c5663360eeb28fad2d4642aecb73ab809fb47c748fdf" | ||
"typesPublisherContentHash": "cd2ce49c57e55772aeba241bcd15651b7f45551b69241d28bd6ca4bfaa954a6a", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -8,9 +8,7 @@ # Installation | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/quill | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/quill | ||
Additional Details | ||
* Last updated: Tue, 22 Nov 2016 20:59:30 GMT | ||
* File structure: Mixed | ||
* Library Dependencies: none | ||
* Module Dependencies: none | ||
* Last updated: Tue, 20 Jun 2017 20:20:01 GMT | ||
* Dependencies: none | ||
* Global values: Delta, Quill | ||
@@ -17,0 +15,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9908
139
17