Merge branch 'manifoldmarkets:main' into main
This commit is contained in:
commit
2d3ec3c96d
|
@ -4,7 +4,6 @@ import clsx from 'clsx'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
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 { MAX_COMMENT_LENGTH } from 'web/lib/firebase/comments'
|
||||||
import { Avatar } from './avatar'
|
import { Avatar } from './avatar'
|
||||||
import { TextEditor, useTextEditor } from './editor'
|
import { TextEditor, useTextEditor } from './editor'
|
||||||
|
@ -80,7 +79,6 @@ export function CommentInputTextArea(props: {
|
||||||
upload: Parameters<typeof TextEditor>[0]['upload']
|
upload: Parameters<typeof TextEditor>[0]['upload']
|
||||||
submitComment: (id?: string) => void
|
submitComment: (id?: string) => void
|
||||||
isSubmitting: boolean
|
isSubmitting: boolean
|
||||||
submitOnEnter?: boolean
|
|
||||||
presetId?: string
|
presetId?: string
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
|
@ -90,11 +88,8 @@ export function CommentInputTextArea(props: {
|
||||||
submitComment,
|
submitComment,
|
||||||
presetId,
|
presetId,
|
||||||
isSubmitting,
|
isSubmitting,
|
||||||
submitOnEnter,
|
|
||||||
replyToUser,
|
replyToUser,
|
||||||
} = props
|
} = props
|
||||||
const isMobile = (useWindowSize().width ?? 0) < 768 // TODO: base off input device (keybord vs touch)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
editor?.setEditable(!isSubmitting)
|
editor?.setEditable(!isSubmitting)
|
||||||
}, [isSubmitting, editor])
|
}, [isSubmitting, editor])
|
||||||
|
@ -108,15 +103,14 @@ export function CommentInputTextArea(props: {
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// submit on Enter key
|
// Submit on ctrl+enter or mod+enter key
|
||||||
editor.setOptions({
|
editor.setOptions({
|
||||||
editorProps: {
|
editorProps: {
|
||||||
handleKeyDown: (view, event) => {
|
handleKeyDown: (view, event) => {
|
||||||
if (
|
if (
|
||||||
submitOnEnter &&
|
|
||||||
event.key === 'Enter' &&
|
event.key === 'Enter' &&
|
||||||
!event.shiftKey &&
|
!event.shiftKey &&
|
||||||
(!isMobile || event.ctrlKey || event.metaKey) &&
|
(event.ctrlKey || event.metaKey) &&
|
||||||
// mention list is closed
|
// mention list is closed
|
||||||
!(view.state as any).mention$.active
|
!(view.state as any).mention$.active
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { getProbability } from 'common/calculate'
|
||||||
import { track } from 'web/lib/service/analytics'
|
import { track } from 'web/lib/service/analytics'
|
||||||
import { Tipper } from '../tipper'
|
import { Tipper } from '../tipper'
|
||||||
import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns'
|
import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns'
|
||||||
|
|
||||||
import { Content } from '../editor'
|
import { Content } from '../editor'
|
||||||
import { Editor } from '@tiptap/react'
|
import { Editor } from '@tiptap/react'
|
||||||
import { UserLink } from 'web/components/user-link'
|
import { UserLink } from 'web/components/user-link'
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Comment } from 'common/comment'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from 'common/contract'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
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 { JSONContent } from '@tiptap/core'
|
||||||
import { richTextToString } from 'common/util/parse'
|
import { richTextToString } from 'common/util/parse'
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ export function toLiteMarket(contract: Contract): LiteMarket {
|
||||||
: closeTime,
|
: closeTime,
|
||||||
question,
|
question,
|
||||||
tags,
|
tags,
|
||||||
url: `https://manifold.markets/${creatorUsername}/${slug}`,
|
url: `https://${DOMAIN}/${creatorUsername}/${slug}`,
|
||||||
pool,
|
pool,
|
||||||
probability,
|
probability,
|
||||||
p,
|
p,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user