{* WoltLab *}
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAttachment.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabButton.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabCode.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabColor.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabDropdown.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabEvent.js?v={@LAST_UPDATE_TIME}',
'source',
'table',
'WoltLabAttachment',
+ 'WoltLabCode',
'WoltLabColor',
'WoltLabDropdown',
'WoltLabEvent',
--- /dev/null
+$.Redactor.prototype.WoltLabCode = function() {
+ "use strict";
+
+ return {
+ init: function() {
+ this.opts.activeButtonsStates.pre = 'code';
+
+ require(['EventHandler'], (function (EventHandler) {
+ EventHandler.add('com.woltlab.wcf.redactor2', 'bbcode_code_' + this.$element[0].id, (function(data) {
+ data.cancel = true;
+
+ this.button.toggle({}, 'pre', 'func', 'block.format');
+
+ var pre = this.selection.block();
+ if (pre && pre.nodeName === 'PRE') {
+ if (pre.textContent === '') {
+ pre.textContent = '\u200B';
+ }
+
+ if (elData(pre, 'display-value') === '') {
+ elData(pre, 'display-value', 'TODO: source code');
+ }
+ }
+ }).bind(this));
+ }).bind(this));
+ }
+ };
+};
--- /dev/null
+.redactor-editor pre {
+ background-color: rgb(255, 255, 255) !important;
+ border: 1px solid rgb(196, 196, 196) !important;
+ border-radius: 2px;
+ color: rgb(68, 68, 68) !important;
+ font-family: Consolas, 'Courier New', monospace;
+ margin: 1em 0;
+ padding: 10px 20px;
+ position: relative;
+ white-space: pre;
+
+ &::before {
+ content: attr(data-display-value);
+ display: block;
+ font-family: $wcfFontFamily;
+ margin-bottom: 20px;
+
+ @include wcfFontHeadline;
+ }
+}