ドライブウィンドウもポップアウトできるように

This commit is contained in:
syuilo 2017-11-14 01:21:28 +09:00
parent 861159404f
commit 52eed29cd0
2 changed files with 16 additions and 4 deletions

View File

@ -1,11 +1,11 @@
<mk-drive-browser-window> <mk-drive-browser-window>
<mk-window ref="window" is-modal={ false } width={ '800px' } height={ '500px' }> <mk-window ref="window" is-modal={ false } width={ '800px' } height={ '500px' } popout={ popout }>
<yield to="header"> <yield to="header">
<p class="info" if={ parent.usage }><b>{ parent.usage.toFixed(1) }%</b> %i18n:desktop.tags.mk-drive-browser-window.used%</p> <p class="info" if={ parent.usage }><b>{ parent.usage.toFixed(1) }%</b> %i18n:desktop.tags.mk-drive-browser-window.used%</p>
<i class="fa fa-cloud"></i>%i18n:desktop.tags.mk-drive-browser-window.drive% <i class="fa fa-cloud"></i>%i18n:desktop.tags.mk-drive-browser-window.drive%
</yield> </yield>
<yield to="content"> <yield to="content">
<mk-drive-browser multiple={ true } folder={ parent.folder }/> <mk-drive-browser multiple={ true } folder={ parent.folder } ref="browser"/>
</yield> </yield>
</mk-window> </mk-window>
<style> <style>
@ -28,10 +28,21 @@
</style> </style>
<script> <script>
import CONFIG from '../../../common/scripts/config';
this.mixin('api'); this.mixin('api');
this.folder = this.opts.folder ? this.opts.folder : null; this.folder = this.opts.folder ? this.opts.folder : null;
this.popout = () => {
const folder = this.refs.window.refs.browser.folder;
if (folder) {
return `${CONFIG.url}/i/drive/folder/${folder.id}`;
} else {
return `${CONFIG.url}/i/drive`;
}
};
this.on('mount', () => { this.on('mount', () => {
this.refs.window.on('closed', () => { this.refs.window.on('closed', () => {
this.unmount(); this.unmount();

View File

@ -268,8 +268,9 @@
const x = window.screenX + position.left; const x = window.screenX + position.left;
const y = window.screenY + position.top; const y = window.screenY + position.top;
window.open(this.popoutUrl, const url = typeof this.popoutUrl == 'function' ? this.popoutUrl() : this.popoutUrl;
this.popoutUrl,
window.open(url, url,
`height=${height},width=${width},left=${x},top=${y}`); `height=${height},width=${width},left=${x},top=${y}`);
this.close(); this.close();