Improve dropdown menus, animation

This commit is contained in:
Tom Moor
2017-09-09 16:55:02 -07:00
parent dcbad23cb1
commit c919e51ce6
6 changed files with 87 additions and 77 deletions

View File

@ -79,6 +79,16 @@ class Document extends BaseModel {
return !this.isEmpty && !this.isSaving;
}
@computed get allowDelete(): boolean {
const collection = this.collection;
return (
collection &&
collection.type === 'atlas' &&
collection.documents &&
collection.documents.length > 1
);
}
/* Actions */
@action star = async () => {
@ -182,6 +192,14 @@ class Document extends BaseModel {
return;
};
download() {
const a = window.document.createElement('a');
a.textContent = 'download';
a.download = `${this.title}.md`;
a.href = `data:text/markdown;charset=UTF-8,${encodeURIComponent(this.text)}`;
a.click();
}
updateData(data: Object = {}, dirty: boolean = false) {
if (data.text) {
const { title, emoji } = parseTitle(data.text);