All Projects → netpi → Ueditor

netpi / Ueditor

📝 UEditor 官方支持的版本有PHP JSP ASP .NET. ueditor for nodejs 可以让你的UEditor支持node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Ueditor

Spruce
A social networking platform made using Node.js and MongoDB
Stars: ✭ 399 (-19.07%)
Mutual labels:  express
Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (-11.16%)
Mutual labels:  express
Kite
🌴 Kite 前台页面是vue ssr服务端渲染、后台页面是react spa、服务层nodejs express、mysql编写的一套多权限文章、动态管理系统
Stars: ✭ 455 (-7.71%)
Mutual labels:  express
Peril
☢️ Serious and immediate danger.
Stars: ✭ 410 (-16.84%)
Mutual labels:  express
Vue2 blog
使用vue2.x + vue-cli +vue-router+ vuex + axios + mysql + express + pm2 + webpack+nginx构建的具有登录,注册,留言,用户发帖,用户评论等功能的SPA Blog。注意,注意,注意,后端API全部自己手写,很适合刚学习vue以及express的小伙伴学习,喜欢请Star鼓励一下我,谢谢!项目预览:
Stars: ✭ 417 (-15.42%)
Mutual labels:  express
Create Graphql
Command-line utility to build production-ready servers with GraphQL.
Stars: ✭ 441 (-10.55%)
Mutual labels:  express
Protect
Proactively protect your Node.js web services
Stars: ✭ 394 (-20.08%)
Mutual labels:  express
Fullstack Javascript Architecture
✍️ Opinionated project architecture for Full-Stack JavaScript Applications.
Stars: ✭ 464 (-5.88%)
Mutual labels:  express
Any Rule
🦕 常用正则大全, 支持web / vscode / idea / Alfred Workflow多平台
Stars: ✭ 5,708 (+1057.81%)
Mutual labels:  express
Inversify Express Utils
Some utilities for the development of Express application with InversifyJS
Stars: ✭ 454 (-7.91%)
Mutual labels:  express
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+765.11%)
Mutual labels:  express
Video.github.io
🎬视频网站项目已实现功能: 首页导航栏,中部轮播图,以及电影列表的展现,底部导航链接 注册页面 视频播放页面 搜索页面 登录页面 用户管理页面 一键安装 电影抓取 等功能。基于NodeJS的Express框架开发的动态网站项目,下面也提供了本程序的相关演示站点。
Stars: ✭ 413 (-16.23%)
Mutual labels:  express
Hackernews React Graphql
Hacker News clone rewritten with universal JavaScript, using React and GraphQL.
Stars: ✭ 4,242 (+760.45%)
Mutual labels:  express
Jackblog Api Express
Jackblog API Server Express版, 个人博客系统, 基于RESTful架构, 使用Node.js, Express, MongoDB, Redis, Token Auth, 七牛云存储等.
Stars: ✭ 405 (-17.85%)
Mutual labels:  express
Social Network
Mini social network that I made as my first web app project.
Stars: ✭ 458 (-7.1%)
Mutual labels:  express
Graphql Ws
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
Stars: ✭ 398 (-19.27%)
Mutual labels:  express
Express Openapi Validator
🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
Stars: ✭ 436 (-11.56%)
Mutual labels:  express
Nestjs
A collection of badass modules and utilities to help you level up your NestJS applications 🚀
Stars: ✭ 475 (-3.65%)
Mutual labels:  express
Api Design Node V3
[Course] API design in Node with Express v3
Stars: ✭ 459 (-6.9%)
Mutual labels:  express
Express Jwt Permissions
🚦 Express middleware for JWT permissions
Stars: ✭ 444 (-9.94%)
Mutual labels:  express

Node.js : ueditor

UEditor 官方支持的版本有PHP JSP ASP .NET.

ueditor for nodejs 可以让你的UEditor支持nodejs

[email protected] 已经全面升级 。

##Installation

 npm install ueditor --save

Usage

var bodyParser = require('body-parser')
var ueditor = require("ueditor")
app.use(bodyParser.urlencoded({
  extended: true
}))
app.use(bodyParser.json());

// /ueditor 入口地址配置 https://github.com/netpi/ueditor/blob/master/example/public/ueditor/ueditor.config.js
// 官方例子是这样的 serverUrl: URL + "php/controller.php"
// 我们要把它改成 serverUrl: URL + 'ue'
app.use("/ueditor/ue", ueditor(path.join(__dirname, 'public'), function(req, res, next) {

  // ueditor 客户发起上传图片请求

  if(req.query.action === 'uploadimage'){

    // 这里你可以获得上传图片的信息
    var foo = req.ueditor;
    console.log(foo.filename); // exp.png
    console.log(foo.encoding); // 7bit
    console.log(foo.mimetype); // image/png

    // 下面填写你要把图片保存到的路径 ( 以 path.join(__dirname, 'public') 作为根路径)
    var img_url = 'yourpath';
    res.ue_up(img_url); //你只要输入要保存的地址 。保存操作交给ueditor来做
  }
  //  客户端发起图片列表请求
  else if (req.query.action === 'listimage'){
    var dir_url = 'your img_dir'; // 要展示给客户端的文件夹路径
    res.ue_list(dir_url) // 客户端会列出 dir_url 目录下的所有图片
  }
  // 客户端发起其它请求
  else {

    res.setHeader('Content-Type', 'application/json');
    // 这里填写 ueditor.config.json 这个文件的路径
    res.redirect('/ueditor/ueditor.config.json')
}}));

