From 4c801f76b4b4d03765b140af49a0d292c5243c6b Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Fri, 9 Sep 2022 11:09:31 -0700 Subject: [PATCH 1/2] Submit comments on ctrl/cmd-enter (#830) * Submit comments on ctrl/cmd-enter * Remove unused import * Tweak padding on /tournaments * Always submit on ctrl+enter Since we took out group chats, this should be fine for all comments --- web/components/comment-input.tsx | 10 ++-------- web/components/feed/feed-comments.tsx | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/web/components/comment-input.tsx b/web/components/comment-input.tsx index 1d0b3cc1..ca1f4a96 100644 --- a/web/components/comment-input.tsx +++ b/web/components/comment-input.tsx @@ -4,7 +4,6 @@ import clsx from 'clsx' import { User } from 'common/user' import { useEffect, useState } from 'react' import { useUser } from 'web/hooks/use-user' -import { useWindowSize } from 'web/hooks/use-window-size' import { MAX_COMMENT_LENGTH } from 'web/lib/firebase/comments' import { Avatar } from './avatar' import { TextEditor, useTextEditor } from './editor' @@ -80,7 +79,6 @@ export function CommentInputTextArea(props: { upload: Parameters[0]['upload'] submitComment: (id?: string) => void isSubmitting: boolean - submitOnEnter?: boolean presetId?: string }) { const { @@ -90,11 +88,8 @@ export function CommentInputTextArea(props: { submitComment, presetId, isSubmitting, - submitOnEnter, replyToUser, } = props - const isMobile = (useWindowSize().width ?? 0) < 768 // TODO: base off input device (keybord vs touch) - useEffect(() => { editor?.setEditable(!isSubmitting) }, [isSubmitting, editor]) @@ -108,15 +103,14 @@ export function CommentInputTextArea(props: { if (!editor) { return } - // submit on Enter key + // Submit on ctrl+enter or mod+enter key editor.setOptions({ editorProps: { handleKeyDown: (view, event) => { if ( - submitOnEnter && event.key === 'Enter' && !event.shiftKey && - (!isMobile || event.ctrlKey || event.metaKey) && + (event.ctrlKey || event.metaKey) && // mention list is closed !(view.state as any).mention$.active ) { diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx index a63a4b6e..a3e9f35a 100644 --- a/web/components/feed/feed-comments.tsx +++ b/web/components/feed/feed-comments.tsx @@ -20,7 +20,6 @@ import { getProbability } from 'common/calculate' import { track } from 'web/lib/service/analytics' import { Tipper } from '../tipper' import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns' - import { Content } from '../editor' import { Editor } from '@tiptap/react' import { UserLink } from 'web/components/user-link' From 18466afc7801235eda899de978e2e1d0588dc219 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Fri, 9 Sep 2022 11:43:23 -0700 Subject: [PATCH 2/2] Fix API URLs from non "manifold.markets" domains --- web/pages/api/v0/_types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/pages/api/v0/_types.ts b/web/pages/api/v0/_types.ts index 3aa15901..ea2f053b 100644 --- a/web/pages/api/v0/_types.ts +++ b/web/pages/api/v0/_types.ts @@ -5,7 +5,7 @@ import { Comment } from 'common/comment' import { Contract } from 'common/contract' import { User } from 'common/user' import { removeUndefinedProps } from 'common/util/object' -import { ENV_CONFIG } from 'common/envs/constants' +import { DOMAIN, ENV_CONFIG } from 'common/envs/constants' import { JSONContent } from '@tiptap/core' import { richTextToString } from 'common/util/parse' @@ -121,7 +121,7 @@ export function toLiteMarket(contract: Contract): LiteMarket { : closeTime, question, tags, - url: `https://manifold.markets/${creatorUsername}/${slug}`, + url: `https://${DOMAIN}/${creatorUsername}/${slug}`, pool, probability, p,