From: Alexander Ebert Date: Sat, 21 May 2016 11:34:06 +0000 (+0200) Subject: Added basic redactor plugins (WIP) X-Git-Tag: 3.0.0_Beta_1~1695 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9dab371146c06c3f8d365652e443673b1c25c2aa;p=GitHub%2FWoltLab%2FWCF.git Added basic redactor plugins (WIP) --- diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index 5991bba5fa..0f98454c9b 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -27,7 +27,7 @@ var config = { buttons: buttons, minHeight: 200, - plugins: ['WoltLabButton', 'WoltLabColor', 'WoltLabDropdown', 'WoltLabEvent', 'WoltLabLink', 'WoltLabQuote'], + plugins: ['alignment', 'source', 'table', 'WoltLabButton', 'WoltLabColor', 'WoltLabDropdown', 'WoltLabEvent', 'WoltLabLink', 'WoltLabQuote'], toolbarFixed: false, woltlab: { autosave: autosave @@ -48,7 +48,11 @@ }); head.load([ + {* Imperavi *} '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/alignment.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/source.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/table.js?v={@LAST_UPDATE_TIME}', {* WoltLab *} '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabButton.js?v={@LAST_UPDATE_TIME}', diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/alignment.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/alignment.js new file mode 100644 index 0000000000..19e331881d --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/alignment.js @@ -0,0 +1,50 @@ +(function($) +{ + $.Redactor.prototype.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 = {}; + + 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 }; + + 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'); + } + }; + }; +})(jQuery); \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/source.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/source.js new file mode 100644 index 0000000000..d8fc60b7a6 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/source.js @@ -0,0 +1,195 @@ +(function($) +{ + $.Redactor.prototype.source = function() + { + return { + init: function() + { + var button = this.button.addFirst('html', 'HTML'); + this.button.addCallback(button, this.source.toggle); + + var style = { + 'width': '100%', + 'margin': '0', + 'background': '#111', + 'box-sizing': 'border-box', + 'color': 'rgba(255, 255, 255, .8)', + 'font-size': '14px', + 'outline': 'none', + 'padding': '16px', + 'line-height': '22px', + 'font-family': 'Menlo, Monaco, Consolas, "Courier New", monospace' + }; + + this.source.$textarea = $('