Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onRSAuth() {
Radio.request('collections/Configs', 'saveConfigs', {
configs: [
{name: 'remotestorageAddress', value: this.ui.address.val().trim()},
{name: 'cloudStorage' , value: 'remotestorage'},
],
});
}
async removeModel(options) {
const {model} = options;
const res = await (options.force ? 'confirm' : this.showConfirm(model));
if (res !== 'confirm') {
return;
}
return Radio.request('collections/Notes', 'remove', {model});
}
async fetchUsers() {
this.users = await Radio.request('collections/Users', 'find');
}
print: function(btn){
if(!btn){
btn = this.layout.getRegion('actions').currentView.$('[data-action=print]');
}
btn.trigger('state', [ 'loading', '' ]);
Radio.request('print', 'receipt', {
model: this.order
})
.then(function(){
btn.trigger('state', [ 'success', null ]);
})
.catch(function(error){
Radio.request('modal', 'error', error);
btn.trigger('state', [ 'error', null ]);
});
},
async redirect(preRedirect = true) {
if (preRedirect) {
await this.preRedirect();
Radio.request('utils/Url', 'navigateBack');
}
else {
const url = Radio.request('utils/Url', 'getNoteLink', this.model);
Radio.request('utils/Url', 'navigate', {url});
}
this.view.destroy();
}
get configs() {
return Radio.request('collections/Configs', 'findConfigs');
}
show() {
this.view = new View({configs: this.configs});
Radio.request('Layout', 'show', {
region : 'brand',
view : this.view,
});
}
linkAction() {
const dialog = Radio.request('components/linkDialog', 'show');
if (!dialog) {
return;
}
return dialog.then(link => {
if (!link || !link.length) {
return;
}
const cursor = this.instance.getCursor('start');
const text = this.instance.getSelection() || 'Link';
this.instance.replaceSelection(`[${text}](${link})`);
this.instance.setSelection(
{line: cursor.line, ch: cursor.ch + 1},