From 99b5695fec6e557ef34afba734c96b65d063b732 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 11 Jan 2019 17:20:29 -0600 Subject: [PATCH 1/2] Fix SdkConfig import to use transformed module This was originally added in #7755, which pulled in the original source for the module, breaking ancient browsers without support for classes (#8082). --- src/vector/rageshakesetup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/rageshakesetup.js b/src/vector/rageshakesetup.js index 7992df2b47..4c37624959 100644 --- a/src/vector/rageshakesetup.js +++ b/src/vector/rageshakesetup.js @@ -26,7 +26,7 @@ limitations under the License. */ import rageshake from "matrix-react-sdk/lib/rageshake/rageshake"; -import SdkConfig from "matrix-react-sdk/src/SdkConfig"; +import SdkConfig from "matrix-react-sdk/lib/SdkConfig"; function initRageshake() { rageshake.init().then(() => { From 8c895cd435c2653c614ff272d19d298aef756b93 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 15 Jan 2019 08:30:07 +0000 Subject: [PATCH 2/2] Correct the copying of e-mail addresses in the electron app Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- electron_app/src/webcontents-handler.js | 30 +++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/electron_app/src/webcontents-handler.js b/electron_app/src/webcontents-handler.js index d566de515a..1f381eb8d2 100644 --- a/electron_app/src/webcontents-handler.js +++ b/electron_app/src/webcontents-handler.js @@ -1,10 +1,12 @@ const {clipboard, nativeImage, Menu, MenuItem, shell} = require('electron'); const url = require('url'); +const MAILTO_PREFIX = "mailto:"; + const PERMITTED_URL_SCHEMES = [ 'http:', 'https:', - 'mailto:', + MAILTO_PREFIX, ]; function safeOpenURL(target) { @@ -47,7 +49,7 @@ function onLinkContextMenu(ev, params) { if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) { popupMenu.append(new MenuItem({ - label: 'Copy Image', + label: 'Copy image', click() { if (url.startsWith('data:')) { clipboard.writeImage(nativeImage.createFromDataURL(url)); @@ -58,14 +60,24 @@ function onLinkContextMenu(ev, params) { })); } - // No point offerring to copy a blob: URL either + // No point offering to copy a blob: URL either if (!url.startsWith('blob:')) { - popupMenu.append(new MenuItem({ - label: 'Copy Link Address', - click() { - clipboard.writeText(url); - }, - })); + // Special-case e-mail URLs to strip the `mailto:` like modern browsers do + if (url.startsWith(MAILTO_PREFIX)) { + popupMenu.append(new MenuItem({ + label: 'Copy email address', + click() { + clipboard.writeText(url.substr(MAILTO_PREFIX.length)); + }, + })); + } else { + popupMenu.append(new MenuItem({ + label: 'Copy link address', + click() { + clipboard.writeText(url); + }, + })); + } } // popup() requires an options object even for no options popupMenu.popup({});