@codemirror/view 6.5.1 → 6.7.0
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 +28 -0
- package/dist/index.cjs +312 -146
- package/dist/index.d.ts +108 -1
- package/dist/index.js +309 -147
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1366,6 +1366,94 @@ to show when the editor is empty.
|
|
|
1366
1366
|
*/
|
|
1367
1367
|
declare function placeholder(content: string | HTMLElement): Extension;
|
|
1368
1368
|
|
|
1369
|
+
/**
|
|
1370
|
+
Markers shown in a [layer](https://codemirror.net/6/docs/ref/#view.layer) must conform to this
|
|
1371
|
+
interface. They are created in a measuring phase, and have to
|
|
1372
|
+
contain all their positioning information, so that they can be
|
|
1373
|
+
drawn without further DOM layout reading.
|
|
1374
|
+
|
|
1375
|
+
Markers are automatically absolutely positioned. Their parent
|
|
1376
|
+
element has the same top-left corner as the document, so they
|
|
1377
|
+
should be positioned relative to the document.
|
|
1378
|
+
*/
|
|
1379
|
+
interface LayerMarker {
|
|
1380
|
+
/**
|
|
1381
|
+
Compare this marker to a marker of the same type. Used to avoid
|
|
1382
|
+
unnecessary redraws.
|
|
1383
|
+
*/
|
|
1384
|
+
eq(other: LayerMarker): boolean;
|
|
1385
|
+
/**
|
|
1386
|
+
Draw the marker to the DOM.
|
|
1387
|
+
*/
|
|
1388
|
+
draw(): HTMLElement;
|
|
1389
|
+
/**
|
|
1390
|
+
Update an existing marker of this type to this marker.
|
|
1391
|
+
*/
|
|
1392
|
+
update?(dom: HTMLElement, oldMarker: LayerMarker): boolean;
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
Implementation of [`LayerMarker`](https://codemirror.net/6/docs/ref/#view.LayerMarker) that creates
|
|
1396
|
+
a rectangle at a given set of coordinates.
|
|
1397
|
+
*/
|
|
1398
|
+
declare class RectangleMarker implements LayerMarker {
|
|
1399
|
+
private className;
|
|
1400
|
+
private left;
|
|
1401
|
+
private top;
|
|
1402
|
+
private width;
|
|
1403
|
+
private height;
|
|
1404
|
+
/**
|
|
1405
|
+
Create a marker with the given class and dimensions. If `width`
|
|
1406
|
+
is null, the DOM element will get no width style.
|
|
1407
|
+
*/
|
|
1408
|
+
constructor(className: string, left: number, top: number, width: number | null, height: number);
|
|
1409
|
+
draw(): HTMLDivElement;
|
|
1410
|
+
update(elt: HTMLElement, prev: RectangleMarker): boolean;
|
|
1411
|
+
private adjust;
|
|
1412
|
+
eq(p: RectangleMarker): boolean;
|
|
1413
|
+
/**
|
|
1414
|
+
Create a set of rectangles for the given selection range,
|
|
1415
|
+
assigning them theclass`className`. Will create a single
|
|
1416
|
+
rectangle for empty ranges, and a set of selection-style
|
|
1417
|
+
rectangles covering the range's content (in a bidi-aware
|
|
1418
|
+
way) for non-empty ones.
|
|
1419
|
+
*/
|
|
1420
|
+
static forRange(view: EditorView, className: string, range: SelectionRange): readonly RectangleMarker[];
|
|
1421
|
+
}
|
|
1422
|
+
interface LayerConfig {
|
|
1423
|
+
/**
|
|
1424
|
+
Determines whether this layer is shown above or below the text.
|
|
1425
|
+
*/
|
|
1426
|
+
above: boolean;
|
|
1427
|
+
/**
|
|
1428
|
+
When given, this class is added to the DOM element that will
|
|
1429
|
+
wrap the markers.
|
|
1430
|
+
*/
|
|
1431
|
+
class?: string;
|
|
1432
|
+
/**
|
|
1433
|
+
Called on every view update. Returning true triggers a marker
|
|
1434
|
+
update (a call to `markers` and drawing of those markers).
|
|
1435
|
+
*/
|
|
1436
|
+
update(update: ViewUpdate, layer: HTMLElement): boolean;
|
|
1437
|
+
/**
|
|
1438
|
+
Build a set of markers for this layer, and measure their
|
|
1439
|
+
dimensions.
|
|
1440
|
+
*/
|
|
1441
|
+
markers(view: EditorView): readonly LayerMarker[];
|
|
1442
|
+
/**
|
|
1443
|
+
If given, this is called when the layer is created.
|
|
1444
|
+
*/
|
|
1445
|
+
mount?(layer: HTMLElement, view: EditorView): void;
|
|
1446
|
+
/**
|
|
1447
|
+
If given, called when the layer is removed from the editor or
|
|
1448
|
+
the entire editor is destroyed.
|
|
1449
|
+
*/
|
|
1450
|
+
destroy?(layer: HTMLElement, view: EditorView): void;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
Define a layer.
|
|
1454
|
+
*/
|
|
1455
|
+
declare function layer(config: LayerConfig): Extension;
|
|
1456
|
+
|
|
1369
1457
|
/**
|
|
1370
1458
|
Helper class used to make it easier to maintain decorations on
|
|
1371
1459
|
visible code that matches a given regular expression. To be used
|
|
@@ -1584,6 +1672,12 @@ interface TooltipView {
|
|
|
1584
1672
|
tooltip.
|
|
1585
1673
|
*/
|
|
1586
1674
|
positioned?(space: Rect): void;
|
|
1675
|
+
/**
|
|
1676
|
+
By default, the library will restrict the size of tooltips so
|
|
1677
|
+
that they don't stick out of the available space. Set this to
|
|
1678
|
+
false to disable that.
|
|
1679
|
+
*/
|
|
1680
|
+
resize?: boolean;
|
|
1587
1681
|
}
|
|
1588
1682
|
/**
|
|
1589
1683
|
Facet to which an extension can add a value to show a tooltip.
|
|
@@ -1820,4 +1914,17 @@ line](https://codemirror.net/6/docs/ref/#view.highlightActiveLine).
|
|
|
1820
1914
|
*/
|
|
1821
1915
|
declare function highlightActiveLineGutter(): Extension;
|
|
1822
1916
|
|
|
1823
|
-
|
|
1917
|
+
/**
|
|
1918
|
+
Returns an extension that highlights whitespace, adding a
|
|
1919
|
+
`cm-highlightSpace` class to stretches of spaces, and a
|
|
1920
|
+
`cm-highlightTab` class to individual tab characters. By default,
|
|
1921
|
+
the former are shown as faint dots, and the latter as arrows.
|
|
1922
|
+
*/
|
|
1923
|
+
declare function highlightWhitespace(): Extension;
|
|
1924
|
+
/**
|
|
1925
|
+
Returns an extension that adds a `cm-trailingSpace` class to all
|
|
1926
|
+
trailing whitespace.
|
|
1927
|
+
*/
|
|
1928
|
+
declare function highlightTrailingWhitespace(): Extension;
|
|
1929
|
+
|
|
1930
|
+
export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
|