From 74a5c0bd76dbf2ea1cf73bcab1bf0f99a426d42e Mon Sep 17 00:00:00 2001 From: shixiaohua Date: Tue, 20 Feb 2024 17:58:40 +0800 Subject: [PATCH] feat:toolbar --- src/pages/Note/Hlexical/index.jsx | 17 +++++++--- .../Note/Hlexical/plugins/ToolbarPlugin.js | 34 +++++++++---------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/pages/Note/Hlexical/index.jsx b/src/pages/Note/Hlexical/index.jsx index 707fb0c..30b9b08 100644 --- a/src/pages/Note/Hlexical/index.jsx +++ b/src/pages/Note/Hlexical/index.jsx @@ -26,6 +26,11 @@ import md5 from "md5" import {isEmpty} from "../../../utils/ObjectUtils"; import {useDispatch} from "react-redux"; import {updatedSavedFile} from "../../../redux/tableBarItem_reducer"; +import {ListPlugin} from "@lexical/react/LexicalListPlugin"; +import {LinkPlugin} from "@lexical/react/LexicalLinkPlugin"; +import AutoLinkPlugin from "./plugins/AutoLinkPlugin"; +import ListMaxIndentLevelPlugin from "./plugins/ListMaxIndentLevelPlugin"; +import CodeHighlightPlugin from "./plugins/CodeHighlightPlugin"; function Placeholder() { return
Enter some rich text...
; } @@ -181,17 +186,19 @@ export default function Hlexical(props) { {/*黑窗口动态记录当前操作*/} + - {/**/} - {/**/} - {/**/} - {/**/} - {/**/} + + + + + {/*markdown 快捷键*/} + {/*文件操作导入文件*/} {/**/} diff --git a/src/pages/Note/Hlexical/plugins/ToolbarPlugin.js b/src/pages/Note/Hlexical/plugins/ToolbarPlugin.js index 554d63b..51f6d46 100644 --- a/src/pages/Note/Hlexical/plugins/ToolbarPlugin.js +++ b/src/pages/Note/Hlexical/plugins/ToolbarPlugin.js @@ -53,16 +53,16 @@ const supportedBlockTypes = new Set([ ]); const blockTypeToBlockName = { - code: "Code Block", - h1: "Large Heading", - h2: "Small Heading", - h3: "Heading", - h4: "Heading", - h5: "Heading", - ol: "Numbered List", - paragraph: "Normal", - quote: "Quote", - ul: "Bulleted List" + code: "代码块", + h1: "一级标题", + h2: "二级标题", + h3: "三级标题", + h4: "四级标题", + h5: "五级标题", + ol: "有序序列", + paragraph: "普通文本", + quote: "引用", + ul: "无序序列" }; function Divider() { @@ -378,37 +378,37 @@ function BlockOptionsDropdownList({