Skip to content

Commit

Permalink
CTRL+S/CTRL+O stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
choptop84 committed Sep 9, 2024
1 parent 62b936d commit b0056f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions editor/ImportPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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 = "";

Expand Down
9 changes: 6 additions & 3 deletions editor/SongEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit b0056f2

Please sign in to comment.