@vscode/markdown-editor 0.0.2-103 → 0.0.2-104

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 CHANGED
@@ -24,7 +24,7 @@ declare interface AnnotatedRange {
24
24
  }
25
25
 
26
26
  /** 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 | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode | UnhandledBlockAstNode;
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
28
 
29
29
  declare type AnyViewData = DocumentViewData | BlockViewData | InlineViewData | ListItemViewData | TableRowViewData | TableCellViewData | MarkerViewData | GlueViewData | DiffHunkViewData | DiffDecorationViewData;
30
30
 
@@ -89,7 +89,7 @@ export declare class AsyncClipboardStrategy implements IClipboardStrategy {
89
89
  connect(context: IClipboardContext): IDisposable;
90
90
  }
91
91
 
92
- export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode | UnhandledBlockAstNode;
92
+ export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode | UnhandledBlockAstNode;
93
93
 
94
94
  /**
95
95
  * A block-level node. Every block may carry a {@link leadingTrivia} glue — the
@@ -166,7 +166,7 @@ declare class BlockQuoteViewData {
166
166
  */
167
167
  export declare function blocksIntersecting(doc: DocumentAstNode, start: SourceOffset, endExclusive: SourceOffset): BlockAstNode[];
168
168
 
169
- declare type BlockViewData = HeadingViewData | ParagraphViewData | FrontMatterViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | BlockQuoteViewData | ListViewData | TableViewData | UnhandledBlockViewData;
169
+ declare type BlockViewData = HeadingViewData | ParagraphViewData | FrontMatterViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | VideoViewData | BlockQuoteViewData | ListViewData | TableViewData | UnhandledBlockViewData;
170
170
 
171
171
  /**
172
172
  * Base view node for everything the editor renders, generic over the
@@ -218,6 +218,8 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
218
218
  export declare interface BlockViewOptions {
219
219
  readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
220
220
  readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
221
+ /** Temporarily yields the host editor's text input while a nested control owns focus. */
222
+ readonly suspendEditContextWhileFocused?: (element: HTMLElement) => IDisposable;
221
223
  /**
222
224
  * Supplies live, declarative metadata for recognized links. The editor owns
223
225
  * the markup and styling; providers own lookup, caching, and updates.
@@ -1270,6 +1272,7 @@ export declare class EditorView extends Disposable {
1270
1272
  */
1271
1273
  private readonly _document;
1272
1274
  private readonly _embeddedCodeEditorFactoryVersion;
1275
+ private readonly _suspendEditContextForBlockControl;
1273
1276
  /** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
1274
1277
  get documentViewNode(): IObservable<DocumentViewNode | undefined>;
1275
1278
  /** Re-resolves embedded code editors while preserving the surrounding editor view. */
@@ -1440,6 +1443,7 @@ export declare class EditorView extends Disposable {
1440
1443
  * original block. Honours {@link geometricHitTest}.
1441
1444
  */
1442
1445
  resolveOffsetFromPoint(point: Point2D): SourceOffset | undefined;
1446
+ private _resolveControlFreeVideoOffset;
1443
1447
  /**
1444
1448
  * Resolve table-cell hits that have no measurable text run. Empty cells map
1445
1449
  * from their own box instead of snapping to a neighboring cell; element-only
@@ -2110,6 +2114,8 @@ export declare const insertParagraph: EditCommand;
2110
2114
  * elsewhere split into two paragraphs (`\n\n`).
2111
2115
  * - fenced code / front matter — insert a newline that preserves the current
2112
2116
  * line's indentation, staying inside the fences.
2117
+ * - video — leave the completed HTML block at its end; otherwise insert a
2118
+ * normal source line break.
2113
2119
  * - block quote — continue the quote (`\n> `); an empty quote line exits it.
2114
2120
  * - list — continue the list with the next marker (incrementing ordered
2115
2121
  * numbers, re-emitting task checkboxes); an empty item outdents one level
@@ -3226,6 +3232,49 @@ declare class UnhandledBlockViewData {
3226
3232
  constructor(ast: UnhandledBlockAstNode, showMarkup: boolean, content: readonly AnyViewData[]);
3227
3233
  }
3228
3234
 
3235
+ /**
3236
+ * A standalone HTML `<video>` whose source can be rendered without executing
3237
+ * arbitrary raw HTML. Its exact HTML remains in `content`, so activating the
3238
+ * block restores the original source for editing.
3239
+ */
3240
+ export declare class VideoAstNode extends BlockAstNodeBase {
3241
+ readonly attributes: VideoAttributes;
3242
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
3243
+ readonly leadingTrivia?: GlueAstNode | undefined;
3244
+ readonly kind = "video";
3245
+ constructor(attributes: VideoAttributes, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
3246
+ get children(): readonly AstNode[];
3247
+ get source(): MarkerAstNode | undefined;
3248
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
3249
+ withLeadingTrivia(trivia: GlueAstNode | undefined): VideoAstNode;
3250
+ protected _localEquals(o: this): boolean;
3251
+ }
3252
+
3253
+ /** The supported semantic attributes of a standalone HTML `<video>` block. */
3254
+ export declare interface VideoAttributes {
3255
+ readonly src: string;
3256
+ readonly title?: string;
3257
+ readonly autoplay: boolean;
3258
+ readonly controls: boolean;
3259
+ readonly loop: boolean;
3260
+ readonly muted: boolean;
3261
+ }
3262
+
3263
+ declare class VideoViewData {
3264
+ readonly ast: VideoAstNode;
3265
+ /** Active: reveal the exact HTML source; inactive: render the native video. */
3266
+ readonly showMarkup: boolean;
3267
+ readonly content: readonly AnyViewData[];
3268
+ /** Nested diff state; top-level video diff state lives on the document child. */
3269
+ readonly diffKind?: "added" | "modified" | undefined;
3270
+ readonly kind = "video";
3271
+ constructor(ast: VideoAstNode,
3272
+ /** Active: reveal the exact HTML source; inactive: render the native video. */
3273
+ showMarkup: boolean, content: readonly AnyViewData[],
3274
+ /** Nested diff state; top-level video diff state lives on the document child. */
3275
+ diffKind?: "added" | "modified" | undefined);
3276
+ }
3277
+
3229
3278
  /**
3230
3279
  * Immutable view of an AST node. Pairs `ast` with its rendered `dom` and a
3231
3280
  * mirror of `ast.children` as ViewNode children. Source offsets are NEVER