第一次写博文,那我就把我最新使用百度编器过程中的一些方法写在这里,供新手参考
1、下载百度编辑器文件,选择 utf8版本,下载地址:
2、打开vs2010(其它版本类似),新建一个空白网站,
3、打开新建网站所有在目录,将刚刚下载好的百度编辑器文件放一个文件夹中,我这里的文件夹名字为:"ueditor"
4、将【ueditor】-【net】-【App_Code】文件夹和【Bin】文件夹剪切到根目录下,如下图所示:
5、打开【ueditor】-【net】文件夹下的web.config文件,将下图中红色框中的内容剪切到根目下web.config相应的位置
最后在根文件中web.config中的内容为下图所示
同时,删除【ueditor】-【net】文件夹下的web.config文件
6、打开【ueditor】下的ueditor.config.js文件,找到【serverUrl: URL + "net/controller.ashx"】,
将其中的内容更改为:【serverUrl: URL + "../ueditor/net/controller.ashx"】
如下图所示
7、打开【ueditor】-【net】文件夹下的config.json文件
这里有所有上传的图片路径、文件路径的设置 ,我这里就只说明一个图片,其它的方法类似
将【"imageUrlPrefix": "/ueditor/net/"】的内容更改为【"imageUrlPrefix": ""】,
将【"imagePathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",】更改为【"imagePathFormat": "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",】
如下图所示:
8、在根目下创建【upload】文件夹,同时在【upload】文件夹下创建三个子文件夹,分别为:【image】(用于存放图片)、【video】(用于存放视频)、【file】(用于存放文件),这里设置的文件可以更心名称,但是要和第7步的路径设置要保持统一,如下图所示
9、添新窗体,测试编辑器使用
以下是我的前端代码
-
<pre name="code" class="csharp"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
-
-
>
-
-
<html xmlns="">
-
<head runat="server">
-
<title>title>
-
<script type="text/javascript" src="../ueditor/ueditor.config.js">script>
-
-
<script type="text/javascript" src="../ueditor/ueditor.all.js">script>
-
-
head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
<asp:TextBox ID="container" runat="server" TextMode="MultiLine" name="container"
-
ClientIDMode="Static" style="width:800px;height:800px";>asp:TextBox>
-
-
<script type="text/javascript">
-
var ue = UE.getEditor('container');
-
script>
-
div>
-
form>
-
body>
-
html>
10、最后一步,更改网站运行的路径,不需要加前缀的路径
选择网站根名称,点属性
将图片的中虚拟路径删除,只保留【/】
如下图所示
最后运行,如下图所示
附件:config.json
-
-
{
-
-
"imageActionName": "uploadimage",
-
"imageFieldName": "upfile",
-
"imageMaxSize": 2048000,
-
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
-
"imageCompressEnable": true,
-
"imageCompressBorder": 1600,
-
"imageInsertAlign": "none",
-
"imageUrlPrefix": "",
-
"imagePathFormat": "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
"scrawlActionName": "uploadscrawl",
-
"scrawlFieldName": "upfile",
-
"scrawlPathFormat": "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
-
"scrawlMaxSize": 2048000,
-
"scrawlUrlPrefix": "",
-
"scrawlInsertAlign": "none",
-
-
-
"snapscreenActionName": "uploadimage",
-
"snapscreenPathFormat": "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
-
"snapscreenUrlPrefix": "",
-
"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": "",
-
"catcherMaxSize": 2048000,
-
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
-
-
-
"videoActionName": "uploadvideo",
-
"videoFieldName": "upfile",
-
"videoPathFormat": "/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}",
-
"videoUrlPrefix": "",
-
"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": "",
-
"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": "",
-
"imageManagerInsertAlign": "none",
-
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
-
-
-
"fileManagerActionName": "listfile",
-
"fileManagerListPath": "/upload/file",
-
"fileManagerUrlPrefix": "",
-
"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"
-
]
-
-
}
阅读(1939) | 评论(0) | 转发(0) |