diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index ca3b9e43..09b42e77 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -156,7 +156,7 @@ export const CommentsTree = (props: Props) => { > handleSubmitComment(value)} + onSubmit={handleSubmitComment} /> diff --git a/src/components/Editor/EditorToolbar/MicroToolbar.tsx b/src/components/Editor/EditorToolbar/MicroToolbar.tsx index 8e9b42db..10c88404 100644 --- a/src/components/Editor/EditorToolbar/MicroToolbar.tsx +++ b/src/components/Editor/EditorToolbar/MicroToolbar.tsx @@ -1,5 +1,5 @@ import { Editor } from '@tiptap/core' -import { Show, createEffect, createSignal, on } from 'solid-js' +import { Accessor, Show, createEffect, createSignal, on } from 'solid-js' import { createEditorTransaction } from 'solid-tiptap' import { Icon } from '~/components/_shared/Icon/Icon' import { useLocalize } from '~/context/localize' @@ -10,7 +10,7 @@ import styles from '../SimplifiedEditor.module.scss' export interface MicroToolbarProps { showing?: boolean - editor?: Editor + editor: Accessor } export const MicroToolbar = (props: MicroToolbarProps) => { @@ -19,7 +19,7 @@ export const MicroToolbar = (props: MicroToolbarProps) => { // show / hide for menu const [showSimpleMenu, setShowSimpleMenu] = createSignal(!props.showing) const selection = createEditorTransaction( - () => props.editor, + props.editor, (instance) => instance?.state.selection ) @@ -30,13 +30,13 @@ export const MicroToolbar = (props: MicroToolbarProps) => { createEffect(on([selection, showLinkInput], ([s, l]) => !l && setShowSimpleMenu(!s?.empty))) // focus on link input when it shows up - createEffect(on(showLinkInput, (x?: boolean) => x && props.editor?.chain().focus().run())) + createEffect(on(showLinkInput, (x?: boolean) => x && props.editor()?.chain().focus().run())) const [storedSelection, setStoredSelection] = createSignal() const recoverSelection = () => { if (!storedSelection()?.empty) { createEditorTransaction( - () => props.editor, + props.editor, (instance?: Editor) => { const r = selection() if (instance && r) { @@ -48,14 +48,14 @@ export const MicroToolbar = (props: MicroToolbarProps) => { } } const storeSelection = () => { - const selection = props.editor?.state.selection + const selection = props.editor()?.state.selection if (!selection?.empty) { setStoredSelection(selection) } } const toggleShowLink = () => { if (showLinkInput()) { - props.editor?.chain().focus().run() + props.editor()?.chain().focus().run() recoverSelection() } else { storeSelection() @@ -63,7 +63,7 @@ export const MicroToolbar = (props: MicroToolbarProps) => { setShowLinkInput(!showLinkInput()) } return ( - + {(instance) => (
} export const MiniToolbar = (props: MiniToolbarProps) => { @@ -21,17 +21,17 @@ export const MiniToolbar = (props: MiniToolbarProps) => { const [showLinkInput, setShowLinkInput] = createSignal(false) // focus on link input when it shows up - createEffect(on(showLinkInput, (x?: boolean) => x && props.editor?.chain().focus().run())) + createEffect(on(showLinkInput, (x?: boolean) => x && props.editor()?.chain().focus().run())) const selection = createEditorTransaction( - () => props.editor, + props.editor, (instance) => instance?.state.selection ) const [storedSelection, setStoredSelection] = createSignal() const recoverSelection = () => { if (!storedSelection()?.empty) { createEditorTransaction( - () => props.editor, + props.editor, (instance?: Editor) => { const r = selection() if (instance && r) { @@ -43,14 +43,14 @@ export const MiniToolbar = (props: MiniToolbarProps) => { } } const storeSelection = () => { - const selection = props.editor?.state.selection + const selection = props.editor()?.state.selection if (!selection?.empty) { setStoredSelection(selection) } } const toggleShowLink = () => { if (showLinkInput()) { - props.editor?.chain().focus().run() + props.editor()?.chain().focus().run() recoverSelection() } else { storeSelection() @@ -60,7 +60,7 @@ export const MiniToolbar = (props: MiniToolbarProps) => { return (
- + {(instance) => (
diff --git a/src/components/Editor/MicroEditor/MicroEditor.tsx b/src/components/Editor/MicroEditor/MicroEditor.tsx index 906f4193..42cbe8b8 100644 --- a/src/components/Editor/MicroEditor/MicroEditor.tsx +++ b/src/components/Editor/MicroEditor/MicroEditor.tsx @@ -43,7 +43,7 @@ export const MicroEditor = (props: MicroEditorProps): JSX.Element => { })} >
- +
diff --git a/src/components/Editor/MiniEditor/MiniEditor.tsx b/src/components/Editor/MiniEditor/MiniEditor.tsx index 32f383b2..ac63ab2f 100644 --- a/src/components/Editor/MiniEditor/MiniEditor.tsx +++ b/src/components/Editor/MiniEditor/MiniEditor.tsx @@ -53,7 +53,7 @@ export default function MiniEditor(props: MiniEditorProps): JSX.Element {
- + 0}>