diff --git a/docs/design/README.md b/docs/design/README.md
index e88f362..6d60949 100644
--- a/docs/design/README.md
+++ b/docs/design/README.md
@@ -28,7 +28,7 @@ The visual spec of record for the back-office SPA and the transactional emails,
| [Home](screens/home.md) | `/home` | 4 | `source/RenewCMS Screens Back-office.dc.html` |
| [Articles](screens/articles.md) | `/article` | 14 | `source/RenewCMS Screens Back-office.dc.html` |
| [New article](screens/new-article.md) | `modal from anywhere · /article/new` | 5 | `source/RenewCMS Screens Back-office.dc.html` |
-| [Editor](screens/editor.md) | `/article/:id/edit` | 19 | `source/RenewCMS Screens Back-office.dc.html` |
+| [Editor](screens/editor.md) | `/article/:id/edit` | 22 | `source/RenewCMS Screens Back-office.dc.html` |
| [Integration](screens/integration.md) | `/integration` | 2 | `source/RenewCMS Screens Back-office.dc.html` |
| [Global](screens/global.md) | `any route` | 4 | `source/RenewCMS Screens Back-office.dc.html` |
diff --git a/docs/design/components.md b/docs/design/components.md
index ba2e6cd..d64cd24 100644
--- a/docs/design/components.md
+++ b/docs/design/components.md
@@ -252,7 +252,7 @@ Responsive Below lg , the details panel becomes a right slideover, opened with i
### ImageUploader
-Opens from the editor's image button in a small modal. Files are checked in the browser before anything is sent. After a successful upload the image goes in at the cursor and the modal closes.
+Opens from the editor's image button in a small modal. Files are checked in the browser before anything is sent. A JPEG, PNG or WEBP then goes through a crop-and-resize step before it uploads; an SVG skips straight to uploading. After a successful upload the image goes in at the cursor and the modal closes.
Drop an image here Choose file PNG, JPEG, WEBP, SVG · max 10 MB
@@ -262,9 +262,21 @@ Drop to upload
dragging over
-north-wall.jpg 62%
+Crop and resize north-wall.jpg · 3.9 MB
-Uploading 2.4 of 3.9 MB
+crop, default: whole image selected, width "1600 px"
+
+Crop and resize north-wall.jpg · 3.9 MB
+
+crop, ratio locked to 16:9
+
+Crop and resize north-wall.jpg · 3.9 MB
+
+crop, crop narrower than the chosen width
+
+north-wall.jpg 43%
+
+Uploading 180 of 420 KB
uploading
@@ -282,6 +294,10 @@ server error
Built from UModal title="Add an image" › UFileUpload accept="image/png,image/jpeg,image/webp,image/svg+xml" :multiple="false" layout="list" + UProgress size="xs" . Uploads go through XMLHttpRequest , because fetch has no upload progress, as FormData with the field name file . The 201 location is inserted with insertImage(location, '') .
+Crop and resize A JPEG, PNG or WEBP opens on a 640px-wide modal (`md.crop`) between the file picker and the upload, replacing the "Add an image" title with "Crop and resize" and the filename/size as the description. The stage shows the image with the crop frame starting as the whole image: a rule-of-thirds grid (lines at 33.3 %/66.6 %), four 12×12 px corner handles, and a pixel-size label (mono, bottom-left, dark pill) that tracks the frame's current size. The frame is `tabindex="0"`, `aria-label="Crop area. Arrow keys move it, Shift and arrow keys resize it."`; dragging moves it, dragging a handle resizes it, arrow keys nudge it by 1 px and Shift+arrow keys resize it.
+
+Aspect ratio is a `radiogroup` of five pills — Original, Free, 16:9, 4:3, 1:1 — plus Rotate and Reset actions above it. Width is a second `radiogroup` — Original, 1600 px (default), 1200 px, 800 px. A mono line below reads "Uploads as {width} × {height} px · about {size}", where the estimated size is shown in KB under 1 MB and in MB above it. When the chosen width is larger than the crop's own width, the output stays at the crop's size (never upscaled) and an info row explains why: "The crop is {crop width} px wide, so it's uploaded at that size. Enlarging it would make it blurry." The footer becomes "Choose another file" (back to the file picker, `data-act="upload-pick"` from `idle`) and "Upload image" (starts the upload with the cropped, resized file). SVGs never see this step: they upload as soon as they're chosen. The "in progress" state afterwards reports the resized file's size, e.g. "Uploading 180 of 420 KB".
+
Validation Before uploading, the uploader checks both the MIME type and the file extension, and that size ≤ 10 × 1024 × 1024 . The size error names the file size: "north-wall.tif is 14.2 MB. Images can be up to 10 MB." A server 400 shows the same message as a client-side rejection.
Props, emits articleId: number . Emits uploaded(location) , close . A 401 hands off to the global session flow. A 404 means the article was deleted, which the editor handles.
diff --git a/docs/design/screens/editor.md b/docs/design/screens/editor.md
index b7fd8b2..d5336e0 100644
--- a/docs/design/screens/editor.md
+++ b/docs/design/screens/editor.md
@@ -83,13 +83,50 @@ On mobile, Save and Publish sit in a sticky bottom bar and the details panel ope
- Editor: status "draft", save "dirty"
- Mobile: leading arrow-left button, trailing ellipsis
+### Upload: crop and resize
+
+**Trigger:** A JPEG, PNG or WEBP passed the checks, and nothing is sent yet. The crop starts as the whole image and the width defaults to 1600 px. SVGs skip this step.
+
+- Breadcrumbs: Articles › How we price a bathroom renovation (mobile title "Edit article")
+- Modal: **Crop and resize** "north-wall.jpg · 3.9 MB"
+ - crop: ratio "Original", width "1600 px"
+ - cancel "Choose another file"
+ - confirm "Upload image"
+- Editor: status "draft", save "dirty"
+- Mobile: leading arrow-left button, trailing ellipsis
+
+### Upload: crop to a ratio
+
+**Trigger:** 16:9 chosen. The frame keeps the ratio while it's dragged or resized. Arrow keys move it; Shift and arrow keys resize it.
+
+- Breadcrumbs: Articles › How we price a bathroom renovation (mobile title "Edit article")
+- Modal: **Crop and resize** "north-wall.jpg · 3.9 MB"
+ - crop: ratio "16:9", width "1600 px"
+ - cancel "Choose another file"
+ - confirm "Upload image"
+- Editor: status "draft", save "dirty"
+- Mobile: leading arrow-left button, trailing ellipsis
+
+### Upload: crop narrower than the width
+
+**Trigger:** The crop is smaller than the chosen width, so it keeps its own size.
+
+- Breadcrumbs: Articles › How we price a bathroom renovation (mobile title "Edit article")
+- Modal: **Crop and resize** "north-wall.jpg · 3.9 MB"
+ - crop: ratio "1:1", width "1600 px"
+ - note: "The crop is 640 px wide, so it's uploaded at that size. Enlarging it would make it blurry."
+ - cancel "Choose another file"
+ - confirm "Upload image"
+- Editor: status "draft", save "dirty"
+- Mobile: leading arrow-left button, trailing ellipsis
+
### Upload: in progress
-**Trigger:** A valid file is uploading. Closing the dialog cancels the upload.
+**Trigger:** Upload image was pressed. The cropped, resized file is uploading. Closing the dialog cancels the upload.
- Breadcrumbs: Articles › How we price a bathroom renovation (mobile title "Edit article")
- Modal: **Add an image**
- - upload state: state "uploading"
+ - upload state: state "uploading" ("Uploading 180 of 420 KB")
- cancel "Cancel upload"
- Editor: status "draft", save "dirty"
- Mobile: leading arrow-left button, trailing ellipsis
diff --git a/docs/design/source/AppFrame.dc.html b/docs/design/source/AppFrame.dc.html
index 5bb087e..1253519 100644
--- a/docs/design/source/AppFrame.dc.html
+++ b/docs/design/source/AppFrame.dc.html
@@ -128,7 +128,7 @@
PreviewSave{{ pub.t }}
-
+Delete
@@ -214,6 +214,41 @@
diff --git a/docs/design/source/RenewCMS Prototype.dc.html b/docs/design/source/RenewCMS Prototype.dc.html
index de2570a..08502f5 100644
--- a/docs/design/source/RenewCMS Prototype.dc.html
+++ b/docs/design/source/RenewCMS Prototype.dc.html
@@ -294,7 +294,14 @@ class Component extends DCLogic {
return
}
if (m.type === 'upload') {
+ if (m.state === 'crop' && typeof a === 'string') {
+ if (a === 'modal-cancel') return this.setState({ modal: { ...m, state: 'idle' } })
+ if (a.startsWith('crop-r-')) return this.setState({ modal: { ...m, ratio: +a.slice(7) } })
+ if (a.startsWith('crop-s-')) return this.setState({ modal: { ...m, size: +a.slice(7) } })
+ if (a === 'crop-reset') return this.setState({ modal: { ...m, ratio: 0, size: 1 } })
+ }
if (a === 'modal-cancel' || a === 'modal-close') return close()
+ if (a === 'upload-pick' && m.state === 'idle') return this.setState({ modal: { ...m, state: 'crop', ratio: 0, size: 1 } })
if ((a === 'upload-pick' || a === 'modal-confirm') && m.state !== 'uploading') {
this.setState({ modal: { ...m, state: 'uploading' } })
this.later(() => {
@@ -334,7 +341,7 @@ class Component extends DCLogic {
if (s.route === 'integration') return { kind: 'integration', ...T('integration', ['Integration']), mTitle: 'Integration', copied: s.copied }
if (s.route === 'editor') {
const a = this.art(s.cur) || {}, e = s.ed || {}
- return { kind: 'editor', ...T('articles', ['Articles', a.t]), mTitle: 'Edit article', mLead: 'arrow-left', mAction: 'ellipsis', ed: { ...e, title: a.t, imgs: (a.imgs || 0) + (e.image ? 1 : 0) }, modal: this.modalS() }
+ return { kind: 'editor', ...T('articles', ['Articles', a.t]), mTitle: 'Edit article', mLead: 'arrow-left', mAction: 'trash-2', ed: { ...e, title: a.t, imgs: (a.imgs || 0) + (e.image ? 1 : 0) }, modal: this.modalS() }
}
return { kind: 'home', home: { sub: '' } }
}
@@ -347,6 +354,7 @@ class Component extends DCLogic {
const imgs = a.imgs === 0 ? '' : a.imgs === 1 ? ' and its image' : ' and its ' + a.imgs + ' images'
return { title: 'Delete this article?', desc: '"' + a.t + '"' + imgs + ' will be deleted. This can\'t be undone.', cancel: 'Cancel', confirm: m.loading ? 'Deleting…' : 'Delete article', tone: 'danger', loading: m.loading }
}
+ if (m.type === 'upload' && m.state === 'crop') return { title: 'Crop and resize', desc: 'north-wall.jpg · 3.9 MB', close: true, crop: { ratio: m.ratio, size: m.size }, cancel: 'Choose another file', confirm: 'Upload image' }
if (m.type === 'upload') return { title: 'Add an image', close: true, upload: { state: m.state }, cancel: m.state === 'uploading' ? 'Cancel upload' : 'Cancel' }
if (m.type === 'leave') { const a = this.art(this.state.cur) || {}; return { title: 'Leave without saving?', desc: 'Your changes to "' + a.t + '" haven\'t been saved.', cancel: 'Discard changes', confirm: 'Keep editing' } }
return null
diff --git a/docs/design/source/RenewCMS Screens Back-office.dc.html b/docs/design/source/RenewCMS Screens Back-office.dc.html
index c5f7d75..fe00fef 100644
--- a/docs/design/source/RenewCMS Screens Back-office.dc.html
+++ b/docs/design/source/RenewCMS Screens Back-office.dc.html
@@ -93,6 +93,7 @@ class Component extends DCLogic {
const nf = (title, body, extra = {}) => [{ label: 'Title', value: title, count: [...title].length + ' / 200', ...(extra.t || {}) }, { label: 'First paragraph', value: body, area: true, ...(extra.b || {}) }]
const ed = { kind: 'editor', nav: 'articles', crumbs: ['Articles', 'How we price a bathroom renovation'], mTitle: 'Edit article', mLead: 'arrow-left', mAction: 'ellipsis' }
const E = (o = {}, extra = {}) => withM({ ...ed, ...extra, ed: { status: 'draft', save: 'saved', ...o } })
+ const cropM = crop => ({ title: 'Crop and resize', desc: 'north-wall.jpg · 3.9 MB', close: true, crop, cancel: 'Choose another file', confirm: 'Upload image' })
const del = (loading, err) => ({ title: 'Delete this article?', desc: '"Winter checklist for timber windows" and its 3 images will be deleted. This can\'t be undone.', cancel: 'Cancel', confirm: loading ? 'Deleting…' : 'Delete article', tone: 'danger', loading, notice: err })
return [
{ label: 'Boot', title: 'App boot', route: 'any route, first load', api: 'GET /v1/auth/me (pending)', note: 'While the session is checked, the shell renders with skeletons, never a spinner. The possible outcomes are: 200 with a verified user, which renders the route; 200 with an unverified user, which goes to /register/pending; and 401, which goes to /login?redirect=. Public routes skip this check.', states: [
@@ -137,7 +138,10 @@ class Component extends DCLogic {
E({ save: 'dirty', len: 10214 }, { name: 'Too long', trigger: 'Over 10 000. Save and Publish are disabled until it\'s shorter.' }),
E({ preview: true }, { name: 'Preview', trigger: 'The Preview switch. Shows the title and body in the content scale, the way a public site might.' }),
E({ save: 'dirty' }, { name: 'Upload: choose', trigger: 'The image button in the toolbar, or a file dropped on the editor.', modal: { title: 'Add an image', close: true, upload: { state: 'idle' }, cancel: 'Cancel' } }),
- E({ save: 'dirty' }, { name: 'Upload: in progress', trigger: 'A valid file is uploading. Closing the dialog cancels the upload.', modal: { title: 'Add an image', close: true, upload: { state: 'uploading' }, cancel: 'Cancel upload' } }),
+ E({ save: 'dirty' }, { name: 'Upload: crop and resize', trigger: 'A JPEG, PNG or WEBP passed the checks, and nothing is sent yet. The crop starts as the whole image and the width defaults to 1600 px. SVGs skip this step.', modal: cropM({ ratio: 0, size: 1 }) }),
+ E({ save: 'dirty' }, { name: 'Upload: crop to a ratio', trigger: '16:9 chosen. The frame keeps the ratio while it\'s dragged or resized. Arrow keys move it; Shift and arrow keys resize it.', modal: cropM({ ratio: 2, size: 1 }) }),
+ E({ save: 'dirty' }, { name: 'Upload: crop narrower than the width', trigger: 'The crop is smaller than the chosen width, so it keeps its own size.', modal: cropM({ ratio: 4, size: 1, rect: [42, 34, 15.873, 21.164] }) }),
+ E({ save: 'dirty' }, { name: 'Upload: in progress', trigger: 'Upload image was pressed. The cropped, resized file is uploading. Closing the dialog cancels the upload.', modal: { title: 'Add an image', close: true, upload: { state: 'uploading' }, cancel: 'Cancel upload' } }),
E({ save: 'dirty' }, { name: 'Upload: rejected', trigger: 'Checked in the browser, so nothing is sent.', modal: { title: 'Add an image', close: true, upload: { state: 'rejected' }, cancel: 'Cancel', confirm: 'Choose another file' } }),
E({ save: 'dirty', image: true }, { name: 'Upload: inserted', trigger: '201: the image goes in at the cursor, and the article now has unsaved changes.', toasts: [T('success', 'circle-check', 'Image added', 'Save to keep it in the article.')] }),
E({ save: 'saving', pending: 'Saving and publishing…' }, { name: 'Publishing', trigger: '"Save and publish": the PATCH body, then the publish request.' }),
diff --git a/docs/design/states.md b/docs/design/states.md
index caa5eec..6948f06 100644
--- a/docs/design/states.md
+++ b/docs/design/states.md
@@ -74,7 +74,7 @@ Every state is drawn at desktop and mobile on the screen boards, with final copy
| Editor | `/article/:id/edit` | Near the limit | At least 9 000 HTML characters | [editor](screens/editor.md) |
| Editor | `/article/:id/edit` | Too long | Over 10 000: Save and Publish disabled | [editor](screens/editor.md) |
| Editor | `/article/:id/edit` | Preview | Switch on | [editor](screens/editor.md) |
-| Editor | `/article/:id/edit` | Uploading, rejected, inserted | ImageUploader | [editor](screens/editor.md) |
+| Editor | `/article/:id/edit` | Choose, crop and resize, uploading, rejected, inserted | ImageUploader | [editor](screens/editor.md) |
| Editor | `/article/:id/edit` | Publishing, unpublishing | PATCH publish or unpublish | [editor](screens/editor.md) |
| Editor | `/article/:id/edit` | Leave guard | Navigating away while dirty | [editor](screens/editor.md) |
| Editor | `/article/:id/edit` | Offline | navigator.onLine is false | [editor](screens/editor.md) |
diff --git a/features/editor_image_crop_resize.feature b/features/editor_image_crop_resize.feature
new file mode 100644
index 0000000..76cbeb8
--- /dev/null
+++ b/features/editor_image_crop_resize.feature
@@ -0,0 +1,131 @@
+Feature: Crop and resize step in the editor's image uploader
+
+ As a verified RenewCMS owner adding an image to an article
+ I want to crop and resize a JPEG, PNG or WEBP before it uploads
+ So that I control the framing and file size of images in my articles, without needing an
+ external editor
+
+ Background:
+ Given ImageUploader inserts a crop-and-resize step between the idle file picker and the
+ upload, for any JPEG, PNG or WEBP that already passed the browser validation described in
+ features/editor_image_upload.feature; that feature's idle, dragging-over, rejected,
+ uploading, inserted and failed states and its POST /v1/article/{articleId}/image contract
+ are unchanged and out of scope here
+ And an SVG file skips this step entirely and uploads immediately, as before
+ And opening the step retitles the modal from "Add an image" to "Crop and resize", with the
+ description "{filename} · {size}" (e.g. "north-wall.jpg · 3.9 MB")
+ And the stage shows the chosen image at its natural pixel dimensions with a crop frame that
+ starts as the whole image: a rule-of-thirds grid (lines at 33.3 %/66.6 %), four 12×12 px
+ corner handles, and a mono pixel-size label in a dark pill at the frame's bottom-left
+ corner, tracking the frame's current size
+ And the frame is reachable by Tab (tabindex="0"), aria-label "Crop area. Arrow keys move it,
+ Shift and arrow keys resize it."; dragging the frame moves it, dragging a handle resizes
+ it, arrow keys nudge it by 1 px, and Shift+arrow keys resize it by 1 px
+ And above the frame, "Aspect ratio" is a radiogroup of five pills — Original, Free, 16:9,
+ 4:3, 1:1 — next to "Rotate" and "Reset" actions; "Width" is a second radiogroup — Original,
+ 1600 px (default), 1200 px, 800 px
+ And a mono line below reads "Uploads as {width} × {height} px · about {size}" (KB under
+ 1 MB, MB at or above it), recomputed whenever the ratio, width, frame rect or rotation
+ changes
+ And the output width is min(the chosen width preset, the crop frame's own pixel width) —
+ never upscaled — and the output height keeps the crop frame's own aspect ratio; when the
+ crop is narrower than the chosen width, an info row reads "The crop is {crop width} px
+ wide, so it's uploaded at that size. Enlarging it would make it blurry."
+ And the footer offers "Choose another file" (discards this step and returns to the idle file
+ picker with no adjustments carried over) and "Upload image" (uploads the cropped, resized
+ file through the unchanged POST /v1/article/{articleId}/image flow)
+ And "Rotate" turns the image 90° clockwise each activation, cycling 0°→90°→180°→270°→0°, and
+ width presets apply to the post-rotation image
+ And "Reset" returns the ratio to Original, the width to 1600 px, the crop frame to the whole
+ unrotated image, and the rotation to 0°, without closing the modal
+
+ Scenario: A raster file opens the crop-and-resize step instead of uploading immediately
+ Given ImageUploader is open in the idle state for article 12
+ When the user chooses a file named "north-wall.jpg", content type "image/jpeg", size 3.9 MB,
+ natural dimensions 4032 × 3024 px
+ Then no request is sent to POST /v1/article/12/image
+ And the modal retitles to "Crop and resize" with the description "north-wall.jpg · 3.9 MB"
+ And the crop frame starts as the whole image, ratio "Original" is selected, and width
+ "1600 px" is selected
+ And the mono line reads "Uploads as 1600 × 1200 px · about 420 KB"
+ And the footer reads "Choose another file" and "Upload image"
+
+ Scenario: An SVG skips the crop step and uploads immediately
+ Given ImageUploader is open in the idle state for article 12
+ When the user chooses a file named "diagram.svg", content type "image/svg+xml", size 40 KB
+ Then POST /v1/article/12/image is sent immediately with that file
+ And the crop-and-resize step is never shown
+
+ Scenario Outline: Choosing an aspect ratio locks the frame to it
+ Given the crop-and-resize step is open for "north-wall.jpg" (4032 × 3024 px), ratio
+ "Original", width "1600 px"
+ When the user selects ratio ""
+ Then the crop frame becomes × px, centered on the image
+ And dragging or resizing the frame afterwards keeps that aspect ratio
+ And the mono line reads "Uploads as × px · about {size}"
+
+ Examples:
+ | ratio | crop_width | crop_height | out_width | out_height |
+ | 16:9 | 4032 | 2268 | 1600 | 900 |
+ | 4:3 | 4032 | 3024 | 1600 | 1200 |
+ | 1:1 | 3024 | 3024 | 1600 | 1600 |
+
+ Scenario: Choosing a narrower width preset recomputes the output without upscaling
+ Given the crop-and-resize step is open for "north-wall.jpg", ratio "Original", width
+ "1600 px"
+ When the user selects width "800 px"
+ Then the mono line reads "Uploads as 800 × 600 px · about {size}", a smaller estimate than
+ before
+
+ Scenario: A crop narrower than the chosen width is uploaded at its own size, not upscaled
+ Given the crop-and-resize step is open for "north-wall.jpg", ratio "1:1", width "1600 px"
+ When the user resizes the crop frame down to 640 × 640 px
+ Then the mono line reads "Uploads as 640 × 640 px · about {size}"
+ And an info row reads "The crop is 640 px wide, so it's uploaded at that size. Enlarging it
+ would make it blurry."
+
+ Scenario: Free ratio removes the aspect-ratio constraint
+ Given the crop-and-resize step is open for "north-wall.jpg", ratio "Original"
+ When the user selects ratio "Free"
+ Then the crop frame can be dragged or resized to any width and height independently, no
+ longer snapping to a fixed ratio
+
+ Scenario: Arrow keys move the crop frame and Shift+arrow keys resize it
+ Given the crop-and-resize step is open for "north-wall.jpg" with the crop frame focused
+ When the user presses ArrowRight
+ Then the frame moves 1 px right and the mono line's size is unchanged
+ When the user presses Shift+ArrowRight
+ Then the frame's width grows by 1 px and the mono line updates to the new output size
+
+ Scenario: Rotate cycles the image in 90° steps and Reset returns to the opened defaults
+ Given the crop-and-resize step is open for "north-wall.jpg" at ratio "16:9", width "800 px"
+ When the user activates "Rotate"
+ Then the image and crop frame rotate 90° clockwise
+ When the user activates "Reset"
+ Then ratio returns to "Original", width returns to "1600 px", the frame returns to the
+ whole, unrotated image, and the mono line reads "Uploads as 1600 × 1200 px · about 420 KB"
+
+ Scenario: "Choose another file" returns to the file picker without uploading
+ Given the crop-and-resize step is open for "north-wall.jpg"
+ When the user activates "Choose another file"
+ Then no request is sent to POST /v1/article/12/image
+ And the idle state is shown again, with the file picker available
+
+ Scenario: A newly chosen file opens a fresh crop step, not the previous file's adjustments
+ Given the user returned to idle via "Choose another file" from a crop step that had ratio
+ "16:9" and width "800 px"
+ When the user chooses a new file named "sunset.jpg", content type "image/jpeg", size 2.1 MB,
+ natural dimensions 3000 × 2000 px
+ Then the crop-and-resize step reopens with ratio "Original", width "1600 px", and the frame
+ as the whole new image
+
+ Scenario: "Upload image" uploads the cropped, resized file, not the original
+ Given the crop-and-resize step is open for "north-wall.jpg" with ratio "Original", width
+ "1600 px" and the mono line "Uploads as 1600 × 1200 px · about 420 KB"
+ When the user activates "Upload image"
+ Then POST /v1/article/12/image is sent with a single file under the field name "file" whose
+ pixel dimensions are 1600 × 1200 and whose size is about 420 KB, not the original
+ 4032 × 3024, 3.9 MB file
+ And the uploading state shows "Uploading 0.0 of 420 KB"
+ When the upload reports 180 KB sent of 420 KB
+ Then the uploading state shows "north-wall.jpg 43%" and "Uploading 180 of 420 KB"
diff --git a/features/editor_image_crop_resize.qa.md b/features/editor_image_crop_resize.qa.md
new file mode 100644
index 0000000..d4b9f00
--- /dev/null
+++ b/features/editor_image_crop_resize.qa.md
@@ -0,0 +1,86 @@
+# QA: Crop and resize step in the editor's image uploader
+
+## Automated (Vitest + Vue Test Utils, `task test:web`)
+
+Mount EditorPage inside DashboardShell at `/article/12/edit` with the editor_core.qa.md fixture
+article (id 12, "How we price a bathroom renovation", is_online false), GET already resolved
+200. Reuse editor_image_upload.qa.md's fake-XHR setup for the upload itself. Stub the chosen
+file's decoded natural size (e.g. mock `Image`/`createImageBitmap` or whatever the component
+uses to read `naturalWidth`/`naturalHeight`) so tests control it deterministically, and stub the
+crop/resize step's own output producer (whatever function turns the frame rect + width preset
+into a Blob) as a spy, asserting it is called with the frame's rect in natural-image pixels and
+the resolved output width/height, and stubbing its returned Blob's size — without asserting how
+it renders internally (canvas/OffscreenCanvas is a coder implementation detail).
+
+1. **A raster file opens "Crop and resize" instead of uploading** — choose `north-wall.jpg`
+ (image/jpeg, 3.9 MB, natural 4032×3024); assert no XHR is created; assert the modal title is
+ "Crop and resize", description "north-wall.jpg · 3.9 MB", ratio "Original" and width
+ "1600 px" selected, mono line "Uploads as 1600 × 1200 px · about 420 KB", footer "Choose
+ another file" / "Upload image".
+2. **An SVG bypasses the step** — choose `diagram.svg` (image/svg+xml, 40 KB); assert an XHR to
+ `/v1/article/12/image` is created immediately and the crop step never renders.
+3. **Ratio presets lock the frame, Examples-driven (16:9 / 4:3 / 1:1)** — from the opened step,
+ select each ratio pill; assert the frame's reported rect and the mono line's output size match
+ the feature's Examples table.
+4. **Width preset recomputes the output** — select width "800 px"; assert the mono line reads
+ "Uploads as 800 × 600 px" (assert dimensions exactly; assert only that the size figure changed
+ to a smaller value, not a specific number).
+5. **A crop narrower than the width shows the info row and keeps its own size** — resize the
+ frame (via its resize API/spy) to 640×640 with ratio "1:1", width "1600 px"; assert the mono
+ line reads "Uploads as 640 × 640 px · about {size}" and the info row reads exactly "The crop
+ is 640 px wide, so it's uploaded at that size. Enlarging it would make it blurry."
+6. **Free ratio removes the constraint** — select ratio "Free"; assert a subsequent resize call
+ with independent width/height is accepted without being coerced back to a ratio.
+7. **Arrow and Shift+Arrow keys move/resize** — focus the frame; fire `ArrowRight`; assert the
+ frame's x increases by 1 px and the mono line's size is unchanged; fire `Shift+ArrowRight`;
+ assert the frame's width increases by 1 px and the mono line updates.
+8. **Rotate cycles 90° and Reset restores defaults** — activate "Rotate"; assert the reported
+ rotation is 90°; activate "Reset"; assert ratio "Original", width "1600 px", the frame back to
+ the whole unrotated image, and the mono line "Uploads as 1600 × 1200 px · about 420 KB".
+9. **"Choose another file" discards the step** — activate it; assert no XHR was created and the
+ idle state renders.
+10. **A newly chosen file reopens at defaults** — from idle after "Choose another file" out of a
+ 16:9/800px step, choose `sunset.jpg` (image/jpeg, 2.1 MB, natural 3000×2000); assert the new
+ crop step opens with ratio "Original", width "1600 px", frame as the whole new image (not the
+ previous file's ratio/width).
+11. **"Upload image" sends the cropped/resized file** — from the default 1600×1200/420 KB step,
+ activate "Upload image"; assert the XHR is created with a file whose declared size is 420 KB
+ (not 3.9 MB); assert the uploading state shows "Uploading 0.0 of 420 KB"; fire an
+ `upload.progress` with `loaded: 180 * 1024, total: 420 * 1024`; assert "north-wall.jpg 43%"
+ and "Uploading 180 of 420 KB".
+
+## Visual (manual verification via `task visual:check -- editor` — desktop and mobile, light and
+dark)
+
+Reference: `docs/design/screens/editor.md` states "Upload: crop and resize", "Upload: crop to a
+ratio", "Upload: crop narrower than the width", and the updated "Upload: in progress"; board
+`docs/design/source/RenewCMS Screens Back-office.dc.html`, group "Editor". Add each state's mock
+setup to `web/visual/states.ts`, reusing editor_core.qa.md's fixture article (id 12, "How we
+price a bathroom renovation", draft) and the sample file "north-wall.jpg · 3.9 MB".
+
+- [ ] Upload: crop and resize — modal "Crop and resize" / "north-wall.jpg · 3.9 MB", ratio
+ "Original", width "1600 px", cancel "Choose another file", confirm "Upload image".
+- [ ] Upload: crop to a ratio — same modal, ratio "16:9" selected, frame locked to that ratio.
+- [ ] Upload: crop narrower than the width — ratio "1:1", width "1600 px", frame resized to
+ 640×640, info row "The crop is 640 px wide, so it's uploaded at that size. Enlarging it
+ would make it blurry."
+- [ ] Upload: in progress (updated) — modal "Add an image", uploading "north-wall.jpg 43%" /
+ "Uploading 180 of 420 KB", cancel "Cancel upload".
+- [ ] Mobile (all of the above at 390×844): same modal layout constraints as other editor modals.
+- [ ] Keyboard/focus: the crop frame is reachable by Tab; its `aria-label` is "Crop area. Arrow
+ keys move it, Shift and arrow keys resize it."; Arrow/Shift+Arrow move and resize it without
+ moving focus elsewhere; the aspect-ratio and width radiogroups follow standard roving-tabindex
+ radiogroup keyboard behavior (arrow keys between pills, one tab stop per group); "Rotate" and
+ "Reset" are reachable and named by their visible text.
+ - [ ] Motion: no auto-close or timed transition in this step; frame drag/resize follows pointer
+ with no easing delay (not part of the 10 % capture budget, spot-checked only).
+
+## Manual verification
+
+- **Real image decoding and resizing** — Vitest stubs `naturalWidth`/`naturalHeight` and the
+ output producer; confirm real JPEG/PNG/WEBP files of varying orientations and EXIF rotation
+ crop, rotate and resize correctly against `task dev` with a live server, since jsdom has no
+ real canvas/image pipeline.
+- **Real POST of the resized file** — confirm the actual uploaded bytes decode to the expected
+ pixel dimensions server-side, complementing `features/upload_article_image.feature`'s
+ httptest coverage of the handler in isolation.
diff --git a/web/src/components/ImageUploader.vue b/web/src/components/ImageUploader.vue
index 2fda1df..8f5ef26 100644
--- a/web/src/components/ImageUploader.vue
+++ b/web/src/components/ImageUploader.vue
@@ -1,13 +1,38 @@
+