fix: select workspace (#1)

This commit is contained in:
Kilu.He 2025-01-02 18:46:55 +08:00 committed by GitHub
parent 23472c414d
commit 2996ace23c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 7 deletions

View File

@ -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"
}
}

View File

@ -55,7 +55,7 @@ function CreateWorkspace () {
</div>
}
>
{t('workspace.new')}
{t('workspace.create')}
</Button>
<NormalModal
title={t('workspace.create')}

View File

@ -21,6 +21,10 @@ function Color () {
} = useSelectionToolbarContext();
const editor = useSlateStatic() as YjsEditor;
const isActivated = CustomEditor.isMarkActive(editor, EditorMarkFormat.BgColor) || CustomEditor.isMarkActive(editor, EditorMarkFormat.FontColor);
const marks = CustomEditor.getAllMarks(editor);
const activeBgColor = marks.find(mark => mark[EditorMarkFormat.BgColor])?.[EditorMarkFormat.BgColor];
const activeFontColor = marks.find(mark => mark[EditorMarkFormat.FontColor])?.[EditorMarkFormat.FontColor];
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);
const open = Boolean(anchorEl);
@ -141,7 +145,8 @@ function Color () {
<div
className={`w-full h-full absolute top-0 left-0 rounded-[6px] border-2 cursor-pointer opacity-50 hover:opacity-100`}
style={{
borderColor: color.color || 'var(--text-title)',
borderColor: activeFontColor === color.color ? 'var(--fill-default)' : undefined,
color: renderColor(color.color) || 'var(--text-title)',
opacity: color.color ? undefined : 1,
}}
/>
@ -169,7 +174,7 @@ function Color () {
<div
className={`w-full h-full absolute top-0 left-0 rounded-[6px] border-2`}
style={{
borderColor: renderColor(color.color),
borderColor: activeBgColor === color.color ? 'var(--fill-default)' : undefined,
}}
/>
<div
@ -184,7 +189,7 @@ function Color () {
</div>
</div>
</div>;
}, [editorBgColors, editorTextColors, handlePickedColor, t]);
}, [activeBgColor, activeFontColor, editorBgColors, editorTextColors, handlePickedColor, t]);
return (
<>

View File

@ -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) {