准备工作

百度编辑器官方下载,并将文件放到项目根目录下。

因为vs2008 只到Framework 3.5,所以需要将4.0的东西去掉。

1)下载.net framework 3.5版的 Newtonsoft.Json.dll 替换掉 /net/bin 中的。

2)删除 net 文件下 config.cs 里的 using System.Dynamic,因为3.5版本没有这个。

3)查找替换,用 string.IsNullOrEmpty 替换 String.IsNullOrWhiteSpace。

4)去掉 config.json 里的解释,不然上传图片功能用不了。(下面的可以直接拿去用,里面修改了图片显示的地址,"imageUrlPrefix": "" 原文是这样:"imageUrlPrefix": "/ueditor/net/", /* 图片访问路径前缀 */)

{

    "imageActionName": "uploadimage",
"imageFieldName": "upfile",
"imageMaxSize": 2048000,
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
"imageCompressEnable": true,
"imageCompressBorder": 1600,
"imageInsertAlign": "none",
"imageUrlPrefix": "",
"imagePathFormat": "/UeEditor/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", "scrawlActionName": "uploadscrawl",
"scrawlFieldName": "upfile",
"scrawlPathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"scrawlMaxSize": 2048000,
"scrawlUrlPrefix": "/ueditor/net/",
"scrawlInsertAlign": "none", "snapscreenActionName": "uploadimage",
"snapscreenPathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"snapscreenUrlPrefix": "/ueditor/net/",
"snapscreenInsertAlign": "none", "catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"],
"catcherActionName": "catchimage",
"catcherFieldName": "source",
"catcherPathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"catcherUrlPrefix": "/ueditor/net/",
"catcherMaxSize": 2048000,
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], "videoActionName": "uploadvideo",
"videoFieldName": "upfile",
"videoPathFormat": "upload/video/{yyyy}{mm}{dd}/{time}{rand:6}",
"videoUrlPrefix": "/ueditor/net/",
"videoMaxSize": 102400000,
"videoAllowFiles": [
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], "fileActionName": "uploadfile",
"fileFieldName": "upfile",
"filePathFormat": "upload/file/{yyyy}{mm}{dd}/{time}{rand:6}",
"fileUrlPrefix": "/ueditor/net/",
"fileMaxSize": 51200000,
"fileAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
], "imageManagerActionName": "listimage",
"imageManagerListPath": "upload/image",
"imageManagerListSize": 20,
"imageManagerUrlPrefix": "/ueditor/net/",
"imageManagerInsertAlign": "none",
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], "fileManagerActionName": "listfile",
"fileManagerListPath": "upload/file",
"fileManagerUrlPrefix": "/ueditor/net/",
"fileManagerListSize": 20,
"fileManagerAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
] }

去掉注释后的config.json

关于调用

<script src="../../UeEditor/ueditor.config.js" type="text/javascript"></script>

<script src="../../UeEditor/ueditor.all.min.js" type="text/javascript"></script>

<script id="editor" type="text/plain" style="width: 1024px; height: 500px;"></script>

<script type="text/javascript">
var ue = UE.getEditor('editor');//初始化后才能看到百度编辑器
function getData() {
return UE.getEditor('editor').getContent();//获取内容
}
ue.ready(function() {
//异步回调
UE.getEditor('editor').execCommand('insertHtml', "123456");//设置内容,用于修改功能
});
</script>

Ps:Js 的引用顺序不能变,否则会报错。下载的 demo 中有详细用法。

关于上传图片(重点)

此时上传图片是不好使的,按F12,会看到报错的信息,错误的原因是因为没有找到 net 文件夹中的 controller.ashx 这个文件。

controller.ashx 里面写了加载 config.json,加载到了,上传图片的功能也就好使了。

解决步骤:

1、修改 ueditor.config.js 文件,将, serverUrl: URL + "net/controller.ashx" 改成 , serverUrl: "/UeEditor/controller.ashx" ,改成相对路径。(此处可不改,但是需要删除 net 文件夹下的 web.config ,显示图片的路径也会有些问题。)

2、准备工作中的第4条,已经处理了显示图片的路径问题。(去掉注释,清空路径)

3、将 net 文件夹下的 config.json 与 controller.ashx 移动到 UeEditor 下。

效果:

 Ps:关于图片的保存路径,可以在 \net\App_Code 中 UploadHandler.cs 的 Process 方法中修改。

