Tinymce 和 html 内容无法保持代码相同

Tinymce and html content not keeps code the same

我正在尝试插入前任。这段代码在我的网页中获取谷歌地图,我在 tinymce 中更改了整个网站。

  <div id="g-map">
    <div class="container-fluid">
        <div class="row">
            <div id="map"></div>
        </div>
    </div>
</div>

但我得到的是 <div id="g-map">&nbsp;</div> 知道为什么会这样吗?到目前为止,当保存似乎无关紧要时,我没有任何线索测试将 htmlentitles 更改为 htmlspecial char。

这是我的 tinymce.init 选项,它包含 javascript 也

mode : "specific_textareas",
editor_selector : "editor",
relative_urls : false,
remove_script_host : false,
document_base_url : "http://localhost",
allow_script_urls: true,
remove_script_host : false,
convert_urls : true,
extended_valid_elements : "script[src|type|language]",
height: 500,

对不起所有读到这里的人!像往常一样,在尝试整理 1 小时后,我休息了一下,找到了这个 gem 作为答案 valid_elements : '*[*]'。希望至少可以帮助别人。

html Entities中NBSP表示不间断space,也称为空space。

此外,我建议您试试这个更好的编辑器:CK Editor。我认为比 Tiny MCE 更好。