Repository URL to install this package:
|
Version:
0.9.0 ▾
|
| assets |
| examples |
| lib |
| Gemfile |
| README.md |
| Rakefile |
| el-ckeditor.gemspec |
$ gem install el-ckeditor
or add gem 'el-ckeditor' to your Gemfile
Ignore this if el-ckeditor added to Gemfile and Bundler.require used.
Otherwise you'll have to load el-ckeditor gem explicitly.
Just add this at the top of your app:
require 'el-ckeditor'
Just include EL::CKE into your controllers and render editor using ckeditor:
# --- base/controllers/articles/edit.rb --- class Articles include EL::CKEditor def edit id @article = Article.first(id: id.to_i) || styled_halt(400, 'Article not found') render end end # --- base/views/articles/edit.slim --- textarea#content = @article.content == ckeditor(:content)
If you need a file browser to pick images/video from, set :path option to a directory containing images/videos:
== ckeditor(:content, path: 'public/assets')
Path should be relative to application root.
When you need a prefix to be prepended to image's URL, use :prefix option:
== ckeditor(:content, path: 'public/assets', prefix: 'images')
el-ckeditor will update textarea content when save button hovered.
It could be done by listening onchange event, but this will duplicate content multiple times and could make the page huge and slow on bigger documents.
To mark some button as save button add saveButton class.
That's it, saveButton are used by default by el-ckeditor. You can also use another CSS selector by passing it via :save_button option:
== ckeditor(:content, save_button: '#save')
If you have a list of snippets you need to insert into edited content, pass them into editor via :snippets option:
- snippets = ['{{ "top-menu" }}', '{{ "left-menu" }}'] == ckeditor(:content, snippets: snippets)
You can also provide a proc for snippets. It will be called every time editor rendered:
- snippets = lambda { Snippet.all.map(&:name) } == ckeditor(:content, snippets: snippets)
If you need to render a readonly editor, set :readonly option to true:
== ckeditor(:content, readonly: true)
As simple as:
== ckeditor(:content, lang: :de)
See the list of available languages here
Mailing List: groups.google.com/.../espresso-framework
IRC channel: #espressorb on irc.freenode.net
Author - Walter Smith