| null = useRef(null)
+
+ // FIXME: editor can't be focused with dialog on Android devices
+ const focusEditor = () => {
+ if (!show) {
+ return
+ }
+
+ const $editor = ref.current?.querySelector('.ProseMirror') as HTMLElement
+ if ($editor) {
+ $editor.focus()
+ }
+ }
+
+ return (
+
+ {children && children({ openDialog })}
+
+
+
+ )
+}
+
+export const CommentFormBetaDialog = (props: CommentFormBetaDialogProps) => (
+ }>
+ {({ openDialog }) => <>{props.children({ openDialog })}>}
+
+)
diff --git a/src/components/Dialogs/index.tsx b/src/components/Dialogs/index.tsx
index 1119299e4d..d958bedb9e 100644
--- a/src/components/Dialogs/index.tsx
+++ b/src/components/Dialogs/index.tsx
@@ -15,6 +15,7 @@ export * from './SetUserNameDialog'
// Article
export * from './AppreciatorsDialog'
export * from './BindEmailHintDialog'
+export * from './CommentFormBetaDialog'
export * from './CommentFormDialog'
export * from './FingerprintDialog'
export * from './MigrationDialog'
diff --git a/src/views/ArticleDetail/Toolbar/FixedToolbar/index.tsx b/src/views/ArticleDetail/Toolbar/FixedToolbar/index.tsx
index 413aafb285..1913f9e218 100644
--- a/src/views/ArticleDetail/Toolbar/FixedToolbar/index.tsx
+++ b/src/views/ArticleDetail/Toolbar/FixedToolbar/index.tsx
@@ -3,7 +3,12 @@ import { FormattedMessage } from 'react-intl'
import { TEST_ID, TOOLBAR_FIXEDTOOLBAR_ID } from '~/common/enums'
import { toLocale, toPath } from '~/common/utils'
-import { BookmarkButton, ButtonProps, ReCaptchaProvider } from '~/components'
+import {
+ BookmarkButton,
+ ButtonProps,
+ CommentFormBetaDialog,
+ ReCaptchaProvider,
+} from '~/components'
import DropdownActions, {
DropdownActionsControls,
} from '~/components/ArticleDigest/DropdownActions'
@@ -14,7 +19,6 @@ import {
} from '~/gql/graphql'
import AppreciationButton from '../../AppreciationButton'
-import { CommentsDialog } from '../../Comments/CommentsDialog'
import CommentButton from '../CommentButton'
import DonationButton from '../DonationButton'
import styles from './styles.module.css'
@@ -27,6 +31,7 @@ export type FixedToolbarProps = {
privateFetched: boolean
lock: boolean
showCommentToolbar: boolean
+ openCommentsDialog?: () => void
} & DropdownActionsControls
const fragments = {
@@ -70,6 +75,7 @@ const FixedToolbar = ({
privateFetched,
lock,
showCommentToolbar,
+ openCommentsDialog,
...props
}: FixedToolbarProps) => {
const path = toPath({ page: 'articleDetail', article })
@@ -97,19 +103,19 @@ const FixedToolbar = ({
}
return (
-
- {({ openDialog: openCommentsDialog }) => (
-
+ )}
+
+
)
}