Including settings when submitting inline edit
authorAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jul 2016 15:42:30 +0000 (17:42 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jul 2016 15:42:35 +0000 (17:42 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Ui/Message/InlineEditor.js

index 4258efa481b33cb523ec67152cfe8f9c91a41d69..54acb6904e9f3cf7b35036342b524dfa493d8e16 100644 (file)
@@ -425,6 +425,25 @@ define(
                        
                        var id = this._getEditorId();
                        
+                       // add any available settings
+                       var settingsContainer = elById('settings_' + id);
+                       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', 'getText_' + id, parameters.data);
                        
                        if (!this._validate(parameters)) {