CKEditor 和预填充文本区域
我正在使用 MVC.NET 和 CKEditor,并且想要预填充文本区域,以便在编辑表单上文本已加载。
我尝试:
<%= Html.TextBox("Message", Model.Message) %>
我可以看到文本区域包含正确的文本,但由于 CKEditor 更改了 html,因此它不会插入编辑器中。有没有办法破解它,以便我可以将文本插入表单中?
I am using MVC.NET and CKEditor and want to prefill the textarea so on edit forms the text is already loaded.
I try with:
<%= Html.TextBox("Message", Model.Message) %>
I can see that the textarea contains the correct text, but since CKEditor alters the html, it isn't inserted into the editor. Is there a way to hack it so I can insert the text into the form?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个愚蠢的错误,一个简单的:
<%= Html.TextAreaFor(model => model.Message) %>
就让它工作了。It was a stupid error, a simple:
<%= Html.TextAreaFor(model => model.Message) %>
made it work.CKEditor 是为 WebForms 设计的,其设计方式依赖于请求和响应等外部依赖项。
除非 CKEditor 公司提供 MVC 的帮助扩展,否则您将无法做到这一点。您还可以搜索是否有提供类似接口的扩展点。
CKEditor is desined for WebForms and its designed in such a way to depend on the external dependencies like request and response.
Unless the CKEditor company provides the helper extension for MVC you will not be able to do that. You can also search if there is any extension points provided like interfaces.