如何解决如何将微数据插入tinymce 5x
大家好,新年快乐!
我正在使用 Tinymce 5x,但在使用编辑器输出有效的 html5 + 微数据时遇到了大问题。 这是我初始化编辑器的方式:
tinymce.init({
selector: 'textarea.editors',schema: 'html5',extended_valid_elements : "@[itemtype|itemscope|itemprop|id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup]",plugins: 'print preview fullpage paste importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',imagetools_cors_hosts: ['picsum.photos'],menubar: 'file edit view insert format tools table help',toolbar: 'undo redo | bold italic underline strikethrough | image toc visualblocks | fontselect fontsizeselect formatselect | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl',toc_depth: 4,toolbar_sticky: true,autosave_ask_before_unload: true,autosave_interval: "30s",autosave_prefix: "{path}{query}-{id}-",autosave_restore_when_empty: false,autosave_retention: "2m",image_advtab: true,relative_urls : false,remove_script_host : true,document_base_url : "https://www.example.com/",external_image_list_url : "process.php?basics=media_img_list",content_css: [
'//fonts.googleapis.com/css?family=Lato:300,300i,400,400i','//www.tiny.cloud/css/codepen.min.css'
],importcss_append: true,height: 300,height: 500,image_caption: true,quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',noneditable_noneditable_class: "mceNonEditable",toolbar_drawer: 'sliding',contextmenu: "link image imagetools table",style_formats: [
{ title: 'Citation',block: 'div',classes: 'quotation' },]
});
现在我想输出的是:
<section itemscope itemtype="http://schema.org/Question">
<h2 itemprop="name text">My Question</h2>
<div itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<p itemprop="text">My Answer</p>
</div>
</section>
但是当我用 HTML 编辑器保存它时,所有属性都被剥离,当我将它发送到我的 PHP 文件时,它会剥离部分标签。
你能帮我解决这个问题吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。