vs2008 使用百度编辑器的更多相关文章

  1. 百度编辑器ueditor 在vs2008中的使用方法

    个人觉得百度编辑器ueditor还是不错的,虽然出生的时间比较短,但某些方面相比其它富文本编辑器更优秀,免费.可定制等等. 由于在官方下载的ueditor包是在vs2012下开发的,可以在vs2010 ...

  2. 一步步开发自己的博客 .NET版(4、文章发布功能)百度编辑器

    前言 这次开发的博客主要功能或特点: 第一:可以兼容各终端,特别是手机端. 第二:到时会用到大量html5,炫啊. 第三:导入博客园的精华文章,并做分类.(不要封我) 第四:做个插件,任何网站上的技术 ...

  3. 关于百度编辑器UEditor的一点说明

    大家在使用的时候要特别注意editor_config.js中的“URL”这个参数 我的理解:1.这个参数是editor整个结构的总路径          2.首先要把这个路径配置好了.才能正常的显示, ...

  4. 百度编辑器ueditor插入表格没有边框颜色的解决方法

    附:从word excel 中 复制的表格提交后无边框,参考这个同学的,写的很详细:   http://blog.csdn.net/lovelyelfpop/article/details/51678 ...

  5. 百度编辑器UEditor的使用方法

    百度编辑器具有丰富文本编辑功能,且开源免费,其使用方法如下: 1.在官网上下载对应的Uditor压缩包:http://ueditor.baidu.com/website/download.html 2 ...

  6. 百度编辑器ueditor插入表格没有边框,没有颜色的解决方法 2015-01-06 09:24 98人阅读 评论(0) 收藏

    百度富文本编辑器..很强大.. - - ,不过有些BUG..真的很无解.. 最近用这个,发现上传的表格全部没有表框.. 解决办法如下: 转载的.. 百度编辑器ueditor插入一个表格后,在编辑过程中 ...

  7. UEditor百度编辑器,工具栏上自定义添加一个普通按钮

    添加一个名叫“hougelou”的普通按钮在工具栏上: 第一步:找到ueditor.config.js文件中的toolbars数组,增加一个“hougelou”字符串,然后找到labelMap数组,对 ...

  8. 百度编辑器 ueditor 内容编辑自动套P标签,及p标签 替换

    如图,红框为回车键和shift+回车 :    ===>>  ueditor.all.js中: 1: 搜索修改成false:allowDivTransToP: false 再搜索并修改以下 ...

  9. 百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法

    百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法 金刚 前端 ueditor 初始化 因项目中使用了百度编辑器——ueditor.整体来说性能还不错. 发现问题 我在做一个编辑页面 ...

随机推荐

  1. JS_高程1.javascript简介

    1.javaScript诞生于1995年,最开始是为了处理以前由服务器端语言负责的一些诸如验证的操作. 2.一些名词: ECMA:European Computer Manufacturers Ass ...

  2. SqlHelper分享

    using Model; using System; using System.Collections.Generic; using System.Configuration; using Syste ...

  3. Schaepher 博客目录

    update: 2017-03-16 福州大学2015年秋软件工程实践课 软工课程作业目录 软工实践课程总结 团队博客 软件案例分析优秀链接汇总 Android Android学习笔记: (一):th ...

  4. JAVA自学笔记22

    JAVA自学笔记22 1.操作基本数据类型的流 DataInputStream DataOutputStream 数据输出流允许应用程序以适当方式将基本的Java数据类型写入输出流中.然后,应用程序可 ...

  5. Android的Databinding-单向绑定

    两种方式实现观察绑定. 一.POJO类实现android.databinding.Observable,在属性set方法中调用notifyPropertyChanged(BR.lastName); 其 ...

  6. MFC中使用ATL报错:error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    我在MFC中使用ATL函数A2W的时候报如下的错误: error C4430: missing type specifier - int assumed. Note: C++ does not sup ...

  7. linux 压缩当前文件夹下所有文件

    linux zip压缩.压缩当前文件夹下所有文件,压缩为a.zip.命令行的方法是怎样. zip  -r fileName.zip  文件夹名 tar tar命令可以用来压缩打包单文件.多个文件.单个 ...

  8. Android 解压zip文件你知道多少?

    对于Android常用的压缩格式ZIP,你了解多少? Android的有两种解压ZIP的方法,你知道吗? ZipFile和ZipInputStream的解压效率,你对比过吗? 带着以上问题,现在就开始 ...

  9. nrm管理npm源

    npm源:npm install命令下载需要依赖包的服务器地址,默认是 npm ---- https://registry.npmjs.org/ 而国外的源速度太慢,所以我们一般都用国内的淘宝源tao ...

  10. Navicat(数据库可视化操作软件)安装、配置、测试

    Navicat(数据库可视化操作软件)安装.配置.测试(win7_64bit) 目录 1.概述 2.本文用到的工具 3.Navicat安装.激活与配置 4.简单测试 5.注意事项 6.相关博文 > ...