TinyMCE 不允许将 div 块放入标签中
TinyMCE doesn't allow to put div block into a tag
这里是插件的配置。
theme: "modern",
toolbar: "link, image, styleselect, formatselect forecolor backcolor | bold,italic,underline | bullist,numlist,outdent,indent | undo,redo | pastetext,pasteword,selectall | code fullscreen",
pagebreak_separator: "<p class='page-separator'> </p>",
plugins: 'link image code fullscreen wordcount textcolor',
relative_urls: false,
remove_script_host: false,
image_caption: true,
cleanup_on_startup: false,
trim_span_elements: false,
verify_html: false,
cleanup: false,
convert_urls: false,
valid_elements: '*[*]',
valid_children: '*[*]',
allow_html_in_named_anchor: true,
allow_unsafe_link_target: true,
force_br_newlines: false,
force_p_newlines: false,
forced_root_block: '',
document_base_url: (!window.location.origin ? window.location.protocol + "//" + window.location.host : window.location.origin) + "/"
因此,我要做的是将带有背景图片的 div 块放入标签中。
如您所见,我实现了一些选项来禁用源代码验证,但 tinymce 仍在编辑我的代码。
我需要的示例:
<a href="http://mosplitka.ru/uploads/Cersaie/cersaie_17.jpg" data-gallery="cersaie">
<div class="page-gallery-item-bg" style="background-image:url('http://mosplitka.ru/uploads/Cersaie/medium_cersaie_17.jpg'); ">
</div>
</a>
关闭源代码面板后结束我得到的内容:
<div class="page-gallery-item-bg" style="background-image: url('http://mosplitka.ru/uploads/Cersaie/medium_cersaie_17.jpg');"> </div>
<a href="http://mosplitka.ru/uploads/Cersaie/cersaie_17.jpg" data-gallery="cersaie"> </a>
我想我找到了。
我确定参数 valid_children: '[]' 包括标签的所有变体,但显然不是。所以我将其更改为 valid_children: 'a[div]' 并且成功了。仍然无法弄清楚为什么第一个版本没有成功。希望对某人有所帮助。
这里是插件的配置。
theme: "modern",
toolbar: "link, image, styleselect, formatselect forecolor backcolor | bold,italic,underline | bullist,numlist,outdent,indent | undo,redo | pastetext,pasteword,selectall | code fullscreen",
pagebreak_separator: "<p class='page-separator'> </p>",
plugins: 'link image code fullscreen wordcount textcolor',
relative_urls: false,
remove_script_host: false,
image_caption: true,
cleanup_on_startup: false,
trim_span_elements: false,
verify_html: false,
cleanup: false,
convert_urls: false,
valid_elements: '*[*]',
valid_children: '*[*]',
allow_html_in_named_anchor: true,
allow_unsafe_link_target: true,
force_br_newlines: false,
force_p_newlines: false,
forced_root_block: '',
document_base_url: (!window.location.origin ? window.location.protocol + "//" + window.location.host : window.location.origin) + "/"
因此,我要做的是将带有背景图片的 div 块放入标签中。 如您所见,我实现了一些选项来禁用源代码验证,但 tinymce 仍在编辑我的代码。 我需要的示例:
<a href="http://mosplitka.ru/uploads/Cersaie/cersaie_17.jpg" data-gallery="cersaie">
<div class="page-gallery-item-bg" style="background-image:url('http://mosplitka.ru/uploads/Cersaie/medium_cersaie_17.jpg'); ">
</div>
</a>
<div class="page-gallery-item-bg" style="background-image: url('http://mosplitka.ru/uploads/Cersaie/medium_cersaie_17.jpg');"> </div>
<a href="http://mosplitka.ru/uploads/Cersaie/cersaie_17.jpg" data-gallery="cersaie"> </a>
我想我找到了。 我确定参数 valid_children: '[]' 包括标签的所有变体,但显然不是。所以我将其更改为 valid_children: 'a[div]' 并且成功了。仍然无法弄清楚为什么第一个版本没有成功。希望对某人有所帮助。