Support rich text with embedded images in a textarea.
I need to allow users to create "posts" with embedded images. I am thinking about adding a JavaScript WYSIWYG editor such as Trumbowyg and store the HTML in the database. Also, the images should be uploaded to the server via Ajax when they are inserted in the text editor.
It looks like a sizable task, so I wanted to ask here first in case anyone thought about this before. Also, how likely is that FAE would incorporate this feature if it gets coded.
Thanks for the feature request, @6temes. We currently use the rich text editor SimpleMDE which supports Markdown and highlights formatting live. It's enabled by using the markdown option.
fae_input f, :some_text_area, markdown: true
It currently lacks the ability to directly upload and embed images, however we have customized one of our apps to include such a feature. I think I'd only consider a PR if the feature is built on top of SimpleMDE. I'll leave this open as a feature request and look into what it would take to port over our previous integration.
thanks
Yeah please support this i need it also 👍 thanks
I guess that there two different subjects here:
First is how to upload images and include them in a rich text field. Should those images belong to the model parent model or it is better just have a generic EmbeddedImage model and throw them there?
Second is if it could be possible to support raw HTML in rich text fields.
I prefer the EmbeddedImage way and anyway please add an optional instead of using markdown editor we can use the wysiwyg editor it more common for not tech savy user. God bless
@6temes: For our integration we enabled the image button on SimpleMDE and coded it to open a modal with an image uploader. Once an image was uploaded, it'd embed the md code with the location of the uploaded image. The image doesn't need it's own object, we just used Fae::Image as there's no real association other than a hardcoded link in the markdown.
Second is if it could be possible to support raw HTML in rich text fields.
Fae doesn't have any built in helpers to output HTML in the textareas, but you can put whatever content in the textareas you want, including HTML. It's up to the frontend to determine how it's parsed.
@ferryphang: I'm sorry but we won't be developing a wysiwyg integration other that the current SimpleMDE. PRs would be considered :)
despite us devs prefering MD, a WYSIWYG editor with good image integration is vital to get other team members / clients to think about adopting a cms.
fixed in #224, thanks @6temes!
This is great news! thanks @6temes