-
Notifications
You must be signed in to change notification settings - Fork 238
Customizing the buttons
Eric London edited this page Jun 23, 2013
·
1 revision
In the gem source (lib/rich.rb) you can see the default buttons defined in @@editor[:toolbar]:
@@editor = {
:height => 400,
:stylesSet => [],
:extraPlugins => 'stylesheetparser,richfile,MediaEmbed',
:removePlugins => 'scayt,menubutton,image,forms',
:contentsCss => :default,
:removeDialogTabs => 'link:advanced;link:target',
:startupOutlineBlocks => true,
:forcePasteAsPlainText => true,
:format_tags => 'h3;p;pre',
:toolbar => [['Format','Styles'],['Bold', 'Italic', '-','NumberedList', 'BulletedList', 'Blockquote', '-', 'richImage', 'richFile','MediaEmbed', '-', 'Link', 'Unlink'],['Source', 'ShowBlocks']],
:language => I18n.default_locale,
:richBrowserUrl => '/rich/files/',
:uiColor => '#f4f4f4'
}
To make local modifications in a rails project, edit your rich.rb initializer (config/initializers/rich.rb), and add your modified list:
if Object.const_defined?("Rich")
Rich.setup do |config|
# ..snip..
# default list
config.editor[:toolbar] = [['Format','Styles'],['Bold', 'Italic', '-','NumberedList', 'BulletedList', 'Blockquote', '-', 'richImage', 'richFile','MediaEmbed', '-', 'Link', 'Unlink'],['Source', 'ShowBlocks']]
# modified list with text alignment (for example)
config.editor[:toolbar] = [['Format','Styles'],['Bold', 'Italic', '-','NumberedList', 'BulletedList', 'Blockquote', '-', 'richImage', 'richFile','MediaEmbed', '-', 'Link', 'Unlink'],['Source', 'ShowBlocks'],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']]
# ..snip..
end
Rich.insert
end