Integrated hooks into templates and provided a blokc/hook for the left and right editbar menu
This commit is contained in:
parent
05c2e0fde5
commit
a5366a0a16
|
@ -25,7 +25,8 @@
|
|||
"hooks": {
|
||||
"somehookname": "ep_fintest/otherpart:somehook",
|
||||
"morehook": "ep_fintest/otherpart:morehook",
|
||||
"expressCreateServer": "ep_fintest/otherpart:expressServer"
|
||||
"expressCreateServer": "ep_fintest/otherpart:expressServer",
|
||||
"eejsBlock_editbarMenuLeft": "ep_fintest/otherpart:eejsBlock_editbarMenuLeft"
|
||||
},
|
||||
"client_hooks": {
|
||||
"somehookname": "ep_fintest/static/js/test:bar"
|
||||
|
|
|
@ -14,3 +14,12 @@ exports.expressServer = function (hook_name, args, cb) {
|
|||
res.send("<em>Abra cadabra</em>");
|
||||
});
|
||||
}
|
||||
|
||||
exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) {
|
||||
args.content = args.content + '\
|
||||
<li id="testButton" onClick="window.pad&&pad.editbarClick(\'clearauthorship\');return false;">\
|
||||
<a class="buttonicon buttonicon-test" title="Test test test"></a>\
|
||||
</li>\
|
||||
';
|
||||
return cb();
|
||||
}
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
<% e.begin_define_block("foo"); %>
|
||||
YY
|
||||
<% e.super(); %>
|
||||
ZZ
|
||||
<% e.end_define_block(); %>
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
|
||||
/* Basic usage:
|
||||
*
|
||||
* require("./eejs").require("./examples/foo.ejs")
|
||||
* require("./index").require("./examples/foo.ejs")
|
||||
*/
|
||||
|
||||
var ejs = require("ejs");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js");
|
||||
|
||||
exports.info = {
|
||||
buf_stack: [],
|
||||
|
@ -62,17 +63,26 @@ exports.begin_define_block = function (name) {
|
|||
exports.begin_capture();
|
||||
}
|
||||
|
||||
exports.super = function () {
|
||||
exports.info.buf.push('<!eejs!super!>');
|
||||
}
|
||||
|
||||
exports.end_define_block = function () {
|
||||
content = exports.end_capture();
|
||||
var name = exports.info.block_stack.pop();
|
||||
if (typeof exports.info.blocks[name].content == "undefined")
|
||||
exports.info.blocks[name].content = content;
|
||||
else if (typeof exports.info.blocks[name].content.indexOf('<!eejs!super!>'))
|
||||
exports.info.blocks[name].content = exports.info.blocks[name].content.replace('<!eejs!super!>', content);
|
||||
|
||||
return exports.info.blocks[name].content;
|
||||
}
|
||||
|
||||
exports.end_block = function () {
|
||||
var res = exports.end_define_block();
|
||||
exports.info.buf.push(res);
|
||||
var name = exports.info.block_stack[exports.info.block_stack.length-1];
|
||||
var args = {content: exports.end_define_block()};
|
||||
hooks.callAll("eejsBlock_" + name, args);
|
||||
exports.info.buf.push(args.content);
|
||||
}
|
||||
|
||||
exports.begin_block = exports.begin_define_block;
|
||||
|
|
|
@ -15,61 +15,65 @@
|
|||
|
||||
<div id="editbar">
|
||||
<ul id="menu_left">
|
||||
<li id="bold" onClick="window.pad&&pad.editbarClick('bold');return false">
|
||||
<a class="buttonicon buttonicon-bold" title="Bold (ctrl-B)"></a>
|
||||
</li>
|
||||
<li id="italic" onClick="window.pad&&pad.editbarClick('italic'); return false;">
|
||||
<a class="buttonicon buttonicon-italic" title="Italics (ctrl-I)"></a>
|
||||
</li>
|
||||
<li id="underline" onClick="window.pad&&pad.editbarClick('underline');return false;" >
|
||||
<a class="buttonicon buttonicon-underline" title="Underline (ctrl-U)"></a>
|
||||
</li>
|
||||
<li id="strikethrough" onClick="window.pad&&pad.editbarClick('strikethrough');return false;">
|
||||
<a class="buttonicon buttonicon-strikethrough" title="Strikethrough"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="oderedlist" onClick="window.pad&&pad.editbarClick('insertorderedlist');return false;">
|
||||
<a class="buttonicon buttonicon-insertorderedlist" title="Toggle Ordered List"></a>
|
||||
</li>
|
||||
<li id="unoderedlist" onClick="window.pad&&pad.editbarClick('insertunorderedlist');return false;">
|
||||
<a class="buttonicon buttonicon-insertunorderedlist" title="Toggle Bullet List"></a>
|
||||
</li>
|
||||
<li id="indent" onClick="window.pad&&pad.editbarClick('indent');return false;">
|
||||
<a class="buttonicon buttonicon-indent" title="Indent"></a>
|
||||
</li>
|
||||
<li id="outdent" onClick="window.pad&&pad.editbarClick('outdent');return false;">
|
||||
<a class="buttonicon buttonicon-outdent" title="Unindent"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="undo" onClick="window.pad&&pad.editbarClick('undo');return false;">
|
||||
<a class="buttonicon buttonicon-undo" title="Undo (ctrl-Z)"></a>
|
||||
</li>
|
||||
<li id="redo" onClick="window.pad&&pad.editbarClick('redo');return false;">
|
||||
<a class="buttonicon buttonicon-redo" title="Redo (ctrl-Y)"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="clearAuthorship" onClick="window.pad&&pad.editbarClick('clearauthorship');return false;">
|
||||
<a class="buttonicon buttonicon-clearauthorship" title="Clear Authorship Colors"></a>
|
||||
</li>
|
||||
<% e.begin_block("editbarMenuLeft"); %>
|
||||
<li id="bold" onClick="window.pad&&pad.editbarClick('bold');return false">
|
||||
<a class="buttonicon buttonicon-bold" title="Bold (ctrl-B)"></a>
|
||||
</li>
|
||||
<li id="italic" onClick="window.pad&&pad.editbarClick('italic'); return false;">
|
||||
<a class="buttonicon buttonicon-italic" title="Italics (ctrl-I)"></a>
|
||||
</li>
|
||||
<li id="underline" onClick="window.pad&&pad.editbarClick('underline');return false;" >
|
||||
<a class="buttonicon buttonicon-underline" title="Underline (ctrl-U)"></a>
|
||||
</li>
|
||||
<li id="strikethrough" onClick="window.pad&&pad.editbarClick('strikethrough');return false;">
|
||||
<a class="buttonicon buttonicon-strikethrough" title="Strikethrough"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="oderedlist" onClick="window.pad&&pad.editbarClick('insertorderedlist');return false;">
|
||||
<a class="buttonicon buttonicon-insertorderedlist" title="Toggle Ordered List"></a>
|
||||
</li>
|
||||
<li id="unoderedlist" onClick="window.pad&&pad.editbarClick('insertunorderedlist');return false;">
|
||||
<a class="buttonicon buttonicon-insertunorderedlist" title="Toggle Bullet List"></a>
|
||||
</li>
|
||||
<li id="indent" onClick="window.pad&&pad.editbarClick('indent');return false;">
|
||||
<a class="buttonicon buttonicon-indent" title="Indent"></a>
|
||||
</li>
|
||||
<li id="outdent" onClick="window.pad&&pad.editbarClick('outdent');return false;">
|
||||
<a class="buttonicon buttonicon-outdent" title="Unindent"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="undo" onClick="window.pad&&pad.editbarClick('undo');return false;">
|
||||
<a class="buttonicon buttonicon-undo" title="Undo (ctrl-Z)"></a>
|
||||
</li>
|
||||
<li id="redo" onClick="window.pad&&pad.editbarClick('redo');return false;">
|
||||
<a class="buttonicon buttonicon-redo" title="Redo (ctrl-Y)"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="clearAuthorship" onClick="window.pad&&pad.editbarClick('clearauthorship');return false;">
|
||||
<a class="buttonicon buttonicon-clearauthorship" title="Clear Authorship Colors"></a>
|
||||
</li>
|
||||
<% e.end_block(); %>
|
||||
</ul>
|
||||
<ul id="menu_right">
|
||||
<li id="settingslink" onClick="window.pad&&pad.editbarClick('settings');return false;">
|
||||
<a class="buttonicon buttonicon-settings" id="settingslink" title="Settings of this pad"></a>
|
||||
</li>
|
||||
<li id="importexportlink" onClick="window.pad&&pad.editbarClick('import_export');return false;">
|
||||
<a class="buttonicon buttonicon-import_export" id="exportlink" title="Import/Export from/to different document formats"></a>
|
||||
</li>
|
||||
<li id="embedlink" onClick="window.pad&&pad.editbarClick('embed');return false;" >
|
||||
<a class="buttonicon buttonicon-embed" id="embedlink" title="Share and Embed this pad"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="timesliderlink" onClick="document.location = document.location.pathname+ '/timeslider'">
|
||||
<a class="buttonicon buttonicon-history" title="Show the history of this pad"></a>
|
||||
</li>
|
||||
<li id="usericon" onClick="window.pad&&pad.editbarClick('showusers');return false;" title="Show connected users">
|
||||
<span class="buttonicon buttonicon-showusers" id="usericonback"></span>
|
||||
<span id="online_count">1</span>
|
||||
</li>
|
||||
<% e.begin_block("editbarMenuRight"); %>
|
||||
<li id="settingslink" onClick="window.pad&&pad.editbarClick('settings');return false;">
|
||||
<a class="buttonicon buttonicon-settings" id="settingslink" title="Settings of this pad"></a>
|
||||
</li>
|
||||
<li id="importexportlink" onClick="window.pad&&pad.editbarClick('import_export');return false;">
|
||||
<a class="buttonicon buttonicon-import_export" id="exportlink" title="Import/Export from/to different document formats"></a>
|
||||
</li>
|
||||
<li id="embedlink" onClick="window.pad&&pad.editbarClick('embed');return false;" >
|
||||
<a class="buttonicon buttonicon-embed" id="embedlink" title="Share and Embed this pad"></a>
|
||||
</li>
|
||||
<li class="separator"></li>
|
||||
<li id="timesliderlink" onClick="document.location = document.location.pathname+ '/timeslider'">
|
||||
<a class="buttonicon buttonicon-history" title="Show the history of this pad"></a>
|
||||
</li>
|
||||
<li id="usericon" onClick="window.pad&&pad.editbarClick('showusers');return false;" title="Show connected users">
|
||||
<span class="buttonicon buttonicon-showusers" id="usericonback"></span>
|
||||
<span id="online_count">1</span>
|
||||
</li>
|
||||
<% e.end_block(); %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue