drhanjuw56233 2013-12-05 16:25
浏览 54

TinyMCE或WordPress将WBR html元素插入WordPress中的文本

Greeting all,

I've written a simple WordPress shortcode which wraps inline $content in <code> tags. I see that sometimes the $content contains <wbr /> elements, which must be inserted either by TinyMCE or by WordPress. I'd never even heard of <wbr /> (word break opportunity) until I looked it up.

I'm guessing that TinyMCE is inserting the element in the WordPress visual editor, but I can't be sure. I looked through both the WordPress and TinyMCE source and I see mentions of <wbr /> but I couldn't find where it is being injected into the post content.

Do you know why the <wbr /> elements are being inserted, and if it's possible to turn off that behavior in shortcodes?

Forgot to mention that (for now) I'm working around the issue by removing the <wbr /> elements using preg_replace(). But I consider this kind of hack-ish and I'd prefer to turn it off in a cleaner way.

  • 写回答

1条回答 默认 最新

  • douhutongvm382381 2013-12-09 03:02
    关注

    You can set invalid elements in tinymce using the invalid_elements option. This will take care of your issue. You have a lot of control with tinymce, you shouldn't have to use any regex. This and similar options in the cleanup/output should help you.

    tinymce.init({
            ...
            invalid_elements : "wbr"
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错