wip
This commit is contained in:
parent
9a722898d2
commit
5d05a25ae2
3 changed files with 56 additions and 49 deletions
|
@ -1,35 +1,38 @@
|
||||||
<mk-drive-browser-nav-folder data-draghover={ draghover } @click="onclick" ondragover={ ondragover } ondragenter={ ondragenter } ondragleave={ ondragleave } ondrop={ ondrop }>
|
<template>
|
||||||
<template v-if="folder == null">%fa:cloud%</template><span>{ folder == null ? '%i18n:desktop.tags.mk-drive-browser-nav-folder.drive%' : folder.name }</span>
|
<div class="mk-drive-nav-folder"
|
||||||
<style lang="stylus" scoped>
|
:data-draghover="draghover"
|
||||||
:scope
|
@click="onClick"
|
||||||
&[data-draghover]
|
@dragover.prevent.stop="onDragover"
|
||||||
background #eee
|
@dragenter="onDragenter"
|
||||||
|
@dragleave="onDragleave"
|
||||||
|
@drop.stop="onDrop"
|
||||||
|
>
|
||||||
|
<template v-if="folder == null">%fa:cloud%</template>
|
||||||
|
<span>{{ folder == null ? '%i18n:desktop.tags.mk-drive-browser-nav-folder.drive%' : folder.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
</style>
|
<script lang="ts">
|
||||||
<script lang="typescript">
|
import Vue from 'vue';
|
||||||
this.mixin('api');
|
export default Vue.extend({
|
||||||
|
props: ['folder', 'browser'],
|
||||||
this.folder = this.opts.folder ? this.opts.folder : null;
|
data() {
|
||||||
this.browser = this.parent;
|
return {
|
||||||
|
hover: false,
|
||||||
this.hover = false;
|
draghover: false
|
||||||
|
};
|
||||||
this.onclick = () => {
|
},
|
||||||
|
methods: {
|
||||||
|
onClick() {
|
||||||
this.browser.move(this.folder);
|
this.browser.move(this.folder);
|
||||||
};
|
},
|
||||||
|
onMouseover() {
|
||||||
this.onmouseover = () => {
|
this.hover = true;
|
||||||
this.hover = true
|
},
|
||||||
};
|
onMouseout() {
|
||||||
|
this.hover = false;
|
||||||
this.onmouseout = () => {
|
},
|
||||||
this.hover = false
|
onDragover(e) {
|
||||||
};
|
|
||||||
|
|
||||||
this.ondragover = e => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
// このフォルダがルートかつカレントディレクトリならドロップ禁止
|
// このフォルダがルートかつカレントディレクトリならドロップ禁止
|
||||||
if (this.folder == null && this.browser.folder == null) {
|
if (this.folder == null && this.browser.folder == null) {
|
||||||
e.dataTransfer.dropEffect = 'none';
|
e.dataTransfer.dropEffect = 'none';
|
||||||
|
@ -40,18 +43,14 @@
|
||||||
e.dataTransfer.dropEffect = 'move';
|
e.dataTransfer.dropEffect = 'move';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
},
|
||||||
|
onDragenter() {
|
||||||
this.ondragenter = () => {
|
|
||||||
if (this.folder || this.browser.folder) this.draghover = true;
|
if (this.folder || this.browser.folder) this.draghover = true;
|
||||||
};
|
},
|
||||||
|
onDragleave() {
|
||||||
this.ondragleave = () => {
|
|
||||||
if (this.folder || this.browser.folder) this.draghover = false;
|
if (this.folder || this.browser.folder) this.draghover = false;
|
||||||
};
|
},
|
||||||
|
onDrop(e) {
|
||||||
this.ondrop = e => {
|
|
||||||
e.stopPropagation();
|
|
||||||
this.draghover = false;
|
this.draghover = false;
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
|
@ -74,7 +73,7 @@
|
||||||
if (obj.type == 'file') {
|
if (obj.type == 'file') {
|
||||||
const file = obj.id;
|
const file = obj.id;
|
||||||
this.browser.removeFile(file);
|
this.browser.removeFile(file);
|
||||||
this.api('drive/files/update', {
|
this.$root.$data.os.api('drive/files/update', {
|
||||||
file_id: file,
|
file_id: file,
|
||||||
folder_id: this.folder ? this.folder.id : null
|
folder_id: this.folder ? this.folder.id : null
|
||||||
});
|
});
|
||||||
|
@ -84,13 +83,21 @@
|
||||||
// 移動先が自分自身ならreject
|
// 移動先が自分自身ならreject
|
||||||
if (this.folder && folder == this.folder.id) return false;
|
if (this.folder && folder == this.folder.id) return false;
|
||||||
this.browser.removeFolder(folder);
|
this.browser.removeFolder(folder);
|
||||||
this.api('drive/folders/update', {
|
this.$root.$data.os.api('drive/folders/update', {
|
||||||
folder_id: folder,
|
folder_id: folder,
|
||||||
parent_id: this.folder ? this.folder.id : null
|
parent_id: this.folder ? this.folder.id : null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
</script>
|
}
|
||||||
</mk-drive-browser-nav-folder>
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.mk-drive-nav-folder
|
||||||
|
&[data-draghover]
|
||||||
|
background #eee
|
||||||
|
|
||||||
|
</style>
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<mk-window ref="window" is-modal @closed="$destroy">
|
<mk-window ref="window" is-modal @closed="$destroy">
|
||||||
<span slot="header">
|
<span slot="header">
|
||||||
<span v-if="!parent.opts.reply">%i18n:desktop.tags.mk-post-form-window.post%</span>
|
<span v-if="!reply">%i18n:desktop.tags.mk-post-form-window.post%</span>
|
||||||
<span v-if="parent.opts.reply">%i18n:desktop.tags.mk-post-form-window.reply%</span>
|
<span v-if="reply">%i18n:desktop.tags.mk-post-form-window.reply%</span>
|
||||||
<span :class="$style.count" v-if="media.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.attaches%'.replace('{}', media.length) }}</span>
|
<span :class="$style.count" v-if="media.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.attaches%'.replace('{}', media.length) }}</span>
|
||||||
<span :class="$style.count" v-if="uploadings.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.uploading-media%'.replace('{}', uploadings.length) }}<mk-ellipsis/></span>
|
<span :class="$style.count" v-if="uploadings.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.uploading-media%'.replace('{}', uploadings.length) }}<mk-ellipsis/></span>
|
||||||
</span>
|
</span>
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
<mk-post-preview v-if="parent.opts.reply" :class="$style.postPreview" :post="reply"/>
|
<mk-post-preview v-if="reply" :class="$style.postPreview" :post="reply"/>
|
||||||
<mk-post-form ref="form"
|
<mk-post-form ref="form"
|
||||||
:reply="reply"
|
:reply="reply"
|
||||||
@posted="$refs.window.close"
|
@posted="$refs.window.close"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<button ref="drive" title="%i18n:desktop.tags.mk-post-form.attach-media-from-drive%" @click="selectFileFromDrive">%fa:cloud%</button>
|
<button ref="drive" title="%i18n:desktop.tags.mk-post-form.attach-media-from-drive%" @click="selectFileFromDrive">%fa:cloud%</button>
|
||||||
<button class="kao" title="%i18n:desktop.tags.mk-post-form.insert-a-kao%" @click="kao">%fa:R smile%</button>
|
<button class="kao" title="%i18n:desktop.tags.mk-post-form.insert-a-kao%" @click="kao">%fa:R smile%</button>
|
||||||
<button class="poll" title="%i18n:desktop.tags.mk-post-form.create-poll%" @click="poll = true">%fa:chart-pie%</button>
|
<button class="poll" title="%i18n:desktop.tags.mk-post-form.create-poll%" @click="poll = true">%fa:chart-pie%</button>
|
||||||
<p class="text-count { over: refs.text.value.length > 1000 }">{ '%i18n:desktop.tags.mk-post-form.text-remain%'.replace('{}', 1000 - refs.text.value.length) }</p>
|
<p class="text-count" :class="{ over: text.length > 1000 }">{{ '%i18n:desktop.tags.mk-post-form.text-remain%'.replace('{}', 1000 - text.length) }}</p>
|
||||||
<button :class="{ posting }" ref="submit" :disabled="!canPost" @click="post">
|
<button :class="{ posting }" ref="submit" :disabled="!canPost" @click="post">
|
||||||
{{ posting ? '%i18n:desktop.tags.mk-post-form.posting%' : submitText }}<mk-ellipsis v-if="posting"/>
|
{{ posting ? '%i18n:desktop.tags.mk-post-form.posting%' : submitText }}<mk-ellipsis v-if="posting"/>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in a new issue