Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions redactorextras/resources/plugins/alignment.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
}
.text-right {
text-align: right;
}
.text-justify {
text-align: justify;
}
97 changes: 55 additions & 42 deletions redactorextras/resources/plugins/alignment.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,61 @@ if (!RedactorPlugins) var RedactorPlugins = {};

RedactorPlugins.alignment = function()
{
return {
langs: {
en: {
"align": "Align",
"align-left": "Align Left",
"align-center": "Align Center",
"align-right": "Align Right"
}
},
init: function()
{
var that = this;
var dropdown = {};
return {
langs: {
en: {
"align": "Align",
"align-left": "Align Left",
"align-center": "Align Center",
"align-right": "Align Right",
"align-justify": "Align Justify",
}
},
init: function()
{
var that = this;
var dropdown = {};

dropdown.left = { title: that.lang.get('align-left'), func: that.alignment.setLeft };
dropdown.center = { title: that.lang.get('align-center'), func: that.alignment.setCenter };
dropdown.right = { title: that.lang.get('align-right'), func: that.alignment.setRight };
dropdown.left = { title: that.lang.get('align-left'), func: that.alignment.setLeft };
dropdown.center = { title: that.lang.get('align-center'), func: that.alignment.setCenter };
dropdown.right = { title: that.lang.get('align-right'), func: that.alignment.setRight };
dropdown.justify = { title: that.lang.get('align-justify'), func: that.alignment.setJustify };

var button = this.button.add('alignment', this.lang.get('align'));
this.button.addDropdown(button, dropdown);
},
removeAlign: function()
{
this.block.removeClass('text-center');
this.block.removeClass('text-right');
},
setLeft: function()
{
this.buffer.set();
this.alignment.removeAlign();
},
setCenter: function()
{
this.buffer.set();
this.alignment.removeAlign();
this.block.addClass('text-center');
},
setRight: function()
{
this.buffer.set();
this.alignment.removeAlign();
this.block.addClass('text-right');
}
};
var button = this.button.add('alignment', this.lang.get('align'));
this.button.setIcon(button, '<i class="re-icon-alignment"></i>');
this.button.addDropdown(button, dropdown);
},
removeAlign: function()
{
this.block.removeClass('text-center');
this.block.removeClass('text-right');
this.block.removeClass('text-justify');
},
setLeft: function()
{
this.buffer.set();
this.alignment.removeAlign();
},
setCenter: function()
{
this.buffer.set();
this.alignment.removeAlign();
this.block.addClass('text-center');
this.core.editor().focus()
},
setRight: function()
{
this.buffer.set();
this.alignment.removeAlign();
this.block.addClass('text-right');
this.core.editor().focus()
},
setJustify: function()
{
this.buffer.set();
this.alignment.removeAlign();
this.block.addClass('text-justify');
this.core.editor().focus()
}
};
};