From 4fd2dd481ef3065419a34735e684cc11bed2e6c6 Mon Sep 17 00:00:00 2001 From: Nzime Date: Wed, 4 Oct 2017 12:34:30 +0000 Subject: [PATCH 1/2] Update Alignment Plugin --- .../resources/plugins/alignment.css | 3 + redactorextras/resources/plugins/alignment.js | 100 ++++++++++-------- 2 files changed, 58 insertions(+), 45 deletions(-) mode change 100755 => 100644 redactorextras/resources/plugins/alignment.js diff --git a/redactorextras/resources/plugins/alignment.css b/redactorextras/resources/plugins/alignment.css index 3c1004d..b12da98 100644 --- a/redactorextras/resources/plugins/alignment.css +++ b/redactorextras/resources/plugins/alignment.css @@ -3,4 +3,7 @@ } .text-right { text-align: right; +} +.text-justify { + text-align: justify; } \ No newline at end of file diff --git a/redactorextras/resources/plugins/alignment.js b/redactorextras/resources/plugins/alignment.js old mode 100755 new mode 100644 index 2ef0d02..69d6aaf --- a/redactorextras/resources/plugins/alignment.js +++ b/redactorextras/resources/plugins/alignment.js @@ -1,53 +1,63 @@ -// Alignment -// Adapted from offical Redactor site -// https://imperavi.com/redactor/plugins/alignment/ 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, ''); + 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() + } + }; }; \ No newline at end of file From a1c8a3ba0dc72323855025b27e1c1a85625bbfa7 Mon Sep 17 00:00:00 2001 From: Nzime Date: Wed, 4 Oct 2017 12:54:00 +0000 Subject: [PATCH 2/2] Add missing comments --- redactorextras/resources/plugins/alignment.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/redactorextras/resources/plugins/alignment.js b/redactorextras/resources/plugins/alignment.js index 69d6aaf..a22048d 100644 --- a/redactorextras/resources/plugins/alignment.js +++ b/redactorextras/resources/plugins/alignment.js @@ -1,3 +1,6 @@ +// Alignment +// Adapted from offical Redactor site +// https://imperavi.com/redactor/plugins/alignment/ if (!RedactorPlugins) var RedactorPlugins = {};