feat: 增加复制粘贴功能

This commit is contained in:
2021-10-06 20:03:52 +08:00
parent 2048a89d7e
commit 9d81aaa4fb
9 changed files with 143 additions and 51 deletions
+10 -1
View File
@@ -1,3 +1,5 @@
import { toJS } from "mobx";
const notations = {
zero: "0",
do: "1",
@@ -31,6 +33,7 @@ function isSeparator(notationOrNote) {
// 创建符号
function createNotation(initial) {
const n = {
type: "notation",
key: `n_${String(Math.random())}`,
note: "0",
octave: 0,
@@ -46,5 +49,11 @@ function createNotation(initial) {
}
return n;
}
function cloneNotation(notation) {
const origin = JSON.parse(JSON.stringify(toJS(notation)));
delete origin.key;
const n = createNotation(origin);
return n;
}
export { notations, isNote, isSeparator, createNotation };
export { notations, isNote, isSeparator, createNotation, cloneNotation };