@vscode/markdown-editor 0.0.2-83 → 0.0.2-84
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 +33 -105
- package/dist/index.js +1705 -2171
- package/dist/index.js.map +1 -1
- package/dist/markdown-editor.css +1 -1
- package/package.json +5 -7
- package/src/contrib/comments/commentInput.css +37 -98
- package/src/contrib/comments/commentWidget.css +60 -0
- package/src/contrib/comments/comments.css +0 -129
- package/src/contrib/commentsVscode/vscodeCommentWidgetV2.css +0 -171
package/dist/index.d.ts
CHANGED
|
@@ -386,16 +386,10 @@ declare interface Comment_2 {
|
|
|
386
386
|
export { Comment_2 as Comment }
|
|
387
387
|
|
|
388
388
|
/**
|
|
389
|
-
*
|
|
390
|
-
* textarea and a send button, styled after the gdocs/Word "add a comment"
|
|
391
|
-
* affordance.
|
|
389
|
+
* The compact editing state for a markdown comment.
|
|
392
390
|
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* wherever it likes and is responsible for placing it relative to a selection.
|
|
396
|
-
*
|
|
397
|
-
* State is observable-driven (no framework): {@link value} reflects the live
|
|
398
|
-
* textarea content; submit/cancel are reported through the option callbacks.
|
|
391
|
+
* The widget owns its DOM and draft state but not its position. The comment-mode
|
|
392
|
+
* controller mounts it next to the active selection.
|
|
399
393
|
*/
|
|
400
394
|
export declare class CommentInputWidget extends Disposable {
|
|
401
395
|
private readonly _options?;
|
|
@@ -406,27 +400,24 @@ export declare class CommentInputWidget extends Disposable {
|
|
|
406
400
|
private readonly _value;
|
|
407
401
|
/** Live, untrimmed textarea content. */
|
|
408
402
|
get value(): IObservable<string>;
|
|
409
|
-
/** The raw textarea, exposed so a host can move focus into it
|
|
403
|
+
/** The raw textarea, exposed so a host can move focus into it. */
|
|
410
404
|
get inputElement(): HTMLTextAreaElement;
|
|
411
405
|
constructor(_options?: CommentInputWidgetOptions | undefined);
|
|
412
|
-
/** Move focus into the textarea (caret at the end). */
|
|
413
406
|
focus(): void;
|
|
414
|
-
/** Replace the textarea content. */
|
|
415
407
|
setText(text: string): void;
|
|
416
|
-
/** Clear the textarea. */
|
|
417
408
|
clear(): void;
|
|
418
409
|
private _submit;
|
|
419
410
|
private _autoSize;
|
|
420
411
|
}
|
|
421
412
|
|
|
422
413
|
export declare interface CommentInputWidgetOptions {
|
|
423
|
-
/** Placeholder shown while the textarea is empty. Defaults to "Add
|
|
414
|
+
/** Placeholder shown while the textarea is empty. Defaults to "Add comment". */
|
|
424
415
|
readonly placeholder?: string;
|
|
425
416
|
/** Called after the textarea changes size. */
|
|
426
417
|
readonly onDidChangeSize?: () => void;
|
|
427
418
|
/**
|
|
428
|
-
* Called when the user submits a non-empty comment (Enter or the
|
|
429
|
-
*
|
|
419
|
+
* Called when the user submits a non-empty comment (Enter or the add button).
|
|
420
|
+
* The text is trimmed; never called with an empty string.
|
|
430
421
|
*/
|
|
431
422
|
readonly onSubmit?: (text: string) => void;
|
|
432
423
|
/** Called when the user dismisses the input (Escape). */
|
|
@@ -434,7 +425,7 @@ export declare interface CommentInputWidgetOptions {
|
|
|
434
425
|
}
|
|
435
426
|
|
|
436
427
|
/**
|
|
437
|
-
* Comment mode — a
|
|
428
|
+
* Comment mode — a compact "add a comment" affordance layered on top of
|
|
438
429
|
* the editor *without modifying it*. It reads the editor's public observables
|
|
439
430
|
* ({@link EditorModel.readonlyMode}, {@link EditorModel.selection}) and the
|
|
440
431
|
* exposed {@link EditorView.caretRect} geometry, and mounts a
|
|
@@ -502,20 +493,10 @@ export declare interface CommentModeControllerOptions {
|
|
|
502
493
|
readonly gap?: number;
|
|
503
494
|
}
|
|
504
495
|
|
|
505
|
-
/** Human-readable labels (for pickers / dropdowns). */
|
|
506
|
-
export declare const COMMENTS_DESIGN_LABELS: Record<CommentsDesign, string>;
|
|
507
|
-
|
|
508
|
-
/** design id → presenter factory over a shared CommentsModel + EditorView. */
|
|
509
|
-
export declare const COMMENTS_DESIGNS: Record<CommentsDesign, CommentsPresenterFactory>;
|
|
510
|
-
|
|
511
|
-
/** The available comment rendering designs. */
|
|
512
|
-
export declare type CommentsDesign = 'connected' | 'vscode' | 'vscode-v2';
|
|
513
|
-
|
|
514
496
|
/**
|
|
515
|
-
* Seedable store of {@link Comment}s for the comment-mode contribution.
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
* {@link comments}.
|
|
497
|
+
* Seedable store of {@link Comment}s for the comment-mode contribution. It has
|
|
498
|
+
* no opinion on rendering or persistence — a host seeds it via
|
|
499
|
+
* {@link set}/{@link add} and observes {@link comments}.
|
|
519
500
|
*/
|
|
520
501
|
export declare class CommentsModel {
|
|
521
502
|
private readonly _comments;
|
|
@@ -523,11 +504,6 @@ export declare class CommentsModel {
|
|
|
523
504
|
private _sequence;
|
|
524
505
|
/** The current comments, in insertion order. */
|
|
525
506
|
get comments(): IObservable<readonly Comment_2[]>;
|
|
526
|
-
/**
|
|
527
|
-
* The comment currently hovered (by its card or its highlight), or
|
|
528
|
-
* `undefined`. Shared so the card and the highlight can react together.
|
|
529
|
-
*/
|
|
530
|
-
readonly hoveredId: ISettableObservable<string | undefined>;
|
|
531
507
|
/** Replace the whole comment set. */
|
|
532
508
|
set(comments: readonly Comment_2[]): void;
|
|
533
509
|
/**
|
|
@@ -546,55 +522,41 @@ export declare class CommentsModel {
|
|
|
546
522
|
remove(id: string): void;
|
|
547
523
|
}
|
|
548
524
|
|
|
549
|
-
/** Optional, design-specific context a presenter may use (ignored by others). */
|
|
550
|
-
export declare interface CommentsPresenterContext {
|
|
551
|
-
/** Light/dark hint for the token-wrapped VS Code widget designs. */
|
|
552
|
-
readonly theme?: 'light' | 'dark';
|
|
553
|
-
/**
|
|
554
|
-
* Resolves a source offset to a 1-based line number, for designs that show
|
|
555
|
-
* line info (the VS Code V1 card). Optional because the model itself carries
|
|
556
|
-
* no text; the host (which owns the source) supplies it.
|
|
557
|
-
*/
|
|
558
|
-
readonly resolveLine?: (offset: number) => number;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/** Builds a presenter for a given model + editor view. */
|
|
562
|
-
export declare type CommentsPresenterFactory = (model: CommentsModel, view: EditorView, context?: CommentsPresenterContext) => ICommentsPresenter;
|
|
563
|
-
|
|
564
525
|
/** A comment the user submitted, with the source range it was anchored to. */
|
|
565
526
|
export declare interface CommentSubmission {
|
|
566
527
|
readonly text: string;
|
|
567
528
|
readonly range: OffsetRange;
|
|
568
529
|
}
|
|
569
530
|
|
|
570
|
-
/**
|
|
571
|
-
* Renders persistent comments as a gdocs-style side rail: each comment's range
|
|
572
|
-
* is highlighted (reusing the editor's selection geometry via
|
|
573
|
-
* {@link EditorView.rangeRects}), a leader line curves from the bottom of that
|
|
574
|
-
* highlight to a card stacked in the right rail, and cards never overlap.
|
|
575
|
-
*
|
|
576
|
-
* Everything is mounted into {@link EditorView.overlayContainer} so it shares
|
|
577
|
-
* the selection/caret coordinate space and scrolls with the document. When the
|
|
578
|
-
* editor's natural right margin is too narrow for the rail, the view reserves
|
|
579
|
-
* proportional space by padding the editor on the right — but only while there
|
|
580
|
-
* are comments.
|
|
581
|
-
*/
|
|
531
|
+
/** Displays posted comments beside their source ranges. */
|
|
582
532
|
export declare class CommentsView extends Disposable {
|
|
583
533
|
private readonly _model;
|
|
584
534
|
private readonly _view;
|
|
585
535
|
private readonly _layer;
|
|
586
536
|
private readonly _entries;
|
|
537
|
+
private _order;
|
|
538
|
+
private _pendingRevealCommentId;
|
|
587
539
|
constructor(_model: CommentsModel, _view: EditorView);
|
|
588
|
-
|
|
589
|
-
private _update;
|
|
590
|
-
/** Create/update/remove per-comment DOM to match `comments`. */
|
|
540
|
+
revealComment(id: string): void;
|
|
591
541
|
private _reconcile;
|
|
592
|
-
private
|
|
593
|
-
private
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
542
|
+
private _relayout;
|
|
543
|
+
private _revealPendingComment;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/** Compact posted state for a markdown comment. */
|
|
547
|
+
export declare class CommentWidget {
|
|
548
|
+
private readonly _domNode;
|
|
549
|
+
private readonly _disposables;
|
|
550
|
+
get element(): HTMLElement;
|
|
551
|
+
constructor(options: CommentWidgetOptions);
|
|
552
|
+
dispose(): void;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
export declare interface CommentWidgetOptions {
|
|
556
|
+
/** The posted comment body. */
|
|
557
|
+
readonly body: string;
|
|
558
|
+
/** If provided, shows a delete action and invokes it when activated. */
|
|
559
|
+
readonly onDelete?: () => void;
|
|
598
560
|
}
|
|
599
561
|
|
|
600
562
|
/** The lossless source slices of a complete block HTML comment. */
|
|
@@ -1902,9 +1864,6 @@ export declare interface IClipboardStrategy {
|
|
|
1902
1864
|
connect(context: IClipboardContext): IDisposable;
|
|
1903
1865
|
}
|
|
1904
1866
|
|
|
1905
|
-
/** A live rendering of a {@link CommentsModel}. Dispose to unmount it. */
|
|
1906
|
-
export declare type ICommentsPresenter = IDisposable;
|
|
1907
|
-
|
|
1908
1867
|
/** The Monarch language definitions the default highlighter wires up. */
|
|
1909
1868
|
export declare interface IDefaultMonarchGrammars {
|
|
1910
1869
|
typescript: unknown;
|
|
@@ -2931,29 +2890,6 @@ export declare interface SourceEditEvent {
|
|
|
2931
2890
|
|
|
2932
2891
|
export declare type SourceOffset = number;
|
|
2933
2892
|
|
|
2934
|
-
export declare abstract class StackedCommentsPresenter extends Disposable implements ICommentsPresenter {
|
|
2935
|
-
protected readonly model: CommentsModel;
|
|
2936
|
-
protected readonly view: EditorView;
|
|
2937
|
-
protected readonly context?: CommentsPresenterContext | undefined;
|
|
2938
|
-
private readonly _layer;
|
|
2939
|
-
private readonly _entries;
|
|
2940
|
-
private _order;
|
|
2941
|
-
private _pendingRevealCommentId;
|
|
2942
|
-
constructor(model: CommentsModel, view: EditorView, context?: CommentsPresenterContext | undefined);
|
|
2943
|
-
/** Build the card DOM for a comment. Called once per new comment. */
|
|
2944
|
-
protected abstract createWidget(comment: Comment_2): StackWidget;
|
|
2945
|
-
revealComment(id: string): void;
|
|
2946
|
-
private _reconcile;
|
|
2947
|
-
private _relayout;
|
|
2948
|
-
private _revealPendingComment;
|
|
2949
|
-
}
|
|
2950
|
-
|
|
2951
|
-
/** The minimal widget contract a subclass must produce. */
|
|
2952
|
-
export declare interface StackWidget {
|
|
2953
|
-
readonly element: HTMLElement;
|
|
2954
|
-
dispose(): void;
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
2893
|
export declare class StrikethroughAstNode extends AstNode {
|
|
2958
2894
|
readonly openMarker: MarkerAstNode;
|
|
2959
2895
|
readonly content: readonly (InlineAstNode | GlueAstNode)[];
|
|
@@ -3552,14 +3488,6 @@ export declare const vscodeKeyboardProfile: KeyboardProfile;
|
|
|
3552
3488
|
|
|
3553
3489
|
export declare const vscodeLocalKeyboardProfile: KeyboardProfile;
|
|
3554
3490
|
|
|
3555
|
-
export declare class VscodeStackedCommentsView extends StackedCommentsPresenter {
|
|
3556
|
-
protected createWidget(comment: Comment_2): StackWidget;
|
|
3557
|
-
}
|
|
3558
|
-
|
|
3559
|
-
export declare class VsCodeV2CommentsView extends StackedCommentsPresenter {
|
|
3560
|
-
protected createWidget(comment: Comment_2): StackWidget;
|
|
3561
|
-
}
|
|
3562
|
-
|
|
3563
3491
|
export declare interface WordNavigationConfig {
|
|
3564
3492
|
readonly wordSeparators: string;
|
|
3565
3493
|
readonly wordSegmenterLocales: readonly string[];
|