From 40af94e101548a09352bc6042f2979672307e500 Mon Sep 17 00:00:00 2001 From: Ilya Y <75578537+ilya-bkv@users.noreply.github.com> Date: Thu, 27 Jul 2023 20:38:38 +0300 Subject: [PATCH] add editor fixes (#144) * add editor fixes --- .../Article/AudioPlayer/PlayerPlaylist.tsx | 1 + src/components/Article/Comment.tsx | 2 ++ src/components/Article/CommentsTree.tsx | 2 -- src/components/Editor/Editor.tsx | 7 +++---- src/components/Editor/SimplifiedEditor.tsx | 9 ++++----- .../Editor/TextBubbleMenu/TextBubbleMenu.tsx | 2 +- src/components/Inbox/Message.tsx | 5 ----- .../GrowingTextarea/GrowingTextarea.module.scss | 1 + .../_shared/SolidSwiper/SolidSwiper.tsx | 1 + src/context/inbox.tsx | 17 +++++++++-------- 10 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/components/Article/AudioPlayer/PlayerPlaylist.tsx b/src/components/Article/AudioPlayer/PlayerPlaylist.tsx index 917d8ed0..ac4e1b11 100644 --- a/src/components/Article/AudioPlayer/PlayerPlaylist.tsx +++ b/src/components/Article/AudioPlayer/PlayerPlaylist.tsx @@ -163,6 +163,7 @@ export const PlayerPlaylist = (props: Props) => { onSubmit={(value) => handleMediaItemFieldChange('body', value)} placeholder={t('Description')} smallHeight={true} + submitButtonText={t('Save')} /> { }> {t('Loading')}

}> { const { t } = useLocalize() const [commentsOrder, setCommentsOrder] = createSignal('createdAt') const [newReactions, setNewReactions] = createSignal([]) - const [submitted, setSubmitted] = createSignal(false) const { reactionEntities, actions: { createReaction } @@ -97,7 +96,6 @@ export const CommentsTree = (props: Props) => { body: value, shout: props.shoutId }) - setSubmitted(true) } catch (error) { console.error('[handleCreate reaction]:', error) } diff --git a/src/components/Editor/Editor.tsx b/src/components/Editor/Editor.tsx index b5b69d9c..52749462 100644 --- a/src/components/Editor/Editor.tsx +++ b/src/components/Editor/Editor.tsx @@ -1,4 +1,4 @@ -import { createEffect, createSignal, onMount } from 'solid-js' +import { createEffect, createSignal, onMount, untrack } from 'solid-js' import { createTiptapEditor, useEditorHTML } from 'solid-tiptap' import { useLocalize } from '../../context/localize' import { Bold } from '@tiptap/extension-bold' @@ -43,7 +43,6 @@ import type { Doc } from 'yjs/dist/src/utils/Doc' import './Prosemirror.scss' import { TrailingNode } from './extensions/TrailingNode' import Article from './extensions/Article' -import styles from './SimplifiedEditor.module.scss' type Props = { shoutId: number @@ -111,7 +110,7 @@ export const Editor = (props: Props) => { } = { current: null } - + const { initialContent } = props const editor = createTiptapEditor(() => ({ element: editorElRef.current, editorProps: { @@ -222,7 +221,7 @@ export const Editor = (props: Props) => { TrailingNode, Article ], - content: props.initialContent ?? null + content: initialContent ?? null })) const { diff --git a/src/components/Editor/SimplifiedEditor.tsx b/src/components/Editor/SimplifiedEditor.tsx index 56c736c3..210a9576 100644 --- a/src/components/Editor/SimplifiedEditor.tsx +++ b/src/components/Editor/SimplifiedEditor.tsx @@ -18,7 +18,6 @@ import { Popover } from '../_shared/Popover' import { Italic } from '@tiptap/extension-italic' import { Modal } from '../Nav/Modal' import { hideModal, showModal } from '../../stores/ui' -import { Link } from '@tiptap/extension-link' import { Blockquote } from '@tiptap/extension-blockquote' import { CustomImage } from './extensions/CustomImage' import { UploadModalContent } from './UploadModalContent' @@ -27,11 +26,13 @@ import { clsx } from 'clsx' import styles from './SimplifiedEditor.module.scss' import { Placeholder } from '@tiptap/extension-placeholder' import { InsertLinkForm } from './InsertLinkForm' +import { Link } from '@tiptap/extension-link' type Props = { initialContent?: string onSubmit: (text: string) => void placeholder: string + submitButtonText?: string quoteEnabled?: boolean imageEnabled?: boolean setClear?: boolean @@ -137,9 +138,7 @@ const SimplifiedEditor = (props: Props) => { } onMount(() => { - if (props.submitByShiftEnter || props.submitByEnter) { - window.addEventListener('keydown', handleKeyDown) - } + window.addEventListener('keydown', handleKeyDown) }) onCleanup(() => { @@ -224,7 +223,7 @@ const SimplifiedEditor = (props: Props) => {
)} +
-
{(triggerRef: (el) => void) => (
diff --git a/src/context/inbox.tsx b/src/context/inbox.tsx index f4b068bc..06084b2e 100644 --- a/src/context/inbox.tsx +++ b/src/context/inbox.tsx @@ -71,14 +71,15 @@ export const InboxProvider = (props: { children: JSX.Element }) => { return chat } - pipe( - subclient().subscription(newMessage, {}), - subscribe((result) => { - // console.info('[subscription]') - // console.debug(result) - // TODO: handle data result - }) - ) + // pipe( + // subclient().subscription(newMessage, {}), + // subscribe((result) => { + // console.info('[subscription]') + // console.debug(result) + // // TODO: handle data result + // }) + // ) + const actions = { createChat, loadChats,