ruby-on-rails – 如何将h4标签添加到refinerycms编辑器?

我正在尝试将一个h4标签添加到refinerycms wysiwyg编辑器中.我该怎么做呢?没有找到任何关于此的文件.

我假设我必须对此配置var做一些事情:

config.wymeditor_whitelist_tags = {}

解决方法

以下说明适用于Refinery CMS的2.x.x和3.x.x版.

但是,在版本3.x.x中,您将需要使用custom_visual_editor_boot_options而不是custom_wymeditor_boot_options.

使用此文件https://github.com/refinery/refinerycms/blob/master/core/app/assets/javascripts/admin.js,您可以为Refinery中的WYMeditor指定自定义选项.

首先,您需要覆盖该文件

bundle exec rake refinery:override javascript=admin

现在,打开app / assets / javascripts / 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'}
    ]
  }; 
}

请注意,您正在执行的操作是覆盖boot_wym.js.erb,它仅将h1,h2,h3和p指定为容器标记.见:https://github.com/refinery/refinerycms/blob/2-0-stable/core/app/assets/javascripts/refinery/boot_wym.js.erb#L49-L54

您在custom_wymeditor_boot_options中指定的任何选项都会覆盖boot_wym.js.erb中wymeditor_boot_options内的任何内容,因此请确保它是有效的Javascript,否则编辑器根本不会加载.

希望有所帮助;如果你需要澄清任何事情,请告诉我.

菲尔

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...