Comparing version 0.2.25 to 0.2.26
@@ -7,2 +7,3 @@ { | ||
"aceEditEvent": "ep_align/static/js/index", | ||
"postToolbarInit": "ep_align/static/js/index", | ||
"aceDomLineProcessLineAttributes": "ep_align/static/js/index", | ||
@@ -19,2 +20,3 @@ "postAceInit": "ep_align/static/js/index", | ||
"collectContentPost": "ep_align/static/js/shared", | ||
"padInitToolbar": "ep_align/index", | ||
"getLineHTMLForExport": "ep_align/index" | ||
@@ -21,0 +23,0 @@ } |
44
index.js
const eejs = require('ep_etherpad-lite/node/eejs/'); | ||
const Changeset = require('ep_etherpad-lite/static/js/Changeset'); | ||
const Security = require('ep_etherpad-lite/static/js/security'); | ||
const settings = require('ep_etherpad-lite/node/utils/Settings'); | ||
exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) { | ||
if (args.renderContext.isReadOnly) return cb(); | ||
for (const button of ['alignLeft', 'alignJustify', 'alignCenter', 'alignRight']) { | ||
if (JSON.stringify(settings.toolbar).indexOf(button) > -1 ) { | ||
return cb(); | ||
} | ||
} | ||
args.content += eejs.require('ep_align/templates/editbarButtons.ejs'); | ||
@@ -31,1 +39,37 @@ return cb(); | ||
} | ||
exports.padInitToolbar = function (hook_name, args, cb) { | ||
const toolbar = args.toolbar; | ||
const alignLeftButton = toolbar.button({ | ||
command: 'alignLeft', | ||
localizationId: 'ep_align.toolbar.left.title', | ||
class: "buttonicon buttonicon-align-left ep_align ep_align_left" | ||
}); | ||
const alignCenterButton = toolbar.button({ | ||
command: 'alignCenter', | ||
localizationId: 'ep_align.toolbar.middle.title', | ||
class: "buttonicon buttonicon-align-center ep_align ep_align_center" | ||
}); | ||
const alignJustifyButton = toolbar.button({ | ||
command: 'alignJustify', | ||
localizationId: 'ep_align.toolbar.justify.title', | ||
class: "buttonicon buttonicon-align-justify ep_align ep_align_justify" | ||
}); | ||
const alignRightButton = toolbar.button({ | ||
command: 'alignRight', | ||
localizationId: 'ep_align.toolbar.right.title', | ||
class: "buttonicon buttonicon-align-right ep_align ep_align_right" | ||
}); | ||
toolbar.registerButton('alignLeft', alignLeftButton); | ||
toolbar.registerButton('alignCenter', alignCenterButton); | ||
toolbar.registerButton('alignJustify', alignJustifyButton); | ||
toolbar.registerButton('alignRight', alignRightButton); | ||
return cb(); | ||
}; |
@@ -8,5 +8,5 @@ { | ||
"ep_align.align": "Alinio", | ||
"ep_align.left": "Chwith", | ||
"ep_align.right": "De", | ||
"ep_align.justify": "Unioni" | ||
"ep_align.toolbar.left.title": "Chwith", | ||
"ep_align.toolbar.right.title": "De", | ||
"ep_align.toolbar.justify.title": "Unioni" | ||
} |
@@ -7,4 +7,4 @@ { | ||
}, | ||
"ep_align.left": "Venstre", | ||
"ep_align.right": "Højre" | ||
"ep_align.toolbar.left.title": "Venstre", | ||
"ep_align.toolbar.right.title": "Højre" | ||
} |
@@ -7,4 +7,4 @@ { | ||
"ep_align.left": "Linksbündig", | ||
"ep_align.right": "Rechtsbündig", | ||
"ep_align.justify": "Blocksatz" | ||
"ep_align.toolbar.right.title": "Rechtsbündig", | ||
"ep_align.toolbar.justify.title": "Blocksatz" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Ratnayış", | ||
"ep_align.left": "Çep", | ||
"ep_align.center": "Merkez", | ||
"ep_align.right": "Raşt", | ||
"ep_align.justify": "Heq" | ||
"ep_align.toolbar.left.title": "Çep", | ||
"ep_align.toolbar.center.title": "Merkez", | ||
"ep_align.toolbar.right.title": "Raşt", | ||
"ep_align.toolbar.justify.title": "Heq" | ||
} |
{ | ||
"ep_align.align" : "Align", | ||
"ep_align.left" : "Left", | ||
"ep_align.center" : "Center", | ||
"ep_align.right" : "Right", | ||
"ep_align.justify" : "Justify" | ||
"ep_align.toolbar.left.title" : "Left", | ||
"ep_align.toolbar.center.title" : "Center", | ||
"ep_align.toolbar.right.title" : "Right", | ||
"ep_align.toolbar.justify.title" : "Justify" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Alignement", | ||
"ep_align.left": "Gauche", | ||
"ep_align.center": "Centre", | ||
"ep_align.right": "Droit", | ||
"ep_align.justify": "Justifié" | ||
"ep_align.toolbar.left.title": "Gauche", | ||
"ep_align.toolbar.center.title": "Centre", | ||
"ep_align.toolbar.right.title": "Droit", | ||
"ep_align.toolbar.justify.title": "Justifié" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "יישור", | ||
"ep_align.left": "שמאל", | ||
"ep_align.center": "מרכז", | ||
"ep_align.right": "ימין", | ||
"ep_align.justify": "פיזור שוויוני" | ||
"ep_align.toolbar.left.title": "שמאל", | ||
"ep_align.toolbar.center.title": "מרכז", | ||
"ep_align.toolbar.right.title": "ימין", | ||
"ep_align.toolbar.justify.title": "פיזור שוויוני" | ||
} |
@@ -8,5 +8,5 @@ { | ||
"ep_align.align": "Illesztés", | ||
"ep_align.left": "Balra igazítás", | ||
"ep_align.right": "Jobbra igazítás", | ||
"ep_align.justify": "Sorkizárt" | ||
"ep_align.toolbar.left.title": "Balra igazítás", | ||
"ep_align.toolbar.right.title": "Jobbra igazítás", | ||
"ep_align.toolbar.justify.title": "Sorkizárt" | ||
} |
@@ -7,5 +7,5 @@ { | ||
}, | ||
"ep_align.left": "Sinistra", | ||
"ep_align.right": "Destra", | ||
"ep_align.justify": "Giustificato" | ||
"ep_align.toolbar.left.title": "Sinistra", | ||
"ep_align.toolbar.right.title": "Destra", | ||
"ep_align.toolbar.justify.title": "Giustificato" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "정렬", | ||
"ep_align.left": "왼쪽", | ||
"ep_align.center": "가운데", | ||
"ep_align.right": "오른쪽", | ||
"ep_align.justify": "균등" | ||
"ep_align.toolbar.left.title": "왼쪽", | ||
"ep_align.toolbar.center.title": "가운데", | ||
"ep_align.toolbar.right.title": "오른쪽", | ||
"ep_align.toolbar.justify.title": "균등" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Порамни", | ||
"ep_align.left": "Лево", | ||
"ep_align.center": "По средина", | ||
"ep_align.right": "Десно", | ||
"ep_align.justify": "Порамни пасус" | ||
"ep_align.toolbar.left.title": "Лево", | ||
"ep_align.toolbar.center.title": "По средина", | ||
"ep_align.toolbar.right.title": "Десно", | ||
"ep_align.toolbar.justify.title": "Порамни пасус" | ||
} |
@@ -8,5 +8,5 @@ { | ||
"ep_align.align": "Uitlijnen", | ||
"ep_align.left": "Links", | ||
"ep_align.right": "Rechts", | ||
"ep_align.justify": "Uitvullen" | ||
"ep_align.toolbar.left.title": "Links", | ||
"ep_align.toolbar.right.title": "Rechts", | ||
"ep_align.toolbar.justify.title": "Uitvullen" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Wyrównanie", | ||
"ep_align.left": "Do lewej", | ||
"ep_align.center": "Wyśrodkowanie", | ||
"ep_align.right": "Do prawej", | ||
"ep_align.justify": "Justowanie" | ||
"ep_align.toolbar.left.title": "Do lewej", | ||
"ep_align.toolbar.center.title": "Wyśrodkowanie", | ||
"ep_align.toolbar.right.title": "Do prawej", | ||
"ep_align.toolbar.justify.title": "Justowanie" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Aliniament", | ||
"ep_align.left": "Snistra", | ||
"ep_align.center": "Sènter", | ||
"ep_align.right": "Drita", | ||
"ep_align.justify": "Giustifiché" | ||
"ep_align.toolbar.left.title": "Snistra", | ||
"ep_align.toolbar.center.title": "Sènter", | ||
"ep_align.toolbar.right.title": "Drita", | ||
"ep_align.toolbar.justify.title": "Giustifiché" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Alinhar", | ||
"ep_align.left": "Esquerda", | ||
"ep_align.center": "Centro", | ||
"ep_align.right": "Direita", | ||
"ep_align.justify": "Justificar" | ||
"ep_align.toolbar.left.title": "Esquerda", | ||
"ep_align.toolbar.center.title": "Centro", | ||
"ep_align.toolbar.right.title": "Direita", | ||
"ep_align.toolbar.justify.title": "Justificar" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Textjustering", | ||
"ep_align.left": "Vänsterjustera", | ||
"ep_align.center": "Centrera", | ||
"ep_align.right": "Högerjustera", | ||
"ep_align.justify": "Marginaljustera" | ||
"ep_align.toolbar.left.title": "Vänsterjustera", | ||
"ep_align.toolbar.center.title": "Centrera", | ||
"ep_align.toolbar.right.title": "Högerjustera", | ||
"ep_align.toolbar.justify.title": "Marginaljustera" | ||
} |
@@ -8,4 +8,4 @@ { | ||
"ep_align.align": "Ihanay", | ||
"ep_align.left": "Kaliwa", | ||
"ep_align.right": "Kanan" | ||
"ep_align.toolbar.left.title": "Kaliwa", | ||
"ep_align.toolbar.right.title": "Kanan" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "Hizalama", | ||
"ep_align.left": "Sol", | ||
"ep_align.center": "Merkez", | ||
"ep_align.right": "Sağ", | ||
"ep_align.justify": "Hak" | ||
"ep_align.toolbar.left.title": "Sol", | ||
"ep_align.toolbar.center.title": "Merkez", | ||
"ep_align.toolbar.right.title": "Sağ", | ||
"ep_align.toolbar.justify.title": "Hak" | ||
} |
@@ -8,6 +8,6 @@ { | ||
"ep_align.align": "校準", | ||
"ep_align.left": "左", | ||
"ep_align.center": "中", | ||
"ep_align.right": "右", | ||
"ep_align.justify": "左右對齊" | ||
"ep_align.toolbar.left.title": "左", | ||
"ep_align.toolbar.center.title": "中", | ||
"ep_align.toolbar.right.title": "右", | ||
"ep_align.toolbar.justify.title": "左右對齊" | ||
} |
@@ -21,3 +21,3 @@ { | ||
}, | ||
"version": "0.2.25", | ||
"version": "0.2.26", | ||
"funding": { | ||
@@ -24,0 +24,0 @@ "type": "individual", |
@@ -1,6 +0,4 @@ | ||
var _, $, jQuery; | ||
const $ = require('ep_etherpad-lite/static/js/rjquery').$; | ||
const _ = require('ep_etherpad-lite/static/js/underscore'); | ||
var $ = require('ep_etherpad-lite/static/js/rjquery').$; | ||
var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
// All our tags are block elements, so we just return them. | ||
@@ -23,6 +21,8 @@ var tags = ['left', 'center', 'justify', 'right']; | ||
}); | ||
return; | ||
}; | ||
// On caret position change show the current align | ||
exports.aceEditEvent = function (hook, call, cb) { | ||
exports.aceEditEvent = function (hook, call) { | ||
// If it's not a click or a key event and the text hasn't changed then do nothing | ||
@@ -37,3 +37,3 @@ const cs = call.callstack; | ||
// It looks like we should check to see if this section has this attribute | ||
setTimeout(() => { // avoid race condition.. | ||
return setTimeout(() => { // avoid race condition.. | ||
const attributeManager = call.documentAttributeManager; | ||
@@ -67,2 +67,4 @@ const rep = call.rep; | ||
}); | ||
return; | ||
}, 250); | ||
@@ -125,2 +127,34 @@ }; | ||
editorInfo.ace_doInsertAlign = _(doInsertAlign).bind(context); | ||
return; | ||
} | ||
exports.postToolbarInit = function (hook_name, context) { | ||
const editbar = context.toolbar; // toolbar is actually editbar - http://etherpad.org/doc/v1.5.7/#index_editbar | ||
editbar.registerCommand('alignLeft', function () { | ||
align(context, 0); | ||
}); | ||
editbar.registerCommand('alignCenter', function () { | ||
align(context, 1); | ||
}); | ||
editbar.registerCommand('alignJustify', function () { | ||
align(context, 2); | ||
}); | ||
editbar.registerCommand('alignRight', function () { | ||
align(context, 3); | ||
}); | ||
return true; | ||
}; | ||
function align(context, alignment){ | ||
context.ace.callWithAce(function(ace){ | ||
ace.ace_doInsertAlign(alignment); | ||
ace.ace_focus(); | ||
},'insertalign' , true); | ||
} | ||
@@ -1,4 +0,4 @@ | ||
var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
const _ = require('ep_etherpad-lite/static/js/underscore'); | ||
var tags = ['left', 'center', 'justify', 'right']; | ||
const tags = ['left', 'center', 'justify', 'right']; | ||
@@ -5,0 +5,0 @@ exports.collectContentPre = (hookName, context, cb) => { |
Sorry, the diff of this file is not supported yet
32138
32
757