added: change a setting in main command palette
This commit is contained in:
parent
2935034202
commit
a3c8d25299
24
main.js
24
main.js
|
@ -939,18 +939,22 @@ function editsettings()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editsetting(name)
|
||||||
|
{
|
||||||
|
if (settings[name])
|
||||||
|
{
|
||||||
|
settings[name] = prompt(name, settings[name]);
|
||||||
|
savesettings();
|
||||||
|
loadsettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function changesetting()
|
function changesetting()
|
||||||
{
|
{
|
||||||
searchinlist(Object.keys(settings).map(name => name + ": " + settings[name]))
|
searchinlist(Object.keys(settings).map(name => name + ": " + settings[name]))
|
||||||
.then(setting =>
|
.then(setting =>
|
||||||
{
|
{
|
||||||
var name = setting.split(":").shift();
|
editsetting(setting.split(":").shift());
|
||||||
if (settings[name])
|
|
||||||
{
|
|
||||||
settings[name] = prompt(name, settings[name]);
|
|
||||||
savesettings();
|
|
||||||
loadsettings();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1797,7 +1801,7 @@ function commandpalette()
|
||||||
.map(c => c.hint)
|
.map(c => c.hint)
|
||||||
.concat(snippets.map(s => "Insert snippet: " + s.hint))
|
.concat(snippets.map(s => "Insert snippet: " + s.hint))
|
||||||
.concat(list().map(t => "Open note: " + t))
|
.concat(list().map(t => "Open note: " + t))
|
||||||
)
|
.concat(Object.keys(settings).map(s => "Edit setting: " + s)))
|
||||||
.then(hint =>
|
.then(hint =>
|
||||||
{
|
{
|
||||||
var command = commands.find(c => c.hint == hint);
|
var command = commands.find(c => c.hint == hint);
|
||||||
|
@ -1817,6 +1821,10 @@ function commandpalette()
|
||||||
{
|
{
|
||||||
loadnote(hint.replace("Open note: ", ""));
|
loadnote(hint.replace("Open note: ", ""));
|
||||||
}
|
}
|
||||||
|
else if (hint.startsWith("Edit setting: "))
|
||||||
|
{
|
||||||
|
editsetting(hint.replace("Edit setting: ", ""));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if unknown command, create a new note
|
// if unknown command, create a new note
|
||||||
|
|
Loading…
Reference in New Issue