-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1834f8d
commit 5fef73b
Showing
7 changed files
with
95 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useMemo } from "react"; | ||
import { observer } from "mobx-react-lite"; | ||
|
||
import { langStore } from "@carefree0910/business"; | ||
|
||
import type { IPythonPlugin } from "@/schema/_python"; | ||
import { drawboardPluginFactory } from "@/plugins/utils/factory"; | ||
import Render from "@/plugins/components/Render"; | ||
import CFMarkdown from "@/components/CFMarkdown"; | ||
import { Lang, getRandomHash } from "@carefree0910/core"; | ||
|
||
const shortcutsMarkdown: Record<Lang, string> = { | ||
zh: ` | ||
| 快捷键 | 行为 | | ||
| :----- | ---: | | ||
| \`Command\`+\`A\` | 选中所有节点 | | ||
| \`Command\`+\`C\` | 复制 | | ||
| \`Command\`+\`V\` | 粘贴 | | ||
| \`Command\`+\`[\` | 当前节点往后移动一层 | | ||
| \`Command\`+\`]\` | 当前节点往前移动一层 | | ||
| \`[\` | 当前节点移到最低层 | | ||
| \`]\` | 当前节点移到最顶层 | | ||
| \`Delete\` | 删除选中的节点 | | ||
| \`Command\`+\`G\` | 打组 | | ||
| \`Command\`+\`Shift\`+\`G\` | 解组 | | ||
| \`Command\`+\`Z\` | 撤销 | | ||
| \`Command\`+\`Shift\`+\`Z\` | 重做 | | ||
`, | ||
en: ` | ||
| Shortcut | Behaviour | | ||
| :------- | ---------: | | ||
| \`Command\`+\`A\` | Select all \`Node\`s | | ||
| \`Command\`+\`C\` | Copy | | ||
| \`Command\`+\`V\` | Paste | | ||
| \`Command\`+\`[\` | Move one layer backward | | ||
| \`Command\`+\`]\` | Move one layer forward | | ||
| \`[\` | Move to the bottom | | ||
| \`]\` | Move to the top | | ||
| \`Delete\` | Delete selecting \`Node\`(s) | | ||
| \`Command\`+\`G\` | Group | | ||
| \`Command\`+\`Shift\`+\`G\` | Ungroup | | ||
| \`Command\`+\`Z\` | Undo | | ||
| \`Command\`+\`Shift\`+\`Z\` | Redo | | ||
`, | ||
}; | ||
const ShortcutsPlugin = ({ pluginInfo, ...props }: IPythonPlugin) => { | ||
const id = useMemo(() => `shortcuts_${getRandomHash()}`, []); | ||
const lang = langStore.tgt; | ||
|
||
return ( | ||
<Render id={id} {...props}> | ||
<CFMarkdown markdown={shortcutsMarkdown[lang]} /> | ||
</Render> | ||
); | ||
}; | ||
|
||
drawboardPluginFactory.register("shortcuts", true)(observer(ShortcutsPlugin)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters