Some cleanup
authorAlexander Ebert <ebert@woltlab.com>
Sun, 21 Aug 2016 21:05:22 +0000 (23:05 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 21 Aug 2016 21:05:22 +0000 (23:05 +0200)
com.woltlab.wcf/templates/wysiwyg.tpl
wcfsetup/install/files/acp/templates/wysiwyg.tpl
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php
wcfsetup/install/files/lib/system/html/metacode/converter/QuoteMetacodeConverter.class.php
wcfsetup/install/files/lib/system/message/embedded/object/QuoteMessageEmbeddedObjectHandler.class.php
wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php
wcfsetup/install/files/lib/util/MessageUtil.class.php

index cf1e9b0a7f184fa646cf2a4aec96cf8cd65e4432..365c0c00ccb79a806044efedb6a97d9bc59b00ea 100644 (file)
@@ -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}',
                                        'WoltLabInlineCode',
                                        'WoltLabLink',
                                        'WoltLabModal',
-                                       'WoltLabParagraphize',
                                        'WoltLabQuote',
                                        'WoltLabSize',
                                        'WoltLabSmiley',
index 42db80b1c8a121fdc6794bb5a26bbaea8e1edc65..365c0c00ccb79a806044efedb6a97d9bc59b00ea 100644 (file)
                                                '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,
                        // 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);
                });
        });
index 7bbe7087782ac4ab04e01dce17d47026be63f99f..575a6860d0c1d64bbaacfa39d61aa2f35b24782b 100644 (file)
@@ -415,6 +415,8 @@ class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlInputNode {
                        case 'code':
                        case 'div':
                        case 'p':
+                       case 'woltlab-quote':
+                       case 'woltlab-spoiler':
                                return true;
                                break;
                        
index 010536d7089ea328459cede93c64a26ce17ee4a2..2bc10d4596995b8855762e7878fb645387aa2876 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\html\metacode\converter;
 
 /**
- * Converts quote bbcode into `<blockquote>`.
+ * Converts quote bbcode into `<woltlab-quote>`.
  * 
  * @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);
index 856ff0cf6fd31fcd46b9a2fc9e492bc5d8d3a0a5..f1faf44ea33842a0a6439efb8beae2500c18d2f9 100644 (file)
@@ -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;
index 163f9f018ca1f69d64041e234b2d75a23f947e78..57e85a2ea5a2e33c2966c59b38ab6c27c761c4ab 100644 (file)
@@ -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));
                                }
index e056bea12c8ff4253dcddfcdf74ffa1600cfccc8..5a969acf0f7e81254ee3324596259f9aac12e29e 100644 (file)
@@ -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');