mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 16:35:01 -04:00

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/
19 lines
590 B
JavaScript
19 lines
590 B
JavaScript
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);
|
|
});
|
|
});
|
|
}
|