如何添加“小盘股"用于 TinyMCE 高级编辑器的样式以使用“样式"中的样式WordPress 中的下拉工具 [英] How to add a "small caps" style for the TinyMCE Advanced editor to use the style in the "Styles" dropdown tool in WordPress

查看:15
本文介绍了如何添加“小盘股"用于 TinyMCE 高级编辑器的样式以使用“样式"中的样式WordPress 中的下拉工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mystique 主题包括两个需要更新以允许自定义样式部分的文件.添加了小型大写字母"样式,用于正确格式化法律期刊引文.为 TinyMCE Advanced 编辑器添加小型大写字母"样式以使用 WordPress 中样式"下拉工具中的样式的步骤是什么.

The Mystique theme includes two files that need to be updated to allow a custom styles section. The addition of a "small caps" style for use in the correct formatting of law journal citations. What is the steps to add a "small caps" style for the TinyMCE Advanced editor to use the style in the "Styles" dropdown tool in WordPress.

推荐答案

Goetz 给出的答案并不完整,因为如果您没有明确定义,TinyMCE 不知道您的用户定义格式".也许几年前它就这样做了,但 4.7.x 版似乎没有这样做.除了他的答案之外,还添加以下代码(可能需要 setup):

The answer given by Goetz is not complete, since TinyMCE does not know about your "user defined format" if you don't define it explicitly. Maybe it did some years ago, but version 4.7.x doesn't seem to do so. Add the code below in addition to his answer (it maybe needs to be bevore setup):

formats: {
    smallcaps: {
      inline: 'span',
      styles: {
        'font-variant': 'small-caps'
      },
      attributes: {
        title: 'smallcaps'
      }
    },
  },
  toolbar: 'smallcaps_button'

我更喜欢通过像 _button_format 这样的后缀来稍微不同地命名格式和按钮,但这实际上应该不是问题.因此,它避免了忘记在此处正确定义所有需要的部分(formattoolbared.addButton()).所以,我的 toolbar 包含按钮 smallcaps_button 并且函数是 ed.addButton('smallcaps_button')

I prefer naming the formats and buttons slightly differently by suffixes like _button or _format, but that actually should not be a problem. Hence it avoids forgetting about to correctly define all needed parts here (format, toolbar, ed.addButton()). So, my toolbar contains the button smallcaps_button and the function is ed.addButton('smallcaps_button')

就是这样.

这篇关于如何添加“小盘股"用于 TinyMCE 高级编辑器的样式以使用“样式"中的样式WordPress 中的下拉工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