@codemirror/view 0.19.20 → 0.19.24
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 +273 -162
- package/dist/index.d.ts +52 -2
- package/dist/index.js +273 -162
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -424,7 +424,7 @@ interface MeasureRequest<T> {
|
|
|
424
424
|
Called in a DOM write phase to update the document. Should _not_
|
|
425
425
|
do anything that triggers DOM layout.
|
|
426
426
|
*/
|
|
427
|
-
write(measure: T, view: EditorView): void;
|
|
427
|
+
write?(measure: T, view: EditorView): void;
|
|
428
428
|
/**
|
|
429
429
|
When multiple requests with the same key are scheduled, only the
|
|
430
430
|
last one will actually be ran.
|
|
@@ -573,7 +573,8 @@ declare class BlockInfo {
|
|
|
573
573
|
*/
|
|
574
574
|
readonly length: number;
|
|
575
575
|
/**
|
|
576
|
-
The top position of the element
|
|
576
|
+
The top position of the element (relative to the top of the
|
|
577
|
+
document).
|
|
577
578
|
*/
|
|
578
579
|
readonly top: number;
|
|
579
580
|
/**
|
|
@@ -767,6 +768,19 @@ declare class EditorView {
|
|
|
767
768
|
*/
|
|
768
769
|
plugin<T>(plugin: ViewPlugin<T>): T | null;
|
|
769
770
|
/**
|
|
771
|
+
The top position of the document, in screen coordinates. This
|
|
772
|
+
may be negative when the editor is scrolled down. Points
|
|
773
|
+
directly to the top of the first line, not above the padding.
|
|
774
|
+
*/
|
|
775
|
+
get documentTop(): number;
|
|
776
|
+
/**
|
|
777
|
+
Reports the padding above and below the document.
|
|
778
|
+
*/
|
|
779
|
+
get documentPadding(): {
|
|
780
|
+
top: number;
|
|
781
|
+
bottom: number;
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
770
784
|
Find the line or block widget at the given vertical position.
|
|
771
785
|
|
|
772
786
|
By default, this position is interpreted as a screen position,
|
|
@@ -776,9 +790,17 @@ declare class EditorView {
|
|
|
776
790
|
position, or a precomputed document top
|
|
777
791
|
(`view.contentDOM.getBoundingClientRect().top`) to limit layout
|
|
778
792
|
queries.
|
|
793
|
+
|
|
794
|
+
*Deprecated: use `blockAtHeight` instead.*
|
|
779
795
|
*/
|
|
780
796
|
blockAtHeight(height: number, docTop?: number): BlockInfo;
|
|
781
797
|
/**
|
|
798
|
+
Find the text line or block widget at the given vertical
|
|
799
|
+
position (which is interpreted as relative to the [top of the
|
|
800
|
+
document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)
|
|
801
|
+
*/
|
|
802
|
+
elementAtHeight(height: number): BlockInfo;
|
|
803
|
+
/**
|
|
782
804
|
Find information for the visual line (see
|
|
783
805
|
[`visualLineAt`](https://codemirror.net/6/docs/ref/#view.EditorView.visualLineAt)) at the given
|
|
784
806
|
vertical position. The resulting block info might hold another
|
|
@@ -788,16 +810,33 @@ declare class EditorView {
|
|
|
788
810
|
Defaults to treating `height` as a screen position. See
|
|
789
811
|
[`blockAtHeight`](https://codemirror.net/6/docs/ref/#view.EditorView.blockAtHeight) for the
|
|
790
812
|
interpretation of the `docTop` parameter.
|
|
813
|
+
|
|
814
|
+
*Deprecated: use `lineBlockAtHeight` instead.*
|
|
791
815
|
*/
|
|
792
816
|
visualLineAtHeight(height: number, docTop?: number): BlockInfo;
|
|
793
817
|
/**
|
|
818
|
+
Find the line block (see
|
|
819
|
+
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
|
|
820
|
+
height.
|
|
821
|
+
*/
|
|
822
|
+
lineBlockAtHeight(height: number): BlockInfo;
|
|
823
|
+
/**
|
|
794
824
|
Iterate over the height information of the visual lines in the
|
|
795
825
|
viewport. The heights of lines are reported relative to the
|
|
796
826
|
given document top, which defaults to the screen position of the
|
|
797
827
|
document (forcing a layout).
|
|
828
|
+
|
|
829
|
+
*Deprecated: use `viewportLineBlocks` instead.*
|
|
798
830
|
*/
|
|
799
831
|
viewportLines(f: (line: BlockInfo) => void, docTop?: number): void;
|
|
800
832
|
/**
|
|
833
|
+
Get the extent and vertical position of all [line
|
|
834
|
+
blocks](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) in the viewport. Positions
|
|
835
|
+
are relative to the [top of the
|
|
836
|
+
document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop);
|
|
837
|
+
*/
|
|
838
|
+
get viewportLineBlocks(): BlockInfo[];
|
|
839
|
+
/**
|
|
801
840
|
Find the extent and height of the visual line (a range delimited
|
|
802
841
|
on both sides by either non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^range)
|
|
803
842
|
line breaks, or the start/end of the document) at the given position.
|
|
@@ -806,9 +845,20 @@ declare class EditorView {
|
|
|
806
845
|
argument, which defaults to 0 for this method. You can pass
|
|
807
846
|
`view.contentDOM.getBoundingClientRect().top` here to get screen
|
|
808
847
|
coordinates.
|
|
848
|
+
|
|
849
|
+
*Deprecated: use `lineBlockAt` instead.*
|
|
809
850
|
*/
|
|
810
851
|
visualLineAt(pos: number, docTop?: number): BlockInfo;
|
|
811
852
|
/**
|
|
853
|
+
Find the line block around the given document position. A line
|
|
854
|
+
block is a range delimited on both sides by either a
|
|
855
|
+
non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^range) line breaks, or the
|
|
856
|
+
start/end of the document. It will usually just hold a line of
|
|
857
|
+
text, but may be broken into multiple textblocks by block
|
|
858
|
+
widgets.
|
|
859
|
+
*/
|
|
860
|
+
lineBlockAt(pos: number): BlockInfo;
|
|
861
|
+
/**
|
|
812
862
|
The editor's total content height.
|
|
813
863
|
*/
|
|
814
864
|
get contentHeight(): number;
|