mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added missing CodeMirror.Doc method - listSelections
The missing method is listed in documentation in [Selection](https://codemirror.net/doc/manual.html#api_selection) section between `doc.getCursor` and `doc.somethingSelected` methods.
This commit is contained in:
parent
02271c5387
commit
b9ba90e8ef
146
codemirror/codemirror.d.ts
vendored
146
codemirror/codemirror.d.ts
vendored
@ -326,15 +326,15 @@ declare module CodeMirror {
|
||||
/** Fires every time the content of the editor is changed. */
|
||||
on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
|
||||
off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
|
||||
|
||||
/** Like the "change" event, but batched per operation, passing an
|
||||
* array containing all the changes that happened in the operation.
|
||||
* This event is fired after the operation finished, and display
|
||||
* changes it makes will trigger a new operation. */
|
||||
|
||||
/** Like the "change" event, but batched per operation, passing an
|
||||
* array containing all the changes that happened in the operation.
|
||||
* This event is fired after the operation finished, and display
|
||||
* changes it makes will trigger a new operation. */
|
||||
on(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void;
|
||||
off(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void;
|
||||
|
||||
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
|
||||
|
||||
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
|
||||
The changeObj never has a next property, since this is fired for each individual change, and not batched per operation.
|
||||
Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization.
|
||||
Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation,
|
||||
@ -471,6 +471,10 @@ declare module CodeMirror {
|
||||
It may be "start" , "end" , "head"(the side of the selection that moves when you press shift + arrow),
|
||||
or "anchor"(the fixed side of the selection).Omitting the argument is the same as passing "head".A { line , ch } object will be returned. */
|
||||
getCursor(start?: string): CodeMirror.Position;
|
||||
|
||||
/** Retrieves a list of all current selections. These will always be sorted, and never overlap (overlapping selections are merged).
|
||||
Each object in the array contains anchor and head properties referring to {line, ch} objects. */
|
||||
listSelections(): { anchor: CodeMirror.Position; head: CodeMirror.Position }[];
|
||||
|
||||
/** Return true if any text is selected. */
|
||||
somethingSelected(): boolean;
|
||||
@ -612,7 +616,7 @@ declare module CodeMirror {
|
||||
/** Array of strings representing the text that replaced the changed range (split by line). */
|
||||
text: string[];
|
||||
/** Text that used to be between from and to, which is overwritten by this change. */
|
||||
removed: string[];
|
||||
removed: string[];
|
||||
/** String representing the origin of the change event and wether it can be merged with history */
|
||||
origin: string;
|
||||
}
|
||||
@ -780,9 +784,9 @@ declare module CodeMirror {
|
||||
This affects the amount of updates needed when scrolling, and the amount of work that such an update does.
|
||||
You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered,
|
||||
and thus the browser's text search works on it. This will have bad effects on performance of big documents. */
|
||||
viewportMargin?: number;
|
||||
|
||||
/** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */
|
||||
viewportMargin?: number;
|
||||
|
||||
/** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */
|
||||
lint?: LintOptions;
|
||||
}
|
||||
|
||||
@ -796,8 +800,8 @@ declare module CodeMirror {
|
||||
/** Like inclusiveLeft , but for the right side. */
|
||||
inclusiveRight?: boolean;
|
||||
|
||||
/** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them.
|
||||
In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed
|
||||
/** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them.
|
||||
In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed
|
||||
respectively directly before and directly after the range. */
|
||||
atomic?: boolean;
|
||||
|
||||
@ -808,19 +812,19 @@ declare module CodeMirror {
|
||||
This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them.
|
||||
The "clear" event fired on the range handle can be used to be notified when this happens. */
|
||||
clearOnEnter?: boolean;
|
||||
|
||||
/** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */
|
||||
clearWhenEmpty?: boolean;
|
||||
|
||||
/** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */
|
||||
clearWhenEmpty?: boolean;
|
||||
|
||||
/** Use a given node to display this range.Implies both collapsed and atomic.
|
||||
The given DOM node must be an inline element(as opposed to a block element). */
|
||||
replacedWith?: HTMLElement;
|
||||
|
||||
/** When replacedWith is given, this determines whether the editor will
|
||||
* capture mouse and drag events occurring in this widget. Default is
|
||||
* false—the events will be left alone for the default browser handler,
|
||||
* or specific handlers on the widget, to capture. */
|
||||
handleMouseEvents?: boolean;
|
||||
|
||||
/** When replacedWith is given, this determines whether the editor will
|
||||
* capture mouse and drag events occurring in this widget. Default is
|
||||
* false—the events will be left alone for the default browser handler,
|
||||
* or specific handlers on the widget, to capture. */
|
||||
handleMouseEvents?: boolean;
|
||||
|
||||
/** A read - only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document.
|
||||
Note: adding a read - only span currently clears the undo history of the editor,
|
||||
@ -835,12 +839,12 @@ declare module CodeMirror {
|
||||
|
||||
/** Equivalent to startStyle, but for the rightmost span. */
|
||||
endStyle?: string;
|
||||
|
||||
/** A string of CSS to be applied to the covered text. For example "color: #fe3". */
|
||||
css?: string;
|
||||
|
||||
/** When given, will give the nodes created for this span a HTML title attribute with the given value. */
|
||||
title?: string;
|
||||
|
||||
/** A string of CSS to be applied to the covered text. For example "color: #fe3". */
|
||||
css?: string;
|
||||
|
||||
/** When given, will give the nodes created for this span a HTML title attribute with the given value. */
|
||||
title?: string;
|
||||
|
||||
/** When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents.
|
||||
By default, a marker appears only in its target document. */
|
||||
@ -1041,48 +1045,48 @@ declare module CodeMirror {
|
||||
* Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless
|
||||
* the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined.
|
||||
*/
|
||||
function overlayMode<T, S>(base: Mode<T>, overlay: Mode<S>, combine?: boolean): Mode<any>
|
||||
|
||||
/**
|
||||
* async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror
|
||||
* gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on
|
||||
* initialization of the CodeMirror instance.
|
||||
*/
|
||||
interface LintStateOptions {
|
||||
async: boolean;
|
||||
hasGutters: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the getAnnotations callback to LintStateOptions which may be overridden by the user if they choose use their own
|
||||
* linter.
|
||||
*/
|
||||
interface LintOptions extends LintStateOptions {
|
||||
getAnnotations: AnnotationsCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that calls the updateLintingCallback with any errors found during the linting process.
|
||||
*/
|
||||
interface AnnotationsCallback {
|
||||
(content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations
|
||||
*/
|
||||
interface UpdateLintingCallback {
|
||||
(codeMirror: Editor, annotations: Annotation[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error,
|
||||
* and an explaination as to why the error was thrown.
|
||||
*/
|
||||
interface Annotation {
|
||||
from: Position;
|
||||
message?: string;
|
||||
severity?: string;
|
||||
to?: Position;
|
||||
function overlayMode<T, S>(base: Mode<T>, overlay: Mode<S>, combine?: boolean): Mode<any>
|
||||
|
||||
/**
|
||||
* async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror
|
||||
* gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on
|
||||
* initialization of the CodeMirror instance.
|
||||
*/
|
||||
interface LintStateOptions {
|
||||
async: boolean;
|
||||
hasGutters: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the getAnnotations callback to LintStateOptions which may be overridden by the user if they choose use their own
|
||||
* linter.
|
||||
*/
|
||||
interface LintOptions extends LintStateOptions {
|
||||
getAnnotations: AnnotationsCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that calls the updateLintingCallback with any errors found during the linting process.
|
||||
*/
|
||||
interface AnnotationsCallback {
|
||||
(content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations
|
||||
*/
|
||||
interface UpdateLintingCallback {
|
||||
(codeMirror: Editor, annotations: Annotation[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error,
|
||||
* and an explaination as to why the error was thrown.
|
||||
*/
|
||||
interface Annotation {
|
||||
from: Position;
|
||||
message?: string;
|
||||
severity?: string;
|
||||
to?: Position;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user