Skip to content

Adding image upload to Quill editor#5364

Closed
armandfardeau wants to merge 6 commits intodecidim:masterfrom
armandfardeau:feature/quill-enhanced
Closed

Adding image upload to Quill editor#5364
armandfardeau wants to merge 6 commits intodecidim:masterfrom
armandfardeau:feature/quill-enhanced

Conversation

@armandfardeau
Copy link
Copy Markdown
Contributor

🎩 What? Why?

Adds an option to add images in the Quill editor on the administrator side (where the editor was previously "full").
The images are uploaded in Base64 format and can be resized.

📋 Subtasks

  • Add CHANGELOG entry
  • Add tests

📷 Screenshots (optional)

image

@armandfardeau armandfardeau requested a review from a team as a code owner September 25, 2019 21:51
@oriolgual
Copy link
Copy Markdown
Contributor

Looks good to me, @andreslucena and @carolromero thoughts?

@carolromero
Copy link
Copy Markdown
Member

carolromero commented Sep 26, 2019

@oriolgual Looks good to me too

@tramuntanal
Copy link
Copy Markdown
Contributor

just linking another PR that was doing the same but not accepted because we were waiting to migrate to rails 6 Trix editor: #4595

Aren't both doing the same?

@microstudi
Copy link
Copy Markdown
Contributor

In favor, the other PR died of inactivity due the discussion about waiting for rails 6. But, let's be realistic, I don't think we are going to migrate anytime soon. Meanwhile this will work for many people.

@oriolgual
Copy link
Copy Markdown
Contributor

@andreslucena are you OK with merging this?

@armandfardeau
Copy link
Copy Markdown
Contributor Author

@tramuntanal Currently, this does something a little bit different. It adds a way to upload AND resize an image.
It also only permit this behavior from previous ":full" version of quill editor which are located on the admin side.

I agree with most of the point of views against this but...

  • This is fully reversible, after all, Base64 encoded images are just text.
  • It should not impact performance significantly since it's only on the admin side.
  • Issue Added a new button to the editor's toolbar: "image" #4595 is from December 2018, and Decidim should not be an image-free platform.

I explored many ways to mimic this behavior, async uploader, text parser.
I see this pull request as a temporary solution that will be easily modified as soon as the need arises.

@tramuntanal
Copy link
Copy Markdown
Contributor

Hey, I liked this feature very much so let's add it!

But at the moment of the other PR there was a member of the community also wanting it and he was not allowed to. Since that PR they did not contribute anymore to the project because they were frustrated. It seems that sometimes decisions are randomly made, just wanted to note that, that's all (maybe the channel I should have used is the meta I'm not sure, don't want to open a discussion anyway).

@virgile-dev
Copy link
Copy Markdown
Contributor

We have so many admins begging for this !
Let's make them happy ❤️ Please 🙏

@andreslucena
Copy link
Copy Markdown
Member

Just to give some feedback: I keep thinking the same about having base64 images on the admin panel. I think we all agree that's far from the optimal solution. It has Performance problems and Caching problems. Thinking a little more on this issue I can see also Backup problems:
Also as far as I understand this could have implications on things like backups: if there are lots of base64 images on the database all the backups are going to keep getting much bigger than now, and it doesn't allow to have features that files have, like de-duplication of same files.
We're planing to have the Rails 6 upgrade on the maintenance contract that starts on October. We're hoping to have a clear calendar of the roadmap of the next couple of next months on the next couple of weeks.

@carolromero
Copy link
Copy Markdown
Member

Thank you @andreslucena for pointing out the technical problems that this fix can bring. What do you think of this @oriolgual? And the rest of devs?

@microstudi
Copy link
Copy Markdown
Contributor

@andreslucena is completely right, but I think that pretty much everyone is already introducing images in base64 format in their Decidim installations by using the "Drag&Drop trick". This just makes life easier for admins.

However, if not approved, customs installation can overwrite those views to add this field as a workaround until Rails 6 is here.

@oriolgual
Copy link
Copy Markdown
Contributor

Maybe there's a workaround: we could use Quill's feature, but then at the backend parse the content of the textfield, extract the image in base64, add it as a regular attachment and then change the content of the text with the attachment URL. What do you think?

@oriolgual
Copy link
Copy Markdown
Contributor

Maybe there's a workaround: we could use Quill's feature, but then at the backend parse the content of the textfield, extract the image in base64, add it as a regular attachment and then change the content of the text with the attachment URL. What do you think?

This could be done in an async job too, this way the user doesn't have to wait too much

@microstudi
Copy link
Copy Markdown
Contributor

The async job would provide backward compatibility with the current situation. We could even merge this PR and create in the future this job to parse all existing content and replace blobs.
Someone should commit to do it though...
Maybe we would have problems with the MD5 signature if we change content?

@armandfardeau
Copy link
Copy Markdown
Contributor Author

armandfardeau commented Oct 1, 2019

I would be happy to work on an async job to parse the body and upload it as an image. I'm just afraid it cannot be done shortly as this feature has not been funded.

@andreslucena
Copy link
Copy Markdown
Member

@tramuntanal can you chime in on the last proposed solution please?

@tramuntanal
Copy link
Copy Markdown
Contributor

Hi all,
I think the same as @andreslucena but it is also true that many admins want this feature.

Upgrading to Rails 6 won't solve the problem "per se", because when we say "upgrading to rails 6" we're implicitly saying "migrating to Trix editor" no?
To migrate to Trix editor first we will have to migrate from carrierwave to active-storage, and then migrate from Quill to Trix.
None of this steps is trivial, but all three are a must do for Decidim I guess.

So, my position is that it will take long until we're into Trix, but we must go there. Meanwile we can apply @oriolgual 's patch in an encapsulated processor that will be easy to remove later.

@andreslucena
Copy link
Copy Markdown
Member

Hi @armandfardeu
I think we all agree that the best solution would involve on having an async job to process the image, so we can keep this PR open until you have time and funding to tackle this.
I know this is not optimal as you've already work on this, as there's working code already, that's why we recommend to start the discussion on MetaDecidim before.
Maybe in the meantime this could be solved on your installations by other ways: like making an override to the javascript code that configures QuillJS or making a decidim-module-quill-extended.
Thanks for your time and dedication on this issue, as I said before I think this is a really important feature although the solution that you've proposed is not optimal :/

@andreslucena
Copy link
Copy Markdown
Member

I would be happy to work on an async job to parse the body and upload it as an image. I'm just afraid it cannot be done shortly as this feature has not been funded.

Just so we can keep focus on the rest of the PRs, I'm going to close this issue until you guys have funding available to make this change on the logic.

@armandfardeau thanks for your work and dedication on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants