feat:toolbar
This commit is contained in:
parent
ed000101b8
commit
74a5c0bd76
|
@ -26,6 +26,11 @@ import md5 from "md5"
|
||||||
import {isEmpty} from "../../../utils/ObjectUtils";
|
import {isEmpty} from "../../../utils/ObjectUtils";
|
||||||
import {useDispatch} from "react-redux";
|
import {useDispatch} from "react-redux";
|
||||||
import {updatedSavedFile} from "../../../redux/tableBarItem_reducer";
|
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() {
|
function Placeholder() {
|
||||||
return <div className="editor-placeholder">Enter some rich text...</div>;
|
return <div className="editor-placeholder">Enter some rich text...</div>;
|
||||||
}
|
}
|
||||||
|
@ -181,17 +186,19 @@ export default function Hlexical(props) {
|
||||||
<HistoryPlugin/>
|
<HistoryPlugin/>
|
||||||
{/*黑窗口动态记录当前操作*/}
|
{/*黑窗口动态记录当前操作*/}
|
||||||
<TreeViewPlugin/>
|
<TreeViewPlugin/>
|
||||||
|
|
||||||
<AutoFocusPlugin/>
|
<AutoFocusPlugin/>
|
||||||
{/*<CodeHighlightPlugin />*/}
|
<CodeHighlightPlugin />
|
||||||
{/*<ListPlugin />*/}
|
<ListPlugin />
|
||||||
{/*<LinkPlugin />*/}
|
<LinkPlugin />
|
||||||
{/*<AutoLinkPlugin />*/}
|
<AutoLinkPlugin/>
|
||||||
{/*<ListMaxIndentLevelPlugin maxDepth={7} />*/}
|
<ListMaxIndentLevelPlugin maxDepth={7} />
|
||||||
{/*markdown 快捷键*/}
|
{/*markdown 快捷键*/}
|
||||||
<MarkdownShortcutPlugin transformers={TRANSFORMERS}/>
|
<MarkdownShortcutPlugin transformers={TRANSFORMERS}/>
|
||||||
<OnChangePlugin onChange={onChange}/>
|
<OnChangePlugin onChange={onChange}/>
|
||||||
<ImportFilePlugin filePath={props.filePath}/>
|
<ImportFilePlugin filePath={props.filePath}/>
|
||||||
<SaveFilePlugin filePath={props.filePath} editorState={editorState}/>
|
<SaveFilePlugin filePath={props.filePath} editorState={editorState}/>
|
||||||
|
{/*文件操作导入文件*/}
|
||||||
{/*<ActionPlugin/>*/}
|
{/*<ActionPlugin/>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -53,16 +53,16 @@ const supportedBlockTypes = new Set([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const blockTypeToBlockName = {
|
const blockTypeToBlockName = {
|
||||||
code: "Code Block",
|
code: "代码块",
|
||||||
h1: "Large Heading",
|
h1: "一级标题",
|
||||||
h2: "Small Heading",
|
h2: "二级标题",
|
||||||
h3: "Heading",
|
h3: "三级标题",
|
||||||
h4: "Heading",
|
h4: "四级标题",
|
||||||
h5: "Heading",
|
h5: "五级标题",
|
||||||
ol: "Numbered List",
|
ol: "有序序列",
|
||||||
paragraph: "Normal",
|
paragraph: "普通文本",
|
||||||
quote: "Quote",
|
quote: "引用",
|
||||||
ul: "Bulleted List"
|
ul: "无序序列"
|
||||||
};
|
};
|
||||||
|
|
||||||
function Divider() {
|
function Divider() {
|
||||||
|
@ -378,37 +378,37 @@ function BlockOptionsDropdownList({
|
||||||
<div className="dropdown" ref={dropDownRef}>
|
<div className="dropdown" ref={dropDownRef}>
|
||||||
<button className="item" onClick={formatParagraph}>
|
<button className="item" onClick={formatParagraph}>
|
||||||
<span className="icon paragraph" />
|
<span className="icon paragraph" />
|
||||||
<span className="text">Normal</span>
|
<span className="text">普通文本</span>
|
||||||
{blockType === "paragraph" && <span className="active" />}
|
{blockType === "paragraph" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
<button className="item" onClick={formatLargeHeading}>
|
<button className="item" onClick={formatLargeHeading}>
|
||||||
<span className="icon large-heading" />
|
<span className="icon large-heading" />
|
||||||
<span className="text">Large Heading</span>
|
<span className="text">一级标题</span>
|
||||||
{blockType === "h1" && <span className="active" />}
|
{blockType === "h1" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
<button className="item" onClick={formatSmallHeading}>
|
<button className="item" onClick={formatSmallHeading}>
|
||||||
<span className="icon small-heading" />
|
<span className="icon small-heading" />
|
||||||
<span className="text">Small Heading</span>
|
<span className="text">二级标题</span>
|
||||||
{blockType === "h2" && <span className="active" />}
|
{blockType === "h2" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
<button className="item" onClick={formatBulletList}>
|
<button className="item" onClick={formatBulletList}>
|
||||||
<span className="icon bullet-list" />
|
<span className="icon bullet-list" />
|
||||||
<span className="text">Bullet List</span>
|
<span className="text">无序序列</span>
|
||||||
{blockType === "ul" && <span className="active" />}
|
{blockType === "ul" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
<button className="item" onClick={formatNumberedList}>
|
<button className="item" onClick={formatNumberedList}>
|
||||||
<span className="icon numbered-list" />
|
<span className="icon numbered-list" />
|
||||||
<span className="text">Numbered List</span>
|
<span className="text">有序序列</span>
|
||||||
{blockType === "ol" && <span className="active" />}
|
{blockType === "ol" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
<button className="item" onClick={formatQuote}>
|
<button className="item" onClick={formatQuote}>
|
||||||
<span className="icon quote" />
|
<span className="icon quote" />
|
||||||
<span className="text">Quote</span>
|
<span className="text">引用</span>
|
||||||
{blockType === "quote" && <span className="active" />}
|
{blockType === "quote" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
<button className="item" onClick={formatCode}>
|
<button className="item" onClick={formatCode}>
|
||||||
<span className="icon code" />
|
<span className="icon code" />
|
||||||
<span className="text">Code Block</span>
|
<span className="text">代码块</span>
|
||||||
{blockType === "code" && <span className="active" />}
|
{blockType === "code" && <span className="active" />}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue