mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-10 00:45:01 -04:00
Add preview as HTML functionality
Add a toolbar button that opens a new window and shows the content of the pad as text/html. Used the 'eye' icon from the Iconic set at http://somerandomdude.com/work/iconic/
This commit is contained in:
parent
b2c06e78d0
commit
fd3472589b
7 changed files with 103 additions and 1 deletions
19
src/node/hooks/express/preview.js
Normal file
19
src/node/hooks/express/preview.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
var hasPadAccess = require("../../padaccess");
|
||||
var previewHandler = require('../../handler/PreviewHandler');
|
||||
|
||||
exports.expressCreateServer = function (hook_name, args, cb) {
|
||||
args.app.get('/p/:pad/:rev?/preview/:type', function(req, res, next) {
|
||||
var types = ['html'];
|
||||
//send a 404 if we don't support this filetype
|
||||
if (types.indexOf(req.params.type) == -1) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
|
||||
hasPadAccess(req, res, function() {
|
||||
previewHandler.doPreview(req, res, req.params.pad, req.params.type);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue