Upload an image using the Static Site Editor
Problem to solve
In the 1st iteration of adding the ability to insert images using the Static Site Editor, we discussed storing the image contents as base64 encoded string within the file that's being edited.
Storing the image contents in this way is not ideal and has some clear drawbacks that should be addressed before we implement this feature.
Intended users
Proposal
When inserting an image via the Static Site Editor we should not permanently store the image contents in the file that's being edited. We should add the image to an MR and store it in the project repo once the MR is merged.
What does success look like, and how can we measure that?
When images are added via the Static Site Editor the contents should not be stored in the Markdown file that's being edited. Ideally, images should be added to an MR and stored in the project repository once the MR is merged.
The Markdown file should reference the added images in the project repo.
Uploading a new image
- A user should be able to upload any image from the supported file formats
- jpg/jpeg
- gif
- png
- A description is optional
- Images are uploaded to a default directory
- Something like
/source/images/uploads
- Something like
Questions
- Can we support relative links prior to generating the image? How would we preview the result if there was no direct URL to reference?
- Is referencing a URL directly any kind of security risk?
- Where do we store uploaded images?
- Should we make the upload directory configurable?
- What happens if an image with the same file name already exists in the target directory?
- When clicking
Save Changes
, should newly inserted images be added to the MR that gets created? - If newly inserted images are added to an MR before we add it to the
master
branch, how do we reference it in the SSE (what happens to the URLs once it gets merged)?
Designs
- Design: #218529[Upload_image_file.png]
- Figma: https://www.figma.com/file/RhYal9t4OZk7IeYsSvEHpW/WYSIWYG-markdown-editor-214559?node-id=433%3A23582