2014-10-06 52 views
0

Razor查看我有一个简单的textareaCKEditor的替换它想要什么

@Html.TextAreaFor(model => model.Text, new { htmlAttributes = new { @class = "form-control ckHolder" } }) 

给到后端的用户,我使用cKEditor,到插件绑定到文本区一个不错的HTML支持我这样做:

CKEDITOR.replace("@Html.IdFor(m => m.Text)", {}); 

所有的工作正常,但今天我开始尝试实现一个标签系统。

<div class="tag-editor"> 
<span class="tag-editor-tags"></span> 
<div class="tag-editor-editable" contenteditable="true"></div> 
</div> 

的渲染下:

<div class="tag-editor-editable ui-autocomplete-input cke_editable cke_editable_inline cke_contents_ltr cke_show_borders" contenteditable="true" autocomplete="off" tabindex="0" spellcheck="false" style="position: relative;" role="textbox" aria-label="Rich Text Editor, editor1" title="Rich Text Editor, editor1" aria-describedby="cke_107"><p><br></p></div> 

但我不会有编辑器标签的内容可编辑的DIV,为什么我用的是明确地CKEDITOR.replace我的textarea,我的ID有这种行为?很奇怪,如果我不使用.replace编辑器不工作在所有...

回答

1

好了,解决了,我发现official documentation

在线编辑解决方案是在推出新技术CKEditor 4 允许您选择页面上的任何可编辑元素并在原位编辑它 。因此,该编辑器可用于编辑内容,该内容看起来就像最终页面一样。 ...

请注意,在这种情况下,您需要首先将CKEDITOR.disableAutoInline选项设置为true来关闭自动编辑器创建 。

所以我刚刚下.replace加入这行

CKEDITOR.disableAutoInline = true; 
相关问题