From c0e12a69a95a8de48ae92cc197bc794dbff215b3 Mon Sep 17 00:00:00 2001 From: hanayashiki Date: Sat, 1 May 2021 06:44:01 -0700 Subject: [PATCH 1/3] Check isComposing for send shortcut --- .gitignore | 1 + src/helpers/dom.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b6e23ba0..09dd7058 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ public3 package-lock.json session_name.session tasks.txt +yarn.lock \ No newline at end of file diff --git a/src/helpers/dom.ts b/src/helpers/dom.ts index 07b5e809..a151ad44 100644 --- a/src/helpers/dom.ts +++ b/src/helpers/dom.ts @@ -598,7 +598,7 @@ export const handleScrollSideEvent = (elem: HTMLElement, side: 'top' | 'bottom', } */ export function isSendShortcutPressed(e: KeyboardEvent) { - if(e.key === 'Enter' && !isMobile) { + if(e.key === 'Enter' && !isMobile && !e.isComposing) { /* if(e.ctrlKey || e.metaKey) { this.messageInput.innerHTML += '
'; placeCaretAtEnd(this.message) From d835284e5d051b52561d3b8d628dc98cbf1629e2 Mon Sep 17 00:00:00 2001 From: hanayashiki Date: Thu, 6 May 2021 19:08:16 -0700 Subject: [PATCH 3/3] Use desktop default to open urls in electron --- src/global.d.ts | 4 ++++ src/lib/richtextprocessor.ts | 9 ++++++++- src/types.d.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) 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 +};