diff --git a/public/index.html b/public/index.html
index 9ea85f6..4ec36ca 100644
--- a/public/index.html
+++ b/public/index.html
@@ -14,6 +14,7 @@
+
diff --git a/src/menu/editor.js b/src/menu/editor.js
index 8047d0f..6daaa51 100644
--- a/src/menu/editor.js
+++ b/src/menu/editor.js
@@ -21,6 +21,7 @@ import {
createParagraph,
createParagraphWithNotations,
} from "../util/paragraph";
+import { convertTone, convertToneTo } from "../util/tone-convert";
import { exportFile, loadFile, saveFile } from "../util/file";
import { findParagraphAndNotation, resetGlobalData } from "../util/editor";
import {
@@ -74,9 +75,28 @@ const handleEditMenu = wrappedAction(({ key }) => {
break;
}
});
-const handleConvertMenu = wrappedAction(() => {
- console.log(111);
-});
+const handleConvertMenu = ({ key }) => {
+ switch (true) {
+ case key.startsWith("convertTo"):
+ const destTone = key.split("-", 2)[1];
+ convertToneTo(destTone);
+ break;
+ case key === "convert-up":
+ convertTone(2);
+ break;
+ case key === "convert-down":
+ convertTone(-2);
+ break;
+ case key === "convert-up8":
+ convertTone(12);
+ break;
+ case key === "convert-down8":
+ convertTone(-12);
+ break;
+ default:
+ break;
+ }
+};
// 画布上的点击事件
const handleClick = wrappedAction((ev) => {
@@ -94,6 +114,9 @@ const handleKeyPress = wrappedAction((ev) => {
if (state.selectedNotationKey) {
// 仅选中符号时作用
+ if (state.helpDialogVisible || state.configDialogVisible) {
+ return;
+ }
const {
paragraph,
notation,
@@ -404,33 +427,27 @@ const editMenu = (
const convertMenu = (