Skip to content

Commit

Permalink
added display story json modal to emergenzy get the JSON if the save …
Browse files Browse the repository at this point in the history
…buttons dont work
  • Loading branch information
Echsecutor committed Dec 16, 2024
1 parent 74c5913 commit 2316ab9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
10 changes: 10 additions & 0 deletions editor/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,16 @@ document

document.addEventListener("keydown", handle_global_key_down);

document
.getElementById("story_modal")
.addEventListener("shown.bs.modal", () => {
document.getElementById("story_code").innerHTML = JSON.stringify(
story,
null,
2
);
});

async function load_last_story_or_example() {
try {
const storyJson = localStorage.getItem(current_editor_story_key);
Expand Down
25 changes: 23 additions & 2 deletions editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@
</head>

<body>

<div class="modal fade modal-xl" id="story_modal" tabindex="-1" aria-labelledby="story_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="story_modal_label">Current Story JSON</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<pre id="story_code">
loading...
</pre>
</div>
</div>
</div>
</div>

<div class="container" id="graph_card">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
Expand All @@ -32,9 +49,13 @@
<li><a class="dropdown-item" id="clear_all_button" href="#">New Adventure</a></li>
<li><a class="dropdown-item" id="load_button" href="#">Load Adventure</a></li>
<li><a class="dropdown-item" id="download_as_is_button" href="#">Save Adventure as it is</a></li>
<li><a class="dropdown-item" id="download_in_one_button" href="#">Save Adventure with all images in one file</a></li>
<li><a class="dropdown-item" id="download_split_button" href="#">Generate playable adventure bundle</a></li>
<li><a class="dropdown-item" id="download_in_one_button" href="#">Save Adventure with all images in one
file</a></li>
<li><a class="dropdown-item" id="download_split_button" href="#">Generate playable adventure bundle</a>
</li>
<li><a class="dropdown-item" id="linearize_button" href="#">Create Linear Story</a></li>
<li><a class="dropdown-item" id="show_story_modal_button" href="#" data-bs-toggle="modal"
data-bs-target="#story_modal">Display Current Story JSON</a></li>
</ul>
</li>
<li class="nav-item dropdown">
Expand Down
15 changes: 14 additions & 1 deletion editor/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ body {
}

#cy {
height: 60vh;
height: 50vh;
width: 100%;
position: relative;
}
Expand All @@ -26,4 +26,17 @@ body {
.row{
margin-top: 5px;
margin-bottom: 5px;
}

pre {
font-family: Consolas,"courier new", monospace;
color: greenyellow;
background-color: black;
padding: 2px;
display: block;
width: 100%;
}

#story_code{
overflow: hidden;
}

0 comments on commit 2316ab9

Please sign in to comment.