How to add h4 tag to refinerycms editor?

I am trying to add the h4 tag to the wysiwyg refinerycms editor. How can I do it? Do not find documentation on this.

I assume I need to do something with this config var:

config.wymeditor_whitelist_tags = {} 
+6
source share
1 answer

The following instructions apply to versions 2.xx and 3.xx of the refinery.

However, in version 3.xx you will need to use custom_visual_editor_boot_options instead of custom_wymeditor_boot_options.

Using this file: https://github.com/refinery/refinerycms/blob/master/core/app/assets/javascripts/admin.js , you can specify custom parameters for WYMeditor in the refinery.

First, you need to override the file:

 bundle exec rake refinery:override javascript=admin 

Now open the /assets/javascripts/admin.js application and edit it like this:

 // 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. // eg 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'} ] }; } 

Note that what you are doing is overriding boot_wym.js.erb, which only specifies h1, h2, h3 and p as container tags. See: https://github.com/refinery/refinerycms/blob/2-0-stable/core/app/assets/javascripts/refinery/boot_wym.js.erb#L49-L54

Any parameters that you specify inside custom_wymeditor_boot_options override anything inside wymeditor_boot_options to boot_wym.js.erb, so make sure it is valid Javascript, otherwise the editors will not load at all.

Hope this helps; let me know if you need to clarify something.

Phil

+20
source

Source: https://habr.com/ru/post/917300/


All Articles