wysiwyg-editor-node-sdk-qn
v0.1.2
Published
Node.js SDK for Froala Editor with Qiniu Cloud
Downloads
3
Readme
Froala WYSIWYG Editor Node.JS SDK (with Qiniu Cloud)
Easing the Froala WYSIWYG HTML Editor server side integration in Node.JS projects.
Installation
Clone this repo or download the zip.
Run
npm install
.(Optional) Run
bower install
to install the editor JS.Load
lib
directory in your project and import it:var FroalaEditor = require('path/to/lib/froalaEditor.js');
To run examples:
npm start
to start a nodejs server formexamples
directory athttp://localhost:3000/
Import lib
var FroalaEditor = require('path/to/lib/froalaEditor.js');
Documentation
基础用法:
使用七牛云:
app.post('/upload_image_validation', function (req, res) {
var options = {
accessKey: 'Your AccessKey', // AK
secretKey: 'Your Secretkey', // SK
bucket: 'Bucket Name', // 存储空间名称
zone: 'Zone_z0', // 机房位置 华东Zone_z0 华北Zone_z1 华南Zone_z2 北美Zone_na0
domain: 'Your domain', // 测试域名或cdn加速域名(末尾不加/)
fieldname: 'myImage',
validation: function(filePath, mimetype, callback) {
gm(filePath).size(function(err, value){
if (err) {
return callback(err);
}
if (!value) {
return callback('Error occurred.');
}
if (value.width != value.height) {
return callback(null, false);
}
return callback(null, true);
});
}
}
FroalaEditor.Image.uploadQn(req, '/uploads/', options, function(err, data) {
if (err) {
return res.send(JSON.stringify(err));
}
res.send(data);
});
});
- 使用七牛云后,文件将不再保存至本地(设置文件路径是为了暂存文件,用于实现用户自定义验证功能,验证结束后文件会删除)
- 关于七牛云的更多信息,请访问官方文档
Help
- Found a bug or have some suggestions? Just submit an issue.
- Having trouble with your integration? Contact Froala Support team.
License
The Froala WYSIWYG Editor Node.JS SDK is licensed under MIT license. However, in order to use Froala WYSIWYG HTML Editor plugin you should purchase a license for it.
Froala Editor has 3 different licenses for commercial use. For details please see License Agreement.