diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 3d6ddc16a28..b04dab0f8a4 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -2113,7 +2113,7 @@ public function rule_div($fid, $id, $div = true, $compact = false) 'href' => '#', 'id' => "ruleadv{$id}", 'title' => $adv_title, - 'data-onclick' => ['rule_adv_switch', $id, '__THIS__'], + 'data-onclick' => ['rule_adv_switch', $id, '__THIS__', ['preventDefault' => true]], 'class' => 'show', ], html::span(['class' => 'inner'], $adv_title) @@ -2140,7 +2140,7 @@ public function rule_div($fid, $id, $div = true, $compact = false) 'href' => '#', 'id' => "ruleadv{$id}", 'title' => $adv_title, - 'data-onclick' => ['rule_adv_switch', $id, '__THIS__'], + 'data-onclick' => ['rule_adv_switch', $id, '__THIS__', ['preventDefault' => true]], 'class' => 'advanced show', ], html::span(['class' => 'inner'], $adv_title) @@ -2150,7 +2150,7 @@ public function rule_div($fid, $id, $div = true, $compact = false) 'href' => '#', 'id' => "ruleadd{$id}", 'title' => $add_title, - 'data-onclick' => ['managesieve_ruleadd', $id], + 'data-onclick' => ['managesieve_ruleadd', $id, ['preventDefault' => true]], 'class' => 'button create add', ], html::span(['class' => 'inner'], $add_title) @@ -2159,7 +2159,7 @@ public function rule_div($fid, $id, $div = true, $compact = false) 'href' => '#', 'id' => "ruledel{$id}", 'title' => $del_title, - 'data-onclick' => ['managesieve_ruledel', $id], + 'data-onclick' => ['managesieve_ruledel', $id, ['preventDefault' => true]], 'class' => 'button delete del ' . $rows_num < 2 ? 'disabled' : '', ], html::span(['class' => 'inner'], $del_title) diff --git a/plugins/newmail_notifier/newmail_notifier.php b/plugins/newmail_notifier/newmail_notifier.php index a856cdc455f..a51457e0df6 100644 --- a/plugins/newmail_notifier/newmail_notifier.php +++ b/plugins/newmail_notifier/newmail_notifier.php @@ -111,7 +111,7 @@ public function prefs_list($args) $field_id = '_' . $key; $input = new html_checkbox(['name' => $field_id, 'id' => $field_id, 'value' => 1]); $content = $input->show($this->rc->config->get($key)) - . ' ' . html::a(['href' => '#', 'data-onclick' => ['newmail_notifier_test_' . $type]], + . ' ' . html::a(['href' => '#', 'data-onclick' => ['newmail_notifier_test_' . $type, ['preventDefault' => true]]], $this->gettext('test')); $args['blocks']['new_message']['options'][$key] = [ diff --git a/program/actions/mail/show.php b/program/actions/mail/show.php index 2692a44b5d6..476756fd2e9 100644 --- a/program/actions/mail/show.php +++ b/program/actions/mail/show.php @@ -751,7 +751,7 @@ public static function message_body($attrib) $supported = in_array($mimetype, self::$CLIENT_MIMETYPES); $show_link_attr = [ 'href' => self::$MESSAGE->get_part_url($attach_prop->mime_id, false), - 'data-onclick' => ['command', 'load-attachment', $attach_prop->mime_id, '__THIS__'], + 'data-onclick' => ['command', 'load-attachment', $attach_prop->mime_id, '__THIS__', ['preventDefault' => true]], ]; $download_link_attr = [ 'href' => $show_link_attr['href'] . '&_download=1', diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index fd59bb8634e..61ed88a97e8 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -2417,7 +2417,7 @@ public function search_form($attrib) if (empty($attrib['form']) && empty($attrib['no-form'])) { $out = $this->form_tag([ 'name' => !empty($attrib['form-name']) ? $attrib['form-name'] : 'rcmqsearchform', - 'data-onsubmit' => ['command', !empty($attrib['command']) ? $attrib['command'] : 'search'], + 'data-onsubmit' => ['command', !empty($attrib['command']) ? $attrib['command'] : 'search', ['preventDefault' => true]], // 'style' => "display:inline" ], $out); } diff --git a/program/js/app.js b/program/js/app.js index b204f72c479..7210290e365 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -10849,15 +10849,23 @@ function rcube_webmail() { } return arg; }); + var preventDefault = false; + if (typeof eventArgs.at(-1) === 'object') { + options = eventArgs.pop(); + var preventDefault = Boolean(options.preventDefault); + } elem.addEventListener(eventName, (ev) => { // Inject a reference to the event object, if required. - var localEventArgs = eventArgs.map(function (arg) { + var localEventArgs = eventArgs.map((arg) => { if (arg === '__EVENT__') { return ev; } return arg; }); - this[methodName](...localEventArgs); + if (preventDefault) { + ev.preventDefault(); + } + return this[methodName](...localEventArgs); }); };