我有以下代码:
HTML:
<p id="edit">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
JS:
<script type="text/javascript">
$(document).ready(function(){
tinymce.init({
inline : true,
selector : 'p#edit'
});
});
</script>
这就是工具栏的样子:
文本对齐按钮和项目符号列表按钮以及缩进按钮不起作用
这里出了什么问题?
答案 0 :(得分:0)
我没有尝试将p元素作为编辑器,但这是我的代码与textarea。关键是你使用正确的选择器和正确的模式。
HTML:
<div class="form-group">
<div class="col-sm-12">
@Html.TextAreaFor(m => m.MarketingInformation, new { @class = "form-control mceEditor" })
</div>
</div>
JS:
<script type="text/javascript">
tinymce.init({
mode: "specific_textareas",
editor_selector : "mceEditor",
height: 100,
plugins: [
"advlist autolink lists link charmap print preview anchor textcolor",
"searchreplace visualblocks code fullscreen",
"insertdatetime table contextmenu paste textcolor"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | forecolor backcolor"
});
</script>
我认为如果你将模式用作'确切'它应该可以工作,但我没有尝试过; http://www.tinymce.com/wiki.php/Configuration3x:mode