Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rich text with embedded images in a textarea. #213

Closed
6temes opened this issue Apr 12, 2017 · 8 comments
Closed

Support rich text with embedded images in a textarea. #213

6temes opened this issue Apr 12, 2017 · 8 comments

Comments

@6temes
Copy link
Contributor

6temes commented Apr 12, 2017

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.

@jamesmk
Copy link
Member

jamesmk commented Apr 12, 2017

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

@ferryphang
Copy link

ferryphang commented Apr 13, 2017

Yeah please support this i need it also 👍 thanks

@6temes
Copy link
Contributor Author

6temes commented Apr 13, 2017

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.

@ferryphang
Copy link

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

@jamesmk
Copy link
Member

jamesmk commented Apr 14, 2017

@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.

screen shot 2017-04-13 at 4 38 11 pm

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 :)

@asecondwill
Copy link

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.

@jamesmk
Copy link
Member

jamesmk commented May 18, 2017

fixed in #224, thanks @6temes!

@jamesmk jamesmk closed this as completed May 18, 2017
@asecondwill
Copy link

This is great news! thanks @6temes

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

No branches or pull requests

4 participants