@vscode/markdown-editor 0.0.2-20 → 0.0.2-22
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/dist/index.d.ts +73 -36
- package/dist/index.js +1424 -1535
- package/dist/index.js.map +1 -1
- package/dist/stringEdit-DzLs4E1d.js +177 -0
- package/dist/stringEdit-DzLs4E1d.js.map +1 -0
- package/dist/web-editors.d.ts +125 -0
- package/dist/web-editors.js +5185 -0
- package/dist/web-editors.js.map +1 -0
- package/package.json +17 -7
- package/src/view/editor.css +139 -40
- package/src/view/themes/default.css +5 -2
- package/src/view/themes/github.css +5 -2
- package/src/view/themes/vscode-default.css +6 -3
- package/src/view/themes/vscode-github.css +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ declare abstract class BlockAstNodeBase extends AstNode {
|
|
|
109
109
|
/**
|
|
110
110
|
* One block's place in the rendered document.
|
|
111
111
|
*
|
|
112
|
-
*
|
|
112
|
+
* Geometry is in editor-local CSS pixels. `height` is either a real DOM measurement
|
|
113
113
|
* (`isMeasured: true`) or an estimate produced when the block is not
|
|
114
114
|
* currently mounted (`isMeasured: false`). Estimates exist so virtual
|
|
115
115
|
* rendering can size the scroll container without mounting every block.
|
|
@@ -124,6 +124,13 @@ export declare interface BlockMeasurement {
|
|
|
124
124
|
readonly block: BlockAstNode;
|
|
125
125
|
readonly absoluteStart: number;
|
|
126
126
|
readonly height: number;
|
|
127
|
+
/** Local border box when mounted and measured. */
|
|
128
|
+
readonly rect: Rect2D | undefined;
|
|
129
|
+
/** Local horizontal padding-box clip when this block scrolls horizontally. */
|
|
130
|
+
readonly viewportClip: {
|
|
131
|
+
readonly left: number;
|
|
132
|
+
readonly right: number;
|
|
133
|
+
} | undefined;
|
|
127
134
|
readonly isMeasured: boolean;
|
|
128
135
|
readonly visualLineMap: VisualLineMap | undefined;
|
|
129
136
|
readonly viewNode: ViewNode | undefined;
|
|
@@ -605,10 +612,9 @@ export declare const cursorUp: VisualCursorCommand;
|
|
|
605
612
|
* derived subscribed.
|
|
606
613
|
*/
|
|
607
614
|
export declare class CursorView extends Disposable {
|
|
608
|
-
private readonly _parent;
|
|
609
615
|
readonly element: HTMLElement;
|
|
610
616
|
readonly rendering: IObservable<CursorViewRendering>;
|
|
611
|
-
constructor(
|
|
617
|
+
constructor(options: CursorViewOptions);
|
|
612
618
|
}
|
|
613
619
|
|
|
614
620
|
export declare interface CursorViewOptions {
|
|
@@ -622,7 +628,7 @@ export declare interface CursorViewOptions {
|
|
|
622
628
|
readonly blocks?: IObservable<readonly SelectionBlock[]>;
|
|
623
629
|
/**
|
|
624
630
|
* When set, the caret is drawn over the transient empty paragraph instead
|
|
625
|
-
* of at {@link offset} — its rect
|
|
631
|
+
* of at {@link offset} — its editor-local rect comes straight
|
|
626
632
|
* from that synthetic element's geometry, since it has no visual-line-map
|
|
627
633
|
* entry. Takes priority over the normal offset-based placement.
|
|
628
634
|
*/
|
|
@@ -886,6 +892,34 @@ export declare interface EditorControllerOptions {
|
|
|
886
892
|
readonly clipboardStrategy?: IClipboardStrategy;
|
|
887
893
|
}
|
|
888
894
|
|
|
895
|
+
/**
|
|
896
|
+
* The editor overlay's local CSS-pixel coordinate space.
|
|
897
|
+
*
|
|
898
|
+
* Browser geometry and pointer APIs expose viewport client coordinates. This
|
|
899
|
+
* boundary converts them immediately into the coordinate system shared by the
|
|
900
|
+
* editor content and its overlays. Range rectangles are axis-aligned, so the
|
|
901
|
+
* current implementation deliberately supports positive axis-aligned scale and
|
|
902
|
+
* translation only.
|
|
903
|
+
*/
|
|
904
|
+
export declare class EditorCoordinateSpace {
|
|
905
|
+
private readonly _getLocalToClientMatrix;
|
|
906
|
+
static forSvgOverlay(overlay: SVGSVGElement): EditorCoordinateSpace;
|
|
907
|
+
private constructor();
|
|
908
|
+
capture(): EditorCoordinateTransform;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/** A stable coordinate conversion captured for one measurement operation. */
|
|
912
|
+
export declare class EditorCoordinateTransform {
|
|
913
|
+
private readonly _localToClient;
|
|
914
|
+
private readonly _clientToLocal;
|
|
915
|
+
constructor(_localToClient: DOMMatrix);
|
|
916
|
+
toLocalPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
|
|
917
|
+
toClientPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
|
|
918
|
+
toLocalRect(rect: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>): Rect2D;
|
|
919
|
+
toClientRect(rect: Pick<Rect2D, 'left' | 'top' | 'width' | 'height'>): Rect2D;
|
|
920
|
+
private _convertRect;
|
|
921
|
+
}
|
|
922
|
+
|
|
889
923
|
export declare class EditorModel {
|
|
890
924
|
private readonly _parser;
|
|
891
925
|
/**
|
|
@@ -1041,6 +1075,7 @@ export declare class EditorView extends Disposable {
|
|
|
1041
1075
|
readonly element: HTMLElement;
|
|
1042
1076
|
readonly editContext: EditContext;
|
|
1043
1077
|
readonly measuredLayout: MeasuredLayoutModel;
|
|
1078
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1044
1079
|
/**
|
|
1045
1080
|
* Inner container that holds the rendered document and the cursor/selection
|
|
1046
1081
|
* overlays. The outer {@link element} spans the full width; this container
|
|
@@ -1052,6 +1087,7 @@ export declare class EditorView extends Disposable {
|
|
|
1052
1087
|
private readonly _selectionView;
|
|
1053
1088
|
private readonly _gutterMarkersView;
|
|
1054
1089
|
private readonly _diffHighlightsView;
|
|
1090
|
+
private _readonlyToggleButton;
|
|
1055
1091
|
/**
|
|
1056
1092
|
* The mounted block sequence, in source order. Rebuilt (not mutated) each
|
|
1057
1093
|
* frame by {@link DocumentViewNode.create}; the view just swaps one
|
|
@@ -1072,7 +1108,7 @@ export declare class EditorView extends Disposable {
|
|
|
1072
1108
|
private readonly _viewData;
|
|
1073
1109
|
get viewData(): IObservable<DocumentViewData | undefined>;
|
|
1074
1110
|
/**
|
|
1075
|
-
* Caret rect (
|
|
1111
|
+
* Caret rect (editor-local coordinates) for the transient empty paragraph, or
|
|
1076
1112
|
* `undefined` when none is armed. Set each frame from the synthetic
|
|
1077
1113
|
* paragraph element's geometry and fed to the {@link CursorView}, which has
|
|
1078
1114
|
* no visual-line-map entry to place the caret from otherwise.
|
|
@@ -1120,11 +1156,14 @@ export declare class EditorView extends Disposable {
|
|
|
1120
1156
|
* {@link EditorModel.readonlyMode}: when locked (read-only) every block stays
|
|
1121
1157
|
* in its clean rendered form (no markdown markers revealed) and edits are
|
|
1122
1158
|
* ignored, while text selection still works. The control lives in a
|
|
1123
|
-
* zero-height *sticky* host
|
|
1124
|
-
*
|
|
1125
|
-
* mirrored onto the root as `.md-readonly`
|
|
1159
|
+
* zero-height *sticky* host inside the centered content container, so the
|
|
1160
|
+
* lock follows the content's right edge and remains pinned as the document
|
|
1161
|
+
* scrolls. The current mode is also mirrored onto the root as `.md-readonly`
|
|
1162
|
+
* for any CSS hooks.
|
|
1126
1163
|
*/
|
|
1127
1164
|
private _setupReadonlyToggle;
|
|
1165
|
+
/** Draws attention to the mode toggle after text input is attempted while locked. */
|
|
1166
|
+
showReadonlyEditingAttempt(): void;
|
|
1128
1167
|
focus(): void;
|
|
1129
1168
|
/**
|
|
1130
1169
|
* Own point→offset resolution. When `true` (the default),
|
|
@@ -1190,9 +1229,9 @@ export declare interface EditorViewOptions extends BlockViewOptions {
|
|
|
1190
1229
|
*/
|
|
1191
1230
|
readonly classNames?: readonly string[];
|
|
1192
1231
|
/**
|
|
1193
|
-
* Whether to render the sticky edit/read-only toggle
|
|
1194
|
-
*
|
|
1195
|
-
* that focus on selection rendering).
|
|
1232
|
+
* Whether to render the sticky edit/read-only toggle at the top-right edge
|
|
1233
|
+
* of the content. Defaults to `true`; set to `false` to omit it (e.g. in
|
|
1234
|
+
* fixtures that focus on selection rendering).
|
|
1196
1235
|
*/
|
|
1197
1236
|
readonly showReadonlyToggle?: boolean;
|
|
1198
1237
|
/**
|
|
@@ -1779,8 +1818,8 @@ export declare class MeasuredLayoutDebugRendering {
|
|
|
1779
1818
|
* Exposes two DOM nodes the caller can place independently:
|
|
1780
1819
|
*
|
|
1781
1820
|
* - {@link overlayElement} — absolutely positioned; the caller mounts it
|
|
1782
|
-
* inside the editor
|
|
1783
|
-
*
|
|
1821
|
+
* inside the editor overlay container so dashed line-bands and run-boxes
|
|
1822
|
+
* share the measured editor-local coordinates.
|
|
1784
1823
|
* - {@link infoElement} — block-flow; the caller mounts it as a sibling
|
|
1785
1824
|
* *below* the editor. Contains the per-block summary table that used
|
|
1786
1825
|
* to live on the overlay.
|
|
@@ -1791,7 +1830,6 @@ export declare class MeasuredLayoutDebugRendering {
|
|
|
1791
1830
|
* the derived subscribed.
|
|
1792
1831
|
*/
|
|
1793
1832
|
export declare class MeasuredLayoutDebugView extends Disposable {
|
|
1794
|
-
private readonly _overlayParent;
|
|
1795
1833
|
readonly overlayElement: HTMLElement;
|
|
1796
1834
|
readonly infoElement: HTMLElement;
|
|
1797
1835
|
readonly rendering: IObservable<MeasuredLayoutDebugRendering>;
|
|
@@ -1804,6 +1842,7 @@ export declare class MeasuredLayoutDebugView extends Disposable {
|
|
|
1804
1842
|
|
|
1805
1843
|
export declare interface MeasuredLayoutDebugViewOptions {
|
|
1806
1844
|
readonly model: MeasuredLayoutModel;
|
|
1845
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1807
1846
|
/**
|
|
1808
1847
|
* DEBUG ONLY. Maps an absolute source offset to a fill color for that
|
|
1809
1848
|
* character's glyph rect. The fixture passes the same function to the
|
|
@@ -1838,10 +1877,9 @@ export declare interface MeasuredLayoutDebugViewOptions {
|
|
|
1838
1877
|
export declare class MeasuredLayoutModel {
|
|
1839
1878
|
readonly measurements: ISettableObservable<readonly BlockMeasurement[], void>;
|
|
1840
1879
|
/**
|
|
1841
|
-
* Concatenated visual line map across all mounted blocks.
|
|
1842
|
-
*
|
|
1843
|
-
*
|
|
1844
|
-
* concatenation is well-formed without re-sorting.
|
|
1880
|
+
* Concatenated visual line map across all mounted blocks. Every per-block
|
|
1881
|
+
* map uses the same editor-local coordinate space, so concatenation is
|
|
1882
|
+
* well-formed without translation or re-sorting.
|
|
1845
1883
|
*/
|
|
1846
1884
|
readonly visualLineMap: IObservableWithChange<VisualLineMap, void>;
|
|
1847
1885
|
}
|
|
@@ -1984,7 +2022,9 @@ declare class PendingParagraphViewData {
|
|
|
1984
2022
|
}
|
|
1985
2023
|
|
|
1986
2024
|
/**
|
|
1987
|
-
* Immutable point in
|
|
2025
|
+
* Immutable point in a caller-defined 2D CSS-pixel coordinate space.
|
|
2026
|
+
* Coordinate-owning APIs must document whether values are viewport-client or
|
|
2027
|
+
* editor-local; values from different spaces must not be mixed.
|
|
1988
2028
|
*/
|
|
1989
2029
|
export declare class Point2D {
|
|
1990
2030
|
readonly x: number;
|
|
@@ -1995,8 +2035,8 @@ export declare class Point2D {
|
|
|
1995
2035
|
}
|
|
1996
2036
|
|
|
1997
2037
|
/**
|
|
1998
|
-
* Immutable axis-aligned rectangle in
|
|
1999
|
-
*
|
|
2038
|
+
* Immutable axis-aligned rectangle in a caller-defined 2D CSS-pixel coordinate
|
|
2039
|
+
* space. `x`/`y` is the top-left corner, growing right/down.
|
|
2000
2040
|
*
|
|
2001
2041
|
* Half-open in both dimensions: `right` and `bottom` are excluded.
|
|
2002
2042
|
*/
|
|
@@ -2064,17 +2104,13 @@ export { Selection_2 as Selection }
|
|
|
2064
2104
|
export declare interface SelectionBlock {
|
|
2065
2105
|
readonly block: BlockAstNode;
|
|
2066
2106
|
readonly absoluteStart: number;
|
|
2067
|
-
|
|
2068
|
-
readonly
|
|
2069
|
-
/**
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
* {@link blockViewportClip} needs the scroll box; connector/rect geometry
|
|
2075
|
-
* still uses {@link element}.
|
|
2076
|
-
*/
|
|
2077
|
-
readonly scrollElement: HTMLElement;
|
|
2107
|
+
/** Block border box in editor-local coordinates. */
|
|
2108
|
+
readonly rect: Rect2D;
|
|
2109
|
+
/** Visible horizontal padding-box bounds for a scrolling block. */
|
|
2110
|
+
readonly viewportClip: {
|
|
2111
|
+
readonly left: number;
|
|
2112
|
+
readonly right: number;
|
|
2113
|
+
} | undefined;
|
|
2078
2114
|
}
|
|
2079
2115
|
|
|
2080
2116
|
export declare type SelectionCommand = (ctx: CursorCommandContext, offset: SourceOffset) => Selection_2;
|
|
@@ -2106,11 +2142,10 @@ export declare interface SelectionRect {
|
|
|
2106
2142
|
* envelope shape used by IDE selection rendering.
|
|
2107
2143
|
*/
|
|
2108
2144
|
export declare class SelectionView extends Disposable {
|
|
2109
|
-
private readonly _parent;
|
|
2110
2145
|
readonly element: SVGSVGElement;
|
|
2111
2146
|
readonly rendering: IObservable<SelectionViewRendering>;
|
|
2112
2147
|
private readonly _path;
|
|
2113
|
-
constructor(
|
|
2148
|
+
constructor(options: SelectionViewOptions);
|
|
2114
2149
|
}
|
|
2115
2150
|
|
|
2116
2151
|
export declare interface SelectionViewOptions {
|
|
@@ -2580,7 +2615,8 @@ export declare class VisualLine {
|
|
|
2580
2615
|
|
|
2581
2616
|
/**
|
|
2582
2617
|
* Geometry of the rendered document, as a map from source offsets to 2D
|
|
2583
|
-
* positions and back.
|
|
2618
|
+
* positions and back. All geometry is expressed in the editor overlay's local
|
|
2619
|
+
* CSS-pixel coordinate space.
|
|
2584
2620
|
*
|
|
2585
2621
|
* Structure (top to bottom):
|
|
2586
2622
|
*
|
|
@@ -2615,7 +2651,7 @@ export declare class VisualLineMap {
|
|
|
2615
2651
|
static measure(blockViews: readonly {
|
|
2616
2652
|
readonly absoluteStart: number;
|
|
2617
2653
|
readonly viewNode: ViewNode;
|
|
2618
|
-
}[]): VisualLineMap;
|
|
2654
|
+
}[], coordinateSpace: EditorCoordinateSpace, transform?: EditorCoordinateTransform): VisualLineMap;
|
|
2619
2655
|
constructor(lines: readonly VisualLine[]);
|
|
2620
2656
|
get lineCount(): number;
|
|
2621
2657
|
get isEmpty(): boolean;
|
|
@@ -2700,6 +2736,7 @@ declare interface VisualRunSource {
|
|
|
2700
2736
|
readonly textNode: Text;
|
|
2701
2737
|
/** Offset within `textNode.data` corresponding to `sourceRange.start`. */
|
|
2702
2738
|
readonly textNodeStart: number;
|
|
2739
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
2703
2740
|
}
|
|
2704
2741
|
|
|
2705
2742
|
export declare class VscodeStackedCommentsView extends StackedCommentsPresenter {
|