From 9f15c16405c0eb8d0221d48500e8da2bdfc1c324 Mon Sep 17 00:00:00 2001 From: YarikMix <43493788+YarikMix@users.noreply.github.com> Date: Wed, 8 May 2024 17:44:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=82=D0=B8=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/src/components/Editor/Editor.sass | 10 +++++++++- public/src/components/LinkInput/LinkInput.tsx | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/public/src/components/Editor/Editor.sass b/public/src/components/Editor/Editor.sass index a0b696fc..cbb12c90 100644 --- a/public/src/components/Editor/Editor.sass +++ b/public/src/components/Editor/Editor.sass @@ -61,7 +61,14 @@ content: "Введите '/' для комманд" color: rgba(255, 255, 255, 0.7) cursor: text - //animation: showAnim 0.5s + animation: fadeIn 0.3s + + @keyframes fadeIn + 0% + opacity: 0 + + 99% + opacity: 1 .subnote-wrapper background: $modal-background @@ -70,6 +77,7 @@ transition: 0.2s ease border: 1px solid #2b3b55 margin: 15px 2px + user-select: none &:hover cursor: pointer diff --git a/public/src/components/LinkInput/LinkInput.tsx b/public/src/components/LinkInput/LinkInput.tsx index 8d715688..138dc1d4 100644 --- a/public/src/components/LinkInput/LinkInput.tsx +++ b/public/src/components/LinkInput/LinkInput.tsx @@ -23,11 +23,20 @@ export class LinkInput extends ScReact.Component { handleSubmit = () => { if (this.state.value) { + console.log(this.isUrlValid(this.state.value)) this.props.onSubmit(this.state.value); this.clearValue(); } }; + isUrlValid(userInput) { + let res = userInput.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g); + if (res == null) + return false; + else + return true; + } + render() { return (