diff --git a/codemirror/codemirror-tests.ts b/codemirror/codemirror-tests.ts index 7f555ceb1..731a650b7 100644 --- a/codemirror/codemirror-tests.ts +++ b/codemirror/codemirror-tests.ts @@ -46,3 +46,7 @@ var annotation: CodeMirror.Annotation = { message: "test", severity: "warning" }; + +myCodeMirror.getValue(); +myCodeMirror.getValue("foo") +myCodeMirror.setValue("bar"); diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 66133d643..482ff4be8 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -145,7 +145,11 @@ declare module CodeMirror { /** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */ swapDoc(doc: CodeMirror.Doc): CodeMirror.Doc; + /** Get the content of the current editor document. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ + getValue(seperator?: string): string; + /** Set the content of the current editor document. */ + setValue(content: string): void; /** Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value. Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. */