|
| 1 | +--- |
| 2 | +name: testing-quill-resize-demo |
| 3 | +description: How to build quill-resize-module with npm/pnpm and exercise demo/index.html end-to-end in a browser (resize handles, size label, align/attributes toolbar, iframe resize). |
| 4 | +--- |
| 5 | + |
| 6 | +# Testing the quill-resize-module demo |
| 7 | + |
| 8 | +## Build |
| 9 | +- npm lane: `npm run build` (= `rollup -c && tsc -p tsconfig.json`), `npm test`, `npm run lint`. |
| 10 | +- pnpm lane: test it in a **separate clone** (e.g. `git clone --no-hardlinks <repo> /tmp/pnpmtest`) so |
| 11 | + `pnpm install` does not clobber the npm `node_modules` in the main checkout. Then |
| 12 | + `pnpm install && pnpm lint && pnpm build && pnpm test`. |
| 13 | +- Adversarial control for the pnpm/`@types/node` issue: replacing |
| 14 | + `ReturnType<typeof setInterval>` with `NodeJS.Timeout` in `src/IframeClick.ts` must make |
| 15 | + `pnpm build` fail with `TS2503: Cannot find namespace 'NodeJS'`. If it doesn't fail, the pnpm |
| 16 | + lane isn't actually reproducing the original bug (e.g. @types/node got hoisted anyway). |
| 17 | +- `pnpm install` regenerates `types/*.d.ts`; if a build failed mid-way those files can be left |
| 18 | + stale/modified — `git checkout .` and rebuild before judging generated output. |
| 19 | + |
| 20 | +## Serving the demo |
| 21 | +- `demo/index.html` is fully static: `cd demo && python3 -m http.server 8080`, open |
| 22 | + `http://localhost:8080/index.html`. No credentials, no dev server, no env vars. |
| 23 | +- `demo/quill-resize-module.min.js` is gitignored and absent in a fresh clone; the release |
| 24 | + workflow does `cp dist/quill-resize-module.min.js demo/`. Test BOTH states: |
| 25 | + - absent → exercises the CDN-fallback path in the `<script>` tag |
| 26 | + - present → exercises the freshly built bundle (what GitHub Pages will serve) |
| 27 | +- Known pitfall: a `<script src=... onerror="this.src='<cdn>'">` fallback does **not** work — |
| 28 | + per the HTML spec the element's "already started" flag prevents a second fetch, so the CDN is |
| 29 | + never requested and `window.QuillResizeModule` stays undefined. Symptom: the Quill snow |
| 30 | + toolbar never renders and the console shows an uncaught TypeError from `Quill.register`. |
| 31 | + A `document.write`-based (or dynamically appended `<script>`) fallback does work. |
| 32 | + |
| 33 | +## UI path for resize interactions |
| 34 | +1. Click the image (or an `iframe.ql-video`) inside `#editor`. |
| 35 | +2. Overlay DOM comes from `src/ResizePlugin.ts` template: `button.handler` (bottom-right drag |
| 36 | + handle), `span.size-label` (live "W x H", requires `showSize: true`), `div.toolbar` with |
| 37 | + `[data-group=size]` (100%/50%/%/Restore), `[data-group=align]` (Left/Center/Right/Restore) |
| 38 | + and `[data-group=attributes]` ("Edit alt text and title" → `div.attributes-panel`). |
| 39 | +3. Drag with `mouse_move` → `left_mouse_down` → several `mouse_move`s → screenshot **while held** |
| 40 | + → `left_mouse_up`. `left_mouse_down` does not accept a coordinate; move first. |
| 41 | +4. Iframes start at 300x150 until resized, so they look small in the page; that's expected. |
| 42 | + |
| 43 | +## Environment gotchas (Devin box) |
| 44 | +- `google-chrome <url>` is a shim that opens a tab in the managed Chrome (CDP on :29229). |
| 45 | + Passing flags launches a *separate* Chrome that the `browser_console`/`read_dom` tools cannot |
| 46 | + attach to. If the browser tools report "Could not connect to Chrome via CDP", make sure exactly |
| 47 | + one Chrome is running with `--remote-debugging-port=29229`; the first CDP call after a |
| 48 | + (re)connect may time out — just retry once. |
| 49 | +- Maximize with `wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz` (not xdotool super+Up). |
| 50 | + |
| 51 | +## Devin Secrets Needed |
| 52 | +None. |
0 commit comments