Files
DefinitelyTyped/types/rangy/rangy-classapplier.d.ts
Maxime Kjaer d06eee332a Add Rangy Class Applier module to Rangy (#18259)
* Add Rangy Class Applier module type definition

* Make RangyClassApplier extend the options

And allow strings in tagName

* Remove reference path in test file

This should hopefully Make the Build Green Again

* Remove call to unexisting method

This was meant for another PR, and I got things a bit mixed up... (I'll
submit the other PR that adds the missing rangy-core properties when I
have a bit more experience with the whole process of writing type
declarations)

* Incorporate previous contributor's feedback

Thanks for the great feedback 😃
2017-07-21 10:03:22 -07:00

37 lines
1.3 KiB
TypeScript

// Type definitions for Rangy Class Applier module
// Project: https://github.com/timdown/rangy
// Definitions by: Maxime Kjaer <https://github.com/MaximeKjaer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="index.d.ts"/>
interface RangyStatic {
createClassApplier(theClass: string, options?: RangyClassApplierOptions, tagNames?: string|string[]): RangyClassApplier;
}
interface RangyClassApplierOptions {
elementTagName?: string;
elementProperties?: {[property: string]: string};
elementAttributes?: {[attribute: string]: string};
ignoreWhiteSpace?: boolean;
applyToEditableOnly?: boolean;
tagNames?: string|string[];
normalize?: boolean;
onElementCreate?: (element: Element, classApplier: RangyClassApplier) => void;
useExistingElements?: boolean;
}
interface RangyClassApplier extends RangyClassApplierOptions {
applyToSelection(win?: Window): void;
undoToSelection(win?: Window): void;
isAppliedToSelection(win?: Window): boolean;
toggleSelection(win?: Window): void;
applyToRange(range: RangyRange): void;
undoToRange(range: RangyRange): void;
isAppliedToRange(range: RangyRange): boolean;
toggleRange(range: RangyRange): void;
detach(doc?: Document|Window|HTMLIFrameElement): void;
className: string;
cssClass: string;
}