2012-06-03 8 views
6

私はrefinerycms wysiwygエディターにh4タグを追加しようとしています。私はこれをどのようにして行うのですか?これに関する文書が見つかりません。refinerycmsエディタにh4タグを追加するには?

私は私がこの設定VARで何かを持っていると仮定しています:

config.wymeditor_whitelist_tags = {} 

答えて

20

次の手順は、バージョン製油所CMSの2.x.xと3.x.xに適用されます。

ただし、バージョン3.x.xでは、custom_wymeditor_boot_optionsではなくcustom_visual_editor_boot_optionsを使用する必要があります。

このファイルを使用して:https://github.com/refinery/refinerycms/blob/master/core/app/assets/javascripts/admin.jsリファイナリーのWYMeditorのカスタムオプションを指定できます。以下のようになり

bundle exec rake refinery:override javascript=admin 

さて、オープンアプリ/資産/ JavaScriptの/ admin.jsし、それを編集します:

まず、あなたはファイルを上書きする必要が

// Use this to customize the wymeditor boot process 
// Just mirror the options specified in boot_wym.js with the new options here. 
// This will completely override anything specified in boot_wym.js for that key. 
// e.g. skin: 'something_else' 
if (typeof(custom_wymeditor_boot_options) == "undefined") { 
    custom_wymeditor_boot_options = { 
    containersItems: [ 
     {'name': 'h1', 'title':'Heading_1', 'css':'wym_containers_h1'} 
     , {'name': 'h2', 'title':'Heading_2', 'css':'wym_containers_h2'} 
     , {'name': 'h3', 'title':'Heading_3', 'css':'wym_containers_h3'} 
     , {'name': 'h4', 'title':'Heading_4', 'css':'wym_containers_h4'} 
     , {'name': 'p', 'title':'Paragraph', 'css':'wym_containers_p'} 
    ] 
    }; 
} 

。なお、あなたがやっているのは、コンテナタグとしてh1、h2、h3、およびpのみを指定するboot_wym.js.erbを上書きすることです。参照してください:あなたは内部の指定https://github.com/refinery/refinerycms/blob/2-0-stable/core/app/assets/javascripts/refinery/boot_wym.js.erb#L49-L54

任意のオプションは、それが有効なJavaScriptのですか、他のエディタがまったくロードされないことを確認してくださいboot_wym.js.erbでwymeditor_boot_options内部に何かを上書きcustom_wymeditor_boot_options。

希望があれば、明確にされたものが必要な場合はお知らせください。

ちょっと訂正、admin.jsをオーバーライドするためのコマンドであるフィル・

+11

「バンドルのexecすくい製油所:ジャバスクリプト=管理者を上書き」/ .jsの拡張子 –

+2

アウトWはまた3.xの中に名前が変更されていますのでご注意'custom_visual_editor_boot_options'に...なぜそれが動作していないのか理解するためにしばらく時間がかかりました。 https://github.com/parndt/refinerycms-wymeditor/blob/master/app/assets/javascripts/refinery/boot_wym.js.erb#L5 – natebeaty

関連する問題