且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将CKEditor集成到Asp.net MVC中

更新时间:2023-02-08 13:43:06

实际上很容易。首先从网站下载最新代码,并将其解压缩到项目中的目录(我选择/ Scripts / ckeditor )。然后在您的视图中,使用与链接中的完整示例 / a>,它应该工作。

It's pretty easy to do actually. First download the latest code from the website and extract it to a directory in your project (I choose /Scripts/ckeditor). Then in your view, use the same code as in the "complete sample" in this link and it should work.

基本上,重要的步骤是:

Basically, the important steps are:


  1. b $ b ckeditor.js文件在你的视图的头部或在你的master
    页面,但是你想做
    它。这需要是项目中的确切位置(我将使用查找文件对话框,您可以在Visual Studio编辑src属性时弹出,以便它自动链接到文件)。

  2. 放置:

  1. Make sure you include the ckeditor.js file in the head from your view or in your master page, however you want to do it. This needs to be the exact location within your project (I would use the find file dialog that you can popup when editing a src attribute in visual studio so that it automatically links to the file).
  2. Place the:

< script type =text / javascript>
CKEDITOR.replace('editor1');
< / script>

<script type="text/javascript"> CKEDITOR.replace( 'editor1' ); </script>

您的textarea之后,make
确保textarea的id是
,在CKEDITOR .replace()
语句。

RIGHT AFTER your textarea and make sure the id of the textarea is the same in the CKEDITOR.replace() statement.