feat(tracker): add ability to copy, cut and paste units

This commit is contained in:
2023-07-18 17:17:50 +03:00
parent 338529012a
commit 5a2e87982e
4 changed files with 56 additions and 1 deletions
+9
View File
@@ -67,6 +67,15 @@ type Tracker struct {
}
func (t *Tracker) UnmarshalContent(bytes []byte) error {
var unit sointu.Unit
if errJSON := json.Unmarshal(bytes, &unit); errJSON == nil {
t.PasteUnit(unit)
return nil
}
if errYaml := yaml.Unmarshal(bytes, &unit); errYaml == nil {
t.PasteUnit(unit)
return nil
}
var instr sointu.Instrument
if errJSON := json.Unmarshal(bytes, &instr); errJSON == nil {
if t.SetInstrument(instr) {