Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
name: Go checks
needs: classify
if: ${{ !cancelled() && needs.classify.result == 'success' }}
runs-on: ubuntu-latest
# Keep Python 3.9 packaging checks on a runner with published binaries.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
Expand Down
40 changes: 40 additions & 0 deletions output/playwright/pr527-upgrade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# #527 frontend dependency verification

The images render the production `V2Composer`, `MarkdownInput`, styles, and Lucide icons in Microsoft Edge. A local React harness supplies draft state and a local submit callback; no API server or model is invoked. Clipboard checks use the browser's system clipboard through `navigator.clipboard.writeText` and actual Ctrl+V / Ctrl+Shift+V keyboard gestures.

| Stage | Product revision | Dependencies |
| --- | --- | --- |
| Before | `964ce97ce640610dab79f5d339f7f14c9e6dea8a` (current main) | Tiptap 3.32.0, React Query 5.104.5, Lucide 1.61.0 |
| After | `19a01a39` (#527 + main + shared CI repair) | Tiptap 3.32.1, React Query 5.105.0, Lucide 1.64.0 |

The production composer/editor files are identical in both checkouts. Each checkout uses its own `npm ci` dependency installation. The upgrade also changes `@types/node` 26.6.5 → 26.6.6; React remains 19.3.1 and jsdom remains 29.1.1.

## Images and interactions

Compare `before-desktop-rich-composer.png` with `after-desktop-rich-composer.png` for the initial Markdown table, local image, and icons. Compare `*-desktop-pasted-composer.png` for the real clipboard paste and edited table cell. `*-narrow-rich-composer.png` shows the same source at a 390px window width; the mode switch is accessed from the attachment menu at that width, matching the production layout. `*-desktop-dark-*` repeats the workflow in dark theme.

`*-viewport.png` images are unaltered full-window captures (1024×600 desktop, 390×800 narrow). `*-composer.png` images are unscaled crops of the full composer at its native width (738px desktop, 358px narrow). Device scale is 1. Every before/after pair uses the same theme, content, and window size.

`metrics.json` records six completed workflows: initial image decode, Markdown/source round trip without rewriting the source, system clipboard Markdown paste with bold/code/table/image, typing into a table cell, local submission preserving serialized Markdown, and Ctrl+Shift+V preserving literal punctuation. The layouts have no horizontal overflow; the add/send icons remain visible. At 390px the mode icon is intentionally inside the attachment menu.

## Existing image-paste issue

An image that forms the final, standalone Markdown paragraph is dropped during paste in both old and upgraded dependencies. An image preceded by text in the same paragraph is retained in both. Restoring a draft containing a standalone image renders it correctly in both. `pasted-image-check.json` and `check-pasted-image.js` retain the four-case reproduction; this existing issue was reported separately and no editor source change was added to this dependency PR.

## Checks

Windows, Node 24.22.1 (official SHA256-verified toolchain), npm 11.19.1:

```powershell
cd web
npm ci --no-audit --no-fund
npm test -- --maxWorkers=2
npm run build
Comment thread
Qiyuanqiii marked this conversation as resolved.
Resolved
git diff --check
```

All 288 test files and 2,932 tests passed. The production build (including TypeScript checking) and whitespace check exited successfully. Raw test/build logs are included. The logs contain jsdom canvas/navigation warnings and the existing large-bundle warning.

## Reproduce

Copy the HTML/TSX/SVG fixture files into `web/.tmp/` in both checkouts. Start their Vite servers at ports 5270 (before) and 5271 (after), then open the chosen fixture URL with Playwright CLI using Edge. Run `capture-editor.js` with `playwright-cli run-code --filename`; its `phase=before` or `phase=after` URL selects the checkout. Run `check-pasted-image.js` to repeat the independent image-paste comparison.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions output/playwright/pr527-upgrade/capture-editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
async (page) => {
const phase = new URL(page.url()).searchParams.get("phase") || "after";
const port = phase === "before" ? 5270 : 5271;
await page.context().grantPermissions(["clipboard-read", "clipboard-write"]);
const checks = [];
for (const [size, viewport, theme] of [
["desktop", {width:1024,height:600}, "light"],
["narrow", {width:390,height:800}, "light"],
["desktop-dark", {width:1024,height:600}, "dark"],
]) {
await page.setViewportSize(viewport);
await page.goto(`http://127.0.0.1:${port}/.tmp/pr527-editor-evidence.html?phase=${phase}&theme=${theme}`);
const input = page.getByRole("textbox", {name:"开始新对话"});
await page.getByRole("heading", {name:"发布检查",exact:true}).waitFor();
await page.evaluate(() => document.fonts.ready);
const image = input.getByRole("img", {name:"编辑器图像"});
await image.evaluate(async img => {await img.decode(); if (!img.naturalWidth) throw new Error("Image failed to load");});
if (await input.getByRole("row").count() !== 3) throw new Error("Initial table missing");
const prefix = `output/playwright/pr527-upgrade/${phase}-${size}`;
await page.screenshot({path:prefix+"-rich-viewport.png"});
await page.locator(".v2-composer").screenshot({path:prefix+"-rich-composer.png"});
const metrics = await page.evaluate(() => {
const input=document.querySelector(".v2-markdown-input");
const form=document.querySelector(".v2-composer");
const icons=Array.from(form.querySelectorAll("svg")).map(svg => ({name:svg.getAttribute("class"),width:svg.getBoundingClientRect().width,height:svg.getBoundingClientRect().height}));
return {viewport:{width:innerWidth,height:innerHeight}, theme:document.documentElement.dataset.prayuTheme,
documentScrollWidth:document.documentElement.scrollWidth,inputWidth:input.clientWidth,inputScrollWidth:input.scrollWidth,
image:{width:input.querySelector("img").naturalWidth,height:input.querySelector("img").naturalHeight},icons};
});
if (metrics.documentScrollWidth > viewport.width || metrics.inputScrollWidth > metrics.inputWidth) throw new Error("Horizontal overflow");
const requiredIcons=await page.locator(".v2-send-button svg,.v2-composer-add-trigger svg").evaluateAll(icons=>icons.map(svg=>({width:svg.getBoundingClientRect().width,height:svg.getBoundingClientRect().height})));
if(requiredIcons.length!==2 || requiredIcons.some(icon=>icon.width<=0 || icon.height<=0)) throw new Error("Primary control icon invisible");
const toggleMode = async label => {
const direct=page.getByRole("button",{name:label,exact:true});
if(await direct.count()) {await direct.click();return;}
await page.getByRole("button",{name:"添加附件",exact:true}).click();
await page.getByRole("menuitem",{name:label,exact:true}).click();
};
await toggleMode("切换为纯文本编辑");
const source=await input.inputValue();
const initial=await page.evaluate(()=>window.reviewFixture.initial);
if (source!==initial) throw new Error("Mode switch rewrote source");
if (size==="desktop") await page.screenshot({path:prefix+"-source-viewport.png"});
await toggleMode("切换为 Markdown 编辑");
await input.click();
await page.keyboard.press("Control+a");
const pasted="## 粘贴草稿\n\n**保留格式**与 `inline`\n\n| 项 | 值 |\n| --- | --- |\n| 中文 | 1 |\n\n预览:![编辑器图像](/.tmp/editor-image.svg)";
await page.evaluate(text=>navigator.clipboard.writeText(text),pasted);
await page.keyboard.press("Control+v");
await input.getByRole("heading",{name:"粘贴草稿",exact:true}).waitFor();
if(await input.locator("strong").textContent()!=="保留格式") throw new Error("Markdown paste lost bold");
if(await input.locator("code").textContent()!=="inline") throw new Error("Markdown paste lost code");
await input.getByRole("img",{name:"编辑器图像"}).evaluate(img=>img.decode());
await input.getByRole("cell",{name:"中文",exact:true}).click();
await page.keyboard.press("End");
await page.keyboard.type("输入");
if(await input.getByRole("cell",{name:"中文输入",exact:true}).count()!==1) throw new Error("Table edit failed");
await input.evaluate(el=>{el.scrollTop=0;});
await page.screenshot({path:prefix+"-pasted-viewport.png"});
if(size==="desktop") await page.locator(".v2-composer").screenshot({path:prefix+"-pasted-composer.png"});
await page.keyboard.press("Control+Enter");
await page.waitForFunction(()=>window.reviewFixture.submitted.length===1);
const submitted=await page.evaluate(()=>window.reviewFixture.submitted[0]);
if(!submitted.includes("**保留格式**") || !submitted.includes("中文输入") || !submitted.includes("![编辑器图像]")) throw new Error("Submitted Markdown lost content");
await input.click();
await page.evaluate(()=>navigator.clipboard.writeText("**literal**"));
await page.keyboard.press("Control+Shift+v");
if(await input.textContent()!=="**literal**" || await input.locator("strong").count()) throw new Error("Plain paste interpreted Markdown");
checks.push({phase,size,...metrics,modeRoundTrip:"source preserved",paste:"system clipboard Ctrl+V",tableEdit:"中文输入",submitted,plainPaste:"literal punctuation preserved"});
}
return checks;
}

18 changes: 18 additions & 0 deletions output/playwright/pr527-upgrade/check-pasted-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
async page => {
const checks=[];
await page.context().grantPermissions(["clipboard-read","clipboard-write"]);
for(const [phase,port] of [["before",5270],["after",5271]]) {
for(const standalone of [true,false]) {
await page.goto(`http://127.0.0.1:${port}/.tmp/pr527-editor-evidence.html?phase=${phase}`);
const input=page.getByRole("textbox",{name:"开始新对话"});
await input.waitFor();
await input.click(); await page.keyboard.press("Control+a");
const text="## 粘贴草稿\n\n**保留格式**与 `inline`\n\n| 项 | 值 |\n| --- | --- |\n| 中文 | 1 |\n\n"+(standalone?"":"预览:")+"![编辑器图像](/.tmp/editor-image.svg)";
await page.evaluate(text=>navigator.clipboard.writeText(text),text);
await page.keyboard.press("Control+v");
await input.getByRole("heading",{name:"粘贴草稿",exact:true}).waitFor();
checks.push({phase,standalone,imageCount:await input.getByRole("img").count(),draft:await page.evaluate(()=>window.reviewFixture.current)});
}
}
return checks;
}
1 change: 1 addition & 0 deletions output/playwright/pr527-upgrade/editor-image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading