This commit is contained in:
parent
5f3f9e2f8f
commit
cb965feab4
|
@ -132,7 +132,7 @@
|
||||||
"double-ended-queue": "2.1.0-0",
|
"double-ended-queue": "2.1.0-0",
|
||||||
"escape-regexp": "0.0.1",
|
"escape-regexp": "0.0.1",
|
||||||
"eslint": "7.4.0",
|
"eslint": "7.4.0",
|
||||||
"eslint-plugin-vue": "6.2.2",
|
"eslint-plugin-vue": "7.0.0-beta.3",
|
||||||
"eventemitter3": "4.0.4",
|
"eventemitter3": "4.0.4",
|
||||||
"feed": "4.2.1",
|
"feed": "4.2.1",
|
||||||
"fibers": "5.0.0",
|
"fibers": "5.0.0",
|
||||||
|
|
|
@ -9,6 +9,7 @@ import MkFormula from './formula.vue';
|
||||||
import MkCode from './code.vue';
|
import MkCode from './code.vue';
|
||||||
import MkGoogle from './google.vue';
|
import MkGoogle from './google.vue';
|
||||||
import { host } from '../config';
|
import { host } from '../config';
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
@ -71,17 +72,13 @@ export default defineComponent({
|
||||||
|
|
||||||
case 'italic': {
|
case 'italic': {
|
||||||
return h('i', {
|
return h('i', {
|
||||||
attrs: {
|
style: 'font-style: oblique;'
|
||||||
style: 'font-style: oblique;'
|
|
||||||
},
|
|
||||||
}, genEl(token.children));
|
}, genEl(token.children));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'big': {
|
case 'big': {
|
||||||
return h('strong', {
|
return h('strong', {
|
||||||
attrs: {
|
style: `display: inline-block; font-size: 150%;`,
|
||||||
style: `display: inline-block; font-size: 150%;`
|
|
||||||
},
|
|
||||||
directives: [this.$store.state.device.animatedMfm ? {
|
directives: [this.$store.state.device.animatedMfm ? {
|
||||||
name: 'animate-css',
|
name: 'animate-css',
|
||||||
value: { classes: 'tada', iteration: 'infinite' }
|
value: { classes: 'tada', iteration: 'infinite' }
|
||||||
|
@ -99,17 +96,13 @@ export default defineComponent({
|
||||||
|
|
||||||
case 'center': {
|
case 'center': {
|
||||||
return [h('div', {
|
return [h('div', {
|
||||||
attrs: {
|
style: 'text-align:center;'
|
||||||
style: 'text-align:center;'
|
|
||||||
}
|
|
||||||
}, genEl(token.children))];
|
}, genEl(token.children))];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'motion': {
|
case 'motion': {
|
||||||
return h('span', {
|
return h('span', {
|
||||||
attrs: {
|
style: 'display: inline-block;',
|
||||||
style: 'display: inline-block;'
|
|
||||||
},
|
|
||||||
directives: [this.$store.state.device.animatedMfm ? {
|
directives: [this.$store.state.device.animatedMfm ? {
|
||||||
name: 'animate-css',
|
name: 'animate-css',
|
||||||
value: { classes: 'rubberBand', iteration: 'infinite' }
|
value: { classes: 'rubberBand', iteration: 'infinite' }
|
||||||
|
@ -125,95 +118,75 @@ export default defineComponent({
|
||||||
const style = this.$store.state.device.animatedMfm
|
const style = this.$store.state.device.animatedMfm
|
||||||
? `animation: spin 1.5s linear infinite; animation-direction: ${direction};` : '';
|
? `animation: spin 1.5s linear infinite; animation-direction: ${direction};` : '';
|
||||||
return h('span', {
|
return h('span', {
|
||||||
attrs: {
|
style: 'display: inline-block;' + style
|
||||||
style: 'display: inline-block;' + style
|
|
||||||
},
|
|
||||||
}, genEl(token.children));
|
}, genEl(token.children));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'jump': {
|
case 'jump': {
|
||||||
return h('span', {
|
return h('span', {
|
||||||
attrs: {
|
style: this.$store.state.device.animatedMfm ? 'display: inline-block; animation: jump 0.75s linear infinite;' : 'display: inline-block;'
|
||||||
style: this.$store.state.device.animatedMfm ? 'display: inline-block; animation: jump 0.75s linear infinite;' : 'display: inline-block;'
|
|
||||||
},
|
|
||||||
}, genEl(token.children));
|
}, genEl(token.children));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'flip': {
|
case 'flip': {
|
||||||
return h('span', {
|
return h('span', {
|
||||||
attrs: {
|
style: 'display: inline-block; transform: scaleX(-1);'
|
||||||
style: 'display: inline-block; transform: scaleX(-1);'
|
|
||||||
},
|
|
||||||
}, genEl(token.children));
|
}, genEl(token.children));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'url': {
|
case 'url': {
|
||||||
return [h(MkUrl, {
|
return [h(MkUrl, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
url: token.node.props.url,
|
||||||
url: token.node.props.url,
|
rel: 'nofollow noopener',
|
||||||
rel: 'nofollow noopener',
|
|
||||||
},
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'link': {
|
case 'link': {
|
||||||
return [h(MkLink, {
|
return [h(MkLink, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
url: token.node.props.url,
|
||||||
url: token.node.props.url,
|
rel: 'nofollow noopener',
|
||||||
rel: 'nofollow noopener',
|
|
||||||
},
|
|
||||||
}, genEl(token.children))];
|
}, genEl(token.children))];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'mention': {
|
case 'mention': {
|
||||||
return [h(MkMention, {
|
return [h(MkMention, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
host: (token.node.props.host == null && this.author && this.author.host != null ? this.author.host : token.node.props.host) || host,
|
||||||
host: (token.node.props.host == null && this.author && this.author.host != null ? this.author.host : token.node.props.host) || host,
|
username: token.node.props.username
|
||||||
username: token.node.props.username
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'hashtag': {
|
case 'hashtag': {
|
||||||
return [h('router-link', {
|
return [h(RouterLink, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
attrs: {
|
to: this.isNote ? `/tags/${encodeURIComponent(token.node.props.hashtag)}` : `/explore/tags/${encodeURIComponent(token.node.props.hashtag)}`,
|
||||||
to: this.isNote ? `/tags/${encodeURIComponent(token.node.props.hashtag)}` : `/explore/tags/${encodeURIComponent(token.node.props.hashtag)}`,
|
style: 'color:var(--hashtag);'
|
||||||
style: 'color:var(--hashtag);'
|
|
||||||
}
|
|
||||||
}, `#${token.node.props.hashtag}`)];
|
}, `#${token.node.props.hashtag}`)];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'blockCode': {
|
case 'blockCode': {
|
||||||
return [h(MkCode, {
|
return [h(MkCode, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
code: token.node.props.code,
|
||||||
code: token.node.props.code,
|
lang: token.node.props.lang,
|
||||||
lang: token.node.props.lang,
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'inlineCode': {
|
case 'inlineCode': {
|
||||||
return [h(MkCode, {
|
return [h(MkCode, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
code: token.node.props.code,
|
||||||
code: token.node.props.code,
|
lang: token.node.props.lang,
|
||||||
lang: token.node.props.lang,
|
inline: true
|
||||||
inline: true
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'quote': {
|
case 'quote': {
|
||||||
if (this.shouldBreak) {
|
if (this.shouldBreak) {
|
||||||
return [h('div', {
|
return [h('div', {
|
||||||
attrs: {
|
class: 'quote'
|
||||||
class: 'quote'
|
|
||||||
}
|
|
||||||
}, genEl(token.children))];
|
}, genEl(token.children))];
|
||||||
} else {
|
} else {
|
||||||
return [h('span', {
|
return [h('span', {
|
||||||
|
@ -226,57 +199,45 @@ export default defineComponent({
|
||||||
|
|
||||||
case 'title': {
|
case 'title': {
|
||||||
return [h('div', {
|
return [h('div', {
|
||||||
attrs: {
|
class: 'title'
|
||||||
class: 'title'
|
|
||||||
}
|
|
||||||
}, genEl(token.children))];
|
}, genEl(token.children))];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'emoji': {
|
case 'emoji': {
|
||||||
return [h('mk-emoji', {
|
return [h('mk-emoji', {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
attrs: {
|
emoji: token.node.props.emoji,
|
||||||
emoji: token.node.props.emoji,
|
name: token.node.props.name,
|
||||||
name: token.node.props.name
|
customEmojis: this.customEmojis,
|
||||||
},
|
normal: this.plain
|
||||||
props: {
|
|
||||||
customEmojis: this.customEmojis,
|
|
||||||
normal: this.plain
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'mathInline': {
|
case 'mathInline': {
|
||||||
return [h(MkFormula, {
|
return [h(MkFormula, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
formula: token.node.props.formula,
|
||||||
formula: token.node.props.formula,
|
block: false
|
||||||
block: false
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'mathBlock': {
|
case 'mathBlock': {
|
||||||
return [h(MkFormula, {
|
return [h(MkFormula, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
formula: token.node.props.formula,
|
||||||
formula: token.node.props.formula,
|
block: true
|
||||||
block: true
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'search': {
|
case 'search': {
|
||||||
return [h(MkGoogle, {
|
return [h(MkGoogle, {
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
props: {
|
q: token.node.props.query
|
||||||
q: token.node.props.query
|
|
||||||
}
|
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
console.log('unknown ast type:', token.node.type);
|
console.log('unrecognized ast type:', token.node.type);
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue, { PropType } from 'vue';
|
import { defineComponent, PropType } from 'vue';
|
||||||
import XWindow from './window.vue';
|
import XWindow from './window.vue';
|
||||||
import MkSwitch from './ui/switch.vue';
|
import MkSwitch from './ui/switch.vue';
|
||||||
import MkInfo from './ui/info.vue';
|
import MkInfo from './ui/info.vue';
|
||||||
import MkButton from './ui/button.vue';
|
import MkButton from './ui/button.vue';
|
||||||
import { notificationTypes } from '../../types';
|
import { notificationTypes } from '../../types';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XWindow,
|
XWindow,
|
||||||
MkSwitch,
|
MkSwitch,
|
||||||
|
|
|
@ -66,6 +66,7 @@ import XReactionIcon from './reaction-icon.vue';
|
||||||
import MkFollowButton from './follow-button.vue';
|
import MkFollowButton from './follow-button.vue';
|
||||||
import notePage from '../filters/note';
|
import notePage from '../filters/note';
|
||||||
import { userPage } from '../filters/user';
|
import { userPage } from '../filters/user';
|
||||||
|
import { locale } from '../i18n';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
@ -89,7 +90,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
getNoteSummary: (text: string) => noteSummary(text, this.$root.i18n.messages[this.$root.i18n.locale]),
|
getNoteSummary: (text: string) => noteSummary(text, locale),
|
||||||
followRequestDone: false,
|
followRequestDone: false,
|
||||||
groupInviteDone: false,
|
groupInviteDone: false,
|
||||||
connection: null,
|
connection: null,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="ulveipgl">
|
<div class="ulveipgl" :style="{ pointerEvents: closing ? 'none' : 'auto' }">
|
||||||
<transition :name="$store.state.device.animation ? 'form-fade' : ''" appear @after-leave="$emit('closed');">
|
<transition :name="$store.state.device.animation ? 'form-fade' : ''" appear @after-leave="$store.commit('setPostForm', null)">
|
||||||
<div class="bg _modalBg" ref="bg" v-if="show" @click="close()"></div>
|
<div class="bg _modalBg" ref="bg" v-if="!closing" @click="close()"></div>
|
||||||
</transition>
|
</transition>
|
||||||
<div class="main" ref="main" @click.self="close()" @keydown="onKeydown">
|
<div class="main" ref="main" @click.self="close()" @keydown="onKeydown">
|
||||||
<transition :name="$store.state.device.animation ? 'form' : ''" appear
|
<transition :name="$store.state.device.animation ? 'form' : ''" appear
|
||||||
@after-leave="destroyDom"
|
@after-leave="destroyDom"
|
||||||
>
|
>
|
||||||
<x-post-form ref="form"
|
<x-post-form ref="form"
|
||||||
v-if="show"
|
v-if="!closing"
|
||||||
:reply="reply"
|
:reply="reply"
|
||||||
:renote="renote"
|
:renote="renote"
|
||||||
:mention="mention"
|
:mention="mention"
|
||||||
|
@ -18,7 +18,8 @@
|
||||||
:instant="instant"
|
:instant="instant"
|
||||||
@posted="onPosted"
|
@posted="onPosted"
|
||||||
@cancel="onCanceled"
|
@cancel="onCanceled"
|
||||||
style="border-radius: var(--radius);"/>
|
style="border-radius: var(--radius);"
|
||||||
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,7 +68,7 @@ export default defineComponent({
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: true
|
closing: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -77,9 +78,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.show = false;
|
this.closing = true;
|
||||||
(this.$refs.bg as any).style.pointerEvents = 'none';
|
|
||||||
(this.$refs.main as any).style.pointerEvents = 'none';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onPosted() {
|
onPosted() {
|
||||||
|
|
|
@ -193,6 +193,7 @@ export default defineComponent({
|
||||||
id,
|
id,
|
||||||
v,
|
v,
|
||||||
focused,
|
focused,
|
||||||
|
invalid,
|
||||||
changed,
|
changed,
|
||||||
filled,
|
filled,
|
||||||
inputEl,
|
inputEl,
|
||||||
|
|
|
@ -295,7 +295,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
post() {
|
post() {
|
||||||
this.$root.post();
|
this.$store.commit('setPostForm', {});
|
||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
|
|
|
@ -12,5 +12,5 @@ export default function(app: App) {
|
||||||
app.directive('user-preview', userPreview);
|
app.directive('user-preview', userPreview);
|
||||||
app.directive('size', size);
|
app.directive('size', size);
|
||||||
//app.directive('particle', particle);
|
//app.directive('particle', particle);
|
||||||
//app.directive('tooltip', tooltip);
|
app.directive('tooltip', tooltip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Directive } from 'vue';
|
||||||
import MkTooltip from '../components/ui/tooltip.vue';
|
import MkTooltip from '../components/ui/tooltip.vue';
|
||||||
import { isDeviceTouch } from '../scripts/is-device-touch';
|
import { isDeviceTouch } from '../scripts/is-device-touch';
|
||||||
|
|
||||||
|
@ -5,7 +6,7 @@ const start = isDeviceTouch ? 'touchstart' : 'mouseover';
|
||||||
const end = isDeviceTouch ? 'touchend' : 'mouseleave';
|
const end = isDeviceTouch ? 'touchend' : 'mouseleave';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
bind(el: HTMLElement, binding, vn) {
|
mounted(el: HTMLElement, binding, vn) {
|
||||||
const self = (el as any)._tooltipDirective_ = {} as any;
|
const self = (el as any)._tooltipDirective_ = {} as any;
|
||||||
|
|
||||||
self.text = binding.value as string;
|
self.text = binding.value as string;
|
||||||
|
@ -55,8 +56,8 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
unbind(el, binding, vn) {
|
unmounted(el, binding, vn) {
|
||||||
const self = el._tooltipDirective_;
|
const self = el._tooltipDirective_;
|
||||||
clearInterval(self.checkTimer);
|
clearInterval(self.checkTimer);
|
||||||
},
|
},
|
||||||
};
|
} as Directive;
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { createI18n } from 'vue-i18n';
|
||||||
|
import { clientDb, get, count } from './db';
|
||||||
|
import { setI18nContexts } from './scripts/set-i18n-contexts';
|
||||||
|
import { version, langs, getLocale } from './config';
|
||||||
|
|
||||||
|
let _lang = localStorage.getItem('lang');
|
||||||
|
|
||||||
|
if (_lang == null) {
|
||||||
|
if (langs.map(x => x[0]).includes(navigator.language)) {
|
||||||
|
_lang = navigator.language;
|
||||||
|
} else {
|
||||||
|
_lang = langs.map(x => x[0]).find(x => x.split('-')[0] == navigator.language);
|
||||||
|
|
||||||
|
if (_lang == null) {
|
||||||
|
// Fallback
|
||||||
|
_lang = 'en-US';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem('lang', _lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const lang = _lang;
|
||||||
|
|
||||||
|
export const locale = await count(clientDb.i18n).then(async n => {
|
||||||
|
if (n === 0) return await setI18nContexts(_lang, version);
|
||||||
|
if ((await get('_version_', clientDb.i18n) !== version)) return await setI18nContexts(_lang, version, true);
|
||||||
|
|
||||||
|
return await getLocale();
|
||||||
|
});
|
||||||
|
|
||||||
|
export const i18n = createI18n({
|
||||||
|
legacy: true,
|
||||||
|
sync: false,
|
||||||
|
locale: _lang,
|
||||||
|
messages: { [_lang]: locale }
|
||||||
|
});
|
|
@ -5,7 +5,6 @@
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import VueMeta from 'vue-meta';
|
import VueMeta from 'vue-meta';
|
||||||
import VAnimateCss from 'v-animate-css';
|
import VAnimateCss from 'v-animate-css';
|
||||||
import { createI18n } from 'vue-i18n';
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||||
import { AiScript } from '@syuilo/aiscript';
|
import { AiScript } from '@syuilo/aiscript';
|
||||||
import { deserialize } from '@syuilo/aiscript/built/serializer';
|
import { deserialize } from '@syuilo/aiscript/built/serializer';
|
||||||
|
@ -16,14 +15,13 @@ import Stream from './scripts/stream';
|
||||||
import widgets from './widgets';
|
import widgets from './widgets';
|
||||||
import directives from './directives';
|
import directives from './directives';
|
||||||
import components from './components';
|
import components from './components';
|
||||||
import { version, langs, getLocale, apiUrl } from './config';
|
import { version, apiUrl } from './config';
|
||||||
import { store } from './store';
|
import { store } from './store';
|
||||||
import { router } from './router';
|
import { router } from './router';
|
||||||
import { applyTheme, lightTheme } from './scripts/theme';
|
import { applyTheme, lightTheme } from './scripts/theme';
|
||||||
import { isDeviceDarkmode } from './scripts/is-device-darkmode';
|
import { isDeviceDarkmode } from './scripts/is-device-darkmode';
|
||||||
import { clientDb, get, count } from './db';
|
|
||||||
import { setI18nContexts } from './scripts/set-i18n-contexts';
|
|
||||||
import { createPluginEnv } from './scripts/aiscript/api';
|
import { createPluginEnv } from './scripts/aiscript/api';
|
||||||
|
import { i18n, lang } from './i18n';
|
||||||
|
|
||||||
console.info(`Misskey v${version}`);
|
console.info(`Misskey v${version}`);
|
||||||
|
|
||||||
|
@ -41,25 +39,6 @@ window.addEventListener('resize', () => {
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Detect the user language
|
|
||||||
let lang = localStorage.getItem('lang');
|
|
||||||
|
|
||||||
if (lang == null) {
|
|
||||||
if (langs.map(x => x[0]).includes(navigator.language)) {
|
|
||||||
lang = navigator.language;
|
|
||||||
} else {
|
|
||||||
lang = langs.map(x => x[0]).find(x => x.split('-')[0] == navigator.language);
|
|
||||||
|
|
||||||
if (lang == null) {
|
|
||||||
// Fallback
|
|
||||||
lang = 'en-US';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem('lang', lang);
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
// Detect the user agent
|
// Detect the user agent
|
||||||
const ua = navigator.userAgent.toLowerCase();
|
const ua = navigator.userAgent.toLowerCase();
|
||||||
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
||||||
|
@ -151,28 +130,11 @@ const app = createApp(Root, {
|
||||||
|
|
||||||
app.use(store);
|
app.use(store);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
app.use(i18n);
|
||||||
app.use(VueHotkey);
|
app.use(VueHotkey);
|
||||||
app.use(VAnimateCss);
|
app.use(VAnimateCss);
|
||||||
app.component('fa', FontAwesomeIcon);
|
app.component('fa', FontAwesomeIcon);
|
||||||
|
|
||||||
//#region Init i18n
|
|
||||||
const locale = await count(clientDb.i18n).then(async n => {
|
|
||||||
if (n === 0) return await setI18nContexts(lang, version);
|
|
||||||
if ((await get('_version_', clientDb.i18n) !== version)) return await setI18nContexts(lang, version, true);
|
|
||||||
|
|
||||||
return await getLocale();
|
|
||||||
});
|
|
||||||
|
|
||||||
const i18n = createI18n({
|
|
||||||
legacy: true,
|
|
||||||
sync: false,
|
|
||||||
locale: lang,
|
|
||||||
messages: { [lang]: locale }
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(i18n);
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
widgets(app);
|
widgets(app);
|
||||||
directives(app);
|
directives(app);
|
||||||
components(app);
|
components(app);
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
<DeckUI v-if="deckmode"/>
|
<DeckUI v-if="deckmode"/>
|
||||||
<DefaultUI v-else/>
|
<DefaultUI v-else/>
|
||||||
|
|
||||||
<XPostFormDialog v-if="$store.state.postForm" v-bind="$store.state.postForm"
|
<XPostFormDialog v-if="$store.state.postForm" v-bind="$store.state.postForm"/>
|
||||||
@done="onDialogDone" @closed="onDialogClosed"/>
|
|
||||||
|
|
||||||
<XDialog v-if="dialog" v-bind="dialog" :key="dialog.id"/>
|
<XDialog v-if="dialog" v-bind="dialog" :key="dialog.id"/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -19,6 +18,7 @@ export default defineComponent({
|
||||||
DefaultUI,
|
DefaultUI,
|
||||||
DeckUI,
|
DeckUI,
|
||||||
XDialog: defineAsyncComponent(() => import('./components/dialog.vue')),
|
XDialog: defineAsyncComponent(() => import('./components/dialog.vue')),
|
||||||
|
XPostFormDialog: defineAsyncComponent(() => import('./components/post-form-dialog.vue')),
|
||||||
},
|
},
|
||||||
|
|
||||||
metaInfo: {
|
metaInfo: {
|
||||||
|
|
|
@ -115,6 +115,7 @@ export const store = createStore({
|
||||||
text: string;
|
text: string;
|
||||||
result: any;
|
result: any;
|
||||||
}[],
|
}[],
|
||||||
|
postForm: null,
|
||||||
fullView: false,
|
fullView: false,
|
||||||
|
|
||||||
// Plugin
|
// Plugin
|
||||||
|
@ -276,6 +277,11 @@ export const store = createStore({
|
||||||
state.dialogs = state.dialogs.filter(d => d.id !== dialogId);
|
state.dialogs = state.dialogs.filter(d => d.id !== dialogId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setPostForm(state, postForm) {
|
||||||
|
if (state.postForm != null && postForm != null) return;
|
||||||
|
state.postForm = postForm;
|
||||||
|
},
|
||||||
|
|
||||||
setFullView(state, v) {
|
setFullView(state, v) {
|
||||||
state.fullView = v;
|
state.fullView = v;
|
||||||
},
|
},
|
||||||
|
|
32
yarn.lock
32
yarn.lock
|
@ -3509,14 +3509,15 @@ escodegen@^1.14.1:
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
source-map "~0.6.1"
|
source-map "~0.6.1"
|
||||||
|
|
||||||
eslint-plugin-vue@6.2.2:
|
eslint-plugin-vue@7.0.0-beta.3:
|
||||||
version "6.2.2"
|
version "7.0.0-beta.3"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.2.2.tgz#27fecd9a3a24789b0f111ecdd540a9e56198e0fe"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-7.0.0-beta.3.tgz#37a4fedf46db74cdb3be268390b4541eb7a810b7"
|
||||||
integrity sha512-Nhc+oVAHm0uz/PkJAWscwIT4ijTrK5fqNqz9QB1D35SbbuMG1uB6Yr5AJpvPSWg+WOw7nYNswerYh0kOk64gqQ==
|
integrity sha512-/p23IRPN9gFNN7dzesrctt06Kvs9E3VRB8BGIAPSEaQNk5yhlKUzntPARjUpsTWW+DQg0mqglZptfkUJK4+4EQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
|
eslint-utils "^2.1.0"
|
||||||
natural-compare "^1.4.0"
|
natural-compare "^1.4.0"
|
||||||
semver "^5.6.0"
|
semver "^7.3.2"
|
||||||
vue-eslint-parser "^7.0.0"
|
vue-eslint-parser "^7.1.0"
|
||||||
|
|
||||||
eslint-scope@^5.0.0:
|
eslint-scope@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
|
@ -3541,6 +3542,13 @@ eslint-utils@^2.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint-visitor-keys "^1.1.0"
|
eslint-visitor-keys "^1.1.0"
|
||||||
|
|
||||||
|
eslint-utils@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27"
|
||||||
|
integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==
|
||||||
|
dependencies:
|
||||||
|
eslint-visitor-keys "^1.1.0"
|
||||||
|
|
||||||
eslint-visitor-keys@^1.1.0:
|
eslint-visitor-keys@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
|
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
|
||||||
|
@ -3593,7 +3601,7 @@ eslint@7.4.0:
|
||||||
text-table "^0.2.0"
|
text-table "^0.2.0"
|
||||||
v8-compile-cache "^2.0.3"
|
v8-compile-cache "^2.0.3"
|
||||||
|
|
||||||
espree@^6.1.2:
|
espree@^6.2.1:
|
||||||
version "6.2.1"
|
version "6.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a"
|
resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a"
|
||||||
integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==
|
integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==
|
||||||
|
@ -10083,15 +10091,15 @@ vue-cropperjs@4.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
cropperjs "^1.5.6"
|
cropperjs "^1.5.6"
|
||||||
|
|
||||||
vue-eslint-parser@^7.0.0:
|
vue-eslint-parser@^7.1.0:
|
||||||
version "7.0.0"
|
version "7.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.0.0.tgz#a4ed2669f87179dedd06afdd8736acbb3a3864d6"
|
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.1.0.tgz#9cdbcc823e656b087507a1911732b867ac101e83"
|
||||||
integrity sha512-yR0dLxsTT7JfD2YQo9BhnQ6bUTLsZouuzt9SKRP7XNaZJV459gvlsJo4vT2nhZ/2dH9j3c53bIx9dnqU2prM9g==
|
integrity sha512-Kr21uPfthDc63nDl27AGQEhtt9VrZ9nkYk/NTftJ2ws9XiJwzJJCnCr3AITQ2jpRMA0XPGDECxYH8E027qMK9Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
debug "^4.1.1"
|
debug "^4.1.1"
|
||||||
eslint-scope "^5.0.0"
|
eslint-scope "^5.0.0"
|
||||||
eslint-visitor-keys "^1.1.0"
|
eslint-visitor-keys "^1.1.0"
|
||||||
espree "^6.1.2"
|
espree "^6.2.1"
|
||||||
esquery "^1.0.1"
|
esquery "^1.0.1"
|
||||||
lodash "^4.17.15"
|
lodash "^4.17.15"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue