refactor: added command option if for remote only
This commit is contained in:
parent
d84ec16c5d
commit
8d4f1de649
14
main.js
14
main.js
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue