mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-21 16:13:00 +00:00
Bugfix: Fix alt + enter search box submit failing with allow popups message
This commit is contained in:
parent
34da19e5b0
commit
7548c1e7ee
3 changed files with 29 additions and 13 deletions
|
@ -10,6 +10,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
- [security] Bugfix: Don't leak the PHP version in emails when expose_php is turned off
|
||||
- Fixed handling of Unicode characters when emailing users - added new `email_subject_utf8` and `email_body_utf8` settings to control the new behaviour
|
||||
- Add new `email_debug_dontsend` setting for debugging emails sent by Pepperminty Wiki
|
||||
- Fixed pressing alt + enter to open a search in a new tab - it should no longer fail and briefly prompt to allow popups
|
||||
|
||||
## Changed
|
||||
- Improved the search indexing system performance - again
|
||||
|
|
|
@ -556,17 +556,32 @@ if(!empty($settings->enable_math_rendering))
|
|||
// alt+enter support in the search box
|
||||
page_renderer::add_js_snippet('// Alt + Enter support in the top search box
|
||||
window.addEventListener("load", function(event) {
|
||||
document.querySelector("input[type=search]").addEventListener("keyup", function(event) {
|
||||
// Listen for Alt + Enter
|
||||
if(event.keyCode == 13 && event.altKey) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
event.cancelBubble = true;
|
||||
event.target.form.setAttribute("target", "_blank");
|
||||
event.target.form.submit();
|
||||
event.target.form.removeAttribute("target");
|
||||
return false; // Required by some browsers
|
||||
let search_box = document.querySelector("input[type=search]"),
|
||||
alt_pressed = false;
|
||||
document.addEventListener("keyup", (event) => {
|
||||
if(event.keyCode !== 18) return;
|
||||
alt_pressed = false;
|
||||
console.info("[search box/alt-tracker] alt released");
|
||||
});
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if(event.keyCode !== 18) return;
|
||||
alt_pressed = true;
|
||||
console.info("[search box/alt-tracker] alt pressed");
|
||||
});
|
||||
|
||||
search_box.form.addEventListener("submit", (event) => {
|
||||
if(!alt_pressed) {
|
||||
console.log("[search box/form] Alt wasn\'t pressed");
|
||||
event.target.removeAttribute("target");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("[search box/form] Fiddling target");
|
||||
|
||||
event.target.setAttribute("target", "_blank");
|
||||
setTimeout(() => {
|
||||
alt_pressed = false;
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
');
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
"version": "0.1",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds per-user watchlists. When a page on a user's watchlist is edited, a notification email is sent.",
|
||||
"lastupdate": 1577117779,
|
||||
"lastupdate": 1577132588,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
@ -232,10 +232,10 @@
|
|||
{
|
||||
"id": "page-edit",
|
||||
"name": "Page editor",
|
||||
"version": "0.17.6",
|
||||
"version": "0.17.7",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
|
||||
"lastupdate": 1575835535,
|
||||
"lastupdate": 1577118172,
|
||||
"optional": false,
|
||||
"extra_data": {
|
||||
"diff.min.js": "https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jsdiff\/2.2.2\/diff.min.js"
|
||||
|
|
Loading…
Reference in a new issue