Add Ctrl+S as shortcut to save story

This commit is contained in:
somebody
2022-11-28 22:13:01 -06:00
parent b6caea023c
commit 6db94890b5
2 changed files with 9 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ var finder_actions = [
{name: "Load Model", icon: "folder_open", type: "action", func: function() { socket.emit('load_model_button', {}); }},
{name: "New Story", icon: "description", type: "action", func: function() { socket.emit('new_story', ''); }},
{name: "Load Story", icon: "folder_open", type: "action", func: function() { socket.emit('load_story_list', ''); }},
{name: "Save Story", icon: "save", type: "action", func: function() { socket.emit("save_story", null, (response) => {save_as_story(response);}); }},
{name: "Save Story", icon: "save", type: "action", func: save_story},
{name: "Download Story", icon: "file_download", type: "action", func: function() { document.getElementById('download_iframe').src = 'json'; }},
{name: "Import Story", icon: "file_download", desc: "Import a prompt from aetherroom.club, formerly prompts.aidg.club", type: "action", func: openClubImport },
@@ -130,8 +130,7 @@ const context_menu_actions = {
// CTRL-[X]
const shortcuts = [
{key: "k", desc: "Finder", func: open_finder},
{key: "/", desc: "Help screen", func: () => openPopup("shortcuts-popup")},
{key: "s", desc: "Save Story", func: save_story},
{key: "z", desc: "Undoes last story action", func: () => socket.emit("back", {}), criteria: canNavigateStoryHistory},
{key: "y", desc: "Redoes last story action", func: () => socket.emit("redo", {}), criteria: canNavigateStoryHistory},
{key: "e", desc: "Retries last story action", func: () => socket.emit("retry", {}), criteria: canNavigateStoryHistory},
@@ -139,6 +138,8 @@ const shortcuts = [
{key: "u", desc: "Focuses Author's Note", func: () => focusEl("#authors_notes")}, // CTRL-N is reserved :^(
{key: "g", desc: "Focuses game text", func: () => focusEl("#input_text")},
{key: "l", desc: '"Lock" screen (Not secure)', func: () => socket.emit("privacy_mode", {'enabled': true})},
{key: "k", desc: "Finder", func: open_finder},
{key: "/", desc: "Help screen", func: () => openPopup("shortcuts-popup")},
]
const chat = {
@@ -652,6 +653,10 @@ function do_probabilities(action) {
}
function save_story() {
socket.emit("save_story", null, response => save_as_story(response));;
}
function do_presets(data) {
for (select of document.getElementsByClassName('presets')) {
//clear out the preset list

View File

@@ -75,7 +75,7 @@
<span class="material-icons-outlined cursor" tooltip="Load Story">folder_open</span>
<span class="button_label">Load Story</span>
</button>
<button class="settings_button var_sync_alt_story_gamesaved" onclick='socket.emit("save_story", null, (response) => {save_as_story(response);});'>
<button class="settings_button var_sync_alt_story_gamesaved" onclick='save_story();'>
<span class="material-icons-outlined cursor var_sync_alt_story_gamesaved" tooltip="Save Story">save</span>
<span class="button_label">Save Story</span>
</button>