@vscode/markdown-editor 0.0.2-39 → 0.0.2-40
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 +67 -1
- package/dist/index.js +1151 -1041
- package/dist/index.js.map +1 -1
- package/dist/{stringEdit-DzLs4E1d.js → stringEdit-CVDbCUBY.js} +85 -47
- package/dist/stringEdit-CVDbCUBY.js.map +1 -0
- package/dist/web-editors.d.ts +5 -0
- package/dist/web-editors.js +1 -1
- package/package.json +1 -1
- package/dist/stringEdit-DzLs4E1d.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -875,6 +875,7 @@ export declare class EditorController extends Disposable {
|
|
|
875
875
|
private _desiredColumn;
|
|
876
876
|
private readonly _keyboardPlatform;
|
|
877
877
|
private readonly _keyboardProfile;
|
|
878
|
+
private readonly _historyStrategy;
|
|
878
879
|
/** Running click count for the current multi-click sequence (1, 2, 3, …). */
|
|
879
880
|
private _clickCount;
|
|
880
881
|
/** Timestamp and position of the previous pointer-down, for multi-click detection. */
|
|
@@ -886,6 +887,7 @@ export declare class EditorController extends Disposable {
|
|
|
886
887
|
private _makeVisualCursorContext;
|
|
887
888
|
private _executeCursorCommand;
|
|
888
889
|
private _executeEditCommand;
|
|
890
|
+
private _runUndoableEdit;
|
|
889
891
|
private _executeVisualCursorCommand;
|
|
890
892
|
/** Move the cursor down one visual line (Arrow Down). */
|
|
891
893
|
cursorDown(extend?: boolean): void;
|
|
@@ -930,6 +932,12 @@ export declare interface EditorControllerOptions {
|
|
|
930
932
|
* strategy (e.g. `AsyncClipboardStrategy`) in hosts that swallow them.
|
|
931
933
|
*/
|
|
932
934
|
readonly clipboardStrategy?: IClipboardStrategy;
|
|
935
|
+
/**
|
|
936
|
+
* Where undo and redo are executed: `LocalHistoryStrategy` for a
|
|
937
|
+
* self-contained editor, or a strategy that forwards to the host's own
|
|
938
|
+
* document history. Left unset, the chords are passed on to the host.
|
|
939
|
+
*/
|
|
940
|
+
readonly historyStrategy?: IHistoryStrategy;
|
|
933
941
|
readonly keyboardPlatform?: KeyboardPlatform;
|
|
934
942
|
readonly keyboardProfile?: KeyboardProfile;
|
|
935
943
|
}
|
|
@@ -969,6 +977,9 @@ export declare type EditorKeyboardAction = {
|
|
|
969
977
|
} | {
|
|
970
978
|
readonly kind: 'edit';
|
|
971
979
|
readonly command: EditKeyboardAction;
|
|
980
|
+
} | {
|
|
981
|
+
readonly kind: 'history';
|
|
982
|
+
readonly command: HistoryKeyboardAction;
|
|
972
983
|
} | {
|
|
973
984
|
readonly kind: 'selectAll';
|
|
974
985
|
} | {
|
|
@@ -1094,6 +1105,12 @@ export declare class EditorModel {
|
|
|
1094
1105
|
}): void;
|
|
1095
1106
|
/** Discard the pending paragraph (if any) without touching the source. */
|
|
1096
1107
|
cancelPendingParagraph(): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Replace the source with an authoritative value from the host, mapping the
|
|
1110
|
+
* selection through the changed span and atomically discarding transient
|
|
1111
|
+
* state anchored to the previous parse.
|
|
1112
|
+
*/
|
|
1113
|
+
replaceSourceText(text: StringValue): void;
|
|
1097
1114
|
/**
|
|
1098
1115
|
* Turn the pending paragraph into real source: rewrite its gap so the typed
|
|
1099
1116
|
* `text` becomes its own paragraph, separated from its neighbours by blank
|
|
@@ -1478,6 +1495,8 @@ declare class HeadingViewData {
|
|
|
1478
1495
|
|
|
1479
1496
|
export declare function hiddenCursorRanges(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, cursor: number): readonly OffsetRange[];
|
|
1480
1497
|
|
|
1498
|
+
declare type HistoryKeyboardAction = 'undo' | 'redo';
|
|
1499
|
+
|
|
1481
1500
|
/**
|
|
1482
1501
|
* The editor operations a clipboard strategy drives. The strategy never
|
|
1483
1502
|
* touches the model or the DOM directly — it asks through this seam, so the
|
|
@@ -1577,6 +1596,22 @@ declare interface IEmbeddedCodeEditorFactory {
|
|
|
1577
1596
|
create(language: string, initialContent: string): IEmbeddedCodeEditor | undefined;
|
|
1578
1597
|
}
|
|
1579
1598
|
|
|
1599
|
+
/**
|
|
1600
|
+
* Routes undo and redo to whatever owns the document's history: the editor
|
|
1601
|
+
* itself on a standalone page, or the enclosing document in a host like
|
|
1602
|
+
* VS Code.
|
|
1603
|
+
*/
|
|
1604
|
+
export declare interface IHistoryStrategy {
|
|
1605
|
+
undo(): void;
|
|
1606
|
+
redo(): void;
|
|
1607
|
+
/**
|
|
1608
|
+
* Invoked around each source mutation so the strategy can record it.
|
|
1609
|
+
* Implemented only by strategies that build their own history; a host that
|
|
1610
|
+
* forwards edits to a VS Code `TextDocument` lets it record them instead.
|
|
1611
|
+
*/
|
|
1612
|
+
record?(operation: () => void, edit?: StringEdit): void;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1580
1615
|
export declare class ImageAstNode extends AstNode {
|
|
1581
1616
|
readonly alt: string;
|
|
1582
1617
|
readonly url: string;
|
|
@@ -1851,6 +1886,32 @@ declare class ListViewData {
|
|
|
1851
1886
|
constructor(ast: ListAstNode, content: readonly AnyViewData[]);
|
|
1852
1887
|
}
|
|
1853
1888
|
|
|
1889
|
+
/**
|
|
1890
|
+
* Compact in-memory history for editors that hold the only copy of the
|
|
1891
|
+
* document, such as a standalone browser page. Where the surrounding host
|
|
1892
|
+
* already records history — a VS Code `TextDocument` — forward to that
|
|
1893
|
+
* instead.
|
|
1894
|
+
*/
|
|
1895
|
+
export declare class LocalHistoryStrategy implements IHistoryStrategy {
|
|
1896
|
+
private readonly _model;
|
|
1897
|
+
private readonly _past;
|
|
1898
|
+
private readonly _future;
|
|
1899
|
+
/**
|
|
1900
|
+
* The source text as of the last change this strategy recorded or applied.
|
|
1901
|
+
* Any other value means the document was replaced behind its back, so the
|
|
1902
|
+
* stored edits no longer line up and must be discarded rather than applied.
|
|
1903
|
+
*/
|
|
1904
|
+
private _lastKnownText;
|
|
1905
|
+
constructor(_model: EditorModel);
|
|
1906
|
+
record(operation: () => void, edit?: StringEdit): void;
|
|
1907
|
+
undo(): void;
|
|
1908
|
+
redo(): void;
|
|
1909
|
+
/** The entry on top of `stack`, or `undefined` when it cannot be applied. */
|
|
1910
|
+
private _peekApplicable;
|
|
1911
|
+
private _apply;
|
|
1912
|
+
private _clear;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1854
1915
|
/**
|
|
1855
1916
|
* Parses markdown into a {@link DocumentAstNode}.
|
|
1856
1917
|
*
|
|
@@ -2126,7 +2187,7 @@ declare class ParagraphViewData {
|
|
|
2126
2187
|
/**
|
|
2127
2188
|
* A *transient* editing state: the empty paragraph the user conjured by
|
|
2128
2189
|
* pressing Enter at the end of a paragraph. Markdown has no empty-paragraph
|
|
2129
|
-
* node, so this never lives in {@link EditorModel
|
|
2190
|
+
* node, so this never lives in {@link EditorModel['sourceText']} or the parsed
|
|
2130
2191
|
* {@link EditorModel.document} — it is pure edit intent that the view renders
|
|
2131
2192
|
* as a synthetic blank line and that the controller either *materializes* (the
|
|
2132
2193
|
* user types) or *cancels* (the user navigates away / backspaces).
|
|
@@ -2401,6 +2462,11 @@ export declare class StringReplacement {
|
|
|
2401
2462
|
constructor(replaceRange: OffsetRange, newText: string);
|
|
2402
2463
|
get isEmpty(): boolean;
|
|
2403
2464
|
equals(other: StringReplacement): boolean;
|
|
2465
|
+
/**
|
|
2466
|
+
* Narrows this replacement to the span that actually changes, by trimming
|
|
2467
|
+
* the prefix and suffix it shares with the text it replaces in `source`.
|
|
2468
|
+
*/
|
|
2469
|
+
removeCommonSuffixPrefix(source: string): StringReplacement;
|
|
2404
2470
|
toString(): string;
|
|
2405
2471
|
}
|
|
2406
2472
|
|