From b0056f2facd2c5288caeac48445e0fcdd5a7d570 Mon Sep 17 00:00:00 2001 From: choptop84 Date: Mon, 9 Sep 2024 16:12:03 -0400 Subject: [PATCH] CTRL+S/CTRL+O stuff --- editor/ImportPrompt.ts | 7 +++++-- editor/SongEditor.ts | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/editor/ImportPrompt.ts b/editor/ImportPrompt.ts index 1c855db..4d48117 100644 --- a/editor/ImportPrompt.ts +++ b/editor/ImportPrompt.ts @@ -76,9 +76,12 @@ export class ImportPrompt implements Prompt { this._cancelButton.addEventListener("click", this._close); this._importButton.addEventListener("click", this._importCategoryButton); this._exportButton.addEventListener("click", this._exportCategoryButton); + if (this._doc.prompt == "export") { + this._exportCategoryButton(); + } } - private _importCategoryButton = (): void => { + public _importCategoryButton = (): void => { this._importPrompt.style.display = ""; this._exportPrompt.style.display = "none"; @@ -92,7 +95,7 @@ export class ImportPrompt implements Prompt { this.container.style.width = "300px"; } - private _exportCategoryButton = (): void => { + public _exportCategoryButton = (): void => { this._importPrompt.style.display = "none"; this._exportPrompt.style.display = ""; diff --git a/editor/SongEditor.ts b/editor/SongEditor.ts index b5bd852..f5f0e25 100644 --- a/editor/SongEditor.ts +++ b/editor/SongEditor.ts @@ -14,7 +14,6 @@ import { InstrumentImportPrompt } from "./InstrumentImportPrompt"; import { EditorConfig, isMobile, prettyNumber, Preset, PresetCategory} from "./EditorConfig"; import { SetThemePrompt } from "./SongThemePrompt" import { EuclideanRhythmPrompt } from "./EuclidgenRhythmPrompt"; -import { ExportPrompt } from "./ExportPrompt"; import "./Layout"; // Imported here for the sake of ensuring this code is transpiled early. import { Instrument, Channel, Synth } from "../synth/synth"; import { HTML, SVG } from "imperative-html/dist/esm/elements-strict"; @@ -2340,7 +2339,7 @@ export class SongEditor { if (promptName) { switch (promptName) { case "export": - this.prompt = new ExportPrompt(this._doc); + this.prompt = new ImportPrompt(this._doc); break; case "import": this.prompt = new ImportPrompt(this._doc); @@ -5133,7 +5132,7 @@ export class SongEditor { case 83: // s if (canPlayNotes) break; if (event.ctrlKey || event.metaKey) { - this._openPrompt("import"); + this._openPrompt("export"); event.preventDefault(); } else { if (this._doc.prefs.enableChannelMuting) { @@ -5151,6 +5150,10 @@ export class SongEditor { break; case 79: // o if (canPlayNotes) break; + if (event.ctrlKey || event.metaKey) { + this._openPrompt("import"); + event.preventDefault(); + } break; case 86: // v