Repository navigation
Conversation
Collaborator
|
@CodFrm 誤刪?? |
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.
Checklist / 检查清单
N/A — Fixes mentioned issues: no issue was filed. The problem was spotted while publishing an announcement.
Description / 描述
The popup renders the announcement from
ext.scriptcat.orgas HTML. The admin sanitizer allowsp,br,strong,em,a,ul,ol,li,preandcode. Tailwind's preflight strips the default styling of all of them, so an announcement with several paragraphs, a command and a link shows up as one dense block. The link looks like plain text,<code>has no background, and lists have no bullets.This PR adds descendant styles to the notice container. The approach follows the
[&_a]:…patternPopupWarningsalready uses for its HTML. It only uses existing tokens (text-primary,bg-background,font-mono), so light and dark themes both work:[&>*+*]:mt-1.5;text-primary, underlined;bg-background, rounded, mono;pre: padded block that scrolls horizontally;ul/ol: bullets and numbers.The change is in one file,
src/pages/popup/App.tsx, and only touches the className. Behavior does not change.Verification
This is a pure visual change, so I verified it by eye (per
develop-testing.md§ When TDD doesn't apply) and did not add a test. I built the extension withpnpm build, then rendered the notice fragment with the builtchunk.css, the same DOM and classes and a 360px width, in light and dark themes. I compared two contents: the announcement currently live (paragraph with an inline link) and a sample using every allowed tag. Before the change, paragraphs, code and the link were not distinguishable. After it, each one is.Tests:
pnpm vitest run src/pages/popup/sometimes fails with the same 17 failures inpreload.test.tsandusePopupData.test.ts. The flake also happens onmainwithout this change (1 of 3 runs onmain, 2 of 3 with the change), and runningusePopupData.test.tsalone did not reproduce it in 4 runs. It is pre-existing and unrelated to this className-only change.Existing 1.5.0 users keep the old rendering. The live announcement was written to read acceptably without these styles: one paragraph with a bold link at the end.