mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add definitions for CodeMirror's runmode addon
This commit is contained in:
parent
8ea42cd8bb
commit
8b7eef80b3
6
codemirror/codemirror-runmode-tests.ts
Normal file
6
codemirror/codemirror-runmode-tests.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/// <reference path="codemirror.d.ts" />
|
||||
/// <reference path="codemirror-runmode.d.ts" />
|
||||
|
||||
var query = "SELECT * FROM Table";
|
||||
|
||||
CodeMirror.runMode(query, "text/x-sql", document.body);
|
||||
22
codemirror/codemirror-runmode.d.ts
vendored
Normal file
22
codemirror/codemirror-runmode.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: Joseph Vaughan <https://github.com/Joev->
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// See docs https://codemirror.net/doc/manual.html#addon_runmode
|
||||
|
||||
declare module CodeMirror {
|
||||
|
||||
/**
|
||||
* Can be used to run a CodeMirror mode over text without actually 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 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,
|
||||
* and inserted into the node (through innerHTML).
|
||||
*/
|
||||
function runMode(text : string, mode : any, output : any): void;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user