mirror of
https://github.com/muerwre/markdown-home-tab.git
synced 2025-04-25 00:46:41 +07:00
made human-friendly editing buttons
This commit is contained in:
parent
6d854f57a5
commit
02333e6049
15 changed files with 175 additions and 28 deletions
|
@ -5,6 +5,7 @@ import { usePersistedValue } from "./hooks/usePersistedValue";
|
|||
import styles from "./styles.module.scss";
|
||||
import { useSettings } from "~/modules/settings/context/SettingsContext";
|
||||
import { EmptyViewer } from "../../components/EmptyViewer";
|
||||
import { EditorWrapper } from "../../components/EditorWrapper";
|
||||
|
||||
interface MarkdownEditorContainerProps {
|
||||
id: string;
|
||||
|
@ -34,14 +35,19 @@ export const MarkdownEditorContainer: FC<MarkdownEditorContainerProps> = ({
|
|||
const viewer = empty ? (
|
||||
<EmptyViewer startEditing={startEditing} />
|
||||
) : (
|
||||
<ReactMarkdownViewer value={value} />
|
||||
<ReactMarkdownViewer value={value} startEditing={startEditing} />
|
||||
);
|
||||
|
||||
const editor = richEditorEnabled ? (
|
||||
<RichEditor value={value} onChange={setValue} locked={locked} />
|
||||
) : (
|
||||
<ReactMarkdownEditor value={value} onChange={setValue} />
|
||||
const editor = (
|
||||
<EditorWrapper onSave={startEditing}>
|
||||
{richEditorEnabled ? (
|
||||
<RichEditor value={value} onChange={setValue} locked={locked} />
|
||||
) : (
|
||||
<ReactMarkdownEditor value={value} onChange={setValue} />
|
||||
)}
|
||||
</EditorWrapper>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={styles.editor}>
|
||||
<Suspense>{locked ? viewer : editor}</Suspense>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue