diff --git a/src/global.d.ts b/src/global.d.ts
index c5121e17..ab6b9980 100644
--- a/src/global.d.ts
+++ b/src/global.d.ts
@@ -5,3 +5,7 @@ declare module 'worker-loader!*' {
export default WebpackWorker;
}
+
+declare const electronHelpers: {
+ openExternal(url): void;
+} | undefined;
diff --git a/src/lib/richtextprocessor.ts b/src/lib/richtextprocessor.ts
index 896b34d5..ad6607fc 100644
--- a/src/lib/richtextprocessor.ts
+++ b/src/lib/richtextprocessor.ts
@@ -557,7 +557,14 @@ namespace RichTextProcessor {
const currentContext = url[0] === '#';
- insertPart(entity, ``, '');
+ 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, ``, '');
}
break;
diff --git a/src/types.d.ts b/src/types.d.ts
index 14636f6e..ade9a964 100644
--- a/src/types.d.ts
+++ b/src/types.d.ts
@@ -82,4 +82,4 @@ export type ConnectionStatusChange = {
isFileNetworker: boolean,
isFileDownload: boolean,
isFileUpload: boolean
-};
\ No newline at end of file
+};