@vscode/markdown-editor 0.0.2-130 → 0.0.2-131
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
CHANGED
|
@@ -39,12 +39,19 @@ Full view fills the visible Markdown viewport, keeps the same iframe alive,
|
|
|
39
39
|
and restores the previous width mode, inline height, and scroll position on exit.
|
|
40
40
|
The host toolbar groups copy and presentation actions in a compact, themed Codicon
|
|
41
41
|
overlay. It appears on hover or keyboard focus without reserving a header row,
|
|
42
|
-
|
|
42
|
+
alongside a rounded border around the iframe and its resize grip. These use the
|
|
43
|
+
same 4px frame and 6px toolbar radii as the Mermaid preview controls.
|
|
44
|
+
The toolbar and border fade in and out over 200ms with `ease-in-out`, matching
|
|
45
|
+
Markdown preview. Reduced-motion preferences disable these transitions.
|
|
46
|
+
The toolbar always provides an exit button in full view. Escape also exits when handled
|
|
43
47
|
by the injected iframe bootstrap (nested remote pages can use the message below).
|
|
44
48
|
Resize handles support pointer capture and Arrow Up/Down. After a user resize,
|
|
45
49
|
content-size reports no longer override the chosen height; **Automatic height**
|
|
46
50
|
returns control to the content. Full view always uses the host viewport height.
|
|
47
51
|
Presentation changes never edit the Markdown source.
|
|
52
|
+
The host iframe uses the page theme's background in every presentation mode.
|
|
53
|
+
Guest HTML can remain transparent to show that color without revealing the
|
|
54
|
+
Markdown document behind it in full view.
|
|
48
55
|
|
|
49
56
|
Cooperative pages can advertise the same preferences with
|
|
50
57
|
`parent.postMessage({ type: 'vscode-markdown-editor::presentation', preferences }, '*')`.
|
|
@@ -68,6 +75,14 @@ viewports. Their light/dark Playwright tests exercise scaled-preview alignment,
|
|
|
68
75
|
drag capture, minimum height, size-report precedence, full-width
|
|
69
76
|
and full-view geometry, mode notifications, state retention, and restoration.
|
|
70
77
|
|
|
78
|
+
**Red editor (hover)** and **Transparent editor (hover)** default the `mockHover`
|
|
79
|
+
fixture input to true for deterministic visual verification. This sets
|
|
80
|
+
`data-md-iframe-hover="true"` on the fixture container, exercising the same chrome
|
|
81
|
+
visibility rules as real hover/focus without moving the pointer. Set the input
|
|
82
|
+
to false to test natural hover behavior.
|
|
83
|
+
The `animations` fixture input defaults to false for stable screenshots. Set it
|
|
84
|
+
to true to exercise the production fades, with either real or mocked hover.
|
|
85
|
+
|
|
71
86
|
## Browser tests
|
|
72
87
|
|
|
73
88
|
`pnpm test:e2e` builds the fixture dependencies and runs the Playwright interaction
|
package/dist/web-editors.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ declare class PhysicalIframe implements IDisposable {
|
|
|
142
142
|
private _reportedHeight;
|
|
143
143
|
private _disposed;
|
|
144
144
|
private readonly _onWindowMessage;
|
|
145
|
+
private readonly _surface;
|
|
145
146
|
private readonly _toolbar;
|
|
146
147
|
private readonly _fullWidthButton;
|
|
147
148
|
private readonly _fullViewButton;
|
package/dist/web-editors.js
CHANGED
|
@@ -7323,9 +7323,9 @@ class Fl {
|
|
|
7323
7323
|
}
|
|
7324
7324
|
class Dl {
|
|
7325
7325
|
constructor(e, n, r, i, o, s, a, c) {
|
|
7326
|
-
this._descriptor = n, this._hostTransport = r, this._frameRoot = o, this._scriptNonce = s, this._themeCss = a, this._iframeBootstrapUrl = c, this.pool = e;
|
|
7326
|
+
this._descriptor = n, this._hostTransport = r, this._frameRoot = o, this._scriptNonce = s, this._themeCss = a, this._iframeBootstrapUrl = c, this.pool = e, this._surface = document.createElement("div"), this._surface.className = "md-iframe-surface";
|
|
7327
7327
|
const u = document.createElement("iframe");
|
|
7328
|
-
u.setAttribute("sandbox", Wr(n.sandbox)), u.setAttribute("allow", n.sandbox?.clipboardWrite ? "clipboard-write" : ""), u.style.width = "100%", u.style.border = "none", u.style.display = "block", u.style.position = "absolute", u.style.pointerEvents = "auto", u.style.background = "
|
|
7328
|
+
u.setAttribute("sandbox", Wr(n.sandbox)), u.setAttribute("allow", n.sandbox?.clipboardWrite ? "clipboard-write" : ""), u.style.width = "100%", u.style.border = "none", u.style.display = "block", u.style.position = "absolute", u.style.pointerEvents = "auto", u.style.background = "var(--md-iframe-background, #fff)", u.style.height = `${n.initialHeight ?? 120}px`, e.park(u), u.addEventListener("blur", () => {
|
|
7329
7329
|
const d = this.editor;
|
|
7330
7330
|
d && !d.visible && this.pool.release(d);
|
|
7331
7331
|
}), this.iframe = u, u.className = "md-iframe-frame", this._toolbar = document.createElement("div"), this._toolbar.className = "md-iframe-toolbar", this._toolbar.setAttribute("data-md-editor-chrome", ""), this._toolbar.setAttribute("role", "toolbar"), this._toolbar.setAttribute("aria-label", "Embedded editor presentation"), this._resetHeightButton = this._addButton("Automatic height", "discard", () => this.editor?.resetHeight()), this._fullWidthButton = this._addButton("Full width", "arrow-both", () => this.editor?.toggleFullWidth()), this._fullViewButton = this._addButton("Full view", "screen-full", () => this.editor?.toggleFullView()), this._toolbar.addEventListener("keydown", (d) => {
|
|
@@ -7358,7 +7358,7 @@ class Dl {
|
|
|
7358
7358
|
return;
|
|
7359
7359
|
}
|
|
7360
7360
|
l?.type !== Xe || typeof l.height != "number" || !Number.isFinite(l.height) || this._applyReportedHeight(l.height);
|
|
7361
|
-
}, window.addEventListener("message", this._onWindowMessage),
|
|
7361
|
+
}, window.addEventListener("message", this._onWindowMessage), this._surface.append(u, this._toolbar, this._resizeHandle), i.appendChild(this._surface), this._surface.hidden = !0, this._toolbar.hidden = !0, this._resizeHandle.hidden = !0, queueMicrotask(() => this._setup());
|
|
7362
7362
|
}
|
|
7363
7363
|
iframe;
|
|
7364
7364
|
editor;
|
|
@@ -7369,6 +7369,7 @@ class Dl {
|
|
|
7369
7369
|
_reportedHeight;
|
|
7370
7370
|
_disposed = !1;
|
|
7371
7371
|
_onWindowMessage;
|
|
7372
|
+
_surface;
|
|
7372
7373
|
_toolbar;
|
|
7373
7374
|
_fullWidthButton;
|
|
7374
7375
|
_fullViewButton;
|
|
@@ -7390,7 +7391,7 @@ class Dl {
|
|
|
7390
7391
|
return;
|
|
7391
7392
|
e.exitFullView(), this._endResize();
|
|
7392
7393
|
const n = e.estimateHeight();
|
|
7393
|
-
this.editor = void 0, e.mountActions(), e.unbindFrame(n), this.pool.park(this.iframe), this._toolbar.hidden = !0, this._resizeHandle.hidden = !0;
|
|
7394
|
+
this.editor = void 0, e.mountActions(), e.unbindFrame(n), this.pool.park(this.iframe), this._surface.hidden = !0, this._toolbar.hidden = !0, this._resizeHandle.hidden = !0;
|
|
7394
7395
|
}
|
|
7395
7396
|
layout(e) {
|
|
7396
7397
|
if (this.editor !== e)
|
|
@@ -7399,8 +7400,10 @@ class Dl {
|
|
|
7399
7400
|
this._frameRoot,
|
|
7400
7401
|
s.left - (i ? 0 : r.left),
|
|
7401
7402
|
(o ? s.top : n.top) - (i ? 0 : r.top)
|
|
7402
|
-
), c = st(this._frameRoot, s.width, s.height), u = a.y + (i ? window.scrollY : this._frameRoot.scrollTop), d = a.x + (i ? window.scrollX : this._frameRoot.scrollLeft), l = c.x, h = o ? Math.max(1, c.y) : e.inlineHeight
|
|
7403
|
-
this.
|
|
7403
|
+
), c = st(this._frameRoot, s.width, s.height), u = a.y + (i ? window.scrollY : this._frameRoot.scrollTop), d = a.x + (i ? window.scrollX : this._frameRoot.scrollLeft), l = c.x, h = o ? Math.max(1, c.y) : e.inlineHeight;
|
|
7404
|
+
this._surface.hidden = !1, this._surface.style.top = `${u}px`, this._surface.style.left = `${d}px`, this._surface.style.width = `${l}px`, this._surface.style.height = `${h + (o ? 0 : e.handleHeight)}px`, this._surface.style.zIndex = o ? "10" : "";
|
|
7405
|
+
const p = o ? "10" : "";
|
|
7406
|
+
this.iframe.style.zIndex = p, this._toolbar.style.zIndex = o ? "11" : "1", this._resizeHandle.style.zIndex = p, this.iframe.style.top = "0", this.iframe.style.left = "0", this.iframe.style.right = "", this.iframe.style.width = `${l}px`, this.iframe.style.height = `${h}px`, this._toolbar.hidden = e.toolbarHeight === 0, this._toolbar.classList.toggle("md-iframe-toolbar-full-view", o), e.mountActions(this._toolbar.hidden ? void 0 : this._toolbar), this._toolbar.style.top = "6px", this._toolbar.style.left = `${l - 6}px`, this._toolbar.style.maxWidth = `${Math.max(0, l - 12)}px`, this._toolbar.style.height = `${e.toolbarHeight}px`, this._fullWidthButton.hidden = !e.presentation.fullWidth || o, this._fullWidthButton.setAttribute("aria-pressed", String(e.mode === "full-width")), this._fullViewButton.hidden = !e.presentation.fullView, this._setButtonAppearance(this._fullViewButton, o ? "Exit full view" : "Full view", o ? "screen-normal" : "screen-full"), this._fullViewButton.setAttribute("aria-pressed", String(o)), this._resetHeightButton.hidden = !e.presentation.resizable || o, this._resizeHandle.hidden = !e.presentation.resizable || o, this._resizeHandle.style.top = `${h}px`, this._resizeHandle.style.left = "0", this._resizeHandle.style.width = `${l}px`, this._resizeHandle.style.height = `${e.handleHeight}px`, this._resizeHandle.setAttribute("aria-valuenow", String(Math.round(h))), this._resizeHandle.setAttribute("aria-valuemin", String(e.presentation.minHeight ?? 1)), this._resizeHandle.setAttribute("aria-valuemax", String(Ut));
|
|
7404
7407
|
}
|
|
7405
7408
|
get reportedHeight() {
|
|
7406
7409
|
return this._reportedHeight;
|
|
@@ -7441,7 +7444,7 @@ class Dl {
|
|
|
7441
7444
|
this._drag = void 0, this.editor && (this.editor.resizing = !1), this.iframe.style.pointerEvents = "auto", e && this._resizeHandle.hasPointerCapture(e.pointerId) && this._resizeHandle.releasePointerCapture(e.pointerId);
|
|
7442
7445
|
}
|
|
7443
7446
|
dispose() {
|
|
7444
|
-
this._disposed || (this._disposed = !0, this.unbind(), window.removeEventListener("message", this._onWindowMessage), this._host?.dispose(), this._transport?.dispose(), this._hostTransport?.dispose(), this.iframe.remove(), this._toolbar.remove(), this._resizeHandle.remove());
|
|
7447
|
+
this._disposed || (this._disposed = !0, this.unbind(), window.removeEventListener("message", this._onWindowMessage), this._host?.dispose(), this._transport?.dispose(), this._hostTransport?.dispose(), this.iframe.remove(), this._toolbar.remove(), this._resizeHandle.remove(), this._surface.remove());
|
|
7445
7448
|
}
|
|
7446
7449
|
_setup() {
|
|
7447
7450
|
if (this._disposed)
|