5.加入呼叫javascript在app/assets/javascripts/application.js
1 |
//= require ckeditor/init |
6.如果要Deployment請加在config/initializers/assets.rb
上
1 |
Rails.application.config.assets.precompile += %w( ckeditor/* ) |
7.搭配SimpleForm使用
1 2 3 |
<%= f.input :content, input_html: { class: 'ckeditor' } %> or <%= f.input :content, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} } %> |
8.客製化Toolbars…等,請調整 app/assets/javascripts/ckeditor/config.js (沒有請建立)
1 2 3 4 5 6 7 8 9 10 |
CKEDITOR.editorConfig = function (config) { // ... other configuration ... config.toolbar_mini = [ ["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"], ]; //工具按鈕排列方式 config.toolbar = "simple"; //簡單的toolbar形式 // ... rest of the original config.js ... } |
9.原生CKEditor沒有支援Youtube插入功能,請先下載Plugin(http://ckeditor.com/addon/youtube),放置於app/assets/javascripts/ckeditor/plugins/youtube中
10.於app/assets/javascripts/ckeditor/config.js增加Youtube按鈕
1 |
config.extraPlugins = 'youtube'; |
11.即可完成使用!
Pages: 1 2