@vscode/markdown-editor 0.0.2-113 → 0.0.2-115
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 +264 -30
- package/dist/index.js +2837 -2128
- 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 +279 -40
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,15 +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);
|
|
89
96
|
writeText(text: string): Promise<void>;
|
|
90
97
|
connect(context: IClipboardContext): IDisposable;
|
|
91
98
|
}
|
|
92
99
|
|
|
93
|
-
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;
|
|
94
101
|
|
|
95
102
|
/**
|
|
96
103
|
* A block-level node. Every block may carry a {@link leadingTrivia} glue — the
|
|
@@ -167,7 +174,7 @@ declare class BlockQuoteViewData {
|
|
|
167
174
|
*/
|
|
168
175
|
export declare function blocksIntersecting(doc: DocumentAstNode, start: SourceOffset, endExclusive: SourceOffset): BlockAstNode[];
|
|
169
176
|
|
|
170
|
-
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;
|
|
171
178
|
|
|
172
179
|
/**
|
|
173
180
|
* Base view node for everything the editor renders, generic over the
|
|
@@ -219,6 +226,7 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
|
|
|
219
226
|
export declare interface BlockViewOptions {
|
|
220
227
|
/** Writes explicit copy actions through the host clipboard; defaults to the browser API. */
|
|
221
228
|
readonly writeClipboardText?: (text: string) => Promise<void>;
|
|
229
|
+
readonly preserveSourceWhitespace?: boolean;
|
|
222
230
|
readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
|
|
223
231
|
readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
|
|
224
232
|
/** Temporarily yields the host editor's text input while a nested control owns focus. */
|
|
@@ -470,11 +478,10 @@ export declare class CommentModeController extends Disposable {
|
|
|
470
478
|
private _anchorX;
|
|
471
479
|
private _pinnedRange;
|
|
472
480
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* 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.
|
|
476
483
|
*/
|
|
477
|
-
private
|
|
484
|
+
private _dismissedRange;
|
|
478
485
|
constructor(_model: EditorModel, _view: EditorView, _options?: CommentModeControllerOptions | undefined);
|
|
479
486
|
private _update;
|
|
480
487
|
private _show;
|
|
@@ -601,6 +608,7 @@ export declare interface CursorCommandContext {
|
|
|
601
608
|
readonly document: DocumentAstNode;
|
|
602
609
|
readonly activeBlock: BlockAstNode | undefined;
|
|
603
610
|
readonly markerVisibleBlocks: ReadonlySet<BlockAstNode>;
|
|
611
|
+
readonly markupSelectionRange?: OffsetRange;
|
|
604
612
|
readonly wordNavigationConfig: WordNavigationConfig;
|
|
605
613
|
readonly cursorPosition: CursorPosition;
|
|
606
614
|
}
|
|
@@ -944,6 +952,7 @@ export declare class EditorController extends Disposable {
|
|
|
944
952
|
private _lastPointerDown;
|
|
945
953
|
constructor(_model: EditorModel, _view: EditorView, options?: EditorControllerOptions);
|
|
946
954
|
private readonly _handleTextUpdate;
|
|
955
|
+
insertText(text: string, selectionOverride?: Selection_2): void;
|
|
947
956
|
private _insertText;
|
|
948
957
|
private _remainingGeneratedIndentation;
|
|
949
958
|
/** Handle typed, pasted, or command-generated text while a paragraph is pending. */
|
|
@@ -1088,17 +1097,11 @@ export declare class EditorModel {
|
|
|
1088
1097
|
private _pendingEdit;
|
|
1089
1098
|
readonly sourceText: ISettableObservable<StringValue, void>;
|
|
1090
1099
|
readonly wordNavigationConfig: ISettableObservable<WordNavigationConfig, void>;
|
|
1091
|
-
/**
|
|
1092
|
-
* Read-only mode. When `true`, the editor never reveals a block's source
|
|
1093
|
-
* markers (markdown special characters like `**`, `#`, list bullets, code
|
|
1094
|
-
* fences, `$…$`) — every block stays in its clean rendered form regardless of
|
|
1095
|
-
* where the caret/selection is — and text-editing commands are ignored.
|
|
1096
|
-
* Explicit interactions with rendered controls, such as task checkboxes,
|
|
1097
|
-
* remain available. Plain text selection still works everywhere (so the user
|
|
1098
|
-
* can copy). The default (`false`) is the normal editing mode where the active
|
|
1099
|
-
* block reveals its markers.
|
|
1100
|
-
*/
|
|
1100
|
+
/** Disables text editing, independently of parsing, layout and markup visibility. */
|
|
1101
1101
|
readonly readonlyMode: ISettableObservable<boolean, void>;
|
|
1102
|
+
readonly presentation: ISettableObservable<EditorPresentation, void>;
|
|
1103
|
+
readonly renderMarkupText: ISettableObservable<RenderMarkupText, void>;
|
|
1104
|
+
readonly presentationPolicy: IObservableWithChange<PresentationPolicy, void>;
|
|
1102
1105
|
/**
|
|
1103
1106
|
* The current selection, or `undefined` when the editor has no caret
|
|
1104
1107
|
* (e.g. an inactive/unfocused rendering).
|
|
@@ -1188,6 +1191,7 @@ export declare class EditorModel {
|
|
|
1188
1191
|
changedBlocks: Set<BlockAstNode>;
|
|
1189
1192
|
} | undefined, void>;
|
|
1190
1193
|
readonly markerVisibleBlocks: IObservableWithChange<Set<BlockAstNode>, void>;
|
|
1194
|
+
getMarkupSelectionRange(selectionRange: OffsetRange | undefined, reader?: IReader): OffsetRange | undefined;
|
|
1191
1195
|
onWillApplySourceEdit(listener: (event: SourceEditEvent) => void): IDisposable;
|
|
1192
1196
|
/** Returns a stable per-object identity without retaining the source text. */
|
|
1193
1197
|
getSourceTextId(sourceText: StringValue): number;
|
|
@@ -1224,6 +1228,20 @@ export declare class EditorModel {
|
|
|
1224
1228
|
|
|
1225
1229
|
export declare type EditorOverlayPosition = 'top-chrome' | 'below-selection' | 'above-decorations';
|
|
1226
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
|
+
|
|
1227
1245
|
/**
|
|
1228
1246
|
* Pure-render view of an {@link EditorModel}.
|
|
1229
1247
|
*
|
|
@@ -1251,10 +1269,12 @@ export declare class EditorView extends Disposable {
|
|
|
1251
1269
|
private readonly _model;
|
|
1252
1270
|
private readonly _options?;
|
|
1253
1271
|
readonly element: HTMLElement;
|
|
1254
|
-
readonly editContext:
|
|
1272
|
+
readonly editContext: EditorTextInputContext;
|
|
1273
|
+
private readonly _nativeEditContext;
|
|
1255
1274
|
readonly measuredLayout: MeasuredLayoutModel;
|
|
1256
1275
|
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1257
1276
|
readonly forcedMarkerVisibleBlocks: ISettableObservable<ReadonlySet<BlockAstNode>, void>;
|
|
1277
|
+
readonly showReadonlyToggle: ISettableObservable<boolean, void>;
|
|
1258
1278
|
/**
|
|
1259
1279
|
* Inner container that holds the rendered document and the cursor/selection
|
|
1260
1280
|
* overlays. The outer {@link element} spans the full width; this container
|
|
@@ -1287,6 +1307,7 @@ export declare class EditorView extends Disposable {
|
|
|
1287
1307
|
private readonly _writeClipboardText;
|
|
1288
1308
|
/** Connects explicit copy actions to the controller's host clipboard strategy. */
|
|
1289
1309
|
setClipboardWriter(writeText: (text: string) => Promise<void>): IDisposable;
|
|
1310
|
+
private _renderedSourceEditing;
|
|
1290
1311
|
/** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
|
|
1291
1312
|
get documentViewNode(): IObservable<DocumentViewNode | undefined>;
|
|
1292
1313
|
/** Re-resolves embedded code editors while preserving the surrounding editor view. */
|
|
@@ -1359,8 +1380,7 @@ export declare class EditorView extends Disposable {
|
|
|
1359
1380
|
private _setupFocusTracking;
|
|
1360
1381
|
private _setupCaretScrollPadding;
|
|
1361
1382
|
/**
|
|
1362
|
-
* Renders the
|
|
1363
|
-
* {@link EditorModel.readonlyMode}: when locked (read-only) every block stays
|
|
1383
|
+
* Renders the locked/rich/source editing mode toggle. When locked every block stays
|
|
1364
1384
|
* in its clean rendered form (no markdown markers revealed) and edits are
|
|
1365
1385
|
* ignored, while text selection still works. The control lives in a
|
|
1366
1386
|
* zero-height *sticky* host inside the centered content container, so the
|
|
@@ -1538,6 +1558,8 @@ export declare class EditorView extends Disposable {
|
|
|
1538
1558
|
}
|
|
1539
1559
|
|
|
1540
1560
|
export declare interface EditorViewOptions extends BlockViewOptions {
|
|
1561
|
+
readonly presentation?: EditorPresentation;
|
|
1562
|
+
readonly textInput?: EditorTextInput;
|
|
1541
1563
|
/**
|
|
1542
1564
|
* Extra class names added to the editor root element, e.g. a theme class
|
|
1543
1565
|
* such as `'md-theme-default'` or `'github-markdown-theme'`. Theme styles
|
|
@@ -1588,6 +1610,24 @@ declare class EmphasisViewData {
|
|
|
1588
1610
|
constructor(ast: EmphasisAstNode, content: readonly AnyViewData[]);
|
|
1589
1611
|
}
|
|
1590
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
|
+
|
|
1591
1631
|
export declare function escapeFindRegex(value: string): string;
|
|
1592
1632
|
|
|
1593
1633
|
export declare const FIND_MATCH_LIMIT = 19999;
|
|
@@ -1833,6 +1873,7 @@ declare class GlueViewData {
|
|
|
1833
1873
|
* block children) the break is already visible, so no `↵` is drawn.
|
|
1834
1874
|
*/
|
|
1835
1875
|
readonly decorateNewline: boolean;
|
|
1876
|
+
readonly showWhitespace: boolean;
|
|
1836
1877
|
readonly kind = "glue";
|
|
1837
1878
|
constructor(ast: GlueAstNode, visible: boolean,
|
|
1838
1879
|
/**
|
|
@@ -1841,7 +1882,7 @@ declare class GlueViewData {
|
|
|
1841
1882
|
* the line ending hiding there; between block-level siblings (list items,
|
|
1842
1883
|
* block children) the break is already visible, so no `↵` is drawn.
|
|
1843
1884
|
*/
|
|
1844
|
-
decorateNewline: boolean);
|
|
1885
|
+
decorateNewline: boolean, showWhitespace?: boolean);
|
|
1845
1886
|
}
|
|
1846
1887
|
|
|
1847
1888
|
/**
|
|
@@ -2142,7 +2183,7 @@ export declare const insertParagraph: EditCommand;
|
|
|
2142
2183
|
* A non-collapsed selection, or any other block, falls back to a plain soft line
|
|
2143
2184
|
* break, preserving today's behaviour.
|
|
2144
2185
|
*/
|
|
2145
|
-
export declare const insertSmartEnter: (ctx: CursorCommandContext) => SmartEnterResult;
|
|
2186
|
+
export declare const insertSmartEnter: (ctx: CursorCommandContext, useSourceLineBreaks?: boolean) => SmartEnterResult;
|
|
2146
2187
|
|
|
2147
2188
|
/**
|
|
2148
2189
|
* VS Code-style Tab: insert to the next tab stop for a caret or partial
|
|
@@ -2317,10 +2358,10 @@ declare class LinkViewData {
|
|
|
2317
2358
|
|
|
2318
2359
|
export declare class ListAstNode extends BlockAstNodeBase {
|
|
2319
2360
|
readonly ordered: boolean;
|
|
2320
|
-
readonly content: readonly (ListItemAstNode | GlueAstNode)[];
|
|
2361
|
+
readonly content: readonly (ListItemAstNode | EmptyBlockAstNode | GlueAstNode)[];
|
|
2321
2362
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
2322
2363
|
readonly kind = "list";
|
|
2323
|
-
constructor(ordered: boolean, content: readonly (ListItemAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
2364
|
+
constructor(ordered: boolean, content: readonly (ListItemAstNode | EmptyBlockAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
2324
2365
|
get children(): readonly AstNode[];
|
|
2325
2366
|
get items(): readonly ListItemAstNode[];
|
|
2326
2367
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
@@ -2337,6 +2378,7 @@ export declare class ListItemAstNode extends AstNode {
|
|
|
2337
2378
|
constructor(marker: MarkerAstNode, content: readonly (BlockAstNode | GlueAstNode)[], checked?: boolean | undefined, leadingTrivia?: GlueAstNode | undefined);
|
|
2338
2379
|
get children(): readonly AstNode[];
|
|
2339
2380
|
get blocks(): readonly BlockAstNode[];
|
|
2381
|
+
get isIncomplete(): boolean;
|
|
2340
2382
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
2341
2383
|
withLeadingTrivia(trivia: GlueAstNode | undefined): ListItemAstNode;
|
|
2342
2384
|
protected _localEquals(o: this): boolean;
|
|
@@ -2356,6 +2398,7 @@ declare class ListItemViewData {
|
|
|
2356
2398
|
* reveals the literal marker instead of the progress affordance.
|
|
2357
2399
|
*/
|
|
2358
2400
|
readonly isRunning: boolean;
|
|
2401
|
+
readonly sourceIndentation: number;
|
|
2359
2402
|
readonly kind = "listItem";
|
|
2360
2403
|
constructor(ast: ListItemAstNode,
|
|
2361
2404
|
/** Whether the selection reaches this item (reveals its markers). */
|
|
@@ -2368,7 +2411,7 @@ declare class ListItemViewData {
|
|
|
2368
2411
|
* Always `false` while the item is active — an active/editing task
|
|
2369
2412
|
* reveals the literal marker instead of the progress affordance.
|
|
2370
2413
|
*/
|
|
2371
|
-
isRunning?: boolean);
|
|
2414
|
+
isRunning?: boolean, sourceIndentation?: number);
|
|
2372
2415
|
}
|
|
2373
2416
|
|
|
2374
2417
|
declare class ListViewData {
|
|
@@ -2404,6 +2447,15 @@ export declare class LocalHistoryStrategy implements IHistoryStrategy {
|
|
|
2404
2447
|
private _clear;
|
|
2405
2448
|
}
|
|
2406
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
|
+
|
|
2407
2459
|
/**
|
|
2408
2460
|
* Parses markdown into a {@link DocumentAstNode}.
|
|
2409
2461
|
*
|
|
@@ -2413,7 +2465,7 @@ export declare class LocalHistoryStrategy implements IHistoryStrategy {
|
|
|
2413
2465
|
* blocks keep their incremental highlighting sessions.
|
|
2414
2466
|
*/
|
|
2415
2467
|
export declare class MarkdownParser {
|
|
2416
|
-
parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
|
|
2468
|
+
parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit, options?: MarkdownParseOptions): DocumentAstNode;
|
|
2417
2469
|
}
|
|
2418
2470
|
|
|
2419
2471
|
/** A semantic syntax marker (heading `#`, fences, brackets, list bullet, …). */
|
|
@@ -2609,6 +2661,11 @@ export declare const moveLinesDown: EditCommand;
|
|
|
2609
2661
|
|
|
2610
2662
|
export declare const moveLinesUp: EditCommand;
|
|
2611
2663
|
|
|
2664
|
+
export declare interface NativeClipboardData {
|
|
2665
|
+
readonly text: string;
|
|
2666
|
+
readonly files: readonly File[];
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2612
2669
|
/**
|
|
2613
2670
|
* Default strategy: handle the browser's native `copy`/`cut`/`paste` events,
|
|
2614
2671
|
* reading and writing the synchronous {@link ClipboardEvent.clipboardData}.
|
|
@@ -2780,6 +2837,22 @@ export declare class Point2D {
|
|
|
2780
2837
|
translate(dx: number, dy: number): Point2D;
|
|
2781
2838
|
}
|
|
2782
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
|
+
|
|
2783
2856
|
/**
|
|
2784
2857
|
* Immutable axis-aligned rectangle in a caller-defined 2D CSS-pixel coordinate
|
|
2785
2858
|
* space. `x`/`y` is the top-left corner, growing right/down.
|
|
@@ -2815,6 +2888,89 @@ declare interface RemovedItem {
|
|
|
2815
2888
|
readonly deletedLocal: readonly AnnotatedRange[];
|
|
2816
2889
|
}
|
|
2817
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
|
+
|
|
2818
2974
|
declare interface ReplacedItem {
|
|
2819
2975
|
readonly kind: 'replaced';
|
|
2820
2976
|
readonly original: AstNode;
|
|
@@ -3049,6 +3205,83 @@ declare class StrongViewData {
|
|
|
3049
3205
|
constructor(ast: StrongAstNode, content: readonly AnyViewData[]);
|
|
3050
3206
|
}
|
|
3051
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
|
+
|
|
3052
3285
|
export declare type TabKeyboardAction = 'insert' | 'outdent';
|
|
3053
3286
|
|
|
3054
3287
|
export declare class TableAstNode extends BlockAstNodeBase {
|
|
@@ -3113,10 +3346,10 @@ declare class TableViewData {
|
|
|
3113
3346
|
}
|
|
3114
3347
|
|
|
3115
3348
|
/**
|
|
3116
|
-
* 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]`/`[ ]`/`[]`
|
|
3117
3350
|
* checkbox, or `undefined` when the item is not a task item. The checkbox is
|
|
3118
3351
|
* plain glue in the AST, so a host that wants to toggle it locates the literal
|
|
3119
|
-
*
|
|
3352
|
+
* checkbox token here.
|
|
3120
3353
|
*/
|
|
3121
3354
|
export declare function taskCheckboxRange(item: ListItemAstNode): OffsetRange | undefined;
|
|
3122
3355
|
|
|
@@ -3140,6 +3373,7 @@ declare class TextViewData {
|
|
|
3140
3373
|
* {@link isRunnerMarkerText} has matched this node. Zero otherwise.
|
|
3141
3374
|
*/
|
|
3142
3375
|
readonly hiddenPrefixLength: number;
|
|
3376
|
+
readonly taskLabel: boolean;
|
|
3143
3377
|
readonly kind = "text";
|
|
3144
3378
|
/**
|
|
3145
3379
|
* Whether non-obvious whitespace in this text is revealed (block is active).
|
|
@@ -3155,7 +3389,7 @@ declare class TextViewData {
|
|
|
3155
3389
|
* mandatory leading separator, once
|
|
3156
3390
|
* {@link isRunnerMarkerText} has matched this node. Zero otherwise.
|
|
3157
3391
|
*/
|
|
3158
|
-
hiddenPrefixLength?: number);
|
|
3392
|
+
hiddenPrefixLength?: number, taskLabel?: boolean);
|
|
3159
3393
|
}
|
|
3160
3394
|
|
|
3161
3395
|
export declare class ThematicBreakAstNode extends BlockAstNodeBase {
|