Integration - BoTreeConsultingTeam/rails-tinymce-preview-demo GitHub Wiki
Welcome to the rails-tinymce-preview-demo wiki!
1.Add to Gemfile
gem 'tinymce-rails'
2.bundle install
3.Include the TinyMCE assets in application.js
//= require tinymce
//= require tinymce-jquery
4.Add to app/views/layouts/application.html.erb
<%= tinymce %>
5.Add to app/views/pages/home.html.erb
<div id='preview'></div>
<%= image_tag "albert_einstein_genius_4020.jpg" %>
<%= text_area_tag :content, '',:class => "tinymce", :rows => 40, :cols => 120, id: 'content' %>
6.Create js file for TinyMCE options and events(tinymceoptions.js
)
- options for TinyMCE
- selector: "textarea" --> This option allows you to specify a CSS selector for
the areas that TinyMCE should make editable.
- plugins --> plugins for TinyMCE editor
- toolbar --> Avaliable tools for content editing in TinyMCE editor
- paste_data_images: true --> Allow image drag and drop in TinyMCE editor
- menubar: false --> for hide menubar in TinyMCE editor
- Events
-
setup --> This option allows you to specify an event that will be executed before the TinyMCE editor instance is rendered.To specify a setup event, please provide the setup option with a javascript function. This function should have one argument, which is a reference to the editor that is being set up.
-
change event --> Fires when contents is modified in the editor
-
keyup event --> Fires when press key from keyboard.
-
7.Add tinymceoptions.js
to application.js
//= require tinymceoptions