From 0d3506a51c9e311a99bbdbbac34718927427afb6 Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Mon, 10 Aug 2026 23:22:15 +0000 Subject: [PATCH] fix: alignment means nothing to a frame that is its whole line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Probed: an as-char frame alone in a paragraph makes a line exactly as tall as itself whatever style:vertical-pos/-rel says — only from-top's offset still lengthens it. The node view cannot see its siblings, so the block's class overrides the alignment it wrote. --- src/lib/editor/extensions/image.ts | 3 +++ src/styles/editor.css | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/editor/extensions/image.ts b/src/lib/editor/extensions/image.ts index 5ff6ee6..5e7108e 100644 --- a/src/lib/editor/extensions/image.ts +++ b/src/lib/editor/extensions/image.ts @@ -368,6 +368,9 @@ class ImageView { this.dom.style.height = `${bh}px`; this.dom.style.verticalAlign = inlineVerticalAlign(this.node.attrs.vAlign, bh, this.node.attrs.wrapOffsetY); + // A frame alone on its line is the whole line, so where it sits against a baseline + // no longer means anything — except an offset, which still lengthens the line. + this.dom.dataset.vAlign = String(this.node.attrs.vAlign ?? ''); } else { this.rotor.style.width = ''; this.rotor.style.height = ''; diff --git a/src/styles/editor.css b/src/styles/editor.css index a9028b5..4996c8f 100644 --- a/src/styles/editor.css +++ b/src/styles/editor.css @@ -279,10 +279,11 @@ vertical-align: baseline; line-height: 0; } -/* Alone on its line (image.ts marks the block) the frame sets the line height by - itself: no descent hangs below it, so it sits on the line bottom, not the baseline. */ -.paper .tiptap .image-line .image-node { - vertical-align: bottom; +/* Alone on its line (image.ts marks the block) the frame sets the line height by itself: + no descent hangs below it, and every vertical-pos but `offset` is moot (probed). Beats + the node view's own inline alignment, which has no other way to know. */ +.paper .tiptap .image-line .image-node:not([data-v-align='offset']) { + vertical-align: bottom !important; } /* While selected, lift the node (and its handles) above the header/footer layer (z-index 22) so a rotate/resize handle poking into a margin stays grabbable. */