fix: preserve full editor width by mirroring Vditor's centering padding#167
Merged
zaaack merged 1 commit intoJul 20, 2026
Merged
Conversation
Vditor's setPadding() centers editable content by computing symmetric left/right padding as (containerWidth - preview.maxWidth) / 2, applied as an inline style. We already override padding-left to a fixed 35px to leave room for our own gutter/toolbar, but without a matching padding-right override, wide viewports kept vditor's large computed right-padding, leaving a big unused gap on the right side of the editor (most visible with wide tables/content). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d05628eb-b7db-49a9-a409-45afa11d4cce
Author
|
@zaaack pls take a look at this PR :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On wide viewports, the editor content (and wide tables) only used about 2/3 of the available width, leaving a large unused gap on the right.
Root cause
Vditor's internal
setPadding()computes symmetric centering padding as(containerWidth - options.preview.maxWidth) / 2(maxWidth defaults to 800) and applies it as an inline style, e.g.padding: 10px 437.5px. This extension'smain.cssalready overrodepadding-leftto a fixed35px !important(to make room for the custom line-number gutter) but never overrodepadding-right, leaving Vditor's large computed right-padding in place on wide viewports.Fix
Added
padding-right: 35px !important;to the.vditor-resetrule inmedia-src/src/main.css, mirroring the existingpadding-leftoverride, so the content area uses the full available width symmetrically.Testing
npx tsc -p ./ --noEmitpasses with no errors.