Fix Tauri call + Matrix.to handler

This commit is contained in:
Dylan 2022-09-04 12:16:14 +09:30
parent e5449ab081
commit 3f12454b21

View file

@ -11,7 +11,9 @@ function handleMatrix(url) {
let joinedRoom; let joinedRoom;
rooms.forEach((room) => { rooms.forEach((room) => {
if (room.getCanonicalAlias() === roomName || roomName in room.getAltAliases()) { if (room.roomId === roomName
|| room.getCanonicalAlias() === roomName
|| roomName in room.getAltAliases()) {
joinedRoom = room; joinedRoom = room;
} }
}); });
@ -43,11 +45,9 @@ export default function handleLink(e) {
// if running inside tauri, check if the tauri backend has a custom handler for this link // if running inside tauri, check if the tauri backend has a custom handler for this link
// useful so we can open urls in a specified app // useful so we can open urls in a specified app
if (window.__TAURI__) { if (window.__TAURI__) {
invoke('open_link', { url: e.target.href }) e.preventDefault();
.then(() => e.preventDefault()) invoke('open_link', { url: e.target.href, bypassHandlers: false });
.catch((error) => console.error(error));
} else { } else {
// open in new tab
window.open(e.target.href); window.open(e.target.href);
e.preventDefault(); e.preventDefault();
} }