Does liquid work with wysiwyg editors? - rails - ruby-on-rails

I have just found liquid and watched the Railscasts on it. The video was pretty old but from watching it, it i can see liquid is what im looking for. Problem is I'm not sure if it will work with popular wysiwyg editor gems. I don't really want my users to be using plain input fields to make the templates.
I don't know if the wysiwyg editor has to be special to work with liquid or if liquid can basically work with any wysiwyg editor gem.
Are there recommended wysiwyg editor gems that work well with liquid or if that isn't a thing are there just normal editor gems that work with liquid?

Yes. Please read this blog. You can also use newsly gem to manage your liquid template with wysiwyg editor. I used ckeditor in one of my application. It's quite easy to install.

Basically you will need to parse the content and add your own data. The editor will not automatically figure out the variables and their values. The editor will save the content with tags and later you can parse it with Liquid
Here is an example form Liquid
#template = Liquid::Template.parse("hi {{name}}") # Parses and compiles the template
#template.render('name' => 'tobi') # => "hi topi"
https://github.com/Shopify/liquid#how-to-use-liquid
And here is a blog post on how someone is using a wysiwyg with Liquid
https://customer.io/blog/Email-wysiwyg-editor-inspired-by-jekyll.html
Hope that helps

Related

How to make text edit function by Rails

Same as title the following, thx~
It is called RTE, or Rich Text Editor. There're many RTEs, and one of them for rails is wysiwyg-rails, it provides the Froala WYSIWYG HTML Editor javascript and stylesheets as a Rails engine for use with the asset pipeline.
You can follow this tutorial to install it: https://github.com/froala/wysiwyg-rails

Is TinyMCE editor compatible with rails 2?

Is TinyMCE editor compatible with rails 2? what are better editors apart from fck editor that can be used in rails, is it compatible with rails 2 as well?
EDIT:
Is TinyMCE editor customizable? html tags can be used in the editor space?
Yes, TinyMCE is compatible with all versions of Rails, because it really has nothing to do with it, all frontend (client-side) editors are just "decorators" for textareas, meaning Rails doesn't care what's in them.
I normally avoid using editors like TinyMCE or FCK, because they force me to "reverse" my development workflow - they come with everything and I need to strip 90% of functionality down. So a better approach would be to use something like markdown and educate users on it's use.
And yes, pretty much all editors are heavily customizable - I recommend you read their respective manuals

How do I turn a RoR view to Responsive (html5)

I have a normal view in html in Rails, containing images and links. How do I turn it to be responsive? (I want it to fit also mobile browser sizes, make it html5)
I know I should use fluid, but what is the full command? Or is there another/better way directly from the text editor?
Rails has limited control on the HTML that comes on to the browse.
Try looking at frameworks like Bootstrap or Foundation.
There are some gems that can help you
Foundation-rails
twitter-bootstrap-rails
There is also a railscast episode on Bootstrap basics.
This has nothing much to do with Rails. Rails is a server side language and responsive templates are frontend (html/css) dependent.
However if you are specifically using bootstrap as many beginners do, you could try : https://github.com/seyhunak/twitter-bootstrap-rails gem for a quick integration of things.

Show Redcloth source in ckeditor : rails3

I just installed ckeditor into my rails app. Now i am trying to do is, configure redcloth and ckeditor in a way that, instead of the html source i would like the ckeditor to show the redcloth source ?
Any hints on how would i achieve that ?
If you are using CKEditor just for its toolbar, I mean just just the possibility to be able to use buttons to apply formatting, I think you should not use CKEditor, which is (from what I know) absolutely not made to work with markdown. What you are looking is a markdown editor.
I recently looked for a good markdown editor, and guess what, the best solution I have found is Stackoverflow markdown editor. It is called pagedown
Note that this editor is a lot lighter than something like ckeditor since the actual element in which you are editing your content is just a textarea. You just hook pagedown to it by using javascript. In Ckeditor, you are actually writing your content into an iframe with a contentEditable="true" parameter, and CKEditor is recopying what you are writing into a hidden textarea.

WYSIWYG web page editor

Hi i want to use WYSIWYG web editor (the editor should have a option for adding videos, images,powerpoint etc..) on to my Rails application. Can any one suggest how can i integrate this editor into my rails application with above feature support. Thanks in advance
FCKEditor
Now it is known as CKeditor.
Please check this tutorial whcih explains how to integrate FCKEditor in Ruby on Rails
You might want to check out WYSI-dangerous: Why WYSIWYG editors are bad for your website and take a look at wymeditor.

Resources