mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-26 23:14:41 +08:00
improve: nextcloud iframe mode unified search result click handling
This commit is contained in:
parent
4b26317be8
commit
0bd3545a34
1 changed files with 16 additions and 8 deletions
|
@ -13,6 +13,7 @@ document.onreadystatechange = () => {
|
|||
passThemesToIFrame();
|
||||
let form = document.querySelector('form.snappymail');
|
||||
form && SnappyMailFormHelper(form);
|
||||
setupUnifiedSearchListener()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -136,15 +137,22 @@ function SnappyMailFormHelper(oForm)
|
|||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener('hashchange', (event) => {
|
||||
const search = event.newURL.substring(event.newURL.lastIndexOf('/') + 1);
|
||||
if (search && search.length < 25) {
|
||||
document.getElementById('rliframe').contentWindow.rl.app.messageList.mainSearch(search);
|
||||
}
|
||||
});
|
||||
function setupUnifiedSearchListener() {
|
||||
const iframe = document.getElementById('rliframe');
|
||||
if (!iframe || !iframe.contentWindow) return;
|
||||
|
||||
addEventListener('hashchange', (event) => {
|
||||
const hashIndex = event.newURL.indexOf('#/mailbox/');
|
||||
if (hashIndex !== -1) {
|
||||
const hash = event.newURL.substring(hashIndex + 1);
|
||||
if (/\/[\w-]+\/[\w-]+\/\w\d+\/.{0,24}/.test(hash)) {
|
||||
iframe.contentWindow.location.hash = hash;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue