From 2996ace23c441267a3f98ab259c3e5f95191ad4d Mon Sep 17 00:00:00 2001 From: "Kilu.He" <108015703+qinluhe@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:46:55 +0800 Subject: [PATCH] fix: select workspace (#1) --- project.inlang/settings.json | 2 +- src/components/app/workspaces/CreateWorkspace.tsx | 2 +- .../toolbar/selection-toolbar/actions/Color.tsx | 11 ++++++++--- src/components/editor/plugins/withPasted.ts | 11 +++++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/project.inlang/settings.json b/project.inlang/settings.json index 76f6f69..970e98e 100644 --- a/project.inlang/settings.json +++ b/project.inlang/settings.json @@ -40,6 +40,6 @@ "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js" ], "plugin.inlang.i18next": { - "pathPattern": "./src/@types/translations/{{languageTag}}.json" + "pathPattern": "./src/@types/translations/{languageTag}.json" } } \ No newline at end of file diff --git a/src/components/app/workspaces/CreateWorkspace.tsx b/src/components/app/workspaces/CreateWorkspace.tsx index 4628991..7ea8824 100644 --- a/src/components/app/workspaces/CreateWorkspace.tsx +++ b/src/components/app/workspaces/CreateWorkspace.tsx @@ -55,7 +55,7 @@ function CreateWorkspace () { } > - {t('workspace.new')} + {t('workspace.create')} mark[EditorMarkFormat.BgColor])?.[EditorMarkFormat.BgColor]; + const activeFontColor = marks.find(mark => mark[EditorMarkFormat.FontColor])?.[EditorMarkFormat.FontColor]; + const [anchorEl, setAnchorEl] = React.useState(null); const open = Boolean(anchorEl); @@ -141,7 +145,8 @@ function Color () {
@@ -169,7 +174,7 @@ function Color () {
; - }, [editorBgColors, editorTextColors, handlePickedColor, t]); + }, [activeBgColor, activeFontColor, editorBgColors, editorTextColors, handlePickedColor, t]); return ( <> diff --git a/src/components/editor/plugins/withPasted.ts b/src/components/editor/plugins/withPasted.ts index d961a14..97f3113 100644 --- a/src/components/editor/plugins/withPasted.ts +++ b/src/components/editor/plugins/withPasted.ts @@ -69,8 +69,15 @@ export const withPasted = (editor: ReactEditor) => { } } - if (lineLength > 1 && html && node.type !== BlockType.CodeBlock) { - return insertHtmlData(editor, data); + if (lineLength > 1 && node.type !== BlockType.CodeBlock) { + if (html) { + return insertHtmlData(editor, data); + } else { + const fragment = lines.map((line) => ({ type: BlockType.Paragraph, children: [{ text: line }] })); + + insertFragment(editor, fragment); + return true; + } } for (const line of lines) {