netpi / ueditor Goto Github PK
View Code? Open in Web Editor NEW:pencil: UEditor 官方支持的版本有PHP JSP ASP .NET. ueditor for nodejs 可以让你的UEditor支持node.js
:pencil: UEditor 官方支持的版本有PHP JSP ASP .NET. ueditor for nodejs 可以让你的UEditor支持node.js
在node环境下 使用demo是可以上传的 但是前端 和后端域名不同情况下 访问serverUrl 能获取到json文件 但是会出现Unexpected token : 感觉是跨域问题 招了很多没解决 求
请问如何实现附件上传啊?我在app.js中的代码如下,但是出错了
//ueditor
app.use("/libs/ueditor/ue", ueditor(path.join(__dirname, 'public'), function (req, res, next) {
// ueditor 客户发起上传文件请求
if (req.query.action === 'uploadfile') {
var foo = req.ueditor;
var date = new Date();
var filename = req.ueditor.filename;
var file_url = '/files';
res.ue_up(file_url); //你只要输入要保存的地址 。保存操作交给ueditor来做
}
// 客户端发起文件列表请求
else if (req.query.action === 'listfile') {
var dir_url = '/files';
res.ue_list(dir_url); // 客户端会列出 dir_url 目录下的所有图片
}
// 客户端发起其它请求
else {
res.setHeader('Content-Type', 'application/json');
res.redirect('/libs/ueditor/nodejs/config.json')
}
}));
我在contentChange事件中,调用getContent()方法,发现会失去选中内容状态,
怎么让getContent()执行后,保留选中的状态
错误提示: app.use("/ueditor/ue", ueditor(path.join(__dirname, 'public'), function(req, res, next) {
^
ReferenceError: path is not defined
求助!
IE下 单图上传 按照示例
if (req.query.action === 'uploadimage') {
// var foo = req.ueditor;
// var date = new Date();
// var imgname = req.ueditor.filename;
var img_url = '/img/ueditor/';
res.ue_up(img_url); //你只要输入要保存的地址 。保存操作交给ueditor来做
}
会提示下载json文件
需要在加入一句 res.setHeader('Content-Type', 'text/html');
来解释响应头
访问/ueditor直接可以上传文件 只能先把/public/ueditor/index.html删了
@netpi
I am using ueditor, but the new version 1.4.3 did not work well in my example. Especially, when I use google browser opened it, but the firefox browser was ok. So I chosed to use umeditor. However, do you know how I can make the ueditor 1.4.3 work well?
Besides, I also wanted to use your module to dule with image uploading, what version of ueditor are you using? Can you give me a concrete example. I just could not make it work. Thank you so much.
不会 node ,你可以帮助我吗?
修改如下 index.js 74行 流没有监听 关闭结束 就返回json了
var tmp=fs.createWriteStream(tmpdir) file.pipe(tmp); tmp.on('close',function () { fse.move(tmpdir, dest, function (err) { if (err) throw err; res.json({ 'url': path.join(img_url, name), 'title': req.body.pictitle, 'original': filename, 'state': 'SUCCESS' }); }); })
在config文件的toolbar里面添加insertcode配置项发现该功能未能实现。
能实现支持吗?
我用koa 来添加中间件时会出现TypeError: middleware must be a function!
第一次提交PR,对操作流程不熟,不知有没有操作错误 =。 =
有没有本地图片绝对URL转相对URL的功能啊,好像在说明里没有看到
把ueditor中间件放到sails框架的controller中触发不了文件上传的callback函数。
项目还没有部署到网上去,用的本地作为服务器。
上传第一张的时候没有问题。上传第二张的时候就会报错。使用chrome查看最后一个传递到服务端的请求提示为“Provisional headers are shown”,意味着请求根本就没有发出去。
而nodejs后台已经挂了提示node_modules\ueditor\index.js:77
if(err) throw err;
Error:ENOENT: no such file or directory, link 'C:\Users\ADMINI~1\AppData\Local\Temp\Desert.jpg' -> 'F:\chuaNodejs\chuayyqing\static\images\ueditor\705214004658163712.jpg'
at Error (native)
我用你的例子是可以跑起来的,后端直接拷贝的你的ueditor放到了express的public下面,我前端用的是react,前端的初始化editor配置是有个服务器的配置路径,
serverUrl : http://127.0.0.1:8031/ueditor/ue`,我在浏览器里面输入http://127.0.0.1:8031/ueditor/ue?action=uploadimage,但是返回报错,说你的config.json第4行报错,我就搞不清清楚了
ie8上传单图的时候24839行报不支持此方法的错误 就是下面的代码块 谁遇到过怎么解决的?
if (whitList[tagName].indexOf(key) === -1) {
node.setAttr(key);
}
类似官方imageUrlPrefix配置文件的配置
也就是回调的时候带着前缀路径
图片上传配置一直报错,提示callback is not a function,是jsonp的原因吗?
测试example
cnpm install
npm start
Error: Cannot find module 'busboy'
cnpm install busboy
Error: Cannot find module 'busboy',依旧
app.use("/edit/ue", ueditor(path.join(__dirname, 'public'), function (req, res, next) {
//客户端上传文件设置
var imgDir = '/public/upload/';
var ActionType = req.query.action;
if (ActionType === 'uploadimage' || ActionType === 'uploadfile' || ActionType === 'uploadvideo') {
var file_url = imgDir;//默认图片上传地址
/其他上传格式的地址/
if (ActionType === 'uploadfile') {
file_url = '/file/ueditor/'; //附件
}
if (ActionType === 'uploadvideo') {
file_url = '/video/ueditor/'; //视频
}
res.ue_up(file_url); //你只要输入要保存的地址 。保存操作交给ueditor来做
res.setHeader('Content-Type', 'text/html');
}
// 客户端发起图片列表请求
else if (req.query.action === 'listimage') {
var dir_url = imgDir;
res.ue_list(dir_url); // 客户端会列出 dir_url 目录下的所有图片
}
// 客户端发起其它请求
else {
res.setHeader('Content-Type', 'application/json');
res.redirect('/public/ueditor/nodejs/config.json');
}
}));
不支持webpack打包吗?他引用了node 的内置模块fs
比如七牛什么的,谢谢:-D
本项目适用于用nodejs作为ueditor后台语言开发者
windows下图片上传后路径“\web\images\ueditor\752116828301561856.jpg” 为反斜杠
我调整了下代码,做了转义,修复了这个 bug
line79 'url': path.join(img_url, name).replace(//g,'/'),
请求后台配置项http错误,上传功能将不能正常使用!
请问是还有哪里需要配置些什么东西吗
默认是Express框架,切换到Sails.js框架下面,怎么弄?
我重新写的一个路由,总是报上传图片错误,请问这是为什么?和public下的文件夹层数没有关系吧?我只是多了一层而已,是出来需要配服务路径,还需要更改哪里,求赐教
直接运行example的app.js,提示安装 express ejs 然后是busboy,前面两个安装好后正常,busboy安装全局或者项目内,安装好后启动app.js始终提示未安装busboy。
还有一个问题是,在网页中使用了您的富文本框后,运行成功,但是上传图片时,图片插件加载失败,提示是:你未正常加载你的配置文件,按照很多网友的说法都去试了,本地运行正常,上传到服务器就失败,目前就这两个问题。
刚开始使用,不是很熟悉,或许很简单,但望指引迷津,thanks
/ueditor/ue?action=uploadimage
Request Headers :Provisional headers are shown
前台解析uParse没有任何反应,求解
我使用了示例代码中的处理方式,上传图片和查看图片列表都没有问题,但是文件就不行。
app.use("/ueditor/ue", ueditor(path.join(__dirname, 'public'), function (req, res, next) {
if ('uploadimage' === req.query.action) {
res.ue_up('/ueditor/nodejs/upload/image/');
} else if ('listimage' === req.query.action) {
res.ue_list('/ueditor/nodejs/upload/image/');
/*注释掉了
} else if ('uploadfile' === req.query.action) {
res.ue_up('/ueditor/nodejs/upload/file/');
} else if ('listfile' === req.query.action) {
res.ue_list('/ueditor/nodejs/upload/file/');
*/
} else {
res.setHeader('Content-Type', 'application/json');
res.redirect('/ueditor/nodejs/config.json');
}
}));
使用node方式后,我添加了(req.query.action === 'listfile')去获取 '/file/ueditor'下文件, 在线附件中能够显示出来,但是选中后确定,在编辑器内没有出现超链接,在官网的演示中是没有问题的,请问是什么问题造成的?
![image](https://user-images.githubusercontent.com/26920008/26959202-7b4477e6-4d01-11e7-8dfe-efc779525050.png
如题,似乎服务配置中的格式化字符串不起作用。
另外,给图片访问加前缀,相应的服务端参数就有效
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.