1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-02 08:48:37 +09:00
This commit is contained in:
syuilo 2018-02-22 21:15:24 +09:00
parent 62d16db008
commit 4fd3192791
11 changed files with 71 additions and 47 deletions

View File

@ -1,15 +1,15 @@
<template>
<div class="mk-messaging-form">
<textarea v-model="text" @keypress="onKeypress" @paste="onPaste" placeholder="%i18n:common.input-message-here%"></textarea>
<div class="files"></div>
<div class="file" v-if="file">{{ file.name }}</div>
<mk-uploader ref="uploader"/>
<button class="send" @click="send" :disabled="sending" title="%i18n:common.send%">
<template v-if="!sending">%fa:paper-plane%</template><template v-if="sending">%fa:spinner .spin%</template>
</button>
<button class="attach-from-local" type="button" title="%i18n:common.tags.mk-messaging-form.attach-from-local%">
<button class="attach-from-local" title="%i18n:common.tags.mk-messaging-form.attach-from-local%">
%fa:upload%
</button>
<button class="attach-from-drive" type="button" title="%i18n:common.tags.mk-messaging-form.attach-from-drive%">
<button class="attach-from-drive" @click="chooseFileFromDrive" title="%i18n:common.tags.mk-messaging-form.attach-from-drive%">
%fa:R folder-open%
</button>
<input name="file" type="file" accept="image/*"/>

View File

@ -1,18 +1,30 @@
import { url } from '../../config';
import MkChooseFileFromDriveWindow from '../views/components/choose-file-from-drive-window.vue';
export default function(opts) {
return new Promise((res, rej) => {
const o = opts || {};
const w = new MkChooseFileFromDriveWindow({
propsData: {
title: o.title,
multiple: o.multiple,
initFolder: o.currentFolder
}
}).$mount();
w.$once('selected', file => {
res(file);
});
document.body.appendChild(w.$el);
if (document.body.clientWidth > 800) {
const w = new MkChooseFileFromDriveWindow({
propsData: {
title: o.title,
multiple: o.multiple,
initFolder: o.currentFolder
}
}).$mount();
w.$once('selected', file => {
res(file);
});
document.body.appendChild(w.$el);
} else {
window['cb'] = file => {
res(file);
};
window.open(url + '/selectdrive',
'drive_window',
'height=500, width=800');
}
});
}

View File

