From 0b282dff85eb1c888a55c165ca209a694564aca0 Mon Sep 17 00:00:00 2001 From: Zhang Minghan Date: Thu, 26 Oct 2023 23:21:57 +0800 Subject: [PATCH] add clean button --- app/pnpm-lock.yaml | 32 +++++++++++++++++++++++++++ app/src/assets/editor.less | 17 +++++++++----- app/src/components/EditorProvider.tsx | 10 ++++++++- app/src/conf.ts | 2 +- 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 4ff181cc..212ab163 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -20,6 +20,9 @@ dependencies: '@radix-ui/react-label': specifier: ^2.0.2 version: 2.0.2(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-scroll-area': + specifier: ^1.0.5 + version: 1.0.5(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-select': specifier: ^2.0.0 version: 2.0.0(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0) @@ -2168,6 +2171,35 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false + /@radix-ui/react-scroll-area@1.0.5(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-b6PAgH4GQf9QEn8zbT2XUHpW5z8BzqEc7Kl11TwDrvuTrxlkcjTD5qa/bxgKr+nmuXKu4L/W5UZ4mlP/VG/5Gw==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.2 + '@radix-ui/number': 1.0.1 + '@radix-ui/primitive': 1.0.1 + '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.33)(react@18.2.0) + '@radix-ui/react-context': 1.0.1(@types/react@18.2.33)(react@18.2.0) + '@radix-ui/react-direction': 1.0.1(@types/react@18.2.33)(react@18.2.0) + '@radix-ui/react-presence': 1.0.1(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.2.33)(react@18.2.0) + '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.2.33)(react@18.2.0) + '@types/react': 18.2.33 + '@types/react-dom': 18.2.14 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + /@radix-ui/react-select@2.0.0(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-RH5b7af4oHtkcHS7pG6Sgv5rk5Wxa7XI8W5gvB1N/yiuDGZxko1ynvOiVhFM7Cis2A8zxF9bTOUVbRDzPepe6w==} peerDependencies: diff --git a/app/src/assets/editor.less b/app/src/assets/editor.less index 84c23bad..77a80b6d 100644 --- a/app/src/assets/editor.less +++ b/app/src/assets/editor.less @@ -85,10 +85,15 @@ } .editor-toolbar { - display: grid; - grid-auto-flow: column; - align-items: flex-end; - gap: 4px; - width: max-content; - margin: 4px 0 4px auto; + display: flex; + width: 100%; + margin: 8px 0 4px; + + & > * { + margin-right: 4px; + + &:last-child { + margin-right: 0; + } + } } diff --git a/app/src/components/EditorProvider.tsx b/app/src/components/EditorProvider.tsx index 1bd9ef52..ef1fb366 100644 --- a/app/src/components/EditorProvider.tsx +++ b/app/src/components/EditorProvider.tsx @@ -6,7 +6,7 @@ import { DialogTitle, DialogTrigger, } from "./ui/dialog.tsx"; -import { Maximize, Image, MenuSquare, PanelRight } from "lucide-react"; +import {Maximize, Image, MenuSquare, PanelRight, XSquare} from "lucide-react"; import { useTranslation } from "react-i18next"; import "../assets/editor.less"; import { Textarea } from "./ui/textarea.tsx"; @@ -14,6 +14,7 @@ import Markdown from "./Markdown.tsx"; import { useEffect, useRef, useState } from "react"; import { Toggle } from "./ui/toggle.tsx"; import { mobile } from "../utils.ts"; +import {Button} from "./ui/button.tsx"; type RichEditorProps = { value: string; @@ -64,6 +65,13 @@ function RichEditor({ return (
+