mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 11:22:41 +01:00
Toolbar hooks
This commit is contained in:
parent
52aa7d3997
commit
988653b8ce
2 changed files with 71 additions and 54 deletions
|
@ -43,58 +43,6 @@ tagAttributes = function (attributes) {
|
||||||
}).join(" ");
|
}).join(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultButtons = {
|
|
||||||
bold: defaultButtonAttributes("bold"),
|
|
||||||
italic: defaultButtonAttributes("italic"),
|
|
||||||
underline: defaultButtonAttributes("underline"),
|
|
||||||
strikethrough: defaultButtonAttributes("strikethrough"),
|
|
||||||
|
|
||||||
orderedlist: {
|
|
||||||
key: "insertorderedlist",
|
|
||||||
localizationId: "pad.toolbar.ol.title",
|
|
||||||
icon: "buttonicon-insertorderedlist"
|
|
||||||
},
|
|
||||||
|
|
||||||
unorderedlist: {
|
|
||||||
key: "insertunorderedlist",
|
|
||||||
localizationId: "pad.toolbar.ul.title",
|
|
||||||
icon: "buttonicon-insertunorderedlist"
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: defaultButtonAttributes("indent"),
|
|
||||||
outdent: {
|
|
||||||
key: "outdent",
|
|
||||||
localizationId: "pad.toolbar.unindent.title",
|
|
||||||
icon: "buttonicon-outdent"
|
|
||||||
},
|
|
||||||
|
|
||||||
undo: defaultButtonAttributes("undo"),
|
|
||||||
redo: defaultButtonAttributes("redo"),
|
|
||||||
|
|
||||||
clearauthorship: {
|
|
||||||
key: "clearauthorship",
|
|
||||||
localizationId: "pad.toolbar.clearAuthorship.title",
|
|
||||||
icon: "buttonicon-clearauthorship"
|
|
||||||
},
|
|
||||||
|
|
||||||
importexport: {
|
|
||||||
key: "import_export",
|
|
||||||
localizationId: "pad.toolbar.import_export.title",
|
|
||||||
icon: "buttonicon-import_export"
|
|
||||||
},
|
|
||||||
|
|
||||||
timeslider: {
|
|
||||||
key: "showTimeSlider",
|
|
||||||
localizationId: "pad.toolbar.timeslider.title",
|
|
||||||
icon: "buttonicon-history"
|
|
||||||
},
|
|
||||||
|
|
||||||
savedrevision: defaultButtonAttributes("savedRevision"),
|
|
||||||
settings: defaultButtonAttributes("settings"),
|
|
||||||
embed: defaultButtonAttributes("embed"),
|
|
||||||
showusers: defaultButtonAttributes("showusers")
|
|
||||||
};
|
|
||||||
|
|
||||||
ButtonsGroup = function () {
|
ButtonsGroup = function () {
|
||||||
this.buttons = [];
|
this.buttons = [];
|
||||||
};
|
};
|
||||||
|
@ -134,7 +82,13 @@ Button = function (attributes) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Button.load = function (btnName) {
|
Button.load = function (btnName) {
|
||||||
return new Button(defaultButtons[btnName]);
|
var button = module.exports.availableButtons[btnName];
|
||||||
|
if (button.constructor === Button || button.constructor === SelectButton) {
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new Button(button);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_.extend(Button.prototype, {
|
_.extend(Button.prototype, {
|
||||||
|
@ -197,7 +151,65 @@ Separator.prototype.render = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
availableButtons: {},
|
availableButtons: {
|
||||||
|
bold: defaultButtonAttributes("bold"),
|
||||||
|
italic: defaultButtonAttributes("italic"),
|
||||||
|
underline: defaultButtonAttributes("underline"),
|
||||||
|
strikethrough: defaultButtonAttributes("strikethrough"),
|
||||||
|
|
||||||
|
orderedlist: {
|
||||||
|
key: "insertorderedlist",
|
||||||
|
localizationId: "pad.toolbar.ol.title",
|
||||||
|
icon: "buttonicon-insertorderedlist"
|
||||||
|
},
|
||||||
|
|
||||||
|
unorderedlist: {
|
||||||
|
key: "insertunorderedlist",
|
||||||
|
localizationId: "pad.toolbar.ul.title",
|
||||||
|
icon: "buttonicon-insertunorderedlist"
|
||||||
|
},
|
||||||
|
|
||||||
|
indent: defaultButtonAttributes("indent"),
|
||||||
|
outdent: {
|
||||||
|
key: "outdent",
|
||||||
|
localizationId: "pad.toolbar.unindent.title",
|
||||||
|
icon: "buttonicon-outdent"
|
||||||
|
},
|
||||||
|
|
||||||
|
undo: defaultButtonAttributes("undo"),
|
||||||
|
redo: defaultButtonAttributes("redo"),
|
||||||
|
|
||||||
|
clearauthorship: {
|
||||||
|
key: "clearauthorship",
|
||||||
|
localizationId: "pad.toolbar.clearAuthorship.title",
|
||||||
|
icon: "buttonicon-clearauthorship"
|
||||||
|
},
|
||||||
|
|
||||||
|
importexport: {
|
||||||
|
key: "import_export",
|
||||||
|
localizationId: "pad.toolbar.import_export.title",
|
||||||
|
icon: "buttonicon-import_export"
|
||||||
|
},
|
||||||
|
|
||||||
|
timeslider: {
|
||||||
|
key: "showTimeSlider",
|
||||||
|
localizationId: "pad.toolbar.timeslider.title",
|
||||||
|
icon: "buttonicon-history"
|
||||||
|
},
|
||||||
|
|
||||||
|
savedrevision: defaultButtonAttributes("savedRevision"),
|
||||||
|
settings: defaultButtonAttributes("settings"),
|
||||||
|
embed: defaultButtonAttributes("embed"),
|
||||||
|
showusers: defaultButtonAttributes("showusers")
|
||||||
|
},
|
||||||
|
|
||||||
|
registerButton: function (buttonName, buttonInfo) {
|
||||||
|
this.availableButtons[buttonName] = buttonInfo;
|
||||||
|
},
|
||||||
|
|
||||||
|
button: function (attributes) {
|
||||||
|
return new Button(attributes);
|
||||||
|
},
|
||||||
separator: function () {
|
separator: function () {
|
||||||
return (new Separator).render();
|
return (new Separator).render();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
<%
|
<%
|
||||||
var settings = require("ep_etherpad-lite/node/utils/Settings")
|
var settings = require("ep_etherpad-lite/node/utils/Settings")
|
||||||
|
, hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks')
|
||||||
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
||||||
, toolbar = require("ep_etherpad-lite/node/utils/toolbar");
|
, toolbar = require("ep_etherpad-lite/node/utils/toolbar");
|
||||||
|
|
||||||
|
hooks.callAll("padInitToolbar", {
|
||||||
|
toolbar: toolbar
|
||||||
|
});
|
||||||
%>
|
%>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<% e.begin_block("htmlHead"); %>
|
<% e.begin_block("htmlHead"); %>
|
||||||
|
|
Loading…
Reference in a new issue