Use desktop default to open urls in electron
This commit is contained in:
parent
89683503f8
commit
d835284e5d
4
src/global.d.ts
vendored
4
src/global.d.ts
vendored
@ -5,3 +5,7 @@ declare module 'worker-loader!*' {
|
||||
|
||||
export default WebpackWorker;
|
||||
}
|
||||
|
||||
declare const electronHelpers: {
|
||||
openExternal(url): void;
|
||||
} | undefined;
|
||||
|
@ -557,7 +557,14 @@ namespace RichTextProcessor {
|
||||
|
||||
const currentContext = url[0] === '#';
|
||||
|
||||
insertPart(entity, `<a class="anchor-url" href="${encodeEntities(url)}"${currentContext ? '' : ' target="_blank" rel="noopener noreferrer"'}${masked ? 'onclick="showMaskedAlert(this)"' : ''}>`, '</a>');
|
||||
const href = (currentContext || typeof electronHelpers === 'undefined')
|
||||
? encodeEntities(url)
|
||||
: `javascript:electronHelpers.openExternal('${encodeEntities(url)}');`;
|
||||
|
||||
const target = (currentContext || typeof electronHelpers !== 'undefined')
|
||||
? '' : ' target="_blank" rel="noopener noreferrer"';
|
||||
|
||||
insertPart(entity, `<a class="anchor-url" href="${href}"${target}${masked ? 'onclick="showMaskedAlert(this)"' : ''}>`, '</a>');
|
||||
}
|
||||
|
||||
break;
|
||||
|
2
src/types.d.ts
vendored
2
src/types.d.ts
vendored
@ -82,4 +82,4 @@ export type ConnectionStatusChange = {
|
||||
isFileNetworker: boolean,
|
||||
isFileDownload: boolean,
|
||||
isFileUpload: boolean
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user