wysihtml5 bootstrap3-wysiwyg 字体大小和 <p> 到 <br>
wysihtml5 bootstrap3-wysiwyg font size and <p> to <br>
我用bootstrap3-wysiwyg based on wysihtml5
我寻求解决方案
在 "Enter" 键上插入 "br" 而不是 "p"
用于根据输入值更改字体大小的按钮
- 使用'br'
$("#TextContent").wysihtml5({useLineBreaks: true, ...})
- 字体大小
var myCustomTemplates = {
custom1: function (context) {
var s = ""
s += '<li class="dropdown">';
s += '<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1" aria-expanded="false">';
s += '<span class="current-color">Size</span>';
s += '<b class="caret"></b>';
s += '</a>';
s += '<ul class="dropdown-menu" style="margin-top: 0px;">';
s += '<li><a class="fontSize" data-wysihtml5-command="fontSize" data-wysihtml5-command-value="fs5">5px</a></li>';
s += '</ul>';
s += '</li>';
return s;
}
};
$("#TextContent").wysihtml5(
{
customTemplates: myCustomTemplates,
"stylesheets": ["~/Content/wysiwyg/editor.css"]
});
editor.css
.wysiwyg-font-size-fs5 {
font-size: 5px;
}
我用bootstrap3-wysiwyg based on wysihtml5
我寻求解决方案
在 "Enter" 键上插入 "br" 而不是 "p"
用于根据输入值更改字体大小的按钮
- 使用'br'
$("#TextContent").wysihtml5({useLineBreaks: true, ...})
- 字体大小
var myCustomTemplates = {
custom1: function (context) {
var s = ""
s += '<li class="dropdown">';
s += '<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1" aria-expanded="false">';
s += '<span class="current-color">Size</span>';
s += '<b class="caret"></b>';
s += '</a>';
s += '<ul class="dropdown-menu" style="margin-top: 0px;">';
s += '<li><a class="fontSize" data-wysihtml5-command="fontSize" data-wysihtml5-command-value="fs5">5px</a></li>';
s += '</ul>';
s += '</li>';
return s;
}
};
$("#TextContent").wysihtml5(
{
customTemplates: myCustomTemplates,
"stylesheets": ["~/Content/wysiwyg/editor.css"]
});
editor.css
.wysiwyg-font-size-fs5 {
font-size: 5px;
}