Skip to content

Commit

Permalink
[codemirror] Add Doc#lineSeparator (#45851)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgto committed Jul 12, 2020
1 parent d3facd7 commit 607b638
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions types/codemirror/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,6 @@ declare namespace CodeMirror {
/** Tells you whether the editor's content can be edited by the user. */
isReadOnly(): boolean;

/** Returns the preferred line separator string for this document, as per the option by the same name. When that option is null, the string "\n" is returned. */
lineSeparator(): string;

/** Switches between overwrite and normal insert mode (when not given an argument),
or sets the overwrite mode to a specific state (when given an argument). */
toggleOverwrite(value?: boolean): void;
Expand Down Expand Up @@ -890,6 +887,9 @@ declare namespace CodeMirror {
rather than the resolved, instantiated mode object. */
getMode(): any;

/** Returns the preferred line separator string for this document, as per the option by the same name. When that option is null, the string "\n" is returned. */
lineSeparator(): string;

/** Calculates and returns a { line , ch } object for a zero-based index whose value is relative to the start of the editor's text.
If the index is out of range of the text then the returned object is clipped to start or end of the text respectively. */
posFromIndex(index: number): CodeMirror.Position;
Expand Down
1 change: 1 addition & 0 deletions types/codemirror/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const myCodeMirror3: CodeMirror.Editor = CodeMirror(
const myCodeMirror4: CodeMirror.Editor = CodeMirror.fromTextArea(myTextArea);

const doc: CodeMirror.Doc = new CodeMirror.Doc('text');
doc.lineSeparator();
const doc2: CodeMirror.Doc = CodeMirror(document.body).getDoc();

const lintStateOptions: CodeMirror.LintStateOptions = {
Expand Down

0 comments on commit 607b638

Please sign in to comment.