七牛上传

var bodyParser = require('body-parser')
var ueditor = require("ueditor")
app.use(bodyParser.urlencoded({
  extended: true
}))
app.use(bodyParser.json());

// 支持七牛上传,如有需要请配置好qn参数,如果没有qn参数则存储在本地
app.use("/ueditor/ue", ueditor(path.join(__dirname, 'public'), {
    qn: {
        accessKey: 'your access key',
        secretKey: 'your secret key',
        bucket: 'your bucket name',
        origin: 'http://{bucket}.u.qiniudn.com'
    }
}, function(req, res, next) {
  // ueditor 客户发起上传图片请求
  var imgDir = '/img/ueditor/'
  if(req.query.action === 'uploadimage'){
    var foo = req.ueditor;

    var imgname = req.ueditor.filename;

    
    res.ue_up(imgDir); //你只要输入要保存的地址 。保存操作交给ueditor来做
  }
  //  客户端发起图片列表请求
  else if (req.query.action === 'listimage'){
    
    res.ue_list(imgDir);  // 客户端会列出 dir_url 目录下的所有图片
  }
  // 客户端发起其它请求
  else {

    res.setHeader('Content-Type', 'application/json');
    res.redirect('/ueditor/ueditor.config.json')
}}));

FDFS上传

var bodyParser = require('body-parser')
var ueditor = require("ueditor")
app.use(bodyParser.urlencoded({
  extended: true
}))
app.use(bodyParser.json());

//FDFS config 参数配置
var ueditorConfig = {
  fdfs: {
    /* Require 必须 */
    upload: {
      host: '192.168.0.40', //fdfs 上传服务器 host
      port: '22122'  // 上传服务器端口(一般默认22122)
    },
    download: {
      host: '192.168.0.82' //fdfs 下载服务器host
    },
    /* Require 必须 */
    /* 可缺省 */
    defaultExt: 'jpg', //默认后缀为png
    charset: 'utf8', //默认为utf8
    timeout: 20 * 1000 //默认超时时间10s
    /* 可缺省 */
  }
};

// 支持FDFS上传,upload跟download字段必填
app.use("/ueditor/ue", ueditor(path.join(__dirname, 'public'),  ueditorConfig, function(req, res, next) {
  // ueditor 客户发起上传图片请求
  var imgDir = '/img/ueditor/'
  if(req.query.action === 'uploadimage'){
    var foo = req.ueditor;

    var imgname = req.ueditor.filename;

    
    res.ue_up(imgDir); //你只要输入要保存的地址 。保存操作交给ueditor来做
  }
  //  客户端发起图片列表请求
  else if (req.query.action === 'listimage'){
    
    res.ue_list(imgDir);  // 客户端会列出 dir_url 目录下的所有图片
  }
  // 客户端发起其它请求
  else {

    res.setHeader('Content-Type', 'application/json');
    res.redirect('/ueditor/ueditor.config.json')
}}));

多类型文件上传 (附件 视频 图片)

var bodyParser = require('body-parser')
var ueditor = require("ueditor")
app.use(bodyParser.urlencoded({
  extended: true
}))
app.use(bodyParser.json());

app.use("/ueditor/ue", ueditor(path.join(__dirname, 'public'), function(req, res, next) {
  var imgDir = '/img/ueditor/' //默认上传地址为图片
  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 (ActionType === 'listimage'){
    
    res.ue_list(imgDir);  // 客户端会列出 dir_url 目录下的所有图片
  }
  // 客户端发起其它请求
  else {
    res.setHeader('Content-Type', 'application/json');
    res.redirect('/ueditor/ueditor.config.json')
}}));

上传配置

app.use("/ueditor/ue", static_url, config = {}, callback);

当config为空时,会默认把图片上传到 static_url + '/img/ueditor' 目录下。
比如例子“Usage”中图片会上传到项目的 public/img/ueditor 目录。

当配置了 config.qn 图片则只会上传到七牛服务器而不会上传到项目目录。
同时上传到七牛和项目目录,只需配置 config.local 即可

config = {
  qn: { ... },
  local: true 
}

你可以来ueditor:nodejs给作者留言

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].