Merge pull request #2563 from hellochar/patch-1

Add definitions for fromTextArea methods
This commit is contained in:
Masahiro Wakame
2014-07-26 10:30:58 +09:00

View File

@@ -9,7 +9,7 @@ declare function CodeMirror(callback: (host: HTMLElement) => void , options?: Co
declare module CodeMirror {
export var Pass: any;
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.Editor;
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea;
var version: string;
@@ -374,6 +374,18 @@ declare module CodeMirror {
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
}
interface EditorFromTextArea extends Editor {
/** Copy the content of the editor into the textarea. */
save(): void;
/** Remove the editor, and restore the original textarea (with the editor's current content). */
toTextArea(): void;
/** Returns the textarea that the instance was based on. */
getTextArea(): HTMLTextAreaElement;
}
class Doc {
constructor (text: string, mode?: any, firstLineNumber?: number);