Skip to content

Commit

Permalink
Merge pull request #559 from TriliumNext/siriusxt-test
Browse files Browse the repository at this point in the history
Make attachments open in a new tab/browser
  • Loading branch information
eliandoran authored Nov 7, 2024
2 parents a02146d + d2ee373 commit b5988ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ export default class AbstractTextTypeWidget extends TypeWidget {

async openImageInCurrentTab($img) {
const { noteId, viewScope } = await this.parseFromImage($img);

if (noteId) {
appContext.tabManager.getActiveContext().setNote(noteId, { viewScope });
} else {
window.open($img.prop("src"), '_blank');
}
}

openImageInNewTab($img) {
const { noteId, viewScope } = this.parseFromImage($img);
async openImageInNewTab($img) {
const { noteId, viewScope } = await this.parseFromImage($img);

if (noteId) {
appContext.tabManager.openTabWithNoteWithHoisting(noteId, { viewScope });
Expand Down
6 changes: 1 addition & 5 deletions src/services/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,9 @@ async function createMainWindow(app: App) {
}

function configureWebContents(webContents: WebContents, spellcheckEnabled: boolean) {
if (!mainWindow) {
return;
}

remoteMain.enable(webContents);

mainWindow.webContents.setWindowOpenHandler((details) => {
webContents.setWindowOpenHandler((details) => {
async function openExternal() {
(await import('electron')).shell.openExternal(details.url);
}
Expand Down

0 comments on commit b5988ba

Please sign in to comment.