Added support for text alignment justify
authorAlexander Ebert <ebert@woltlab.com>
Tue, 21 Jun 2016 10:49:43 +0000 (12:49 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 21 Jun 2016 10:49:43 +0000 (12:49 +0200)
com.woltlab.wcf/templates/wysiwyg.tpl
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAlignment.js [new file with mode: 0644]
wcfsetup/install/files/style/ui/redactor.scss
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 9204e05974a5a9015a551cbc4cc1b387e6eb17a7..13d069435a28be91946d2b13e5c0994745e08f04 100644 (file)
@@ -18,6 +18,7 @@
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/table.js?v={@LAST_UPDATE_TIME}',
                        
                        {* WoltLab *}
+                       '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAlignment.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAttachment.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabBlock.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabButton.js?v={@LAST_UPDATE_TIME}',
                                                heading4: '{lang}wcf.editor.format.heading4{/lang}',
                                                paragraph: '{lang}wcf.editor.format.paragraph{/lang}',
                                                
+                                               'align-center': '{lang}wcf.editor.alignment.center{/lang}',
+                                               'align-justify': '{lang}wcf.editor.alignment.justify{/lang}',
+                                               'align-left': '{lang}wcf.editor.alignment.left{/lang}',
+                                               'align-right': '{lang}wcf.editor.alignment.right{/lang}',
+                                               
                                                // table plugin
                                                'add-head': '{lang}wcf.editor.table.addHead{/lang}',
                                                'delete-column': '{lang}wcf.editor.table.deleteColumn{/lang}',
                                        'alignment',
                                        'source',
                                        'table',
+                                       'WoltLabAlignment',
                                        'WoltLabAttachment',
                                        'WoltLabBlock',
                                        'WoltLabCode',
diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAlignment.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAlignment.js
new file mode 100644 (file)
index 0000000..ee709f0
--- /dev/null
@@ -0,0 +1,25 @@
+$.Redactor.prototype.WoltLabAlignment  = function() {
+       "use strict";
+       
+       return {
+               init: function() {
+                       var mpRemoveAlign = this.alignment.removeAlign;
+                       this.alignment.removeAlign = (function() {
+                               mpRemoveAlign.call(this);
+                               
+                               this.block.removeClass('text-justify');
+                       }).bind(this);
+                       
+                       var listItem = this.dropdown.buildItem('justify', {
+                               title: this.lang.get('align-justify'),
+                               func: (function () {
+                                       this.buffer.set();
+                                       this.alignment.removeAlign();
+                                       this.block.addClass('text-justify');
+                               }).bind(this)
+                       });
+                       
+                       listItem.appendTo(this.button.get('alignment').data('dropdown'));
+               }
+       }
+};
index c00c63be940b83b5580a1987e7672427f291e3e7..1be821152e5da1dd042ad345bb3b37715fbbb4a6 100644 (file)
        text-align: right;
 }
 
+/* alignment plugin / custom value */
+.text-justify {
+       text-align: justify;
+       
+       -webkit-hyphens: auto;
+       -moz-hyphens: auto;
+       -ms-hyphens: auto;
+       hyphens: auto;
+}
+
 /* text color */
 .woltlab-color-000000 { color: #000000 !important; }
 .woltlab-color-000080 { color: #000080 !important; }
index 26bba11465e0e60b465abd6a8db5e57aed337be6..9b4e9d7c68adfe71a50aebce8c9c865a8f27f62f 100644 (file)
@@ -2116,6 +2116,11 @@ Fehler sind beispielsweise:
        </category>
        
        <category name="wcf.editor">
+               <item name="wcf.editor.alignment.center"><![CDATA[Zentrieren]]></item>
+               <item name="wcf.editor.alignment.justify"><![CDATA[Blocksatz]]></item>
+               <item name="wcf.editor.alignment.left"><![CDATA[Linksbündig ausrichten]]></item>
+               <item name="wcf.editor.alignment.right"><![CDATA[Rechtsbündig ausrichten]]></item>
+               
                <item name="wcf.editor.button.alignment"><![CDATA[Ausrichtung]]></item>
                <item name="wcf.editor.button.bold"><![CDATA[Fett]]></item>
                <item name="wcf.editor.button.code"><![CDATA[Code]]></item>
index 416500b49f69689233bb9560303486ac8185d6e3..e6984fef66ef2a12bc2a7e3b1f7b159acef53a00 100644 (file)
@@ -2127,6 +2127,11 @@ Errors are:
        </category>
        
        <category name="wcf.editor">
+               <item name="wcf.editor.alignment.center"><![CDATA[Align center]]></item>
+               <item name="wcf.editor.alignment.justify"><![CDATA[Align justify]]></item>
+               <item name="wcf.editor.alignment.left"><![CDATA[Align left]]></item>
+               <item name="wcf.editor.alignment.right"><![CDATA[Align right]]></item>
+               
                <item name="wcf.editor.button.alignment"><![CDATA[Alignment]]></item>
                <item name="wcf.editor.button.bold"><![CDATA[Bold]]></item>
                <item name="wcf.editor.button.code"><![CDATA[Code]]></item>