0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/spec/system/composer
Renato Atilio ce43d1b189
UX: better rich editor placeholder for non-image and image uploads (#39102)
Previously, all uploads in the rich editor used image placeholder nodes
— even for non-image files like PDFs. This looked broken since a blob
URL for a PDF rendered as a broken image.

This PR introduces a dedicated `upload_placeholder` inline node for
non-image uploads, rendered as a pill with the filename, upload
progress, and a cancel button. Image placeholders now also get a
progress/cancel overlay.

The entire upload lifecycle (insert → progress → resolve/cancel) is
excluded from undo history, so Ctrl+Z never leaves orphaned
placeholders. Deleting a placeholder automatically cancels the in-flight
upload, and duplicates from Option+drag or copy+paste are cleaned up via
`appendTransaction`.

It also fixes a flash of `transparent.png` on image upload completion by
resolving the cached upload URL in the same transaction as the
placeholder replacement.

<img width="275" height="109" alt="image"
src="https://github.com/user-attachments/assets/6b808094-46f9-44db-ad77-6a7714d51587"
/>

<img width="529" height="217" alt="image"
src="https://github.com/user-attachments/assets/3606f992-f6cd-4e88-863e-191c3cc72a9c"
/>

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2026-05-20 16:48:51 -03:00
..
category_templates_spec.rb DEV: Enable Rails/FilePath rubocop rule (#40097) 2026-05-19 19:07:54 +02:00
default_to_subcategory_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
dont_feed_the_trolls_popup_spec.rb DEV: Fix (again) composer body test flakes (#39578) 2026-04-27 12:48:17 +02:00
drafts_spec.rb FIX: use editing-specific text for composer discard and fix false dirty state (#39149) 2026-04-14 23:07:35 +02:00
enqueued_post_draft_spec.rb FIX: Discard draft modal shown after submitting post for approval (#38870) 2026-03-26 09:39:11 +01:00
form_template_tag_chooser_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
post_validation_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
prosemirror_autocomplete_spec.rb DEV: Add missing http mocks in specs (#39229) 2026-04-13 20:43:21 +02:00
prosemirror_code_spec.rb DEV: Restore two prosemirror specs (#39637) 2026-04-29 15:34:19 +02:00
prosemirror_container_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
prosemirror_images_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
prosemirror_input_rules_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
prosemirror_keymap_spec.rb DEV: Add SystemHelpers::LINE_START_KEY (#39498) 2026-04-23 20:48:54 +02:00
prosemirror_links_spec.rb FIX: preserve selection formatting in link-insertion modal (#39374) 2026-05-20 11:22:35 +02:00
prosemirror_onebox_spec.rb DEV: Restore and fix prosemirror specs (#39502) 2026-04-24 15:11:45 +02:00
prosemirror_onebox_toolbar_spec.rb DEV: remove flaky rich editor onebox test (#39278) 2026-04-15 01:05:29 -03:00
prosemirror_pasting_spec.rb DEV: Restore two prosemirror specs (#39637) 2026-04-29 15:34:19 +02:00
prosemirror_quotes_spec.rb DEV: Restore and fix prosemirror specs (#39502) 2026-04-24 15:11:45 +02:00
prosemirror_toolbar_spec.rb DEV: Fix prosemirror toolbar spec flakes (#40093) 2026-05-16 18:46:10 +02:00
prosemirror_uploads_spec.rb UX: better rich editor placeholder for non-image and image uploads (#39102) 2026-05-20 16:48:51 -03:00
prosemirror_watched_words_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
prosemirror_wrap_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
review_media_unless_trust_level_spec.rb DEV: Update rubocop (#38721) 2026-03-20 00:39:52 +01:00
template_validation_spec.rb FIX: Enforce required validation on form template upload field (#38799) 2026-03-24 14:07:05 +01:00