[codemirror] Add lacked arguments of runMode (#43629)

This commit is contained in:
mtgto 2020-04-11 00:49:52 +09:00 committed by GitHub
parent f020953f46
commit 36d0ed0829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -12,13 +12,13 @@ declare module "codemirror" {
/**
* Runs a CodeMirror mode over text without opening an editor instance.
*
* @param text The document to run through the highlighter.
* @param mode The mode to use (must be loaded as normal).
* @param text The document to run through the highlighter.
* @param mode The mode to use (must be loaded as normal).
* @param output If this is a function, it will be called for each token with
* two arguments, the token's text and the token's style class
* (may be null for unstyled tokens). If it is a DOM node, the
* tokens will be converted to span elements as in an editor,
* five arguments, the token's text, the token's style class (may be null for unstyled tokens),
* the number of row of the token, the column position of token and the state of mode.
* If it is a DOM node, the tokens will be converted to span elements as in an editor,
* and inserted into the node (through innerHTML).
*/
function runMode(text: string, modespec: any, callback: (HTMLElement | ((text: string, style: string | null) => void)), options? : { tabSize?: number; state?: any; }): void;
function runMode(text: string, mode: any, callback: (HTMLElement | ((text: string, style?: string | null, row?: number, column?: number, state?: any) => void)), options? : { tabSize?: number; state?: any; }): void;
}

View File

@ -4,3 +4,4 @@ import "codemirror/addon/runmode/runmode";
const query = "SELECT * FROM Table";
CodeMirror.runMode(query, "text/x-sql", document.body);
CodeMirror.runMode(query, "text/x-sql", (text, style, row, column, state) => {});