@vscode/markdown-editor 0.0.2-112 → 0.0.2-114
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/README.md +425 -0
- package/dist/commands.js +1 -1
- package/dist/commands.js.map +1 -1
- package/dist/index.d.ts +281 -31
- package/dist/index.js +3047 -2261
- package/dist/index.js.map +1 -1
- package/package.json +16 -7
- package/src/contrib/rename/rename.css +73 -0
- package/src/contrib/suggest/suggest.css +109 -0
- package/src/view/editor.css +372 -43
- package/src/view/themes/default.css +8 -0
- package/src/view/themes/github.css +9 -0
- package/src/view/themes/vscode-default.css +9 -0
- package/src/view/themes/vscode-github.css +9 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Disposable } from '@vscode/observables';
|
|
|
2
2
|
import { IDisposable } from '@vscode/observables';
|
|
3
3
|
import { IObservable } from '@vscode/observables';
|
|
4
4
|
import { IObservableWithChange } from '@vscode/observables';
|
|
5
|
+
import { IReader } from '@vscode/observables';
|
|
5
6
|
import { ISettableObservable } from '@vscode/observables';
|
|
6
7
|
import { ITransaction } from '@vscode/observables';
|
|
7
8
|
import { MonarchTokenizer } from 'monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js';
|
|
@@ -24,7 +25,7 @@ declare interface AnnotatedRange {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/** Every concrete node kind, for exhaustive consumer-side dispatch. */
|
|
27
|
-
export declare type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode | UnhandledBlockAstNode;
|
|
28
|
+
export declare type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | EmptyBlockAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode | UnhandledBlockAstNode;
|
|
28
29
|
|
|
29
30
|
declare type AnyViewData = DocumentViewData | BlockViewData | InlineViewData | ListItemViewData | TableRowViewData | TableCellViewData | MarkerViewData | GlueViewData | DiffHunkViewData | DiffDecorationViewData;
|
|
30
31
|
|
|
@@ -82,14 +83,21 @@ declare interface AstVisualizationNode {
|
|
|
82
83
|
* fire-and-forget. Paste must wait for the async read before inserting.
|
|
83
84
|
* Handled keydowns must not reach the host, which may replay native clipboard
|
|
84
85
|
* commands even when the browser's default has been prevented.
|
|
86
|
+
*
|
|
87
|
+
* Hosts can supply a paste callback to read images or other clipboard formats.
|
|
88
|
+
* It receives the original context and whether Shift requested plain text.
|
|
89
|
+
* The callback owns asynchronous errors and stale-selection checks. It does
|
|
90
|
+
* not override copy/cut or clipboard handling in nested native inputs.
|
|
85
91
|
*/
|
|
86
92
|
export declare class AsyncClipboardStrategy implements IClipboardStrategy {
|
|
87
93
|
private readonly _clipboard;
|
|
88
|
-
|
|
94
|
+
private readonly _paste?;
|
|
95
|
+
constructor(_clipboard?: Clipboard, _paste?: ((context: IClipboardContext, plainText: boolean) => Promise<void>) | undefined);
|
|
96
|
+
writeText(text: string): Promise<void>;
|
|
89
97
|
connect(context: IClipboardContext): IDisposable;
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode | UnhandledBlockAstNode;
|
|
100
|
+
export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | EmptyBlockAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode | UnhandledBlockAstNode;
|
|
93
101
|
|
|
94
102
|
/**
|
|
95
103
|
* A block-level node. Every block may carry a {@link leadingTrivia} glue — the
|
|
@@ -166,7 +174,7 @@ declare class BlockQuoteViewData {
|
|
|
166
174
|
*/
|
|
167
175
|
export declare function blocksIntersecting(doc: DocumentAstNode, start: SourceOffset, endExclusive: SourceOffset): BlockAstNode[];
|
|
168
176
|
|
|
169
|
-
declare type BlockViewData = HeadingViewData | ParagraphViewData | FrontMatterViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | VideoViewData | BlockQuoteViewData | ListViewData | TableViewData | UnhandledBlockViewData;
|
|
177
|
+
declare type BlockViewData = HeadingViewData | ParagraphViewData | EmptyBlockViewData | FrontMatterViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | VideoViewData | BlockQuoteViewData | ListViewData | TableViewData | UnhandledBlockViewData;
|
|
170
178
|
|
|
171
179
|
/**
|
|
172
180
|
* Base view node for everything the editor renders, generic over the
|
|
@@ -216,6 +224,9 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
|
|
|
216
224
|
}
|
|
217
225
|
|
|
218
226
|
export declare interface BlockViewOptions {
|
|
227
|
+
/** Writes explicit copy actions through the host clipboard; defaults to the browser API. */
|
|
228
|
+
readonly writeClipboardText?: (text: string) => Promise<void>;
|
|
229
|
+
readonly preserveSourceWhitespace?: boolean;
|
|
219
230
|
readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
|
|
220
231
|
readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
|
|
221
232
|
/** Temporarily yields the host editor's text input while a nested control owns focus. */
|
|
@@ -280,6 +291,8 @@ export declare class CodeBlockAstNode extends BlockAstNodeBase {
|
|
|
280
291
|
readonly infoString: string;
|
|
281
292
|
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
282
293
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
294
|
+
/** Logical code tokens, excluding Markdown container prefixes and structural indentation. */
|
|
295
|
+
readonly codeText?: string | undefined;
|
|
283
296
|
readonly kind = "codeBlock";
|
|
284
297
|
private _previous?;
|
|
285
298
|
private _contentEdit?;
|
|
@@ -287,7 +300,9 @@ export declare class CodeBlockAstNode extends BlockAstNodeBase {
|
|
|
287
300
|
/** First token of the fenced code block info string, used for syntax highlighting. */
|
|
288
301
|
language: string,
|
|
289
302
|
/** Complete fenced code block info string, including metadata after the language token. */
|
|
290
|
-
infoString: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined
|
|
303
|
+
infoString: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined,
|
|
304
|
+
/** Logical code tokens, excluding Markdown container prefixes and structural indentation. */
|
|
305
|
+
codeText?: string | undefined);
|
|
291
306
|
get children(): readonly AstNode[];
|
|
292
307
|
get openFence(): MarkerAstNode | undefined;
|
|
293
308
|
get closeFence(): MarkerAstNode | undefined;
|
|
@@ -342,6 +357,8 @@ declare class CodeBlockViewData {
|
|
|
342
357
|
* only, so a nested block currently builds a fresh session on each rebuild.
|
|
343
358
|
*/
|
|
344
359
|
export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData> {
|
|
360
|
+
private readonly _contentElement;
|
|
361
|
+
private _copyAction;
|
|
345
362
|
private _session;
|
|
346
363
|
/**
|
|
347
364
|
* Subscription that re-tokenises the rendered `<code>` in place whenever the
|
|
@@ -364,6 +381,7 @@ export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData>
|
|
|
364
381
|
private readonly _embeddedEditorReadOnly;
|
|
365
382
|
canReuse(data: AnyViewData, options: BlockViewOptions | undefined): boolean;
|
|
366
383
|
constructor(data: CodeBlockViewData, options: BlockViewOptions | undefined, previous: ViewNode | undefined);
|
|
384
|
+
get element(): HTMLElement;
|
|
367
385
|
dispose(): void;
|
|
368
386
|
}
|
|
369
387
|
|
|
@@ -460,11 +478,10 @@ export declare class CommentModeController extends Disposable {
|
|
|
460
478
|
private _anchorX;
|
|
461
479
|
private _pinnedRange;
|
|
462
480
|
/**
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
* empty box on the still-selected text.
|
|
481
|
+
* Keep a dismissed comment hidden across layout updates until the selection
|
|
482
|
+
* changes, whether the user submitted it or pressed Escape.
|
|
466
483
|
*/
|
|
467
|
-
private
|
|
484
|
+
private _dismissedRange;
|
|
468
485
|
constructor(_model: EditorModel, _view: EditorView, _options?: CommentModeControllerOptions | undefined);
|
|
469
486
|
private _update;
|
|
470
487
|
private _show;
|
|
@@ -591,6 +608,7 @@ export declare interface CursorCommandContext {
|
|
|
591
608
|
readonly document: DocumentAstNode;
|
|
592
609
|
readonly activeBlock: BlockAstNode | undefined;
|
|
593
610
|
readonly markerVisibleBlocks: ReadonlySet<BlockAstNode>;
|
|
611
|
+
readonly markupSelectionRange?: OffsetRange;
|
|
594
612
|
readonly wordNavigationConfig: WordNavigationConfig;
|
|
595
613
|
readonly cursorPosition: CursorPosition;
|
|
596
614
|
}
|
|
@@ -934,6 +952,7 @@ export declare class EditorController extends Disposable {
|
|
|
934
952
|
private _lastPointerDown;
|
|
935
953
|
constructor(_model: EditorModel, _view: EditorView, options?: EditorControllerOptions);
|
|
936
954
|
private readonly _handleTextUpdate;
|
|
955
|
+
insertText(text: string, selectionOverride?: Selection_2): void;
|
|
937
956
|
private _insertText;
|
|
938
957
|
private _remainingGeneratedIndentation;
|
|
939
958
|
/** Handle typed, pasted, or command-generated text while a paragraph is pending. */
|
|
@@ -1078,17 +1097,11 @@ export declare class EditorModel {
|
|
|
1078
1097
|
private _pendingEdit;
|
|
1079
1098
|
readonly sourceText: ISettableObservable<StringValue, void>;
|
|
1080
1099
|
readonly wordNavigationConfig: ISettableObservable<WordNavigationConfig, void>;
|
|
1081
|
-
/**
|
|
1082
|
-
* Read-only mode. When `true`, the editor never reveals a block's source
|
|
1083
|
-
* markers (markdown special characters like `**`, `#`, list bullets, code
|
|
1084
|
-
* fences, `$…$`) — every block stays in its clean rendered form regardless of
|
|
1085
|
-
* where the caret/selection is — and text-editing commands are ignored.
|
|
1086
|
-
* Explicit interactions with rendered controls, such as task checkboxes,
|
|
1087
|
-
* remain available. Plain text selection still works everywhere (so the user
|
|
1088
|
-
* can copy). The default (`false`) is the normal editing mode where the active
|
|
1089
|
-
* block reveals its markers.
|
|
1090
|
-
*/
|
|
1100
|
+
/** Disables text editing, independently of parsing, layout and markup visibility. */
|
|
1091
1101
|
readonly readonlyMode: ISettableObservable<boolean, void>;
|
|
1102
|
+
readonly presentation: ISettableObservable<EditorPresentation, void>;
|
|
1103
|
+
readonly renderMarkupText: ISettableObservable<RenderMarkupText, void>;
|
|
1104
|
+
readonly presentationPolicy: IObservableWithChange<PresentationPolicy, void>;
|
|
1092
1105
|
/**
|
|
1093
1106
|
* The current selection, or `undefined` when the editor has no caret
|
|
1094
1107
|
* (e.g. an inactive/unfocused rendering).
|
|
@@ -1178,6 +1191,7 @@ export declare class EditorModel {
|
|
|
1178
1191
|
changedBlocks: Set<BlockAstNode>;
|
|
1179
1192
|
} | undefined, void>;
|
|
1180
1193
|
readonly markerVisibleBlocks: IObservableWithChange<Set<BlockAstNode>, void>;
|
|
1194
|
+
getMarkupSelectionRange(selectionRange: OffsetRange | undefined, reader?: IReader): OffsetRange | undefined;
|
|
1181
1195
|
onWillApplySourceEdit(listener: (event: SourceEditEvent) => void): IDisposable;
|
|
1182
1196
|
/** Returns a stable per-object identity without retaining the source text. */
|
|
1183
1197
|
getSourceTextId(sourceText: StringValue): number;
|
|
@@ -1214,6 +1228,20 @@ export declare class EditorModel {
|
|
|
1214
1228
|
|
|
1215
1229
|
export declare type EditorOverlayPosition = 'top-chrome' | 'below-selection' | 'above-decorations';
|
|
1216
1230
|
|
|
1231
|
+
export declare type EditorPresentation = 'reading' | 'editing';
|
|
1232
|
+
|
|
1233
|
+
/** Text updates and browser attachment are separate so hosts can supply a local transport. */
|
|
1234
|
+
declare interface EditorTextInput {
|
|
1235
|
+
readonly context: EditorTextInputContext;
|
|
1236
|
+
readonly nativeContext: IObservable<EditContext | null>;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
declare interface EditorTextInputContext extends EventTarget {
|
|
1240
|
+
readonly text: string;
|
|
1241
|
+
updateText(start: number, end: number, text: string): void;
|
|
1242
|
+
updateSelection(start: number, end: number): void;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1217
1245
|
/**
|
|
1218
1246
|
* Pure-render view of an {@link EditorModel}.
|
|
1219
1247
|
*
|
|
@@ -1241,10 +1269,12 @@ export declare class EditorView extends Disposable {
|
|
|
1241
1269
|
private readonly _model;
|
|
1242
1270
|
private readonly _options?;
|
|
1243
1271
|
readonly element: HTMLElement;
|
|
1244
|
-
readonly editContext:
|
|
1272
|
+
readonly editContext: EditorTextInputContext;
|
|
1273
|
+
private readonly _nativeEditContext;
|
|
1245
1274
|
readonly measuredLayout: MeasuredLayoutModel;
|
|
1246
1275
|
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1247
1276
|
readonly forcedMarkerVisibleBlocks: ISettableObservable<ReadonlySet<BlockAstNode>, void>;
|
|
1277
|
+
readonly showReadonlyToggle: ISettableObservable<boolean, void>;
|
|
1248
1278
|
/**
|
|
1249
1279
|
* Inner container that holds the rendered document and the cursor/selection
|
|
1250
1280
|
* overlays. The outer {@link element} spans the full width; this container
|
|
@@ -1273,6 +1303,11 @@ export declare class EditorView extends Disposable {
|
|
|
1273
1303
|
private readonly _document;
|
|
1274
1304
|
private readonly _embeddedCodeEditorFactoryVersion;
|
|
1275
1305
|
private readonly _suspendEditContextForBlockControl;
|
|
1306
|
+
private _clipboardWriter;
|
|
1307
|
+
private readonly _writeClipboardText;
|
|
1308
|
+
/** Connects explicit copy actions to the controller's host clipboard strategy. */
|
|
1309
|
+
setClipboardWriter(writeText: (text: string) => Promise<void>): IDisposable;
|
|
1310
|
+
private _renderedSourceEditing;
|
|
1276
1311
|
/** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
|
|
1277
1312
|
get documentViewNode(): IObservable<DocumentViewNode | undefined>;
|
|
1278
1313
|
/** Re-resolves embedded code editors while preserving the surrounding editor view. */
|
|
@@ -1345,8 +1380,7 @@ export declare class EditorView extends Disposable {
|
|
|
1345
1380
|
private _setupFocusTracking;
|
|
1346
1381
|
private _setupCaretScrollPadding;
|
|
1347
1382
|
/**
|
|
1348
|
-
* Renders the
|
|
1349
|
-
* {@link EditorModel.readonlyMode}: when locked (read-only) every block stays
|
|
1383
|
+
* Renders the locked/rich/source editing mode toggle. When locked every block stays
|
|
1350
1384
|
* in its clean rendered form (no markdown markers revealed) and edits are
|
|
1351
1385
|
* ignored, while text selection still works. The control lives in a
|
|
1352
1386
|
* zero-height *sticky* host inside the centered content container, so the
|
|
@@ -1524,6 +1558,8 @@ export declare class EditorView extends Disposable {
|
|
|
1524
1558
|
}
|
|
1525
1559
|
|
|
1526
1560
|
export declare interface EditorViewOptions extends BlockViewOptions {
|
|
1561
|
+
readonly presentation?: EditorPresentation;
|
|
1562
|
+
readonly textInput?: EditorTextInput;
|
|
1527
1563
|
/**
|
|
1528
1564
|
* Extra class names added to the editor root element, e.g. a theme class
|
|
1529
1565
|
* such as `'md-theme-default'` or `'github-markdown-theme'`. Theme styles
|
|
@@ -1574,6 +1610,24 @@ declare class EmphasisViewData {
|
|
|
1574
1610
|
constructor(ast: EmphasisAstNode, content: readonly AnyViewData[]);
|
|
1575
1611
|
}
|
|
1576
1612
|
|
|
1613
|
+
/** One blank source line, or the empty final line after a terminating newline. */
|
|
1614
|
+
export declare class EmptyBlockAstNode extends BlockAstNodeBase {
|
|
1615
|
+
readonly content: readonly GlueAstNode[];
|
|
1616
|
+
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
1617
|
+
readonly kind = "emptyBlock";
|
|
1618
|
+
constructor(content: readonly GlueAstNode[], leadingTrivia?: GlueAstNode | undefined);
|
|
1619
|
+
get children(): readonly AstNode[];
|
|
1620
|
+
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
1621
|
+
withLeadingTrivia(trivia: GlueAstNode | undefined): EmptyBlockAstNode;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
declare class EmptyBlockViewData {
|
|
1625
|
+
readonly ast: EmptyBlockAstNode;
|
|
1626
|
+
readonly content: readonly AnyViewData[];
|
|
1627
|
+
readonly kind = "emptyBlock";
|
|
1628
|
+
constructor(ast: EmptyBlockAstNode, content: readonly AnyViewData[]);
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1577
1631
|
export declare function escapeFindRegex(value: string): string;
|
|
1578
1632
|
|
|
1579
1633
|
export declare const FIND_MATCH_LIMIT = 19999;
|
|
@@ -1819,6 +1873,7 @@ declare class GlueViewData {
|
|
|
1819
1873
|
* block children) the break is already visible, so no `↵` is drawn.
|
|
1820
1874
|
*/
|
|
1821
1875
|
readonly decorateNewline: boolean;
|
|
1876
|
+
readonly showWhitespace: boolean;
|
|
1822
1877
|
readonly kind = "glue";
|
|
1823
1878
|
constructor(ast: GlueAstNode, visible: boolean,
|
|
1824
1879
|
/**
|
|
@@ -1827,7 +1882,7 @@ declare class GlueViewData {
|
|
|
1827
1882
|
* the line ending hiding there; between block-level siblings (list items,
|
|
1828
1883
|
* block children) the break is already visible, so no `↵` is drawn.
|
|
1829
1884
|
*/
|
|
1830
|
-
decorateNewline: boolean);
|
|
1885
|
+
decorateNewline: boolean, showWhitespace?: boolean);
|
|
1831
1886
|
}
|
|
1832
1887
|
|
|
1833
1888
|
/**
|
|
@@ -1915,6 +1970,8 @@ export declare interface IClipboardContext {
|
|
|
1915
1970
|
* swallow the native clipboard events before they reach the editor.
|
|
1916
1971
|
*/
|
|
1917
1972
|
export declare interface IClipboardStrategy {
|
|
1973
|
+
/** Copy an explicit payload without changing the editor selection. Falls back to the browser API when omitted. */
|
|
1974
|
+
writeText?(text: string): Promise<void>;
|
|
1918
1975
|
/**
|
|
1919
1976
|
* Wire up clipboard handling against `context`. The returned disposable
|
|
1920
1977
|
* tears down every listener the strategy installed.
|
|
@@ -2126,7 +2183,7 @@ export declare const insertParagraph: EditCommand;
|
|
|
2126
2183
|
* A non-collapsed selection, or any other block, falls back to a plain soft line
|
|
2127
2184
|
* break, preserving today's behaviour.
|
|
2128
2185
|
*/
|
|
2129
|
-
export declare const insertSmartEnter: (ctx: CursorCommandContext) => SmartEnterResult;
|
|
2186
|
+
export declare const insertSmartEnter: (ctx: CursorCommandContext, useSourceLineBreaks?: boolean) => SmartEnterResult;
|
|
2130
2187
|
|
|
2131
2188
|
/**
|
|
2132
2189
|
* VS Code-style Tab: insert to the next tab stop for a caret or partial
|
|
@@ -2301,10 +2358,10 @@ declare class LinkViewData {
|
|
|
2301
2358
|
|
|
2302
2359
|
export declare class ListAstNode extends BlockAstNodeBase {
|
|
2303
2360
|
readonly ordered: boolean;
|
|
2304
|
-
readonly content: readonly (ListItemAstNode | GlueAstNode)[];
|
|
2361
|
+
readonly content: readonly (ListItemAstNode | EmptyBlockAstNode | GlueAstNode)[];
|
|
2305
2362
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
2306
2363
|
readonly kind = "list";
|
|
2307
|
-
constructor(ordered: boolean, content: readonly (ListItemAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
2364
|
+
constructor(ordered: boolean, content: readonly (ListItemAstNode | EmptyBlockAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
2308
2365
|
get children(): readonly AstNode[];
|
|
2309
2366
|
get items(): readonly ListItemAstNode[];
|
|
2310
2367
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
@@ -2321,6 +2378,7 @@ export declare class ListItemAstNode extends AstNode {
|
|
|
2321
2378
|
constructor(marker: MarkerAstNode, content: readonly (BlockAstNode | GlueAstNode)[], checked?: boolean | undefined, leadingTrivia?: GlueAstNode | undefined);
|
|
2322
2379
|
get children(): readonly AstNode[];
|
|
2323
2380
|
get blocks(): readonly BlockAstNode[];
|
|
2381
|
+
get isIncomplete(): boolean;
|
|
2324
2382
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
2325
2383
|
withLeadingTrivia(trivia: GlueAstNode | undefined): ListItemAstNode;
|
|
2326
2384
|
protected _localEquals(o: this): boolean;
|
|
@@ -2340,6 +2398,7 @@ declare class ListItemViewData {
|
|
|
2340
2398
|
* reveals the literal marker instead of the progress affordance.
|
|
2341
2399
|
*/
|
|
2342
2400
|
readonly isRunning: boolean;
|
|
2401
|
+
readonly sourceIndentation: number;
|
|
2343
2402
|
readonly kind = "listItem";
|
|
2344
2403
|
constructor(ast: ListItemAstNode,
|
|
2345
2404
|
/** Whether the selection reaches this item (reveals its markers). */
|
|
@@ -2352,7 +2411,7 @@ declare class ListItemViewData {
|
|
|
2352
2411
|
* Always `false` while the item is active — an active/editing task
|
|
2353
2412
|
* reveals the literal marker instead of the progress affordance.
|
|
2354
2413
|
*/
|
|
2355
|
-
isRunning?: boolean);
|
|
2414
|
+
isRunning?: boolean, sourceIndentation?: number);
|
|
2356
2415
|
}
|
|
2357
2416
|
|
|
2358
2417
|
declare class ListViewData {
|
|
@@ -2388,6 +2447,15 @@ export declare class LocalHistoryStrategy implements IHistoryStrategy {
|
|
|
2388
2447
|
private _clear;
|
|
2389
2448
|
}
|
|
2390
2449
|
|
|
2450
|
+
export declare interface MarkdownParseOptions {
|
|
2451
|
+
readonly explicitBlankLineBlocks?: boolean;
|
|
2452
|
+
readonly explicitFinalEmptyLine?: boolean;
|
|
2453
|
+
readonly preserveTrailingListContinuation?: boolean;
|
|
2454
|
+
readonly allowEmptyListItemInterrupts?: boolean;
|
|
2455
|
+
readonly requireListMarkerWhitespace?: boolean;
|
|
2456
|
+
readonly allowEmptyTaskItems?: boolean;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2391
2459
|
/**
|
|
2392
2460
|
* Parses markdown into a {@link DocumentAstNode}.
|
|
2393
2461
|
*
|
|
@@ -2397,7 +2465,7 @@ export declare class LocalHistoryStrategy implements IHistoryStrategy {
|
|
|
2397
2465
|
* blocks keep their incremental highlighting sessions.
|
|
2398
2466
|
*/
|
|
2399
2467
|
export declare class MarkdownParser {
|
|
2400
|
-
parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
|
|
2468
|
+
parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit, options?: MarkdownParseOptions): DocumentAstNode;
|
|
2401
2469
|
}
|
|
2402
2470
|
|
|
2403
2471
|
/** A semantic syntax marker (heading `#`, fences, brackets, list bullet, …). */
|
|
@@ -2593,6 +2661,11 @@ export declare const moveLinesDown: EditCommand;
|
|
|
2593
2661
|
|
|
2594
2662
|
export declare const moveLinesUp: EditCommand;
|
|
2595
2663
|
|
|
2664
|
+
export declare interface NativeClipboardData {
|
|
2665
|
+
readonly text: string;
|
|
2666
|
+
readonly files: readonly File[];
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2596
2669
|
/**
|
|
2597
2670
|
* Default strategy: handle the browser's native `copy`/`cut`/`paste` events,
|
|
2598
2671
|
* reading and writing the synchronous {@link ClipboardEvent.clipboardData}.
|
|
@@ -2764,6 +2837,22 @@ export declare class Point2D {
|
|
|
2764
2837
|
translate(dx: number, dy: number): Point2D;
|
|
2765
2838
|
}
|
|
2766
2839
|
|
|
2840
|
+
export declare const presentationPolicies: Readonly<Record<EditorPresentation, PresentationPolicy>>;
|
|
2841
|
+
|
|
2842
|
+
declare interface PresentationPolicy {
|
|
2843
|
+
readonly parseOptions: MarkdownParseOptions;
|
|
2844
|
+
readonly preserveSourceWhitespace: boolean;
|
|
2845
|
+
readonly useSourceLineBreaks: boolean;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* Read native clipboard formats through an editable target. Electron can expose
|
|
2850
|
+
* file clipboard entries here that navigator.clipboard.read() omits. EditContext
|
|
2851
|
+
* roots themselves do not receive execCommand('paste') events.
|
|
2852
|
+
* Returns undefined when the host does not support native programmatic paste.
|
|
2853
|
+
*/
|
|
2854
|
+
export declare function readNativeClipboard(focusTarget: HTMLElement, executePaste?: () => void): NativeClipboardData | undefined;
|
|
2855
|
+
|
|
2767
2856
|
/**
|
|
2768
2857
|
* Immutable axis-aligned rectangle in a caller-defined 2D CSS-pixel coordinate
|
|
2769
2858
|
* space. `x`/`y` is the top-left corner, growing right/down.
|
|
@@ -2799,6 +2888,89 @@ declare interface RemovedItem {
|
|
|
2799
2888
|
readonly deletedLocal: readonly AnnotatedRange[];
|
|
2800
2889
|
}
|
|
2801
2890
|
|
|
2891
|
+
export declare interface RenameAnchor {
|
|
2892
|
+
readonly left: number;
|
|
2893
|
+
readonly top: number;
|
|
2894
|
+
readonly height: number;
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
export declare class RenameModel<TContext = undefined> {
|
|
2898
|
+
private readonly _options;
|
|
2899
|
+
readonly name: ISettableObservable<string, void>;
|
|
2900
|
+
private readonly _session;
|
|
2901
|
+
private readonly _pending;
|
|
2902
|
+
private readonly _failure;
|
|
2903
|
+
private _submission;
|
|
2904
|
+
private _disposed;
|
|
2905
|
+
readonly session: IObservable<RenameSession<TContext> | undefined>;
|
|
2906
|
+
readonly pending: IObservable<boolean>;
|
|
2907
|
+
readonly isOpen: IObservableWithChange<boolean, void>;
|
|
2908
|
+
readonly error: IObservableWithChange<Error | undefined, void>;
|
|
2909
|
+
readonly validationMessage: IObservableWithChange<string | undefined, void>;
|
|
2910
|
+
readonly canSubmit: IObservableWithChange<boolean, void>;
|
|
2911
|
+
private readonly _nameObserver;
|
|
2912
|
+
constructor(_options: RenameModelOptions<TContext>);
|
|
2913
|
+
open(session: RenameSession<TContext>): void;
|
|
2914
|
+
submit(): Promise<RenameSubmitResult>;
|
|
2915
|
+
cancel(): void;
|
|
2916
|
+
dispose(): void;
|
|
2917
|
+
private _close;
|
|
2918
|
+
private _abortSubmission;
|
|
2919
|
+
private _isCurrent;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
export declare interface RenameModelOptions<TContext = undefined> {
|
|
2923
|
+
readonly onSubmit: (request: RenameRequest<TContext>) => void | Promise<void>;
|
|
2924
|
+
readonly onCancel?: (session: RenameSession<TContext>) => void;
|
|
2925
|
+
readonly validate?: (name: string, session: RenameSession<TContext>) => string | undefined;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
export declare interface RenameRequest<TContext = undefined> extends RenameSession<TContext> {
|
|
2929
|
+
readonly name: string;
|
|
2930
|
+
readonly signal: AbortSignal;
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
export declare interface RenameSession<TContext = undefined> {
|
|
2934
|
+
readonly initialName: string;
|
|
2935
|
+
readonly context: TContext;
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
export declare type RenameSubmitResult = {
|
|
2939
|
+
readonly kind: 'submitted';
|
|
2940
|
+
readonly name: string;
|
|
2941
|
+
} | {
|
|
2942
|
+
readonly kind: 'invalid';
|
|
2943
|
+
readonly message: string;
|
|
2944
|
+
} | {
|
|
2945
|
+
readonly kind: 'error';
|
|
2946
|
+
readonly error: Error;
|
|
2947
|
+
} | {
|
|
2948
|
+
readonly kind: 'closed' | 'pending' | 'cancelled' | 'superseded';
|
|
2949
|
+
};
|
|
2950
|
+
|
|
2951
|
+
export declare class RenameWidget<TContext = undefined> extends Disposable {
|
|
2952
|
+
private readonly _container;
|
|
2953
|
+
private readonly _model;
|
|
2954
|
+
private readonly _options;
|
|
2955
|
+
readonly element: HTMLDivElement;
|
|
2956
|
+
readonly inputElement: HTMLInputElement;
|
|
2957
|
+
private readonly _message;
|
|
2958
|
+
private _anchor;
|
|
2959
|
+
private _focusedSession;
|
|
2960
|
+
constructor(_container: HTMLElement, _model: RenameModel<TContext>, _options?: RenameWidgetOptions);
|
|
2961
|
+
focusAndSelect(): void;
|
|
2962
|
+
/** Anchor coordinates are relative to the positioned container's padding box. */
|
|
2963
|
+
layout(anchor?: RenameAnchor): void;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
export declare interface RenameWidgetOptions {
|
|
2967
|
+
readonly autoFocus?: boolean;
|
|
2968
|
+
/** Called when a focused widget closes; the host can restore editor focus. */
|
|
2969
|
+
readonly onDidHide?: () => void;
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
export declare type RenderMarkupText = 'none' | 'selection' | 'all';
|
|
2973
|
+
|
|
2802
2974
|
declare interface ReplacedItem {
|
|
2803
2975
|
readonly kind: 'replaced';
|
|
2804
2976
|
readonly original: AstNode;
|
|
@@ -3033,6 +3205,83 @@ declare class StrongViewData {
|
|
|
3033
3205
|
constructor(ast: StrongAstNode, content: readonly AnyViewData[]);
|
|
3034
3206
|
}
|
|
3035
3207
|
|
|
3208
|
+
export declare type SuggestAcceptance = 'enter' | 'tab' | 'pointer';
|
|
3209
|
+
|
|
3210
|
+
export declare interface SuggestCallbacks<T extends SuggestItem> {
|
|
3211
|
+
readonly onAccept: (item: T, source: SuggestAcceptance) => void;
|
|
3212
|
+
readonly onCancel?: () => void;
|
|
3213
|
+
readonly onSelect?: (item: T | undefined) => void;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
export declare interface SuggestItem {
|
|
3217
|
+
readonly id: string;
|
|
3218
|
+
readonly label: string;
|
|
3219
|
+
readonly detail?: string;
|
|
3220
|
+
readonly type?: string;
|
|
3221
|
+
readonly highlightLength?: number;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
export declare class SuggestModel<T extends SuggestItem = SuggestItem> {
|
|
3225
|
+
private readonly _callbacks;
|
|
3226
|
+
private readonly _state;
|
|
3227
|
+
readonly state: IObservable<SuggestState<T>>;
|
|
3228
|
+
readonly selectedItem: IObservableWithChange<T | undefined, void>;
|
|
3229
|
+
constructor(_callbacks: SuggestCallbacks<T>);
|
|
3230
|
+
show(items: readonly T[], selectedId?: string | undefined): void;
|
|
3231
|
+
showLoading(): void;
|
|
3232
|
+
showError(message: string): void;
|
|
3233
|
+
close(): void;
|
|
3234
|
+
select(id: string): boolean;
|
|
3235
|
+
navigate(direction: SuggestNavigation, pageSize?: number): boolean;
|
|
3236
|
+
accept(source?: SuggestAcceptance): boolean;
|
|
3237
|
+
cancel(): boolean;
|
|
3238
|
+
private _update;
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
export declare type SuggestNavigation = 'next' | 'previous' | 'first' | 'last' | 'nextPage' | 'previousPage';
|
|
3242
|
+
|
|
3243
|
+
export declare type SuggestState<T extends SuggestItem = SuggestItem> = {
|
|
3244
|
+
readonly kind: 'closed';
|
|
3245
|
+
} | {
|
|
3246
|
+
readonly kind: 'loading';
|
|
3247
|
+
} | {
|
|
3248
|
+
readonly kind: 'empty';
|
|
3249
|
+
} | {
|
|
3250
|
+
readonly kind: 'error';
|
|
3251
|
+
readonly message: string;
|
|
3252
|
+
} | {
|
|
3253
|
+
readonly kind: 'ready';
|
|
3254
|
+
readonly items: readonly T[];
|
|
3255
|
+
readonly selectedIndex: number;
|
|
3256
|
+
};
|
|
3257
|
+
|
|
3258
|
+
export declare class SuggestWidget<T extends SuggestItem = SuggestItem> extends Disposable {
|
|
3259
|
+
private readonly _options;
|
|
3260
|
+
readonly element: HTMLDivElement;
|
|
3261
|
+
readonly listElement: HTMLDivElement;
|
|
3262
|
+
private readonly _message;
|
|
3263
|
+
private readonly _savedAttributes;
|
|
3264
|
+
private _items;
|
|
3265
|
+
private _disposed;
|
|
3266
|
+
private _pendingReveal;
|
|
3267
|
+
constructor(_options: SuggestWidgetOptions<T>);
|
|
3268
|
+
handleKeyDown(event: KeyboardEvent): boolean;
|
|
3269
|
+
dispose(): void;
|
|
3270
|
+
private _rowFromEvent;
|
|
3271
|
+
private _render;
|
|
3272
|
+
private _revealSelection;
|
|
3273
|
+
private _createRow;
|
|
3274
|
+
private _restoreAttributes;
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
export declare interface SuggestWidgetOptions<T extends SuggestItem> {
|
|
3278
|
+
readonly model: SuggestModel<T>;
|
|
3279
|
+
readonly focusTarget: HTMLElement;
|
|
3280
|
+
readonly id: string;
|
|
3281
|
+
readonly label?: string;
|
|
3282
|
+
readonly listenForKeyboard?: boolean;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3036
3285
|
export declare type TabKeyboardAction = 'insert' | 'outdent';
|
|
3037
3286
|
|
|
3038
3287
|
export declare class TableAstNode extends BlockAstNodeBase {
|
|
@@ -3097,10 +3346,10 @@ declare class TableViewData {
|
|
|
3097
3346
|
}
|
|
3098
3347
|
|
|
3099
3348
|
/**
|
|
3100
|
-
* Source range (relative to `item`) of a task list item's `[x]`/`[ ]`
|
|
3349
|
+
* Source range (relative to `item`) of a task list item's `[x]`/`[ ]`/`[]`
|
|
3101
3350
|
* checkbox, or `undefined` when the item is not a task item. The checkbox is
|
|
3102
3351
|
* plain glue in the AST, so a host that wants to toggle it locates the literal
|
|
3103
|
-
*
|
|
3352
|
+
* checkbox token here.
|
|
3104
3353
|
*/
|
|
3105
3354
|
export declare function taskCheckboxRange(item: ListItemAstNode): OffsetRange | undefined;
|
|
3106
3355
|
|
|
@@ -3124,6 +3373,7 @@ declare class TextViewData {
|
|
|
3124
3373
|
* {@link isRunnerMarkerText} has matched this node. Zero otherwise.
|
|
3125
3374
|
*/
|
|
3126
3375
|
readonly hiddenPrefixLength: number;
|
|
3376
|
+
readonly taskLabel: boolean;
|
|
3127
3377
|
readonly kind = "text";
|
|
3128
3378
|
/**
|
|
3129
3379
|
* Whether non-obvious whitespace in this text is revealed (block is active).
|
|
@@ -3139,7 +3389,7 @@ declare class TextViewData {
|
|
|
3139
3389
|
* mandatory leading separator, once
|
|
3140
3390
|
* {@link isRunnerMarkerText} has matched this node. Zero otherwise.
|
|
3141
3391
|
*/
|
|
3142
|
-
hiddenPrefixLength?: number);
|
|
3392
|
+
hiddenPrefixLength?: number, taskLabel?: boolean);
|
|
3143
3393
|
}
|
|
3144
3394
|
|
|
3145
3395
|
export declare class ThematicBreakAstNode extends BlockAstNodeBase {
|