Fixed handling of settings in quick reply
authorMarcel Werk <burntime@woltlab.com>
Fri, 26 Aug 2016 12:13:42 +0000 (14:13 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 26 Aug 2016 12:13:48 +0000 (14:13 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js

index d16fa109477d3b718879afd9e535a90a888c543e..251b4e58c006ef18fd46800d334171efdb36f6ec 100644 (file)
@@ -125,6 +125,25 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Dom/ChangeListener', 'Dom/U
                        parameters.data = { message: this._getEditor().code.get() };
                        parameters.removeQuoteIDs = (this._options.quoteManager) ? this._options.quoteManager.getQuotesMarkedForRemoval() : [];
                        
+                       // add any available settings
+                       var settingsContainer = elById('settings_text');
+                       if (settingsContainer) {
+                               elBySelAll('input, select, textarea', settingsContainer, function (element) {
+                                       if (element.nodeName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
+                                               if (!element.checked) {
+                                                       return;
+                                               }
+                                       }
+                                       
+                                       var name = element.name;
+                                       if (parameters.hasOwnProperty(name)) {
+                                               throw new Error("Variable overshadowing, key '" + name + "' is already present.");
+                                       }
+                                       
+                                       parameters[name] = element.value.trim();
+                               });
+                       }
+                       
                        EventHandler.fire('com.woltlab.wcf.redactor2', 'submit_text', parameters.data);
                        
                        if (!User.userId && !additionalParameters) {