parent
edc5a2780d
commit
e570640970
25
main.js
25
main.js
|
@ -144,11 +144,6 @@ var commands = [
|
||||||
action: loadnext,
|
action: loadnext,
|
||||||
shortcut: "ctrl+shift+B"
|
shortcut: "ctrl+shift+B"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
hint: "Sort text",
|
|
||||||
action: sortselection,
|
|
||||||
allowunsaved: true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
hint: "Settings",
|
hint: "Settings",
|
||||||
action: editsettings
|
action: editsettings
|
||||||
|
@ -178,7 +173,7 @@ var commands = [
|
||||||
shortcut: "ctrl+shift+F",
|
shortcut: "ctrl+shift+F",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hint: "Show info",
|
hint: "Show stats",
|
||||||
action: showinfo,
|
action: showinfo,
|
||||||
shortcut: "ctrl+w",
|
shortcut: "ctrl+w",
|
||||||
allowunsaved: true
|
allowunsaved: true
|
||||||
|
@ -273,6 +268,11 @@ var commands = [
|
||||||
{
|
{
|
||||||
hint: "Sort todo.txt list",
|
hint: "Sort todo.txt list",
|
||||||
action: sorttodotxt
|
action: sorttodotxt
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hint: "Sort text",
|
||||||
|
action: sortselection,
|
||||||
|
allowunsaved: true
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var snippets = [
|
var snippets = [
|
||||||
|
@ -496,7 +496,7 @@ function showinfo()
|
||||||
[
|
[
|
||||||
"sync: " + (settings.sync ? "en" : "dis") + "abled",
|
"sync: " + (settings.sync ? "en" : "dis") + "abled",
|
||||||
"title: " + currentnote.title,
|
"title: " + currentnote.title,
|
||||||
"saved: " + saved + " (" + lastsaved + ")",
|
"saved: " + saved + (lastsaved? " (" + lastsaved + ")": ""),
|
||||||
"line count: " + md.value.split("\n").length,
|
"line count: " + md.value.split("\n").length,
|
||||||
"word count: " + getwords(),
|
"word count: " + getwords(),
|
||||||
"cursor position: " + md.selectionStart + " (" + pospercent() + "%)",
|
"cursor position: " + md.selectionStart + " (" + pospercent() + "%)",
|
||||||
|
@ -970,11 +970,6 @@ function togglesplit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isremote()
|
|
||||||
{
|
|
||||||
return settings.sync;
|
|
||||||
}
|
|
||||||
|
|
||||||
function tagslist()
|
function tagslist()
|
||||||
{
|
{
|
||||||
tags = {};
|
tags = {};
|
||||||
|
@ -1305,7 +1300,7 @@ function init()
|
||||||
|
|
||||||
initsnippets();
|
initsnippets();
|
||||||
|
|
||||||
if (isremote())
|
if (settings.sync)
|
||||||
{
|
{
|
||||||
if (localStorage.getItem("pgpkeys") && localStorage.getItem("pgpkeys").startsWith("-----BEGIN PGP PUBLIC KEY BLOCK-----"))
|
if (localStorage.getItem("pgpkeys") && localStorage.getItem("pgpkeys").startsWith("-----BEGIN PGP PUBLIC KEY BLOCK-----"))
|
||||||
{
|
{
|
||||||
|
@ -1879,7 +1874,7 @@ function save()
|
||||||
window.localStorage.setItem("data", JSON.stringify(localdata));
|
window.localStorage.setItem("data", JSON.stringify(localdata));
|
||||||
console.log("data serialized in local storage")
|
console.log("data serialized in local storage")
|
||||||
|
|
||||||
if (isremote())
|
if (settings.sync)
|
||||||
{
|
{
|
||||||
var datatosend = JSON.stringify(localdata);
|
var datatosend = JSON.stringify(localdata);
|
||||||
encryptstring(datatosend)
|
encryptstring(datatosend)
|
||||||
|
@ -2458,7 +2453,7 @@ function executecommand(command)
|
||||||
{
|
{
|
||||||
showtemporaryinfo("Cannot perform '" + command.hint + "' because current note is not saved.");
|
showtemporaryinfo("Cannot perform '" + command.hint + "' because current note is not saved.");
|
||||||
}
|
}
|
||||||
else if (command.remoteonly && !isremote())
|
else if (command.remoteonly && !settings.sync)
|
||||||
{
|
{
|
||||||
showtemporaryinfo(command.hint + " is not available in local mode.");
|
showtemporaryinfo(command.hint + " is not available in local mode.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue