learningequality / learningequality/studio
Notify the user when images are stripped on paste
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 191
- Forks
- 307
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
After #5897, the TipTap editor silently strips <img> tags from pasted HTML — users have no feedback that content they thought they were pasting was removed. Add a brief, user-visible affordance (toast or inline indicator) shown when one or more images were stripped from a paste, so users understand why their pasted content looks different from the source.
Complexity: Low
Target branch: unstable
Context
#5897 was a hotfix; adding a user-visible string wasn't possible without going through the string-freeze process. This issue captures the affordance for unstable.
The Change
When transformPastedHTML strips one or more <img> tags from a paste, surface a brief notification — single toast per paste batch, not per image. Text along the lines of "N image(s) were removed from your paste." Use Studio's existing notification component.
The transformer needs to surface a count to its callers (both editorProps.transformPastedHTML and the toolbar handlePaste). The notification is triggered from those call sites.
How to Get There
- Open an exercise's TipTap editor.
- Paste HTML containing one or more remote
<img>tags (e.g. from https://wiki.c2.com/?TextFormattingExamples). - Expect: a toast/notification indicates the images were removed. The pasted text content survives intact.
Out of Scope
- Changing the strip behavior. Images are still removed; only the notification is added.
- Per-image affordances (inline placeholders, retry buttons). Single per-paste toast only.
- Notifying about the Word/Office cleanup the same transformer performs — only the
<img>strip is user-visible enough to warrant notification.
Acceptance Criteria
General
-
transformPastedHTMLsurfaces a count of stripped<img>tags to its callers.- Either return shape
{html, strippedImgCount}plus update both call sites, or write the count to a transient storage slot the caller reads.
- Either return shape
- Native paste path (
editorProps.transformPastedHTMLinuseEditor.js) triggers a toast when count > 0. - Toolbar Paste button path (
handlePasteinuseToolbarActions.js) triggers the same toast when count > 0. - Toast is fired once per paste batch, not per image.
- New i18n string added for the toast message (with a count placeholder, e.g. ICU
{count, plural, ...}). - Toast uses Studio's existing snackbar / notification component (check
KSnackbarfrom kolibri-design-system or whatever the editor surrounding chrome currently uses).
Testing
- Unit test:
transformPastedHTMLreturns/surfaces count = N when input has N<img>tags. - Unit test: count = 0 → no notification triggered.
- Component test or manual: toast appears with correct count after a paste containing imgs.
References
- #5895 (original bug).
- #5897 (the strip-only PR — introduced the silent removal behavior this issue addresses).
- #5898 (the data: URI upload follow-up; complements this UX work).
AI usage
Used Claude (Opus 4.7) to draft this issue from the spec written during #5897's brainstorming. I reviewed each section and adjusted scope and phrasing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in useEditor.js and useToolbarActions.js, tracing how transformPastedHTML is called and how the existing Studio notification component is used. Then inspect the transformer and its unit tests, adding coverage for stripped-image counts and zero-count behavior. Done means both paste paths show one localized notification per paste batch while pasted text remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, internationalization, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100