2023-09-24 11:35:25 +02:00
|
|
|
<template>
|
|
|
|
<div class='container mx-auto max-w-screen-xl px-6 py-6'>
|
|
|
|
<h1 class='text-2xl lg:text-3xl font-bold mb-4'>
|
|
|
|
{{ $t(`_mfmPlayground.title`) }}
|
|
|
|
</h1>
|
2023-09-26 14:57:26 +02:00
|
|
|
<div class='rounded-lg grid md:grid-cols-2 gap-4'>
|
|
|
|
<div>
|
|
|
|
{{ $t('_mfmPlayground.preview') }}
|
|
|
|
<div :class="$style.mfmRoot" class="mb-2 bg-white dark:bg-[#212529] border-gray-200 dark:border-gray-600">
|
|
|
|
<MkMfm :text="mfmText ?? ''" :baseHost="mfmHost" />
|
|
|
|
</div>
|
|
|
|
<div class="text-xs text-gray-500">{{ $t('_mfmPlayground.disclaimer') }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="space-y-4">
|
|
|
|
<div>
|
|
|
|
<div class="flex">
|
|
|
|
<label for="mfmPlaygroundMFM">{{ $t('_mfmPlayground.mfm') }}</label>
|
|
|
|
<div
|
|
|
|
class="ml-auto"
|
|
|
|
:class="[(mfmText?.length ?? 0) >= 5000 && 'font-bold text-red-600']"
|
|
|
|
>
|
|
|
|
{{ $t('_mfmPlayground.character', [ (mfmText?.length ?? 0) ]) }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<textarea
|
|
|
|
:rows="(mfmText || '').split('\n').length >= 8 ? (mfmText || '').split('\n').length + 5 : 10"
|
|
|
|
class="form-control"
|
|
|
|
id="mfmPlaygroundMFM"
|
|
|
|
v-model="mfmText"
|
|
|
|
></textarea>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<label for="mfmPlaygroundDomain">{{ $t('_mfmPlayground.domain') }}</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<input type="text" class="form-control" id="mfmPlaygroundDomain" v-model="mfmHost" />
|
|
|
|
<GNuxtLink :to="shareURL" target="_blank" class="btn btn-primary !text-white">{{ $t('_mfmPlayground.noteIt') }}<SendIco class="ml-1" /></GNuxtLink>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div class="flex">
|
|
|
|
<div class="w-1/2 md:w-1/3 pr-2 col-form-label">
|
|
|
|
絵文字が表示されないとき
|
|
|
|
</div>
|
|
|
|
<div class="w-1/2 md:w-2/3">
|
|
|
|
<button @click="clearEmojiCache()" class="btn w-full btn-outline-primary hover:!text-white">{{ $t('_mfmPlayground.clearEmojiCache') }}</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-24 11:35:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang='ts'>
|
2023-09-26 14:57:26 +02:00
|
|
|
import SendIco from 'bi/send-fill.svg';
|
|
|
|
import { parseURL, withQuery } from 'ufo';
|
|
|
|
|
2023-09-24 11:35:25 +02:00
|
|
|
definePageMeta({
|
2023-09-26 14:57:26 +02:00
|
|
|
layout: 'tools',
|
2023-09-24 11:35:25 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
const mfmText = ref<string>();
|
|
|
|
const mfmHost = ref<string>('misskey.io');
|
2023-09-26 14:57:26 +02:00
|
|
|
const shareURL = computed(() => {
|
|
|
|
const domain = 'https://' + (parseURL(mfmHost.value).host ?? mfmHost.value) + '/share';
|
|
|
|
return withQuery(domain, { text: mfmText.value });
|
|
|
|
})
|
|
|
|
|
|
|
|
function clearEmojiCache() {
|
|
|
|
if (process.client) {
|
|
|
|
localStorage.clear();
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
}
|
2023-09-24 11:35:25 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style module>
|
|
|
|
.mfmRoot {
|
2023-09-26 14:57:26 +02:00
|
|
|
@apply rounded-lg p-6 border break-words overflow-hidden;
|
2023-09-24 11:35:25 +02:00
|
|
|
font-family: Hiragino Maru Gothic Pro,BIZ UDGothic,Roboto,HelveticaNeue,Arial,sans-serif;
|
|
|
|
line-height: 1.35;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mfmRoot img {
|
|
|
|
display: inline;
|
|
|
|
}
|
|
|
|
</style>
|