mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 22:23:33 +01:00
Merge pull request #810 from redhog/aceEditEvent
Plugin/hook features&bugfixes
This commit is contained in:
commit
e4ff4021ab
6 changed files with 61 additions and 7 deletions
|
@ -16,6 +16,11 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
"ep_etherpad-lite/templates/admin/plugins.html",
|
"ep_etherpad-lite/templates/admin/plugins.html",
|
||||||
render_args), {});
|
render_args), {});
|
||||||
});
|
});
|
||||||
|
args.app.get('/admin/plugins/info', function(req, res) {
|
||||||
|
res.send(eejs.require(
|
||||||
|
"ep_etherpad-lite/templates/admin/plugins-info.html",
|
||||||
|
{}), {});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.socketio = function (hook_name, args, cb) {
|
exports.socketio = function (hook_name, args, cb) {
|
||||||
|
|
|
@ -341,6 +341,11 @@ function Ace2Inner(){
|
||||||
return rep;
|
return rep;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
editorInfo.ace_getAuthor = function()
|
||||||
|
{
|
||||||
|
return thisAuthor;
|
||||||
|
}
|
||||||
|
|
||||||
var currentCallStack = null;
|
var currentCallStack = null;
|
||||||
|
|
||||||
function inCallStack(type, action)
|
function inCallStack(type, action)
|
||||||
|
@ -439,6 +444,14 @@ function Ace2Inner(){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result = action();
|
result = action();
|
||||||
|
|
||||||
|
hooks.callAll('aceEditEvent', {
|
||||||
|
callstack: currentCallStack,
|
||||||
|
editorInfo: editorInfo,
|
||||||
|
rep: rep,
|
||||||
|
documentAttributeManager: documentAttributeManager
|
||||||
|
});
|
||||||
|
|
||||||
//console.log("Just did action for: "+type);
|
//console.log("Just did action for: "+type);
|
||||||
cleanExit = true;
|
cleanExit = true;
|
||||||
}
|
}
|
||||||
|
@ -522,6 +535,7 @@ function Ace2Inner(){
|
||||||
{
|
{
|
||||||
return rep.lines.atOffset(charOffset).key;
|
return rep.lines.atOffset(charOffset).key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function dispose()
|
function dispose()
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,7 @@ exports.aCallAll = function (hook_name, args, cb) {
|
||||||
|
|
||||||
exports.callFirst = function (hook_name, args) {
|
exports.callFirst = function (hook_name, args) {
|
||||||
if (!args) args = {};
|
if (!args) args = {};
|
||||||
if (plugins.hooks[hook_name][0] === undefined) return [];
|
if (plugins.hooks[hook_name] === undefined) return [];
|
||||||
return exports.syncMapFirst(plugins.hooks[hook_name], function (hook) {
|
return exports.syncMapFirst(plugins.hooks[hook_name], function (hook) {
|
||||||
return hookCallWrapper(hook, hook_name, args);
|
return hookCallWrapper(hook, hook_name, args);
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,14 +41,16 @@ exports.formatParts = function () {
|
||||||
return _.map(exports.parts, function (part) { return part.full_name; }).join("\n");
|
return _.map(exports.parts, function (part) { return part.full_name; }).join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.formatHooks = function () {
|
exports.formatHooks = function (hook_set_name) {
|
||||||
var res = [];
|
var res = [];
|
||||||
_.chain(exports.hooks).keys().forEach(function (hook_name) {
|
var hooks = exports.extractHooks(exports.parts, hook_set_name || "hooks");
|
||||||
_.forEach(exports.hooks[hook_name], function (hook) {
|
|
||||||
res.push(hook.hook_name + ": " + hook.hook_fn_name + " from " + hook.part.full_name);
|
_.chain(hooks).keys().forEach(function (hook_name) {
|
||||||
|
_.forEach(hooks[hook_name], function (hook) {
|
||||||
|
res.push("<dt>" + hook.hook_name + "</dt><dd>" + hook.hook_fn_name + " from " + hook.part.full_name + "</dd>");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return res.join("\n");
|
return "<dl>" + res.join("\n") + "</dl>";
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.loadFn = function (path, hookName) {
|
exports.loadFn = function (path, hookName) {
|
||||||
|
@ -62,7 +64,7 @@ exports.loadFn = function (path, hookName) {
|
||||||
return fn;
|
return fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.extractHooks = function (parts, hook_set_name, plugins) {
|
exports.extractHooks = function (parts, hook_set_name) {
|
||||||
var hooks = {};
|
var hooks = {};
|
||||||
_.each(parts,function (part) {
|
_.each(parts,function (part) {
|
||||||
_.chain(part[hook_set_name] || {})
|
_.chain(part[hook_set_name] || {})
|
||||||
|
|
30
src/templates/admin/plugins-info.html
Normal file
30
src/templates/admin/plugins-info.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<%
|
||||||
|
var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
|
||||||
|
%>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Plugin information</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
|
||||||
|
<link rel="stylesheet" href="../../static/css/admin.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<h1>Etherpad Lite</h1>
|
||||||
|
<div class="separator"></div>
|
||||||
|
|
||||||
|
<h2>Installed plugins</h2>
|
||||||
|
<pre><%= plugins.formatPlugins() %></pre>
|
||||||
|
|
||||||
|
<h2>Installed parts</h2>
|
||||||
|
<pre><%= plugins.formatParts() %></pre>
|
||||||
|
|
||||||
|
<h2>Installed hooks</h2>
|
||||||
|
<h3>Server side hooks</h3>
|
||||||
|
<div><%= plugins.formatHooks() %></div>
|
||||||
|
|
||||||
|
<h3>Client side hooks</h3>
|
||||||
|
<div><%= plugins.formatHooks("client_hooks") %></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -20,6 +20,9 @@
|
||||||
|
|
||||||
|
|
||||||
<h1>Etherpad Lite</h1>
|
<h1>Etherpad Lite</h1>
|
||||||
|
|
||||||
|
<a href="/admin/plugins/info">Technical information on installed plugins</a>
|
||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
<h2>Installed plugins</h2>
|
<h2>Installed plugins</h2>
|
||||||
<table>
|
<table>
|
||||||
|
|
Loading…
Reference in a new issue