refactor: added command option if for remote only

This commit is contained in:
quenousimporte 2023-07-04 17:15:34 +02:00
parent d84ec16c5d
commit 8d4f1de649
1 changed files with 7 additions and 7 deletions

14
main.js
View File

@ -334,7 +334,8 @@ var commands = [
},
{
hint: "Send by SMS",
action: sms
action: sms,
remoteonly: true
}];
var snippets = [
@ -378,14 +379,9 @@ var snippets = [
cursor: -4
}];
function sms()
{
if (!isremote())
{
showtemporaryinfo("SMS is not available in local mode.");
return;
}
queryremote({action: "sms", data: currentnote.content.replace(/\n/g, " ")})
.then(data =>
{
@ -2080,6 +2076,10 @@ function executecommand(command)
{
showtemporaryinfo("Cannot perform '" + command.hint + "' because current note is not saved.");
}
else if (command.remoteonly && !isremote())
{
showtemporaryinfo(command.hint + " is not available in local mode.");
}
else if (command.action)
{
command.action();