firemail
标题:
UEditor用于nodejs
[打印本页]
作者:
jimu
时间:
2016-1-23 21:57
标题:
UEditor用于nodejs
本帖最后由 jimu 于 2016-1-30 11:02 编辑
http://ueditor.baidu.com/website/index.html
GitHub 源码
Node.js:ueditor
贡献者:
netpi
可你让您的UEditor 兼容nodejs。Node.js:ueditor@0.0.4以及更高版本,支持图片上传,图片批量管理等。您可以通过npm install ueditor 直接安装此插件。项目代码已经发放到github上,欢迎关注此项目。
文 档
源 码
作者:
jimu
时间:
2016-1-30 11:01
本帖最后由 jimu 于 2016-1-30 11:15 编辑
Node.js:ueditor
使用方法:
到自己的工程目录(如:qiDiJiaoYu)下
npm install ueditor --save
安装完毕显示
qiDiJiaoYu@0.0.0 E:\github\qidijiaoyu_github\qidijiaoyu\qiDiJiaoYu
└─┬ ueditor@1.1.1
├─┬ busboy@0.2.12
│ ├─┬ dicer@0.2.5
│ │ ├── readable-stream@1.1.13
│ │ └── streamsearch@0.1.2
│ └── readable-stream@1.1.13
├─┬ fs-extra@0.11.1
│ ├── jsonfile@2.2.3
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├── ncp@0.6.0
│ └─┬ rimraf@2.5.1
│ └─┬ glob@6.0.4
│ ├─┬ inflight@1.0.4
│ │ └── wrappy@1.0.1
│ ├─┬ minimatch@3.0.0
│ │ └─┬ brace-expansion@1.1.2
│ │ ├── balanced-match@0.3.0
│ │ └── concat-map@0.0.1
│ ├── once@1.3.3
│ └── path-is-absolute@1.0.0
└── node-snowflake@0.0.1
复制代码
安装完后,package.json文件中增加了 "ueditor": "^1.1.1"
node_modules文件夹下增加了
1.png
(49.92 KB, 下载次数: 709)
下载附件
2016-1-30 10:59 上传
其中bin文件下增加了
1.png
(21.52 KB, 下载次数: 701)
下载附件
2016-1-30 11:01 上传
作者:
jimu
时间:
2016-1-30 23:15
本帖最后由 jimu 于 2016-1-31 17:34 编辑
关于html标签字符及转义字符遇到的问题
字符串str的内容为 {"user":"test","conent":"<p><span style="color: rgb(192, 80, 77);">33</span></p>"}
如何用JSON.parse(str) 这会报错 Uncaught SyntaxError: Unexpected token c
到 http://www.bejson.com/ 校验字符串str是不合法的多了双引号
把content对应的内容中的"改为'
复制代码
var post = JSON.parse("{"user":"test","conent":"<p><span style='color: rgb(192, 80, 77);'>33</span></p>"}");
Uncaught SyntaxError: missing ) after argument list
这里要注意,要转换的字符串本身已经是字符串了,没必要再转一次,即:
原写法: var post = '<%- JSON.stringify(locals.post) %>';
改为 var post = <%- JSON.stringify(locals.post) %>; -------------即把外面的单引号去掉
复制代码
var contentTrans = doc.content.replace(/\"/g,"\'")
正则写法上面没有双引号
record.content.replace(/\\/g,"\\\\")%>
复制代码
作者:
jimu
时间:
2016-1-31 00:11
上传图片,登录状态不在了?
---use:[object Object]
---ueditor:[object Object]
POST /ueditor/ue?action=uploadimage 200 35.317 ms - 100
GET /images/ueditor/2016-01-31/693465420044308480.png 200 5.325 ms - 22035
crashing child
Starting child process with 'node ./bin/www'
---use:undefined
--------------currentUser:undefined
复制代码
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3