Javascript tinymce 4中bbcode标记格式不正确
我正在尝试使用tinymce 4.1.5正确格式化bbcode标记的顺序 当我设置文本颜色并给它加下划线时,结束标记会混淆,或者会在颜色标记中添加text decoration=“underline”属性 例如,我Javascript tinymce 4中bbcode标记格式不正确,javascript,asp.net-mvc,tinymce,bbcode,tinymce-4,Javascript,Asp.net Mvc,Tinymce,Bbcode,Tinymce 4,我正在尝试使用tinymce 4.1.5正确格式化bbcode标记的顺序 当我设置文本颜色并给它加下划线时,结束标记会混淆,或者会在颜色标记中添加text decoration=“underline”属性 例如,我 [color="ff0000" text-decoration="underline"]some text[/color] 应该是什么时候 [color="ff0000"][u]some text[/u][/color] 否则我可能会 [color=“ff0000”][u]一些文
[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"/>
}
我正在检查提交后到达控制器的值。我正在尝试查看是否有任何配置、插件或技巧可用于清理此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);
});
},
});
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);
});
},
});