Permalink
Browse files

The old init configuration now fully supported

  • Loading branch information...
1 parent 0a3525b commit f2528c29f1f1cb6f48caeb6a861cded0e86436f5 Trevor Rowe committed Dec 2, 2010
Showing with 17 additions and 17 deletions.
  1. +14 −14 lib/tinymce/hammer.rb
  2. +3 −3 lib/tinymce/hammer/view_helpers.rb
View
@@ -14,20 +14,20 @@ module Tinymce::Hammer
@@themes = ['advanced']
- @@init = [
- [:paste_convert_headers_to_strong, true],
- [:paste_convert_middot_lists, true],
- [:paste_remove_spans, true],
- [:paste_remove_styles, true],
- [:paste_strip_class_attributes, true],
- [:theme, 'advanced'],
- [:theme_advanced_toolbar_align, 'left'],
- [:theme_advanced_toolbar_location, 'top'],
- [:theme_advanced_buttons1, 'undo,redo,cut,copy,paste,pastetext,|,bold,italic,strikethrough,blockquote,charmap,bullist,numlist,removeformat,|,link,unlink,image,|,cleanup,code'],
- [:theme_advanced_buttons2, ''],
- [:theme_advanced_buttons3, ''],
- [:valid_elements, "a[href|title],blockquote[cite],br,caption,cite,code,dl,dt,dd,em,i,img[src|alt|title|width|height|align],li,ol,p,pre,q[cite],small,strike,strong/b,sub,sup,u,ul"],
- ]
+ @@init = {
+ :paste_convert_headers_to_strong => true,
+ :paste_convert_middot_lists => true,
+ :paste_remove_spans => true,
+ :paste_remove_styles => true,
+ :paste_strip_class_attributes => true,
+ :theme => 'advanced',
+ :theme_advanced_toolbar_align => 'left',
+ :theme_advanced_toolbar_location => 'top',
+ :theme_advanced_buttons1 => 'undo,redo,cut,copy,paste,pastetext,|,bold,italic,strikethrough,blockquote,charmap,bullist,numlist,removeformat,|,link,unlink,image,|,cleanup,code',
+ :theme_advanced_buttons2 => '',
+ :theme_advanced_buttons3 => '',
+ :valid_elements => "a[href|title,blockquote[cite],br,caption,cite,code,dl,dt,dd,em,i,img[src|alt|title|width|height|align],li,ol,p,pre,q[cite],small,strike,strong/b,sub,sup,u,ul" ,
+ }
def self.init= js
@@init = js
@@ -18,13 +18,13 @@ def init_tinymce_hammer
# containing tinymce. The second tag initializes tiny mce.
def tinymce_hammer_javascript_tags
- if ::Tinymce::Hammer.init.is_a?(Hash)
- init = HashWithIndifferentAccess.new(::Tinymce::Hammer.init)
+ init = ::Tinymce::Hammer.init
+ if init.is_a?(Hash)
+ init = HashWithIndifferentAccess.new(init)
init = init.keys.sort.collect(&:to_s).sort.collect{|key|
[key, init[key]]
}
end
-
init = init.collect {|key,value| "#{key} : #{value.to_json}" }.join(', ')
setup = "init.setup = #{Tinymce::Hammer.setup};" if Tinymce::Hammer.setup

2 comments on commit f2528c2

Within valid_elements I was missing a[href|title|target ...

I could not set a target because of that.

Owner

trevorrowe replied Aug 29, 2011

The values provided there are only meant to be sensible defaults. You are welcome to configure you own list of valid elements and pass them to Tinymce::Hammer.init = { ... }. You should be even able to do something like:

Tinymce::Hammer.init.merge!(:valid_elements => ....)
Please sign in to comment.