From 30a960ab2bf80d094e78364de2022abd207ec457 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 31 Mar 2024 22:35:19 +0900 Subject: [PATCH] fix --- web/pages/gist/[...pathSegments].tsx | 13 ++++++++++--- web/src/gist/gist-textarea.tsx | 4 +--- web/src/markdown/markdown-textarea.tsx | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/web/pages/gist/[...pathSegments].tsx b/web/pages/gist/[...pathSegments].tsx index c8fb1b8..c30ee2f 100644 --- a/web/pages/gist/[...pathSegments].tsx +++ b/web/pages/gist/[...pathSegments].tsx @@ -1,12 +1,14 @@ import debug from 'debug'; import { useRouter } from 'next/router'; -import { useEffect, useMemo, useState } from 'react'; -import { GistSource, GistSourceLocator } from '../../src/core/GistSource'; +import React, { useEffect, useState } from 'react'; +import { GistSource } from '../../src/core/GistSource'; import useSWR from 'swr'; import { GistTextarea } from '../../src/gist/gist-textarea'; import { PageContainer, PageHeader } from '../../src/layouts'; import { RevealSlidePlayer } from '../../src/player/reveal-slide-player'; import { useRenderSwr } from '../../src/components/useRenderSwr'; +import clsx from 'clsx'; +import { StartPlaybackButton } from '../../src/markdown/markdown-textarea'; const logger = debug('pages:gist'); @@ -21,7 +23,12 @@ function GistSourcePageContent({ src }: { src: GistSource }) { }; const textArea = useRenderSwr(fetched, (v) => ( - + <> +
+ onStartPlayback(v.slideText)} /> +
+ + )); logger(src, fetched); diff --git a/web/src/gist/gist-textarea.tsx b/web/src/gist/gist-textarea.tsx index 425eb64..750b975 100644 --- a/web/src/gist/gist-textarea.tsx +++ b/web/src/gist/gist-textarea.tsx @@ -1,7 +1,5 @@ import { SlideBundle } from '../core/SlideBundle'; import { ReactElement, useState } from 'react'; -import clsx from 'clsx'; -import { Button } from '@mui/material'; import { MarkdownTextarea } from '../markdown/markdown-textarea'; export function GistTextarea(props: { @@ -11,5 +9,5 @@ export function GistTextarea(props: { onStart?(markdownText: string): void; }): ReactElement { const [text, setText] = useState(props.initialValue || props.bundle.slideText); - return ; + return ; } diff --git a/web/src/markdown/markdown-textarea.tsx b/web/src/markdown/markdown-textarea.tsx index 932798c..69cd69b 100644 --- a/web/src/markdown/markdown-textarea.tsx +++ b/web/src/markdown/markdown-textarea.tsx @@ -82,6 +82,7 @@ export function MarkdownTextarea(props: { value: string; onChange(value: string, isManualEdit: boolean): void; className?: string; + readOnly?: boolean; }) { return (
@@ -91,6 +92,7 @@ export function MarkdownTextarea(props: { rows={20} cols={80} value={props.value} + readOnly={props.readOnly} onChange={(ev) => props.onChange(ev.target.value, true)} />