mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 08:25:00 -04:00
some cleanup and better scoping.
This commit is contained in:
parent
5328871ba6
commit
d939fd1ef4
1 changed files with 6 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
||||||
var _ = require('ep_etherpad-lite/static/js/underscore')
|
var _ = require('ep_etherpad-lite/static/js/underscore')._
|
||||||
, padeditor = require('ep_etherpad-lite/static/js/pad_editor').padeditor
|
, padeditor = require('ep_etherpad-lite/static/js/pad_editor').padeditor
|
||||||
, padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar
|
, padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar;
|
||||||
, simpleCommands = ["bold", "italic", "underline", "strikethrough"];
|
|
||||||
|
|
||||||
function registerCallWithAceCommand(commandName, callback) {
|
function registerCallWithAceCommand(commandName, callback) {
|
||||||
padeditbar.registerToolbarCommand(commandName, function () {
|
padeditbar.registerToolbarCommand(commandName, function () {
|
||||||
|
@ -10,13 +9,16 @@ function registerCallWithAceCommand(commandName, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.postAceInit = function () {
|
exports.postAceInit = function () {
|
||||||
|
var simpleCommands = ["bold", "italic", "underline", "strikethrough"]
|
||||||
|
, undoRedoCommands = ["undo", "redo"];
|
||||||
|
|
||||||
_.each(simpleCommands, function (commandName) {
|
_.each(simpleCommands, function (commandName) {
|
||||||
registerCallWithAceCommand(commandName, function (ace) {
|
registerCallWithAceCommand(commandName, function (ace) {
|
||||||
ace.ace_toggleAttributeOnSelection(commandName)
|
ace.ace_toggleAttributeOnSelection(commandName)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
_.each(["undo", "redo"], function (commandName) {
|
_.each(undoRedoCommands, function (commandName) {
|
||||||
registerCallWithAceCommand(commandName, function (ace) {
|
registerCallWithAceCommand(commandName, function (ace) {
|
||||||
ace.ace_doUndoRedo(commandName);
|
ace.ace_doUndoRedo(commandName);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue