[codemirror] Add Doc#lineSeparator (#45851)

This commit is contained in:
mtgto 2020-07-12 17:02:22 +09:00 committed by GitHub
parent d3facd7b56
commit 607b638249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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;
@ -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;

View File

@ -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 = {