@codemirror/view 0.19.29 → 0.19.33
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 +50 -0
- package/dist/index.cjs +284 -125
- package/dist/index.d.ts +53 -2
- package/dist/index.js +285 -127
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _codemirror_rangeset from '@codemirror/rangeset';
|
|
|
2
2
|
import { RangeSet, RangeValue, Range } from '@codemirror/rangeset';
|
|
3
3
|
export { Range } from '@codemirror/rangeset';
|
|
4
4
|
import * as _codemirror_state from '@codemirror/state';
|
|
5
|
-
import { EditorState, Extension, Transaction, ChangeSet, EditorSelection, TransactionSpec, SelectionRange, Facet } from '@codemirror/state';
|
|
5
|
+
import { EditorState, Extension, Transaction, ChangeSet, EditorSelection, TransactionSpec, SelectionRange, StateEffect, Facet } from '@codemirror/state';
|
|
6
6
|
import { Line } from '@codemirror/text';
|
|
7
7
|
import { StyleModule, StyleSpec } from 'style-mod';
|
|
8
8
|
|
|
@@ -264,6 +264,7 @@ interface Rect {
|
|
|
264
264
|
readonly top: number;
|
|
265
265
|
readonly bottom: number;
|
|
266
266
|
}
|
|
267
|
+
declare type ScrollStrategy = "nearest" | "start" | "end" | "center";
|
|
267
268
|
|
|
268
269
|
/**
|
|
269
270
|
Command functions are used in key bindings and other types of user
|
|
@@ -1006,14 +1007,49 @@ declare class EditorView {
|
|
|
1006
1007
|
/**
|
|
1007
1008
|
Effect that can be [added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a
|
|
1008
1009
|
transaction to make it scroll the given range into view.
|
|
1010
|
+
|
|
1011
|
+
*Deprecated*. Use [`scrollIntoView`](https://codemirror.net/6/docs/ref/#view.EditorView^scrollIntoView) instead.
|
|
1009
1012
|
*/
|
|
1010
1013
|
static scrollTo: _codemirror_state.StateEffectType<SelectionRange>;
|
|
1011
1014
|
/**
|
|
1012
1015
|
Effect that makes the editor scroll the given range to the
|
|
1013
1016
|
center of the visible view.
|
|
1017
|
+
|
|
1018
|
+
*Deprecated*. Use [`scrollIntoView`](https://codemirror.net/6/docs/ref/#view.EditorView^scrollIntoView) instead.
|
|
1014
1019
|
*/
|
|
1015
1020
|
static centerOn: _codemirror_state.StateEffectType<SelectionRange>;
|
|
1016
1021
|
/**
|
|
1022
|
+
Returns an effect that can be
|
|
1023
|
+
[added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a transaction to
|
|
1024
|
+
cause it to scroll the given position or range into view.
|
|
1025
|
+
*/
|
|
1026
|
+
static scrollIntoView(pos: number | SelectionRange, options?: {
|
|
1027
|
+
/**
|
|
1028
|
+
By default (`"nearest"`) the position will be vertically
|
|
1029
|
+
scrolled only the minimal amount required to move the given
|
|
1030
|
+
position into view. You can set this to `"start"` to move it
|
|
1031
|
+
to the top of the view, `"end"` to move it to the bottom, or
|
|
1032
|
+
`"center"` to move it to the center.
|
|
1033
|
+
*/
|
|
1034
|
+
y?: ScrollStrategy;
|
|
1035
|
+
/**
|
|
1036
|
+
Effect similar to
|
|
1037
|
+
[`y`](https://codemirror.net/6/docs/ref/#view.EditorView^scrollIntoView^options.y), but for the
|
|
1038
|
+
horizontal scroll position.
|
|
1039
|
+
*/
|
|
1040
|
+
x?: ScrollStrategy;
|
|
1041
|
+
/**
|
|
1042
|
+
Extra vertical distance to add when moving something into
|
|
1043
|
+
view. Not used with the `"center"` strategy. Defaults to 5.
|
|
1044
|
+
*/
|
|
1045
|
+
yMargin?: number;
|
|
1046
|
+
/**
|
|
1047
|
+
Extra horizontal distance to add. Not used with the `"center"`
|
|
1048
|
+
strategy. Defaults to 5.
|
|
1049
|
+
*/
|
|
1050
|
+
xMargin?: number;
|
|
1051
|
+
}): StateEffect<unknown>;
|
|
1052
|
+
/**
|
|
1017
1053
|
Facet to add a [style
|
|
1018
1054
|
module](https://github.com/marijnh/style-mod#documentation) to
|
|
1019
1055
|
an editor view. The view will ensure that the module is
|
|
@@ -1291,6 +1327,12 @@ content).
|
|
|
1291
1327
|
*/
|
|
1292
1328
|
declare function drawSelection(config?: SelectionConfig): Extension;
|
|
1293
1329
|
|
|
1330
|
+
/**
|
|
1331
|
+
Draws a cursor at the current drop position when something is
|
|
1332
|
+
dragged over the editor.
|
|
1333
|
+
*/
|
|
1334
|
+
declare function dropCursor(): Extension;
|
|
1335
|
+
|
|
1294
1336
|
interface SpecialCharConfig {
|
|
1295
1337
|
/**
|
|
1296
1338
|
An optional function that renders the placeholder elements.
|
|
@@ -1362,6 +1404,7 @@ declare class MatchDecorator {
|
|
|
1362
1404
|
private regexp;
|
|
1363
1405
|
private getDeco;
|
|
1364
1406
|
private boundary;
|
|
1407
|
+
private maxLength;
|
|
1365
1408
|
/**
|
|
1366
1409
|
Create a decorator.
|
|
1367
1410
|
*/
|
|
@@ -1384,6 +1427,14 @@ declare class MatchDecorator {
|
|
|
1384
1427
|
the amount of re-matching.
|
|
1385
1428
|
*/
|
|
1386
1429
|
boundary?: RegExp;
|
|
1430
|
+
/**
|
|
1431
|
+
Matching happens by line, by default, but when lines are
|
|
1432
|
+
folded or very long lines are only partially drawn, the
|
|
1433
|
+
decorator may avoid matching part of them for speed. This
|
|
1434
|
+
controls how much additional invisible content it should
|
|
1435
|
+
include in its matches. Defaults to 1000.
|
|
1436
|
+
*/
|
|
1437
|
+
maxLength?: number;
|
|
1387
1438
|
});
|
|
1388
1439
|
/**
|
|
1389
1440
|
Compute the full set of decorations for matches in the given
|
|
@@ -1400,4 +1451,4 @@ declare class MatchDecorator {
|
|
|
1400
1451
|
private updateRange;
|
|
1401
1452
|
}
|
|
1402
1453
|
|
|
1403
|
-
export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, KeyBinding, MatchDecorator, MouseSelectionStyle, PluginField, PluginFieldProvider, PluginSpec, PluginValue, Rect, ViewPlugin, ViewUpdate, WidgetType, drawSelection, highlightActiveLine, highlightSpecialChars, keymap, logException, placeholder, runScopeHandlers, scrollPastEnd };
|
|
1454
|
+
export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, KeyBinding, MatchDecorator, MouseSelectionStyle, PluginField, PluginFieldProvider, PluginSpec, PluginValue, Rect, ViewPlugin, ViewUpdate, WidgetType, drawSelection, dropCursor, highlightActiveLine, highlightSpecialChars, keymap, logException, placeholder, runScopeHandlers, scrollPastEnd };
|