Added support for inline code / [tt]
authorAlexander Ebert <ebert@woltlab.com>
Wed, 8 Jun 2016 13:42:34 +0000 (15:42 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 8 Jun 2016 13:42:45 +0000 (15:42 +0200)
com.woltlab.wcf/templates/wysiwyg.tpl
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInlineCode.js [new file with mode: 0644]
wcfsetup/install/files/style/bbcode/inlineCode.scss [new file with mode: 0644]

index 1d058ab78287e7f4c6aff44f75802429676b3c71..919ccdb60222f7e7579809c035541c4f18a23d80 100644 (file)
@@ -24,6 +24,7 @@
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabDropdown.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabEvent.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabImage.js?v={@LAST_UPDATE_TIME}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}',
                        '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}',
@@ -76,6 +77,7 @@
                                        'WoltLabDropdown',
                                        'WoltLabEvent',
                                        'WoltLabImage',
+                                       'WoltLabInlineCode',
                                        'WoltLabLink',
                                        'WoltLabModal',
                                        'WoltLabQuote',
diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInlineCode.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInlineCode.js
new file mode 100644 (file)
index 0000000..a60646f
--- /dev/null
@@ -0,0 +1,17 @@
+$.Redactor.prototype.WoltLabInlineCode = function() {
+       "use strict";
+       
+       return {
+               init: function() {
+                       this.opts.activeButtonsStates.kbd = 'tt';
+                       
+                       require(['EventHandler'], (function (EventHandler) {
+                               EventHandler.add('com.woltlab.wcf.redactor2', 'bbcode_tt_' + this.$element[0].id, (function(data) {
+                                       data.cancel = true;
+                                       
+                                       this.button.toggle({}, 'kbd', 'func', 'inline.format');
+                               }).bind(this));
+                       }).bind(this));
+               }
+       };
+};
diff --git a/wcfsetup/install/files/style/bbcode/inlineCode.scss b/wcfsetup/install/files/style/bbcode/inlineCode.scss
new file mode 100644 (file)
index 0000000..4b3d0ff
--- /dev/null
@@ -0,0 +1,13 @@
+.inlineCode, /* deprecated, legacy class */
+kbd {
+       background-color: rgba(255, 255, 255, 1) !important;
+       border: 1px solid rgba(196, 196, 196, 1) !important;
+       border-radius: 2px;
+       color: rgba(68, 68, 68, 1) !important;
+       display: inline-block;
+       font-family: Consolas, 'Courier New', monospace;
+       margin: 0 2px;
+       padding: 0 4px;
+       word-break: break-all;
+       word-wrap: break-word;
+}