fixed: hide note when network visible

fixed: network height
changed: escape to hide network
fixed: do not save if not needed
This commit is contained in:
quenousimporte 2023-02-05 10:20:27 +01:00
parent 276e4a0eff
commit 2136faf1ae
3 changed files with 15 additions and 3 deletions

View File

@ -17,7 +17,6 @@
<script src="main.js"></script> <script src="main.js"></script>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script> <script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<div id="networkpage" hidden> <div id="networkpage" hidden>
<div id="network"></div> <div id="network"></div>
</div> </div>

15
main.js
View File

@ -648,6 +648,7 @@ function shownotelinks()
if (settings.enablenetwork) if (settings.enablenetwork)
{ {
networkpage.hidden = false; networkpage.hidden = false;
md.hidden = true;
function id(note) function id(note)
{ {
return localdata.indexOf(note); return localdata.indexOf(note);
@ -712,8 +713,9 @@ function shownotelinks()
var graph = new vis.Network(network, data, options); var graph = new vis.Network(network, data, options);
graph.on("click", function(event) graph.on("click", function(event)
{ {
loadnote(nodes.find(n => n.id == event.nodes[0]).label);
networkpage.hidden = true; networkpage.hidden = true;
md.hidden = false;
loadnote(nodes.find(n => n.id == event.nodes[0]).label);
}); });
} }
else else
@ -1771,6 +1773,12 @@ function save()
return; return;
} }
if (saved)
{
console.log("nothing to save");
return;
}
var content = getnotecontent(); var content = getnotecontent();
if ((content == "" && backup != "") || content == "null" || content == "undefined") if ((content == "" && backup != "") || content == "null" || content == "undefined")
{ {
@ -2031,6 +2039,11 @@ function mainkeydownhandler()
{ {
loadlast(); loadlast();
} }
else if (networkpage.hidden == false)
{
networkpage.hidden = true;
md.hidden = false;
}
else if (preview.hidden == false) else if (preview.hidden == false)
{ {
togglepreview(); togglepreview();

View File

@ -57,7 +57,7 @@ body::-webkit-scrollbar-thumb {
position: absolute; position: absolute;
top: 0; top: 0;
width: 100%; width: 100%;
height: 600px; height: 100%;
opacity: 1; opacity: 1;
} }