From 2aadba64c07c0829fa829dd5e7eb41d6c338b93a Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 21 Aug 2016 23:05:22 +0200 Subject: [PATCH] Some cleanup --- com.woltlab.wcf/templates/wysiwyg.tpl | 2 -- .../install/files/acp/templates/wysiwyg.tpl | 19 ++++++++++++++++++- ...mlInputNodeWoltlabMetacodeMarker.class.php | 2 ++ .../QuoteMetacodeConverter.class.php | 4 ++-- ...uoteMessageEmbeddedObjectHandler.class.php | 2 +- .../quote/MessageQuoteManager.class.php | 2 +- .../files/lib/util/MessageUtil.class.php | 4 ++-- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index cf1e9b0a7f..365c0c00cc 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -25,7 +25,6 @@ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabModal.js?v={@LAST_UPDATE_TIME}', - '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabParagraphize.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabQuote.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSize.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSmiley.js?v={@LAST_UPDATE_TIME}', @@ -169,7 +168,6 @@ 'WoltLabInlineCode', 'WoltLabLink', 'WoltLabModal', - 'WoltLabParagraphize', 'WoltLabQuote', 'WoltLabSize', 'WoltLabSmiley', diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index 42db80b1c8..365c0c00cc 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -133,7 +133,13 @@ 'insert-column-left': '{lang}wcf.editor.table.insertColumnLeft{/lang}', 'insert-column-right': '{lang}wcf.editor.table.insertColumnRight{/lang}', 'insert-row-above': '{lang}wcf.editor.table.insertRowAbove{/lang}', - 'insert-row-below': '{lang}wcf.editor.table.insertRowBelow{/lang}' + 'insert-row-below': '{lang}wcf.editor.table.insertRowBelow{/lang}', + + // size + 'remove-size': '{lang}wcf.editor.button.size.removeSize{/lang}', + + // color + 'remove-color': '{lang}wcf.editor.button.color.removeColor{/lang}', } }, linkify: false, @@ -197,6 +203,17 @@ // already and we can safely add all icons config.plugins.push('WoltLabButton'); + var content = element.value; + element.value = ''; + + config.callbacks = config.callbacks || { }; + config.callbacks.init = function() { + // slight delay to allow Redactor to initialize itself + window.setTimeout(function() { + $(element).redactor('code.set', content); + }, 10); + }; + $(element).redactor(config); }); }); diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php index 7bbe708778..575a6860d0 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php @@ -415,6 +415,8 @@ class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlInputNode { case 'code': case 'div': case 'p': + case 'woltlab-quote': + case 'woltlab-spoiler': return true; break; diff --git a/wcfsetup/install/files/lib/system/html/metacode/converter/QuoteMetacodeConverter.class.php b/wcfsetup/install/files/lib/system/html/metacode/converter/QuoteMetacodeConverter.class.php index 010536d708..2bc10d4596 100644 --- a/wcfsetup/install/files/lib/system/html/metacode/converter/QuoteMetacodeConverter.class.php +++ b/wcfsetup/install/files/lib/system/html/metacode/converter/QuoteMetacodeConverter.class.php @@ -2,7 +2,7 @@ namespace wcf\system\html\metacode\converter; /** - * Converts quote bbcode into `
`. + * Converts quote bbcode into ``. * * @author Alexander Ebert * @copyright 2001-2016 WoltLab GmbH @@ -15,7 +15,7 @@ class QuoteMetacodeConverter extends AbstractMetacodeConverter { * @inheritDoc */ public function convert(\DOMDocumentFragment $fragment, array $attributes) { - $element = $fragment->ownerDocument->createElement('blockquote'); + $element = $fragment->ownerDocument->createElement('woltlab-quote'); $element->setAttribute('data-quote-title', isset($attributes[0]) ? $attributes[0] : ''); $element->setAttribute('data-quote-url', isset($attributes[1]) ? $attributes[1] : ''); $element->appendChild($fragment); diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/QuoteMessageEmbeddedObjectHandler.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/QuoteMessageEmbeddedObjectHandler.class.php index 856ff0cf6f..f1faf44ea3 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/QuoteMessageEmbeddedObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/QuoteMessageEmbeddedObjectHandler.class.php @@ -21,7 +21,7 @@ class QuoteMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObjectHan $usernames = []; /** @var \DOMElement $element */ - foreach ($htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('blockquote') as $element) { + foreach ($htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('woltlab-quote') as $element) { $username = StringUtil::trim($element->getAttribute('data-author')); if (!empty($username) && !in_array($username, $usernames)) { $usernames[] = $username; diff --git a/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php b/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php index 163f9f018c..57e85a2ea5 100644 --- a/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php +++ b/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php @@ -134,7 +134,7 @@ class MessageQuoteManager extends SingletonFactory { $htmlInputProcessor = new HtmlInputProcessor(); $htmlInputProcessor->processIntermediate($fullQuote); - $elements = $htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('blockquote'); + $elements = $htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('woltlab-quote'); while ($elements->length) { DOMUtil::removeNode($elements->item(0)); } diff --git a/wcfsetup/install/files/lib/util/MessageUtil.class.php b/wcfsetup/install/files/lib/util/MessageUtil.class.php index e056bea12c..5a969acf0f 100644 --- a/wcfsetup/install/files/lib/util/MessageUtil.class.php +++ b/wcfsetup/install/files/lib/util/MessageUtil.class.php @@ -53,7 +53,7 @@ class MessageUtil { continue; } - if (DOMUtil::hasParent($element, 'blockquote')) { + if (DOMUtil::hasParent($element, 'woltlab-quote')) { // ignore mentions within quotes continue; } @@ -73,7 +73,7 @@ class MessageUtil { public static function getQuotedUsers(HtmlInputProcessor $htmlInputProcessor) { $usernames = []; - $elements = $htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('blockquote'); + $elements = $htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('woltlab-quote'); /** @var \DOMElement $element */ foreach ($elements as $element) { $username = $element->getAttribute('data-author'); -- 2.20.1