mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-29 16:34:21 +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();
|
passThemesToIFrame();
|
||||||
let form = document.querySelector('form.snappymail');
|
let form = document.querySelector('form.snappymail');
|
||||||
form && SnappyMailFormHelper(form);
|
form && SnappyMailFormHelper(form);
|
||||||
|
setupUnifiedSearchListener()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,15 +137,22 @@ function SnappyMailFormHelper(oForm)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
} catch (e) {
|
||||||
catch(e) {
|
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventListener('hashchange', (event) => {
|
function setupUnifiedSearchListener() {
|
||||||
const search = event.newURL.substring(event.newURL.lastIndexOf('/') + 1);
|
const iframe = document.getElementById('rliframe');
|
||||||
if (search && search.length < 25) {
|
if (!iframe || !iframe.contentWindow) return;
|
||||||
document.getElementById('rliframe').contentWindow.rl.app.messageList.mainSearch(search);
|
|
||||||
}
|
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