diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts index df458fa2c9..8c8a43caf8 100644 --- a/api/js/etemplate/et2_widget_htmlarea.ts +++ b/api/js/etemplate/et2_widget_htmlarea.ts @@ -547,7 +547,7 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable { // are we called by etemplate2.getValues() (has a closure result) // not always setting it, as getValue() is called a lot, e.g. to test input is dirty - if (this.options.applyDefaultFont && typeof result !== 'undefined') + if (this.options.applyDefaultFont && this.getInstanceManager().get_values) { this.applyDefaultFont(); } diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index 178f746842..096fc7d414 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -1216,15 +1216,23 @@ export class etemplate2 } } + /** + * Flag that getValues() is running + */ + get_values = false; + /** * Fetches all input element values and returns them in an associative * array. Widgets which introduce namespacing can use the internal _target * parameter to add another layer. * * @param {et2_widget} _root widget to start iterating + * @param {boolean} skip_reset_dirty true: do NOT reset dirty status */ - getValues(_root : et2_widget) + getValues(_root : et2_widget, skip_reset_dirty : boolean) { + this.get_values = true; + const result = {}; // Iterate over the widget tree @@ -1320,10 +1328,15 @@ export class etemplate2 } delete _target[path[path.length - 1]]; } - _widget.resetDirty(); + if (!skip_reset_dirty) + { + _widget.resetDirty(); + } }, this, et2_IInput); + this.get_values = false; + egw().debug("info", "Value", result); return result; } diff --git a/mail/js/app.js b/mail/js/app.js index 28f1de92d4..5f4b649761 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -4059,17 +4059,7 @@ app.classes.mail = AppJS.extend( action = _egw_action.id; } - var widgets = ['from','to','cc','bcc','subject','folder','replyto','mailaccount', - 'mail_htmltext', 'mail_plaintext', 'lastDrafted', 'filemode', 'expiration', 'password']; - var widget = {}; - for (var index in widgets) - { - widget = self.et2.getWidgetById(widgets[index]); - if (widget) - { - content[widgets[index]] = widget.get_value(); - } - } + Object.assign(content, self.et2.getInstanceManager().getValues(self.et2, true)); if (content) {