fixed: apply colors when selecting theme

fixed: hide colors when hidding editor
changed: md header in italics
This commit is contained in:
quenousimporte 2023-09-24 21:54:12 +02:00
parent 8930b7cbbd
commit 8c224d49d3
1 changed files with 17 additions and 6 deletions

23
main.js
View File

@ -605,6 +605,7 @@ function loadtheme(theme)
settings[i] = themes[theme][i]; settings[i] = themes[theme][i];
} }
applystyle(); applystyle();
applycolors();
resize(); resize();
} }
@ -725,12 +726,22 @@ function connected(note)
return result; return result;
} }
function toggleeditor(hidden)
{
md.hidden = hidden;
if (settings.colors)
{
colored.hidden = hidden;
}
}
function shownotelinks() function shownotelinks()
{ {
if (settings.enablenetwork) if (settings.enablenetwork)
{ {
networkpage.hidden = false; networkpage.hidden = false;
md.hidden = true; toggleeditor(true);
function id(note) function id(note)
{ {
return localdata.indexOf(note); return localdata.indexOf(note);
@ -796,7 +807,7 @@ function shownotelinks()
graph.on("click", function(event) graph.on("click", function(event)
{ {
networkpage.hidden = true; networkpage.hidden = true;
md.hidden = false; toggleeditor(false);
loadnote(nodes.find(n => n.id == event.nodes[0]).label); loadnote(nodes.find(n => n.id == event.nodes[0]).label);
}); });
} }
@ -2099,7 +2110,7 @@ function applycolors()
{ {
header = false; header = false;
} }
line = "<span style='color:lightgrey'>" + line + "</span>"; line = "<em><span style='color:lightgrey'>" + line + "</span></em>";
} }
if (line == "```" && !code) if (line == "```" && !code)
@ -2355,7 +2366,7 @@ function esc(event)
else if (networkpage.hidden == false) else if (networkpage.hidden == false)
{ {
networkpage.hidden = true; networkpage.hidden = true;
md.hidden = false; toggleeditor(false);
} }
else if (preview.hidden == false) else if (preview.hidden == false)
{ {
@ -2557,7 +2568,7 @@ function insertautocomplete(selectednote)
function togglepreview() function togglepreview()
{ {
preview.innerHTML = md2html(md.value); preview.innerHTML = md2html(md.value);
md.hidden = !md.hidden; toggleeditor(!md.hidden);
preview.hidden = !preview.hidden; preview.hidden = !preview.hidden;
if (preview.hidden) if (preview.hidden)
@ -2610,7 +2621,7 @@ function togglepreviewwithsubs()
if (note) if (note)
{ {
preview.innerHTML = md2html(note.content); preview.innerHTML = md2html(note.content);
md.hidden = !md.hidden; toggleeditor(!md.hidden);
preview.hidden = !preview.hidden; preview.hidden = !preview.hidden;
if (preview.hidden) if (preview.hidden)