From 6affca034da39617fcfa7cd8037bbc57b40c4ee2 Mon Sep 17 00:00:00 2001 From: Warrick Corfe-Tan Date: Fri, 18 Jun 2021 16:36:43 +1000 Subject: [PATCH] yarn linting fixes. --- ts/components/session/SessionWrapperModal.tsx | 2 +- .../session/conversation/SessionCompositionBox.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ts/components/session/SessionWrapperModal.tsx b/ts/components/session/SessionWrapperModal.tsx index 8227cd980..5f7d4537a 100644 --- a/ts/components/session/SessionWrapperModal.tsx +++ b/ts/components/session/SessionWrapperModal.tsx @@ -75,7 +75,7 @@ export const SessionWrapperModal = (props: SessionWrapperModalType) => { }; return ( -
+
{showHeader ? ( diff --git a/ts/components/session/conversation/SessionCompositionBox.tsx b/ts/components/session/conversation/SessionCompositionBox.tsx index 4a4be5add..40c431a6b 100644 --- a/ts/components/session/conversation/SessionCompositionBox.tsx +++ b/ts/components/session/conversation/SessionCompositionBox.tsx @@ -226,6 +226,8 @@ export class SessionCompositionBox extends React.Component { break; case 'text': this.showLinkSharingConfirmationModalDialog(e); + break; + default: } } if (imgBlob !== null) { @@ -243,7 +245,7 @@ export class SessionCompositionBox extends React.Component { * @param e paste event */ private showLinkSharingConfirmationModalDialog(e: any) { - let pastedText = e.clipboardData.getData('text'); + const pastedText = e.clipboardData.getData('text'); if (this.isURL(pastedText)) { this.props.updateConfirmModal({ shouldShowConfirm: () => !window.getSettingValue('link-preview-setting'), @@ -263,9 +265,9 @@ export class SessionCompositionBox extends React.Component { * @returns boolean if the string is true or false */ private isURL(str: string) { - var urlRegex = + const urlRegex = '^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$'; - var url = new RegExp(urlRegex, 'i'); + const url = new RegExp(urlRegex, 'i'); return str.length < 2083 && url.test(str); }