@codemirror/view 6.12.0 → 6.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/index.cjs +331 -275
- package/dist/index.d.cts +1969 -0
- package/dist/index.d.ts +34 -17
- package/dist/index.js +332 -276
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _codemirror_state from '@codemirror/state';
|
|
|
2
2
|
import { RangeSet, RangeValue, Range, EditorState, Extension, Transaction, ChangeSet, EditorSelection, EditorStateConfig, TransactionSpec, SelectionRange, Line, StateEffect, Facet } from '@codemirror/state';
|
|
3
3
|
import { StyleModule, StyleSpec } from 'style-mod';
|
|
4
4
|
|
|
5
|
-
type Attrs = {
|
|
5
|
+
declare type Attrs = {
|
|
6
6
|
[name: string]: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ interface Rect {
|
|
|
15
15
|
readonly top: number;
|
|
16
16
|
readonly bottom: number;
|
|
17
17
|
}
|
|
18
|
-
type ScrollStrategy = "nearest" | "start" | "end" | "center";
|
|
18
|
+
declare type ScrollStrategy = "nearest" | "start" | "end" | "center";
|
|
19
19
|
|
|
20
20
|
interface MarkDecorationSpec {
|
|
21
21
|
/**
|
|
@@ -70,7 +70,12 @@ interface WidgetDecorationSpec {
|
|
|
70
70
|
cursor is on the same position. Otherwise, it'll be drawn before
|
|
71
71
|
it. When multiple widgets sit at the same position, their `side`
|
|
72
72
|
values will determine their ordering—those with a lower value
|
|
73
|
-
come first. Defaults to 0.
|
|
73
|
+
come first. Defaults to 0. May not be more than 10000 or less
|
|
74
|
+
than -10000.
|
|
75
|
+
|
|
76
|
+
Block widgets are always drawn before inline widgets when side
|
|
77
|
+
is non-positive, and after them when side is positive,
|
|
78
|
+
regardless of the value of `side`.
|
|
74
79
|
*/
|
|
75
80
|
side?: number;
|
|
76
81
|
/**
|
|
@@ -174,6 +179,13 @@ declare abstract class WidgetType {
|
|
|
174
179
|
*/
|
|
175
180
|
get estimatedHeight(): number;
|
|
176
181
|
/**
|
|
182
|
+
For inline widgets that are displayed inline (as opposed to
|
|
183
|
+
`inline-block`) and introduce line breaks (through `<br>` tags
|
|
184
|
+
or textual newlines), this must indicate the amount of line
|
|
185
|
+
breaks they introduce. Defaults to 0.
|
|
186
|
+
*/
|
|
187
|
+
get lineBreaks(): number;
|
|
188
|
+
/**
|
|
177
189
|
Can be used to configure which kinds of events inside the widget
|
|
178
190
|
should be ignored by the editor. The default is to ignore all
|
|
179
191
|
events.
|
|
@@ -198,7 +210,7 @@ A decoration set represents a collection of decorated ranges,
|
|
|
198
210
|
organized for efficient access and mapping. See
|
|
199
211
|
[`RangeSet`](https://codemirror.net/6/docs/ref/#state.RangeSet) for its methods.
|
|
200
212
|
*/
|
|
201
|
-
type DecorationSet = RangeSet<Decoration>;
|
|
213
|
+
declare type DecorationSet = RangeSet<Decoration>;
|
|
202
214
|
/**
|
|
203
215
|
The different types of blocks that can occur in an editor view.
|
|
204
216
|
*/
|
|
@@ -297,7 +309,7 @@ apply to the editor, and if it can, perform it as a side effect
|
|
|
297
309
|
(which usually means [dispatching](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) a
|
|
298
310
|
transaction) and return `true`.
|
|
299
311
|
*/
|
|
300
|
-
type Command = (target: EditorView) => boolean;
|
|
312
|
+
declare type Command = (target: EditorView) => boolean;
|
|
301
313
|
/**
|
|
302
314
|
Log or report an unhandled exception in client code. Should
|
|
303
315
|
probably only be used by extension code that allows client code to
|
|
@@ -399,7 +411,7 @@ interface MeasureRequest<T> {
|
|
|
399
411
|
*/
|
|
400
412
|
key?: any;
|
|
401
413
|
}
|
|
402
|
-
type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
|
|
414
|
+
declare type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
|
|
403
415
|
/**
|
|
404
416
|
View [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this
|
|
405
417
|
class, which describe what happened, whenever the view is updated.
|
|
@@ -488,7 +500,7 @@ interface MouseSelectionStyle {
|
|
|
488
500
|
*/
|
|
489
501
|
update: (update: ViewUpdate) => boolean | void;
|
|
490
502
|
}
|
|
491
|
-
type MakeSelectionStyle = (view: EditorView, event: MouseEvent) => MouseSelectionStyle | null;
|
|
503
|
+
declare type MakeSelectionStyle = (view: EditorView, event: MouseEvent) => MouseSelectionStyle | null;
|
|
492
504
|
|
|
493
505
|
/**
|
|
494
506
|
Record used to represent information about a block-level element
|
|
@@ -518,11 +530,6 @@ declare class BlockInfo {
|
|
|
518
530
|
*/
|
|
519
531
|
get type(): BlockType | readonly BlockInfo[];
|
|
520
532
|
/**
|
|
521
|
-
If this is a widget block, this will return the widget
|
|
522
|
-
associated with it.
|
|
523
|
-
*/
|
|
524
|
-
get widget(): WidgetType | null;
|
|
525
|
-
/**
|
|
526
533
|
The end of the element as a document position.
|
|
527
534
|
*/
|
|
528
535
|
get to(): number;
|
|
@@ -530,6 +537,16 @@ declare class BlockInfo {
|
|
|
530
537
|
The bottom position of the element.
|
|
531
538
|
*/
|
|
532
539
|
get bottom(): number;
|
|
540
|
+
/**
|
|
541
|
+
If this is a widget block, this will return the widget
|
|
542
|
+
associated with it.
|
|
543
|
+
*/
|
|
544
|
+
get widget(): WidgetType | null;
|
|
545
|
+
/**
|
|
546
|
+
If this is a textblock, this holds the number of line breaks
|
|
547
|
+
that appear in widgets inside the block.
|
|
548
|
+
*/
|
|
549
|
+
get widgetLineBreaks(): number;
|
|
533
550
|
}
|
|
534
551
|
|
|
535
552
|
/**
|
|
@@ -1183,7 +1200,7 @@ to hold the appropriate event object type. For unknown events, it
|
|
|
1183
1200
|
is inferred to `any`, and should be explicitly set if you want type
|
|
1184
1201
|
checking.
|
|
1185
1202
|
*/
|
|
1186
|
-
type DOMEventHandlers<This> = {
|
|
1203
|
+
declare type DOMEventHandlers<This> = {
|
|
1187
1204
|
[event in keyof DOMEventMap]?: (this: This, event: DOMEventMap[event], view: EditorView) => boolean | void;
|
|
1188
1205
|
};
|
|
1189
1206
|
|
|
@@ -1285,7 +1302,7 @@ handlers handled it.
|
|
|
1285
1302
|
*/
|
|
1286
1303
|
declare function runScopeHandlers(view: EditorView, event: KeyboardEvent, scope: string): boolean;
|
|
1287
1304
|
|
|
1288
|
-
type SelectionConfig = {
|
|
1305
|
+
declare type SelectionConfig = {
|
|
1289
1306
|
/**
|
|
1290
1307
|
The length of a full cursor blink cycle, in milliseconds.
|
|
1291
1308
|
Defaults to 1200. Can be set to 0 to disable blinking.
|
|
@@ -1751,7 +1768,7 @@ invalidate the existing tooltip positions.
|
|
|
1751
1768
|
*/
|
|
1752
1769
|
declare function repositionTooltips(view: EditorView): void;
|
|
1753
1770
|
|
|
1754
|
-
type PanelConfig = {
|
|
1771
|
+
declare type PanelConfig = {
|
|
1755
1772
|
/**
|
|
1756
1773
|
By default, panels will be placed inside the editor's DOM
|
|
1757
1774
|
structure. You can use this option to override where panels with
|
|
@@ -1805,7 +1822,7 @@ declare function getPanel(view: EditorView, panel: PanelConstructor): Panel | nu
|
|
|
1805
1822
|
A function that initializes a panel. Used in
|
|
1806
1823
|
[`showPanel`](https://codemirror.net/6/docs/ref/#view.showPanel).
|
|
1807
1824
|
*/
|
|
1808
|
-
type PanelConstructor = (view: EditorView) => Panel;
|
|
1825
|
+
declare type PanelConstructor = (view: EditorView) => Panel;
|
|
1809
1826
|
/**
|
|
1810
1827
|
Opening a panel is done by providing a constructor function for
|
|
1811
1828
|
the panel through this facet. (The panel is closed again when its
|
|
@@ -1846,7 +1863,7 @@ Markers given to this facet should _only_ define an
|
|
|
1846
1863
|
in all gutters for the line).
|
|
1847
1864
|
*/
|
|
1848
1865
|
declare const gutterLineClass: Facet<RangeSet<GutterMarker>, readonly RangeSet<GutterMarker>[]>;
|
|
1849
|
-
type Handlers = {
|
|
1866
|
+
declare type Handlers = {
|
|
1850
1867
|
[event: string]: (view: EditorView, line: BlockInfo, event: Event) => boolean;
|
|
1851
1868
|
};
|
|
1852
1869
|
interface GutterConfig {
|