From cb965feab4d8733830d0b79ab77fd866012fbfef Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 5 Sep 2020 19:38:57 +0900 Subject: [PATCH] wi --- package.json | 2 +- src/client/components/mfm.ts | 107 ++++++------------ .../notification-setting-window.vue | 4 +- src/client/components/notification.vue | 3 +- src/client/components/post-form-dialog.vue | 17 ++- src/client/components/ui/input.vue | 1 + src/client/default.vue | 2 +- src/client/directives/index.ts | 2 +- src/client/directives/tooltip.ts | 7 +- src/client/i18n.ts | 37 ++++++ src/client/init.ts | 44 +------ src/client/root.vue | 4 +- src/client/store.ts | 6 + yarn.lock | 32 ++++-- 14 files changed, 122 insertions(+), 146 deletions(-) create mode 100644 src/client/i18n.ts diff --git a/package.json b/package.json index 9ce6e2a16b..44b5479632 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "double-ended-queue": "2.1.0-0", "escape-regexp": "0.0.1", "eslint": "7.4.0", - "eslint-plugin-vue": "6.2.2", + "eslint-plugin-vue": "7.0.0-beta.3", "eventemitter3": "4.0.4", "feed": "4.2.1", "fibers": "5.0.0", diff --git a/src/client/components/mfm.ts b/src/client/components/mfm.ts index ea3e598c9a..e604915974 100644 --- a/src/client/components/mfm.ts +++ b/src/client/components/mfm.ts @@ -9,6 +9,7 @@ import MkFormula from './formula.vue'; import MkCode from './code.vue'; import MkGoogle from './google.vue'; import { host } from '../config'; +import { RouterLink } from 'vue-router'; export default defineComponent({ props: { @@ -71,17 +72,13 @@ export default defineComponent({ case 'italic': { return h('i', { - attrs: { - style: 'font-style: oblique;' - }, + style: 'font-style: oblique;' }, genEl(token.children)); } case 'big': { return h('strong', { - attrs: { - style: `display: inline-block; font-size: 150%;` - }, + style: `display: inline-block; font-size: 150%;`, directives: [this.$store.state.device.animatedMfm ? { name: 'animate-css', value: { classes: 'tada', iteration: 'infinite' } @@ -99,17 +96,13 @@ export default defineComponent({ case 'center': { return [h('div', { - attrs: { - style: 'text-align:center;' - } + style: 'text-align:center;' }, genEl(token.children))]; } case 'motion': { return h('span', { - attrs: { - style: 'display: inline-block;' - }, + style: 'display: inline-block;', directives: [this.$store.state.device.animatedMfm ? { name: 'animate-css', value: { classes: 'rubberBand', iteration: 'infinite' } @@ -125,95 +118,75 @@ export default defineComponent({ const style = this.$store.state.device.animatedMfm ? `animation: spin 1.5s linear infinite; animation-direction: ${direction};` : ''; return h('span', { - attrs: { - style: 'display: inline-block;' + style - }, + style: 'display: inline-block;' + style }, genEl(token.children)); } case 'jump': { 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)); } case 'flip': { return h('span', { - attrs: { - style: 'display: inline-block; transform: scaleX(-1);' - }, + style: 'display: inline-block; transform: scaleX(-1);' }, genEl(token.children)); } case 'url': { return [h(MkUrl, { key: Math.random(), - props: { - url: token.node.props.url, - rel: 'nofollow noopener', - }, + url: token.node.props.url, + rel: 'nofollow noopener', })]; } case 'link': { return [h(MkLink, { key: Math.random(), - props: { - url: token.node.props.url, - rel: 'nofollow noopener', - }, + url: token.node.props.url, + rel: 'nofollow noopener', }, genEl(token.children))]; } case 'mention': { return [h(MkMention, { key: Math.random(), - props: { - 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 - } + 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 })]; } case 'hashtag': { - return [h('router-link', { + return [h(RouterLink, { key: Math.random(), - attrs: { - to: this.isNote ? `/tags/${encodeURIComponent(token.node.props.hashtag)}` : `/explore/tags/${encodeURIComponent(token.node.props.hashtag)}`, - style: 'color:var(--hashtag);' - } + to: this.isNote ? `/tags/${encodeURIComponent(token.node.props.hashtag)}` : `/explore/tags/${encodeURIComponent(token.node.props.hashtag)}`, + style: 'color:var(--hashtag);' }, `#${token.node.props.hashtag}`)]; } case 'blockCode': { return [h(MkCode, { key: Math.random(), - props: { - code: token.node.props.code, - lang: token.node.props.lang, - } + code: token.node.props.code, + lang: token.node.props.lang, })]; } case 'inlineCode': { return [h(MkCode, { key: Math.random(), - props: { - code: token.node.props.code, - lang: token.node.props.lang, - inline: true - } + code: token.node.props.code, + lang: token.node.props.lang, + inline: true })]; } case 'quote': { if (this.shouldBreak) { return [h('div', { - attrs: { - class: 'quote' - } + class: 'quote' }, genEl(token.children))]; } else { return [h('span', { @@ -226,57 +199,45 @@ export default defineComponent({ case 'title': { return [h('div', { - attrs: { - class: 'title' - } + class: 'title' }, genEl(token.children))]; } case 'emoji': { return [h('mk-emoji', { key: Math.random(), - attrs: { - emoji: token.node.props.emoji, - name: token.node.props.name - }, - props: { - customEmojis: this.customEmojis, - normal: this.plain - } + emoji: token.node.props.emoji, + name: token.node.props.name, + customEmojis: this.customEmojis, + normal: this.plain })]; } case 'mathInline': { return [h(MkFormula, { key: Math.random(), - props: { - formula: token.node.props.formula, - block: false - } + formula: token.node.props.formula, + block: false })]; } case 'mathBlock': { return [h(MkFormula, { key: Math.random(), - props: { - formula: token.node.props.formula, - block: true - } + formula: token.node.props.formula, + block: true })]; } case 'search': { return [h(MkGoogle, { key: Math.random(), - props: { - q: token.node.props.query - } + q: token.node.props.query })]; } default: { - console.log('unknown ast type:', token.node.type); + console.log('unrecognized ast type:', token.node.type); return []; } diff --git a/src/client/components/notification-setting-window.vue b/src/client/components/notification-setting-window.vue index 0fdf39a5ea..8bcc1cc271 100644 --- a/src/client/components/notification-setting-window.vue +++ b/src/client/components/notification-setting-window.vue @@ -19,14 +19,14 @@