Skip to content

Improve file upload experience in content editor

Himanshu Kapoor requested to merge himkp-ce-uploads into master

What does this MR do and why?

Improve file upload experience in content editor:

  1. Allow multiple files (of mixed types: PDF, images, videos, audio etc) to be uploaded at the same time, using the attachment icon in toolbar, using drag/drop or using paste.
  2. Prevent uploads from failing if user makes a change while the file is being uploaded.
  3. Show progress of each upload in a bubble menu when the uploaded file link/image/video/audio is selected.
  4. Allow audio/video to play even before it is uploaded.
  5. Prevent files larger than max upload size from being uploaded and show appropriate warning.
  6. Uploaded images and videos have a max-width set.
  7. Show a selection ring around video and audio files.
  8. If comment is submitted before upload finishes, a broken image/video element isn't added to the page.
  9. Content editor no longer inserts broken images
  10. When adding to a link, the link styling disappears until I press the spacebar
  11. It should be possible to advance the cursor after pressing the spacebar after a link

TODO: (Issues exist on master as well.)

  1. Prevent comment/form from being submitted if the upload has not finished yet.

Screenshots or screen recordings

Scenario Current This MR
Uploading multiple videos
  1. Unable to select multiple files
  2. Videos are very big in dimensions
  3. No progress visible
  4. Cannot play video while it is being uploaded, or even after it is uploaded.

Screen_Recording_2023-05-01_at_12.20.47

  1. Can select multiple files
  2. max-width set on uploaded images and videos
  3. Video can be played while it is being uploaded
Uploading very large files

image

  1. Upload begins and error is thrown after upload fails
  2. Error message is not clear about the file size.

Screen_Recording_2023-05-01_at_12.27.18

Error message is clear, and it shows even before the file has begun uploading.

Uploading progress Only a progress indicator is visible, no percentage included.

Note: Throttle to slow 3G first to simulate a slow upload

image

Untitled

Uploading multiple files Not possible

Screen_Recording_2023-05-01_at_12.41.44

How to set up and validate locally

  1. Disable live reload and restart GDK.
diff --git a/config/webpack.config.js b/config/webpack.config.js
index 4a3c970427c0..03410a600f5d 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -60,7 +60,7 @@ const { DEV_SERVER_HOST, DEV_SERVER_PUBLIC_ADDR } = process.env;
 const DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10);
 const DEV_SERVER_ALLOWED_HOSTS =
   process.env.DEV_SERVER_ALLOWED_HOSTS && process.env.DEV_SERVER_ALLOWED_HOSTS.split(',');
-const DEV_SERVER_LIVERELOAD = IS_DEV_SERVER && process.env.DEV_SERVER_LIVERELOAD !== 'false';
+const DEV_SERVER_LIVERELOAD = false;
 const INCREMENTAL_COMPILER_ENABLED =
   IS_DEV_SERVER &&
   process.env.DEV_SERVER_INCREMENTAL &&
  1. Enable feature flag: echo "Feature.enable(:content_editor_on_issues)" | rails c
  2. Navigate to an issue and try to write a comment. Switch to content editor using the bottom right switcher.
  3. Use the paperclip.svg to attach one or more files, images, videos, audio etc.
  4. Try to edit the page while the file is being uploaded.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Himanshu Kapoor

Merge request reports