@codemirror/view 0.19.24 → 0.19.28
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 +38 -0
- package/dist/index.cjs +854 -861
- package/dist/index.d.ts +22 -15
- package/dist/index.js +854 -859
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,11 @@ declare abstract class WidgetType {
|
|
|
171
171
|
events.
|
|
172
172
|
*/
|
|
173
173
|
ignoreEvent(_event: Event): boolean;
|
|
174
|
+
/**
|
|
175
|
+
This is called when the an instance of the widget is removed
|
|
176
|
+
from the editor view.
|
|
177
|
+
*/
|
|
178
|
+
destroy(_dom: HTMLElement): void;
|
|
174
179
|
}
|
|
175
180
|
/**
|
|
176
181
|
A decoration set represents a collection of decorated ranges,
|
|
@@ -431,6 +436,7 @@ interface MeasureRequest<T> {
|
|
|
431
436
|
*/
|
|
432
437
|
key?: any;
|
|
433
438
|
}
|
|
439
|
+
declare type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
|
|
434
440
|
/**
|
|
435
441
|
View [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this
|
|
436
442
|
class, which describe what happened, whenever the view is updated.
|
|
@@ -694,6 +700,7 @@ declare class EditorView {
|
|
|
694
700
|
readonly contentDOM: HTMLElement;
|
|
695
701
|
private announceDOM;
|
|
696
702
|
private plugins;
|
|
703
|
+
private pluginMap;
|
|
697
704
|
private editorAttrs;
|
|
698
705
|
private contentAttrs;
|
|
699
706
|
private styleModules;
|
|
@@ -1008,7 +1015,7 @@ declare class EditorView {
|
|
|
1008
1015
|
mounted in its [document
|
|
1009
1016
|
root](https://codemirror.net/6/docs/ref/#view.EditorView.constructor^config.root).
|
|
1010
1017
|
*/
|
|
1011
|
-
static styleModule:
|
|
1018
|
+
static styleModule: Facet<StyleModule, readonly StyleModule[]>;
|
|
1012
1019
|
/**
|
|
1013
1020
|
Facet that can be used to add DOM event handlers. The value
|
|
1014
1021
|
should be an object mapping event names to handler functions. The
|
|
@@ -1029,7 +1036,7 @@ declare class EditorView {
|
|
|
1029
1036
|
content. When one returns true, no further input handlers are
|
|
1030
1037
|
called and the default behavior is prevented.
|
|
1031
1038
|
*/
|
|
1032
|
-
static inputHandler:
|
|
1039
|
+
static inputHandler: Facet<(view: EditorView, from: number, to: number, text: string) => boolean, readonly ((view: EditorView, from: number, to: number, text: string) => boolean)[]>;
|
|
1033
1040
|
/**
|
|
1034
1041
|
Allows you to provide a function that should be called when the
|
|
1035
1042
|
library catches an exception from an extension (mostly from view
|
|
@@ -1037,12 +1044,12 @@ declare class EditorView {
|
|
|
1037
1044
|
from user-code-provided callbacks). This is mostly useful for
|
|
1038
1045
|
debugging and logging. See [`logException`](https://codemirror.net/6/docs/ref/#view.logException).
|
|
1039
1046
|
*/
|
|
1040
|
-
static exceptionSink:
|
|
1047
|
+
static exceptionSink: Facet<(exception: any) => void, readonly ((exception: any) => void)[]>;
|
|
1041
1048
|
/**
|
|
1042
1049
|
A facet that can be used to register a function to be called
|
|
1043
1050
|
every time the view updates.
|
|
1044
1051
|
*/
|
|
1045
|
-
static updateListener:
|
|
1052
|
+
static updateListener: Facet<(update: ViewUpdate) => void, readonly ((update: ViewUpdate) => void)[]>;
|
|
1046
1053
|
/**
|
|
1047
1054
|
Facet that controls whether the editor content DOM is editable.
|
|
1048
1055
|
When its highest-precedence value is `false`, the element will
|
|
@@ -1051,33 +1058,33 @@ declare class EditorView {
|
|
|
1051
1058
|
even when those are bound to keys or buttons. See the
|
|
1052
1059
|
[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) facet for that.)
|
|
1053
1060
|
*/
|
|
1054
|
-
static editable:
|
|
1061
|
+
static editable: Facet<boolean, boolean>;
|
|
1055
1062
|
/**
|
|
1056
1063
|
Allows you to influence the way mouse selection happens. The
|
|
1057
1064
|
functions in this facet will be called for a `mousedown` event
|
|
1058
1065
|
on the editor, and can return an object that overrides the way a
|
|
1059
1066
|
selection is computed from that mouse click or drag.
|
|
1060
1067
|
*/
|
|
1061
|
-
static mouseSelectionStyle:
|
|
1068
|
+
static mouseSelectionStyle: Facet<MakeSelectionStyle, readonly MakeSelectionStyle[]>;
|
|
1062
1069
|
/**
|
|
1063
1070
|
Facet used to configure whether a given selection drag event
|
|
1064
1071
|
should move or copy the selection. The given predicate will be
|
|
1065
1072
|
called with the `mousedown` event, and can return `true` when
|
|
1066
1073
|
the drag should move the content.
|
|
1067
1074
|
*/
|
|
1068
|
-
static dragMovesSelection:
|
|
1075
|
+
static dragMovesSelection: Facet<(event: MouseEvent) => boolean, readonly ((event: MouseEvent) => boolean)[]>;
|
|
1069
1076
|
/**
|
|
1070
1077
|
Facet used to configure whether a given selecting click adds
|
|
1071
1078
|
a new range to the existing selection or replaces it entirely.
|
|
1072
1079
|
*/
|
|
1073
|
-
static clickAddsSelectionRange:
|
|
1080
|
+
static clickAddsSelectionRange: Facet<(event: MouseEvent) => boolean, readonly ((event: MouseEvent) => boolean)[]>;
|
|
1074
1081
|
/**
|
|
1075
1082
|
A facet that determines which [decorations](https://codemirror.net/6/docs/ref/#view.Decoration)
|
|
1076
1083
|
are shown in the view. See also [view
|
|
1077
1084
|
plugins](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), which have a separate
|
|
1078
1085
|
mechanism for providing decorations.
|
|
1079
1086
|
*/
|
|
1080
|
-
static decorations:
|
|
1087
|
+
static decorations: Facet<DecorationSet, readonly DecorationSet[]>;
|
|
1081
1088
|
/**
|
|
1082
1089
|
Create a theme extension. The first argument can be a
|
|
1083
1090
|
[`style-mod`](https://github.com/marijnh/style-mod#documentation)
|
|
@@ -1115,12 +1122,12 @@ declare class EditorView {
|
|
|
1115
1122
|
Facet that provides additional DOM attributes for the editor's
|
|
1116
1123
|
editable DOM element.
|
|
1117
1124
|
*/
|
|
1118
|
-
static contentAttributes:
|
|
1125
|
+
static contentAttributes: Facet<AttrSource, readonly AttrSource[]>;
|
|
1119
1126
|
/**
|
|
1120
1127
|
Facet that provides DOM attributes for the editor's outer
|
|
1121
1128
|
element.
|
|
1122
1129
|
*/
|
|
1123
|
-
static editorAttributes:
|
|
1130
|
+
static editorAttributes: Facet<AttrSource, readonly AttrSource[]>;
|
|
1124
1131
|
/**
|
|
1125
1132
|
An extension that enables line wrapping in the editor (by
|
|
1126
1133
|
setting CSS `white-space` to `pre-wrap` in the content).
|
|
@@ -1318,10 +1325,10 @@ Configuration options.
|
|
|
1318
1325
|
config?: SpecialCharConfig): Extension;
|
|
1319
1326
|
|
|
1320
1327
|
/**
|
|
1321
|
-
Returns
|
|
1322
|
-
equivalent to the height of the editor, minus one line
|
|
1323
|
-
that every line in the document can be scrolled to the
|
|
1324
|
-
editor.
|
|
1328
|
+
Returns an extension that makes sure the content has a bottom
|
|
1329
|
+
margin equivalent to the height of the editor, minus one line
|
|
1330
|
+
height, so that every line in the document can be scrolled to the
|
|
1331
|
+
top of the editor.
|
|
1325
1332
|
|
|
1326
1333
|
This is only meaningful when the editor is scrollable, and should
|
|
1327
1334
|
not be enabled in editors that take the size of their content.
|