开发者

What is the best WYSIWYG for Rails - Ruby on Rails Blog [closed]

开发者 https://www.devze.com 2022-12-27 11:23 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

Improve this question

What is the best way to allow for the adding of images and embedding 开发者_StackOverflowof video in the body:text field of a Ruby on Rails blog.

I understand that I can use an attachment like Paperclip to add a photo to a record but I am wondering how to get images/vids into the actual body of the post.


I strongly suggest you give WYSIHAT a try. The biggest problem with the editors mentioned above is its bulky size and "hard-to-customize"(ability). The bad code in most of these editors is a big turn-off. WYSIHAT is more like a framework for a WYSIWYG editor. Extremely easy to customize. Easy to configure. And what more.. Its backed by 37signals. What i would appreiciate about TinyMCE is its paste from word feature which preserves the layout. But if not for that one feature i find the rest really bulky.

Please do read this article: http://37signals.com/svn/posts/1330-introducing-wysihat-an-eventually-better-open-source-wysiwyg-editor

Tutorial on using WYSIHAT: Part 1: http://jrmehle.com/2009/01/25/wysiwhat-wysihat-part-1/

Part 2: http://jrmehle.com/2009/02/13/wysiwhat-wysihat-part-2/

And to make your life even easier theres an awesome rails-engine developed by Jeff Kreeftmeijer (80beans.com) for the 37signals WYSIHAT editor: http://github.com/80beans/wysihat-engine

And heres an article by Jeff Kreeftmeijer: http://www.80beans.com/2009/10/01/wysihat-engine/


Try CKEditor for Rails. It is new version of FCK editor with very clean HTML generator. Very easy to embed. All you need to do is replace your input(text-area) helper tag (for content) with another helper tag. Everything is described nicely in project README. You can upload files (pictures) and use them in content directly from CKEditor.


One of the classic ways to get embedded stuff like that is to use a WYSIWYG editor like TinyMCE. I've used the plugin TinyMCE and there is also TinyMCE Plus. There are probably plugins for TinyMCE itself to handle some of the embedding stuff.

If you start to allow some tags in your body posts, make sure you are protecting yourself from scripting attacks etc, with something like sanitize to clean up tags you don't want to allow. Make sure you read about XSS and HTML/JavaScript injection.

0

精彩评论

暂无评论...
验证码 换一张
取 消