parent
fcbe08e709
commit
2dc58df8f7
65
main.js
65
main.js
|
@ -1,11 +1,12 @@
|
|||
var defaultsettings =
|
||||
{
|
||||
savedelay: 5000,
|
||||
bgcolor: "white",
|
||||
fontfamily: "'Inconsolata', 'Consolas', monospace",
|
||||
fontsize: "90%",
|
||||
fontcolor: "black",
|
||||
lineheight: "130%",
|
||||
|
||||
savedelay: 5000,
|
||||
foldmarkstart: 22232,
|
||||
defaultpreviewinsplit: false,
|
||||
enablefolding: false,
|
||||
|
@ -31,6 +32,34 @@ var tags = null;
|
|||
var currentvault = "";
|
||||
var currenttag = "";
|
||||
|
||||
var themes =
|
||||
{
|
||||
Default:
|
||||
{
|
||||
bgcolor: "white",
|
||||
fontfamily: "'Inconsolata', 'Consolas', monospace",
|
||||
fontsize: "90%",
|
||||
fontcolor: "black",
|
||||
lineheight: "130%"
|
||||
},
|
||||
Notion:
|
||||
{
|
||||
bgcolor: "white",
|
||||
fontfamily: "ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'",
|
||||
fontsize: "16px",
|
||||
fontcolor: "rgb(55,53,47)",
|
||||
lineheight: "24px"
|
||||
},
|
||||
Monkey:
|
||||
{
|
||||
bgcolor: "rgb(227,227,227)",
|
||||
fontfamily: "'Hack', 'Consolas', monospace",
|
||||
fontsize: "14px",
|
||||
fontcolor: "rgb(55,55,55)",
|
||||
lineheight: "26px"
|
||||
}
|
||||
};
|
||||
|
||||
var commands = [
|
||||
{
|
||||
hint: "Close menu"
|
||||
|
@ -218,6 +247,11 @@ var commands = [
|
|||
action: addtagfilter,
|
||||
shortcut: "ctrl+shift+F",
|
||||
savedonly: true
|
||||
},
|
||||
{
|
||||
hint: "Select theme",
|
||||
savedonly: true,
|
||||
action: selecttheme
|
||||
}];
|
||||
|
||||
var snippets = [
|
||||
|
@ -252,6 +286,20 @@ var snippets = [
|
|||
cursor: 0
|
||||
}];
|
||||
|
||||
function selecttheme()
|
||||
{
|
||||
searchinlist(Object.keys(themes))
|
||||
.then(theme => {
|
||||
for (var i in themes[theme])
|
||||
{
|
||||
settings[i] = themes[theme][i];
|
||||
}
|
||||
applystyle();
|
||||
resize();
|
||||
window.localStorage.setItem("settings", JSON.stringify(settings));
|
||||
});
|
||||
}
|
||||
|
||||
function addtagfilter()
|
||||
{
|
||||
var command = commands.find(c => c.action == addtagfilter);
|
||||
|
@ -612,6 +660,15 @@ function loadstorage()
|
|||
}
|
||||
}
|
||||
|
||||
function applystyle()
|
||||
{
|
||||
document.body.style.background = settings.bgcolor;
|
||||
document.body.style.fontFamily = settings.fontfamily;
|
||||
document.body.style.fontSize = settings.fontsize;
|
||||
document.body.style.lineHeight = settings.lineheight;
|
||||
document.body.style.color = settings.fontcolor;
|
||||
}
|
||||
|
||||
function loadsettings()
|
||||
{
|
||||
settings = {...defaultsettings};
|
||||
|
@ -628,11 +685,7 @@ function loadsettings()
|
|||
}
|
||||
}
|
||||
|
||||
document.body.style.background = settings.bgcolor;
|
||||
document.body.style.fontFamily = settings.fontfamily;
|
||||
document.body.style.fontSize = settings.fontsize;
|
||||
document.body.style.lineHeight = settings.lineheight;
|
||||
document.body.style.color = settings.fontcolor;
|
||||
applystyle();
|
||||
|
||||
if (!settings.enablefolding)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue