[英]bbcode tags formatting incorrectly in tinymce 4
我試圖獲取bbcode標簽的順序,以便使用tinymce 4.1.5正確格式化。
當我設置文本顏色並在其下划線時,結束標簽會混在一起,或者將text-decoration =“ underline”屬性放入顏色標簽。
例如,我得到
[color="ff0000" text-decoration="underline"]some text[/color]
什么時候應該
[color="ff0000"][u]some text[/u][/color]
否則我可能會得到[color =“ ff0000”] [u]一些文本[/ color] [u]
這是我的文字區域
@using (Html.BeginForm("TestTinyMce", "Content", FormMethod.Post))
{
@Html.TextArea("TextArea", Model.TextArea, new { @id = "TextArea", @class = "tinymce" })
<input type="submit" value="submit"/>
}
這是初始化:
tinymce.init({
selector: "textarea",
theme: "modern",
plugins: [
"bbcode,paste,textcolor"
],
toolbar1: "undo redo | bold italic underline forecolor | link unlink "
});
我正在檢查提交后到達控制器的值。 我試圖查看是否有任何配置,插件或技巧可以用來清理此bbcode。
我最終用tinymce覆蓋了格式,因此它破壞了跨度。 這樣,我就不會將下划線混入顏色中。
為了處理標簽關閉不匹配的問題,我使用了SaveContent事件並清理了標簽。
tinymce.init({
selector: "textarea.tinymce",
theme: "modern",
width: "100%",
height: "250px",
plugins: [
"bbcode paste textcolor link"
],
toolbar1: "undo redo bold italic underline forecolor link unlink ",
formats: {
bold: { inline: 'strong', exact: true },
italic: { inline: 'em', exact: true },
underline: { inline: 'span', styles: { "text-decoration": "underline" }, exact: true },
forecolor: { inline: 'span', styles: { color: '%value' }, exact: true }
},
// New event
setup: function (editor) {
editor.on('init', function (args) {
});
editor.on('SaveContent', function (e) {
e.content = FixTags(e.content);
});
},
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.