Stackedit/src/components/modals/providers/DropboxSaveModal.vue
2018-03-09 21:56:26 +00:00

47 lines
1.5 KiB
Vue

<template>
<modal-inner aria-label="Synchronize with Dropbox">
<div class="modal__content">
<div class="modal__image">
<icon-provider provider-id="dropbox"></icon-provider>
</div>
<p>This will save <b>{{currentFileName}}</b> to your <b>Dropbox</b> and keep it synchronized.</p>
<form-entry label="File path" error="path">
<input slot="field" class="textfield" type="text" v-model.trim="path" @keydown.enter="resolve()">
<div class="form-entry__info">
<b>Example:</b> {{config.token.fullAccess ? '' : '/Applications/StackEdit (restricted)'}}/path/to/My Document.md<br>
If the file exists, it will be replaced.
</div>
</form-entry>
</div>
<div class="modal__button-bar">
<button class="button" @click="config.reject()">Cancel</button>
<button class="button" @click="resolve()">Ok</button>
</div>
</modal-inner>
</template>
<script>
import dropboxProvider from '../../../services/providers/dropboxProvider';
import modalTemplate from '../common/modalTemplate';
export default modalTemplate({
data: () => ({
path: '',
}),
created() {
this.path = `/${this.currentFileName}.md`;
},
methods: {
resolve() {
if (!dropboxProvider.checkPath(this.path)) {
this.setError('path');
} else {
// Return new location
const location = dropboxProvider.makeLocation(this.config.token, this.path);
this.config.resolve(location);
}
},
},
});
</script>