How do I allow a self closing tag in TinyMCE?

老子叫甜甜 提交于 2020-01-01 14:49:10

问题


The source tags inside my video element need to be self closing so the iPad doesn't start whinging.

I type in <source src="myVideo.m4v" />

TinyMCE keeps changing it to <source src="myVideo.m4v" ></source> though.

How can I tell it to stop?


回答1:


Have a look at valid_elements and extended_valid_elements.

EDIT:

You may use the closed setting in your tinymce init:

closed : /^(br|hr|input|meta|img|link|param|area)$/, // default

to

closed: /^(br|hr|input|meta|img|link|param|area|source)$/,

If this does not work then i think you might additionaly need to change one line of code from the tinymce core code located in Editor.js on line 2666 (newest tiny mce version) and extend the setting there with your source tag.



来源:https://stackoverflow.com/questions/4080132/how-do-i-allow-a-self-closing-tag-in-tinymce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!