This commit is contained in:
syuilo 2020-09-20 21:29:22 +09:00
parent dd1b6b21e1
commit ea37ff3b61
15 changed files with 68 additions and 37 deletions

View File

@ -40,7 +40,7 @@
<x-note-header class="header" :note="appearNote" :mini="true"/> <x-note-header class="header" :note="appearNote" :mini="true"/>
<div class="body" ref="noteBody"> <div class="body" ref="noteBody">
<p v-if="appearNote.cw != null" class="cw"> <p v-if="appearNote.cw != null" class="cw">
<mfm v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis"/> <mfm v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis"/>
<x-cw-button v-model:value="showContent" :note="appearNote"/> <x-cw-button v-model:value="showContent" :note="appearNote"/>
</p> </p>
<div class="content" v-show="appearNote.cw == null || showContent"> <div class="content" v-show="appearNote.cw == null || showContent">

View File

@ -379,7 +379,7 @@ export default defineComponent({
}, },
chooseFileFromDrive() { chooseFileFromDrive() {
selectDriveFile(this.$root, true).then(files => { selectDriveFile(true).then(files => {
for (const file of files) { for (const file of files) {
this.attachMedia(file); this.attachMedia(file);
} }

View File

@ -63,7 +63,7 @@ export default defineComponent({
this.$emit('note'); this.$emit('note');
if (this.sound) { if (this.sound) {
this.$root.sound(note.userId === this.$store.state.i.id ? 'noteMy' : 'note'); os.sound(note.userId === this.$store.state.i.id ? 'noteMy' : 'note');
} }
}; };

View File

@ -17,7 +17,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue';import * as os from '@/os'; import { defineComponent } from 'vue';
import * as os from '@/os';
export default defineComponent({ export default defineComponent({
model: { model: {

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="fgmtyycl _panel _shadow" :style="{ top: top + 'px', left: left + 'px' }"> <div class="fgmtyycl _panel _shadow" :style="{ top: top + 'px', left: left + 'px' }">
<mk-url-preview :url="url"/> <transition name="zoom" @after-leave="$emit('closed')">
<mk-url-preview :url="url" v-if="showing"/>
</transition>
</div> </div>
</template> </template>
@ -21,7 +23,11 @@ export default defineComponent({
}, },
source: { source: {
required: true required: true
} },
showing: {
type: Boolean,
required: true
},
}, },
data() { data() {

View File

@ -23,7 +23,6 @@ import { defineComponent } from 'vue';
import { faExternalLinkSquareAlt } from '@fortawesome/free-solid-svg-icons'; import { faExternalLinkSquareAlt } from '@fortawesome/free-solid-svg-icons';
import { toUnicode as decodePunycode } from 'punycode'; import { toUnicode as decodePunycode } from 'punycode';
import { url as local } from '@/config'; import { url as local } from '@/config';
import MkUrlPreview from './url-preview-popup.vue';
import { isDeviceTouch } from '@/scripts/is-device-touch'; import { isDeviceTouch } from '@/scripts/is-device-touch';
import * as os from '@/os'; import * as os from '@/os';
@ -54,7 +53,7 @@ export default defineComponent({
showTimer: null, showTimer: null,
hideTimer: null, hideTimer: null,
checkTimer: null, checkTimer: null,
preview: null, close: null,
faExternalLinkSquareAlt faExternalLinkSquareAlt
}; };
}, },
@ -68,29 +67,26 @@ export default defineComponent({
this.hash = decodeURIComponent(url.hash); this.hash = decodeURIComponent(url.hash);
}, },
methods: { methods: {
showPreview() { async showPreview() {
if (!document.body.contains(this.$el)) return; if (!document.body.contains(this.$el)) return;
if (this.preview) return; if (this.close) return;
this.preview = new MkUrlPreview({ const promise = os.popup(await import('@/components/url-preview-popup.vue'), {
parent: this, url: this.url,
propsData: { source: this.$el
url: this.url, });
source: this.$el
}
}).$mount();
document.body.appendChild(this.preview.$el); this.close = promise.cancel;
this.checkTimer = setInterval(() => { this.checkTimer = setInterval(() => {
if (!document.body.contains(this.$el)) this.closePreview(); if (!document.body.contains(this.$el)) this.closePreview();
}, 1000); }, 1000);
}, },
closePreview() { closePreview() {
if (this.preview) { if (this.close) {
clearInterval(this.checkTimer); clearInterval(this.checkTimer);
this.preview.destroyDom(); this.close();
this.preview = null; this.close = null;
} }
}, },
onMouseover() { onMouseover() {

View File

@ -169,7 +169,7 @@ export default defineComponent({
notification notification
}); });
} }
this.$root.sound('notification'); os.sound('notification');
}, },
async addColumn(ev) { async addColumn(ev) {

View File

@ -342,7 +342,7 @@ export default defineComponent({
}); });
} }
this.$root.sound('notification'); os.sound('notification');
}, },
widgetFunc(id) { widgetFunc(id) {

View File

@ -192,7 +192,7 @@ export default defineComponent({
}, },
onMessage(message) { onMessage(message) {
this.$root.sound('chat'); os.sound('chat');
const _isBottom = isBottom(this.$el, 64); const _isBottom = isBottom(this.$el, 64);

View File

@ -38,7 +38,7 @@ export default defineComponent({
methods: { methods: {
chooseUploadFolder() { chooseUploadFolder() {
selectDriveFolder(this.$root, false).then(async folder => { selectDriveFolder(false).then(async folder => {
await this.$store.dispatch('settings/set', { key: 'uploadFolder', value: folder ? folder.id : null }); await this.$store.dispatch('settings/set', { key: 'uploadFolder', value: folder ? folder.id : null });
os.dialog({ os.dialog({
type: 'success', type: 'success',

View File

@ -20,7 +20,6 @@ import { faLaugh, faSave, faEye } from '@fortawesome/free-regular-svg-icons';
import { faUndo } from '@fortawesome/free-solid-svg-icons'; import { faUndo } from '@fortawesome/free-solid-svg-icons';
import MkInput from '@/components/ui/input.vue'; import MkInput from '@/components/ui/input.vue';
import MkButton from '@/components/ui/button.vue'; import MkButton from '@/components/ui/button.vue';
import MkReactionPicker from '@/components/reaction-picker.vue';
import { emojiRegexWithCustom } from '../../../misc/emoji-regex'; import { emojiRegexWithCustom } from '../../../misc/emoji-regex';
import { defaultSettings } from '../../store'; import { defaultSettings } from '../../store';
import * as os from '@/os'; import * as os from '@/os';
@ -57,11 +56,12 @@ export default defineComponent({
this.changed = false; this.changed = false;
}, },
preview(ev) { async preview(ev) {
os.modal(MkReactionPicker, { os.modal(await import('@/components/reaction-picker.vue'), {
source: ev.currentTarget || ev.target,
reactions: this.splited, reactions: this.splited,
showFocus: false, showFocus: false,
}, {}, {
source: ev.currentTarget || ev.target,
}); });
}, },
@ -70,11 +70,11 @@ export default defineComponent({
}, },
async chooseEmoji(ev) { async chooseEmoji(ev) {
const vm = os.modal(await import('@/components/emoji-picker.vue'), { os.modal(await import('@/components/emoji-picker.vue'), {
}, {}, {
source: ev.currentTarget || ev.target source: ev.currentTarget || ev.target
}).$once('chosen', emoji => { }).then(emoji => {
this.reactions += emoji; this.reactions += emoji;
vm.close();
}); });
} }
} }

View File

@ -58,7 +58,7 @@ export default defineComponent({
methods: { methods: {
async choose() { async choose() {
selectDriveFile(this.$root, false).then(file => { selectDriveFile(false).then(file => {
this.file = file; this.file = file;
this.value.fileId = file.id; this.value.fileId = file.id;
}); });

View File

@ -414,7 +414,7 @@ export default defineComponent({
}, },
setEyeCatchingImage() { setEyeCatchingImage() {
selectDriveFile(this.$root, false).then(file => { selectDriveFile(false).then(file => {
this.eyeCatchingImageId = file.id; this.eyeCatchingImageId = file.id;
}); });
}, },

View File

@ -2,7 +2,7 @@
<div> <div>
<portal to="header"><fa :icon="faExclamationTriangle"/>TEST</portal> <portal to="header"><fa :icon="faExclamationTriangle"/>TEST</portal>
<div class="_card"> <div class="_card _vMargin">
<div class="_title">Dialog</div> <div class="_title">Dialog</div>
<div class="_content"> <div class="_content">
<mk-input v-model:value="dialogTitle"> <mk-input v-model:value="dialogTitle">
@ -26,6 +26,18 @@
<span>Result: {{ dialogResult }}</span> <span>Result: {{ dialogResult }}</span>
</div> </div>
</div> </div>
<div class="_card _vMargin">
<div class="_title">MFM</div>
<div class="_content">
<mk-textarea v-model:value="mfm">
<span>MFM</span>
</mk-textarea>
</div>
<div class="_content">
<mfm :text="mfm"/>
</div>
</div>
</div> </div>
</template> </template>
@ -35,6 +47,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import MkButton from '@/components/ui/button.vue'; import MkButton from '@/components/ui/button.vue';
import MkInput from '@/components/ui/input.vue'; import MkInput from '@/components/ui/input.vue';
import MkSwitch from '@/components/ui/switch.vue'; import MkSwitch from '@/components/ui/switch.vue';
import MkTextarea from '@/components/ui/textarea.vue';
import * as os from '@/os'; import * as os from '@/os';
export default defineComponent({ export default defineComponent({
@ -42,6 +55,7 @@ export default defineComponent({
MkButton, MkButton,
MkInput, MkInput,
MkSwitch, MkSwitch,
MkTextarea,
}, },
metaInfo() { metaInfo() {
@ -58,6 +72,7 @@ export default defineComponent({
dialogCancelByBgClick: true, dialogCancelByBgClick: true,
dialogInput: false, dialogInput: false,
dialogResult: null, dialogResult: null,
mfm: '',
faExclamationTriangle faExclamationTriangle
} }
}, },

View File

@ -2,11 +2,24 @@
<DeckUI v-if="deckmode"/> <DeckUI v-if="deckmode"/>
<DefaultUI v-else/> <DefaultUI v-else/>
<XModal v-for="modal in $store.state.popups.filter(x => x.type === 'modal')" :key="modal.id" @closed="modal.closed" @click="modal.bgClick" :showing="modal.showing" :source="modal.source"> <XModal v-for="modal in $store.state.popups.filter(x => x.type === 'modal')"
:key="modal.id"
@closed="modal.closed"
@click="modal.bgClick"
:showing="modal.showing"
:source="modal.source"
>
<component :is="modal.component" v-bind="modal.props" v-on="modal.events" @done="modal.done"/> <component :is="modal.component" v-bind="modal.props" v-on="modal.events" @done="modal.done"/>
</XModal> </XModal>
<component v-for="popup in $store.state.popups.filter(x => x.type === 'popup')" :key="popup.id" :is="popup.component" v-bind="popup.props" :showing="popup.showing" v-on="popup.events" @closed="popup.closed"/> <component v-for="popup in $store.state.popups.filter(x => x.type === 'popup')"
:key="popup.id"
:is="popup.component"
v-bind="popup.props"
:showing="popup.showing"
v-on="popup.events"
@closed="popup.closed"
/>
<div id="wait" v-if="$store.state.pendingApiRequestsCount > 0"></div> <div id="wait" v-if="$store.state.pendingApiRequestsCount > 0"></div>
</template> </template>