From b81fb80f7bbc2472b55026f7b67b32e33b714204 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Thu, 11 Aug 2022 10:49:44 -0700 Subject: [PATCH] Simplify Manifold paste logic --- web/components/editor/embed-modal.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/components/editor/embed-modal.tsx b/web/components/editor/embed-modal.tsx index 5d138752..5baac757 100644 --- a/web/components/editor/embed-modal.tsx +++ b/web/components/editor/embed-modal.tsx @@ -20,8 +20,8 @@ function getTweetId(text: string) { // Manifold URL: https://manifold.markets/Austin/will-manifold-ever-be-worth-1b function getManifoldSlug(text: string) { - const match = text.match(/^https?:\/\/manifold\.markets\/([^\/]+)\/([^\/]+)/) - return match ? [match[1], match[2]] : null + const match = text.match(/^https?:\/\/manifold\.markets\/([^\/]+\/[^\/]+)/) + return match ? match[1] : null } // Youtube URL: 'https://www.youtube.com/watch?v=ziq7FUKpCS8' @@ -51,8 +51,9 @@ function embedCode(text: string) { // If it's a number, there may be numeric precision issues. return `` } else if (getManifoldSlug(text)) { - const [username, slug] = getManifoldSlug(text) as [string, string] - return `` + return `` } else if (getYoutubeId(text)) { return `