【问题标题】:Wordpress WYSIWYG editor automatically adding span classes with styleWordpress WYSIWYG 编辑器自动添加具有样式的跨度类
【发布时间】:2013-01-06 05:56:45
【问题描述】:

由于某种原因,当我使用按钮创建项目符号列表时,我在 Wordpress 中的 WYSIWYG 编辑器会自动添加带有样式的 span 类。这很烦人,因为我希望我的文本有一定的大小,但是 span 类对样式进行了硬编码,并且弄乱了大小。

有谁知道如何删除跨度类的自动添加?

这个网站是为客户准备的,他/她不知道如何使用 HTML,这就是为什么它必须使用所见即所得的编辑器。

帮助非常感谢。谢谢。

【问题讨论】:

  • 当我在 WordPress 所见即所得编辑器中创建项目符号列表时,我没有得到相同的行为 - 只是一个标准的、干净的无序列表。你能告诉我们更多关于这件事发生的具体时间吗?

标签: wordpress editor tinymce wysiwyg html


【解决方案1】:

我也有同样的问题,而且我不是在复制,每次创建列表时,编辑器在代码中添加:

正文

到列表的文本。

我怎样才能摆脱这个?


我刚刚在该帖子中找到了适合我的解决方案: http://wordpress.org/support/topic/strange-behaviour-making-lists-in-the-visual-editor

如果您使用子主题,只需将此函数添加到您的 functions.php 文件中:

 /**
 * I want to use the basic 2012 theme but don't want TinyMCE to create
 * unwanted HTML. By removing editor-style.css from the $editor_styles
 * global, this code effectively undoes the call to add_editor_style()
 */
add_action( 'after_setup_theme', 'foobar_setup', 11 );
function foobar_setup() {
  global $editor_styles;
  $editor_styles = array();
}

【讨论】:

    【解决方案2】:

    您是从某处复制和粘贴文本吗?有时,文本的源代码中会包含样式,并且样式会被带到所见即所得。见http://tentblogger.com/copy-paste/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-16
      • 2021-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多