DefinitelyTyped/jsoneditor/index.d.ts
Andy 8841dfc744 Use index.d.ts only (not foo/foo.d.ts) (#12834)
* Use index.d.ts only (not foo/foo.d.ts)

* Convert more packages

* Remove unnecessary references
2016-11-21 12:58:06 -08:00

53 lines
1.7 KiB
TypeScript

// Type definitions for jsoneditor v5.5.7
// Project: https://github.com/josdejong/jsoneditor
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="ace" />
declare module 'jsoneditor' {
export interface JSONEditorNode {
field: string;
value: string;
path: Array<string>;
}
export type JSONEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text';
export interface JSONEditorOptions {
ace?: AceAjax.Ace;
ajv?: any; // Any for now, since ajv typings aren't A-Ok
onChange?: () => void;
onEditable?: (node: JSONEditorNode) => boolean | {field: boolean, value: boolean};
onError?: (error: Error) => void;
onModeChange?: (newMode: JSONEditorMode, oldMode: JSONEditorMode) => void;
escapeUnicode?: boolean;
sortObjectKeys?: boolean;
history?: boolean;
mode?: JSONEditorMode;
modes?: Array<JSONEditorMode>;
name?: string;
schema?: Object;
search?: boolean;
indentation?: number;
theme?: string;
}
export default class JSONEditor {
constructor(container: HTMLElement, options?: JSONEditorOptions, json?: Object);
collapseAll(): void;
destroy(): void;
expandAll(): void;
focus(): void;
set(json: Object): void;
setMode(mode: JSONEditorMode): void;
setName(name?: string): void;
setSchema(schema: Object): void;
setText(jsonString: string): void;
get(): any;
getMode(): JSONEditorMode;
getName(): string;
getText(): string;
}
}