Comparing version 0.0.23 to 0.0.24
@@ -6,4 +6,4 @@ { | ||
"client_hooks": { | ||
"postToolbarInit": "ep_align/static/js/index", | ||
"aceDomLinePreProcessLineAttributes": "ep_align/static/js/index", | ||
"postAceInit": "ep_align/static/js/index", | ||
"aceInitialized": "ep_align/static/js/index", | ||
@@ -18,2 +18,3 @@ "aceAttribsToClasses": "ep_align/static/js/index", | ||
"collectContentPost": "ep_align/static/js/shared", | ||
"padInitToolbar": "ep_align/index", | ||
"getLineHTMLForExport": "ep_align/index", | ||
@@ -20,0 +21,0 @@ "eejsBlock_dd_format":"ep_align/index" |
34
index.js
@@ -43,8 +43,10 @@ var eejs = require('ep_etherpad-lite/node/eejs/'); | ||
var header = _analyzeLine(context.attribLine, context.apool); | ||
var lineContent = context.lineContent; | ||
if (header) { | ||
var inlineStyle = getInlineStyle(header); | ||
return "<" + header + " style=\"" + inlineStyle + "\">" + context.text.substring(1) + "</" + header + ">"; | ||
context.lineContent = "<" + header + " style=\"" + inlineStyle + "\">" + lineContent + "</" + header + ">"; | ||
} | ||
} | ||
function _analyzeLine(alineAttrs, apool) { | ||
@@ -61,1 +63,31 @@ var header = null; | ||
} | ||
exports.padInitToolbar = function (hook_name, args) { | ||
var toolbar = args.toolbar; | ||
var alignLeftButton = toolbar.button({ | ||
command: 'alignLeft', | ||
class: "buttonicon grouped-left ep_align ep_align_left" | ||
}); | ||
var alignCenterButton = toolbar.button({ | ||
command: 'alignCenter', | ||
class: "buttonicon grouped-middle ep_align ep_align_center" | ||
}); | ||
var alignJustifyButton = toolbar.button({ | ||
command: 'alignJustify', | ||
class: "buttonicon grouped-middle ep_align ep_align_justify" | ||
}); | ||
var alignRightButton = toolbar.button({ | ||
command: 'alignRight', | ||
class: "buttonicon grouped-right ep_align ep_align_right" | ||
}); | ||
toolbar.registerButton('alignLeft', alignLeftButton); | ||
toolbar.registerButton('alignCenter', alignCenterButton); | ||
toolbar.registerButton('alignJustify', alignJustifyButton); | ||
toolbar.registerButton('alignRight', alignRightButton); | ||
}; |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
{ | ||
"description": "Add Left/Center/Right/Justify to lines of text in a pad", | ||
"name": "ep_align", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "John McLear", |
@@ -0,0 +0,0 @@ # ep_align |
@@ -14,19 +14,22 @@ var _, $, jQuery; | ||
// Bind the event handler to the toolbar buttons | ||
var postAceInit = function(hook, context){ | ||
$('.ep_align_left').click(function(){ | ||
align(context, 0); | ||
}); | ||
$('.ep_align_center').click(function(){ | ||
align(context, 1); | ||
}); | ||
$('.ep_align_justify').click(function(){ | ||
align(context, 3); | ||
}); | ||
$('.ep_align_right').click(function(){ | ||
align(context, 2); | ||
}); | ||
function postToolbarInit (hook_name, context) { | ||
var 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, 3); | ||
}); | ||
editbar.registerCommand('alignRight', function () { | ||
align(context, 2); | ||
}); | ||
}; | ||
function align(context, alignment){ | ||
@@ -108,7 +111,7 @@ context.ace.callWithAce(function(ace){ | ||
// Export all hooks | ||
exports.postToolbarInit = postToolbarInit; | ||
exports.aceRegisterBlockElements = aceRegisterBlockElements; | ||
exports.aceInitialized = aceInitialized; | ||
exports.postAceInit = postAceInit; | ||
exports.aceDomLinePreProcessLineAttributes = aceDomLinePreProcessLineAttributes; | ||
exports.aceAttribsToClasses = aceAttribsToClasses; | ||
exports.aceEditorCSS = aceEditorCSS; |
@@ -0,0 +0,0 @@ var _ = require('ep_etherpad-lite/static/js/underscore'); |
@@ -0,0 +0,0 @@ describe("Alignment of Text", function(){ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16586
344
18