bootstrap adminlte教程7:不同页面调用不同面板的ueditor
我想在前台调用百度编辑器Ueditor怎么办,只要几个按钮?
答案是肯定的。
先全部引用好,就不说了,先正常显示出使用画面。
然后在官网:http://ueditor.baidu.com/website/download.html#ubuilder
进行自选标签。我们找到这些工具的名称。

看到没,上面是指到工具的图标,下面那个后缀就是他的名字,把你要的全记下来。
然后在视图页面,调用时改更。
将这些工具写进去。
@section Scripts {
<script type="text/javascript">
var editor = UE.getEditor('neirong', {
//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
toolbars: [['FullScreen', 'Undo', 'Unlink', 'Redo', 'Link', 'Simpleupload', 'Emotion', 'Unlink', 'Attachment', 'Bold', 'underline', 'forecolor', 'backcolor', 'fontsize', 'justifyleft', 'justifycenter']],
//focus时自动清空初始化时的内容
autoClearinitialContent: true,
//关闭字数统计
wordCount: false,
//关闭elementPath
elementPathEnabled: false,
//默认的编辑区域高度
initialFrameHeight: 150,
//更多其他参数,请参考ueditor.config.js中的配置项
maximumWords:500
});
</script>
}
我就加了我自己的工具。

突然发生一个问题,我是model.content.这个默认的时候,回复框中会显示内容页面的内容,后以下方式更改。
@using (Html.BeginForm("CreateRlpy", "CmsContents", new { cmsId = Model.Id, count = Model.ReplyCount }, FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-horizontal col-md-12" style="width:100%">
<h4>发表回复</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
<div class="col-md-10">
@*@Html.TextAreaFor(model => model.Contents, htmlAttributes: new { @id = "neirong", Value = "我要回复" })*@
@*<TextArea name="Contents" id = "neirong" Value = "我要回复" />*@
@Html.ValidationMessageFor(model => model.Contents, "", new { @class = "text-danger" })
<script id="neirong" name="Contents" type="text/plain">
这里写你的初始化内容
</script>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="回复" class="btn btn-success" />
</div>
</div>
</div>
}
<p>
</p>
浙公网安备 33010602011771号