added: margins in settings
fixed: apply settings on save, not change event
This commit is contained in:
parent
6f70c6b239
commit
1793a5e50b
22
main.js
22
main.js
|
@ -6,6 +6,7 @@ var defaultsettings =
|
||||||
fontcolor: "black",
|
fontcolor: "black",
|
||||||
lineheight: "130%",
|
lineheight: "130%",
|
||||||
accentcolor: "#5AA7CE",
|
accentcolor: "#5AA7CE",
|
||||||
|
margins: "7%",
|
||||||
|
|
||||||
savedelay: 2000,
|
savedelay: 2000,
|
||||||
foldmarkstart: 22232,
|
foldmarkstart: 22232,
|
||||||
|
@ -886,6 +887,8 @@ function applystyle()
|
||||||
document.body.style.lineHeight = settings.lineheight;
|
document.body.style.lineHeight = settings.lineheight;
|
||||||
document.body.style.color = settings.fontcolor;
|
document.body.style.color = settings.fontcolor;
|
||||||
document.body.style.caretColor = settings.accentcolor;
|
document.body.style.caretColor = settings.accentcolor;
|
||||||
|
document.body.style.marginLeft = settings.margins;
|
||||||
|
document.body.style.marginRight = settings.margins;
|
||||||
|
|
||||||
if (settings.titleinaccentcolor)
|
if (settings.titleinaccentcolor)
|
||||||
{
|
{
|
||||||
|
@ -1556,6 +1559,15 @@ function save()
|
||||||
{
|
{
|
||||||
clearTimeout(workerid);
|
clearTimeout(workerid);
|
||||||
|
|
||||||
|
if (currentnote.title == "settings.json")
|
||||||
|
{
|
||||||
|
settings = JSON.parse(md.value);
|
||||||
|
savesettings();
|
||||||
|
loadsettings();
|
||||||
|
saved = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!localdata)
|
if (!localdata)
|
||||||
{
|
{
|
||||||
showtemporaryinfo("cannot push empty data");
|
showtemporaryinfo("cannot push empty data");
|
||||||
|
@ -1579,12 +1591,6 @@ function save()
|
||||||
currentnote.content = content;
|
currentnote.content = content;
|
||||||
|
|
||||||
window.localStorage.setItem(currentvault, JSON.stringify(localdata));
|
window.localStorage.setItem(currentvault, JSON.stringify(localdata));
|
||||||
|
|
||||||
if (currentnote.title == "settings.json")
|
|
||||||
{
|
|
||||||
settings = JSON.parse(content);
|
|
||||||
savesettings();
|
|
||||||
}
|
|
||||||
console.log("data serialized in local storage")
|
console.log("data serialized in local storage")
|
||||||
|
|
||||||
if (isremote())
|
if (isremote())
|
||||||
|
@ -2003,10 +2009,6 @@ function resetfolds()
|
||||||
function bindfile(note)
|
function bindfile(note)
|
||||||
{
|
{
|
||||||
var changed = currentnote != note;
|
var changed = currentnote != note;
|
||||||
if (currentnote && currentnote.title == "settings.json")
|
|
||||||
{
|
|
||||||
loadsettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
backup = note.content;
|
backup = note.content;
|
||||||
currentnote = note;
|
currentnote = note;
|
||||||
|
|
Loading…
Reference in New Issue