@ -24,6 +24,7 @@ import MkUser from './views/pages/user/user.vue';
import MkSelectDrive from './views/pages/selectdrive.vue';
import MkDrive from './views/pages/drive.vue';
import MkHomeCustomize from './views/pages/home-customize.vue';
import MkMessagingRoom from './views/pages/messaging-room.vue';
/**
* init
@ -70,6 +71,7 @@ init(async (launch) => {
app.$router.addRoutes([
{ path: '/', name: 'index', component: MkIndex },
{ path: '/i/customize-home', component: MkHomeCustomize },
{ path: '/i/messaging/:username', component: MkMessagingRoom },
{ path: '/i/drive', component: MkDrive },
{ path: '/i/drive/folder/:folder', component: MkDrive },
{ path: '/selectdrive', component: MkSelectDrive },

View File

@ -1,5 +1,5 @@
<template>
<mk-window ref="window" width="500px" height="560px" :popout="popout" @closed="$destroy">
<mk-window ref="window" width="500px" height="560px" :popout-url="popout" @closed="$destroy">
<span slot="header" :class="$style.header">%fa:comments%メッセージ: {{ user.name }}</span>
<mk-messaging-room :user="user" :class="$style.content"/>
</mk-window>

View File

@ -111,9 +111,6 @@ export default Vue.extend({
}
});
},
beforeDestroy() {
this.autocomplete.detach();
},
methods: {
focus() {
(this.$refs.text as any).focus();

View File

@ -1,5 +1,5 @@
<template>
<div class="mk-api-setting">
<div class="root api">
<p>Token: <code>{{ os.i.token }}</code></p>
<p>%i18n:desktop.tags.mk-api-info.intro%</p>
<div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-api-info.caution%</p></div>
@ -10,12 +10,14 @@
<script lang="ts">
import Vue from 'vue';
import passwordDialog from '../../scripts/password-dialog';
export default Vue.extend({
methods: {
regenerateToken() {
passwordDialog('%i18n:desktop.tags.mk-api-info.enter-password%', password => {
(this as any).apis.input({
title: '%i18n:desktop.tags.mk-api-info.enter-password%',
type: 'password'
}).then(password => {
(this as any).api('i/regenerate_token', {
password: password
});
@ -26,7 +28,7 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
.mk-api-setting
.root.api
color #4a535a
code

View File

@ -60,7 +60,7 @@
<section class="api" v-show="page == 'api'">
<h1>API</h1>
<mk-api-info/>
<x-api/>
</section>
<section class="other" v-show="page == 'other'">
@ -77,13 +77,15 @@ import XProfile from './settings.profile.vue';
import XMute from './settings.mute.vue';
import XPassword from './settings.password.vue';
import X2fa from './settings.2fa.vue';
import XApi from './settings.api.vue';
export default Vue.extend({
components: {
XProfile,
XMute,
XPassword,
X2fa
X2fa,
XApi
},
data() {
return {

View File

@ -3,14 +3,14 @@ import MkAutocomplete from '../components/autocomplete.vue';
export default {
bind(el, binding, vn) {
const self = el._userPreviewDirective_ = {} as any;
const self = el._autoCompleteDirective_ = {} as any;
self.x = new Autocomplete(el);
self.x.attach();
},
unbind(el, binding, vn) {
const self = el._userPreviewDirective_;
self.x.close();
const self = el._autoCompleteDirective_;
self.x.detach();
}
};

View File

@ -1,6 +1,6 @@
<template>
<div class="mk-messaging-room-page">
<mk-messaging-room v-if="user" :user="user" is-naked/>
<mk-messaging-room v-if="user" :user="user" :is-naked="true"/>
</div>
</template>
@ -9,28 +9,37 @@ import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
export default Vue.extend({
props: ['username'],
data() {
return {
fetching: true,
user: null
};
},
watch: {
$route: 'fetch'
},
created() {
this.fetch();
},
mounted() {
Progress.start();
document.documentElement.style.background = '#fff';
},
methods: {
fetch() {
Progress.start();
this.fetching = true;
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.user = user;
this.fetching = false;
(this as any).api('users/show', {
username: this.$route.params.username
}).then(user => {
this.user = user;
this.fetching = false;
document.title = 'メッセージ: ' + this.user.name;
document.title = 'メッセージ: ' + this.user.name;
Progress.done();
});
Progress.done();
});
}
}
});
</script>

View File

@ -1,15 +1,15 @@
<template>
<div class="mk-selectdrive">
<div class="mkp-selectdrive">
<mk-drive ref="browser"
:multiple="multiple"
@selected="onSelected"
@change-selection="onChangeSelection"
/>
<div>
<footer>
<button class="upload" title="%i18n:desktop.tags.mk-selectdrive-page.upload%" @click="upload">%fa:upload%</button>
<button class="cancel" @click="close">%i18n:desktop.tags.mk-selectdrive-page.cancel%</button>
<button class="ok" @click="ok">%i18n:desktop.tags.mk-selectdrive-page.ok%</button>
</div>
</footer>
</div>
</template>
@ -54,7 +54,7 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
.mk-selectdrive
.mkp-selectdrive
display block
position fixed
width 100%
@ -64,7 +64,7 @@ export default Vue.extend({
> .mk-drive
height calc(100% - 72px)
> div
> footer
position fixed
bottom 0
left 0

View File

@ -29,12 +29,12 @@ export default Vue.extend({
user: null
};
},
created() {
this.fetch();
},
watch: {
$route: 'fetch'
},
created() {
this.fetch();
},
methods: {
fetch() {
this.fetching = true;