iceshrimp-legacy/packages/client/src/components/global/MkMisskeyFlavoredMarkdown.vue

373 lines
6.4 KiB
Vue
Raw Normal View History

<template>
2023-04-08 02:01:42 +02:00
<MfmCore
:text="text"
:plain="plain"
:nowrap="nowrap"
:author="author"
2023-07-17 00:32:32 +02:00
:custom-emojis="customEmojis"
:is-note="isNote"
2023-06-03 23:12:08 +02:00
class="mfm-object"
2023-06-06 01:40:48 +02:00
:class="{
nowrap,
advancedMfm: defaultStore.state.advancedMfm || advancedMfm,
}"
2023-04-08 02:01:42 +02:00
/>
</template>
<script lang="ts" setup>
2023-04-08 02:01:42 +02:00
import {} from "vue";
import MfmCore from "@/components/mfm";
import { defaultStore } from "@/store";
2023-04-08 02:01:42 +02:00
const props = withDefaults(
defineProps<{
text: string;
plain?: boolean;
nowrap?: boolean;
author?: any;
customEmojis?: any;
isNote?: boolean;
advancedMfm: boolean;
2023-04-08 02:01:42 +02:00
}>(),
{
plain: false,
nowrap: false,
author: null,
isNote: true,
2023-07-06 03:28:27 +02:00
},
2023-04-08 02:01:42 +02:00
);
</script>
<style lang="scss">
.content:not(.animatedMfm) {
.mfm-object:not(.advancedMfm) {
2023-06-03 23:12:08 +02:00
[style*="animation:"] {
animation: none !important;
}
[style*="transform:"] {
transform: none !important;
}
[style*="background-color:"] {
background: none !important;
}
[style*="color:"] {
color: inherit !important;
}
[style*="font-family:"] {
font-family: inherit !important;
}
2023-06-03 23:26:37 +02:00
[style*="clip-path:"] {
clip-path: none !important;
}
2023-06-03 23:12:08 +02:00
}
}
.mfm-object.advancedMfm,
2023-06-03 23:12:08 +02:00
.content.animatedMfm {
.mfm-x2 {
--mfm-zoom-size: 200%;
}
2023-06-03 23:12:08 +02:00
.mfm-x3 {
--mfm-zoom-size: 400%;
}
2023-06-03 23:12:08 +02:00
.mfm-x4 {
--mfm-zoom-size: 600%;
}
2023-04-08 02:01:42 +02:00
.mfm-x2,
.mfm-x3,
.mfm-x4 {
2023-06-03 23:12:08 +02:00
font-size: var(--mfm-zoom-size);
2023-04-08 02:01:42 +02:00
.mfm-x2,
.mfm-x3,
.mfm-x4 {
2023-06-03 23:12:08 +02:00
/* only half effective */
font-size: calc(var(--mfm-zoom-size) / 2 + 50%);
.mfm-x2,
.mfm-x3,
.mfm-x4 {
/* disabled */
font-size: 100%;
}
}
}
2023-06-03 23:12:08 +02:00
@keyframes mfm-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
2023-04-08 02:01:42 +02:00
}
2023-06-03 23:12:08 +02:00
@keyframes mfm-spinX {
0% {
transform: perspective(128px) rotateX(0deg);
}
100% {
transform: perspective(128px) rotateX(360deg);
}
2023-04-08 02:01:42 +02:00
}
2023-06-03 23:12:08 +02:00
@keyframes mfm-spinY {
0% {
transform: perspective(128px) rotateY(0deg);
}
100% {
transform: perspective(128px) rotateY(360deg);
}
2023-04-08 02:01:42 +02:00
}
2023-06-03 23:12:08 +02:00
@keyframes mfm-jump {
0% {
transform: translateY(0);
}
25% {
transform: translateY(-16px);
}
50% {
transform: translateY(0);
}
75% {
transform: translateY(-8px);
}
100% {
transform: translateY(0);
}
2023-04-08 02:01:42 +02:00
}
2023-06-03 23:12:08 +02:00
@keyframes mfm-bounce {
0% {
transform: translateY(0) scale(1, 1);
}
25% {
transform: translateY(-16px) scale(1, 1);
}
50% {
transform: translateY(0) scale(1, 1);
}
75% {
transform: translateY(0) scale(1.5, 0.75);
}
100% {
transform: translateY(0) scale(1, 1);
}
2023-04-08 02:01:42 +02:00
}
2020-11-08 09:08:51 +01:00
2023-06-03 23:12:08 +02:00
// const val = () => `translate(${Math.floor(Math.random() * 20) - 10}px, ${Math.floor(Math.random() * 20) - 10}px)`;
// let css = '';
// for (let i = 0; i <= 100; i += 5) { css += `${i}% { transform: ${val()} }\n`; }
@keyframes mfm-twitch {
0% {
transform: translate(7px, -2px);
}
5% {
transform: translate(-3px, 1px);
}
10% {
transform: translate(-7px, -1px);
}
15% {
transform: translate(0px, -1px);
}
20% {
transform: translate(-8px, 6px);
}
25% {
transform: translate(-4px, -3px);
}
30% {
transform: translate(-4px, -6px);
}
35% {
transform: translate(-8px, -8px);
}
40% {
transform: translate(4px, 6px);
}
45% {
transform: translate(-3px, 1px);
}
50% {
transform: translate(2px, -10px);
}
55% {
transform: translate(-7px, 0px);
}
60% {
transform: translate(-2px, 4px);
}
65% {
transform: translate(3px, -8px);
}
70% {
transform: translate(6px, 7px);
}
75% {
transform: translate(-7px, -2px);
}
80% {
transform: translate(-7px, -8px);
}
85% {
transform: translate(9px, 3px);
}
90% {
transform: translate(-3px, -2px);
}
95% {
transform: translate(-10px, 2px);
}
100% {
transform: translate(-2px, -6px);
}
2023-04-08 02:01:42 +02:00
}
2023-06-03 23:12:08 +02:00
// const val = () => `translate(${Math.floor(Math.random() * 6) - 3}px, ${Math.floor(Math.random() * 6) - 3}px) rotate(${Math.floor(Math.random() * 24) - 12}deg)`;
// let css = '';
// for (let i = 0; i <= 100; i += 5) { css += `${i}% { transform: ${val()} }\n`; }
@keyframes mfm-shake {
0% {
transform: translate(-3px, -1px) rotate(-8deg);
}
5% {
transform: translate(0px, -1px) rotate(-10deg);
}
10% {
transform: translate(1px, -3px) rotate(0deg);
}
15% {
transform: translate(1px, 1px) rotate(11deg);
}
20% {
transform: translate(-2px, 1px) rotate(1deg);
}
25% {
transform: translate(-1px, -2px) rotate(-2deg);
}
30% {
transform: translate(-1px, 2px) rotate(-3deg);
}
35% {
transform: translate(2px, 1px) rotate(6deg);
}
40% {
transform: translate(-2px, -3px) rotate(-9deg);
}
45% {
transform: translate(0px, -1px) rotate(-12deg);
}
50% {
transform: translate(1px, 2px) rotate(10deg);
}
55% {
transform: translate(0px, -3px) rotate(8deg);
}
60% {
transform: translate(1px, -1px) rotate(8deg);
}
65% {
transform: translate(0px, -1px) rotate(-7deg);
}
70% {
transform: translate(-1px, -3px) rotate(6deg);
}
75% {
transform: translate(0px, -2px) rotate(4deg);
}
80% {
transform: translate(-2px, -1px) rotate(3deg);
}
85% {
transform: translate(1px, -3px) rotate(-10deg);
}
90% {
transform: translate(1px, 0px) rotate(3deg);
}
95% {
transform: translate(-2px, 0px) rotate(-3deg);
}
100% {
transform: translate(2px, 1px) rotate(2deg);
}
2023-04-08 02:01:42 +02:00
}
2023-06-03 23:12:08 +02:00
@keyframes mfm-rubberBand {
from {
transform: scale3d(1, 1, 1);
}
30% {
transform: scale3d(1.25, 0.75, 1);
}
40% {
transform: scale3d(0.75, 1.25, 1);
}
50% {
transform: scale3d(1.15, 0.85, 1);
}
65% {
transform: scale3d(0.95, 1.05, 1);
}
75% {
transform: scale3d(1.05, 0.95, 1);
}
to {
transform: scale3d(1, 1, 1);
}
2023-04-08 02:01:42 +02:00
}
2021-08-05 14:55:41 +02:00
2023-06-03 23:12:08 +02:00
@keyframes mfm-rainbow {
0% {
filter: hue-rotate(0deg) contrast(150%) saturate(150%);
}
100% {
filter: hue-rotate(360deg) contrast(150%) saturate(150%);
}
2023-04-08 02:01:42 +02:00
}
2023-05-15 05:18:58 +02:00
2023-06-03 23:12:08 +02:00
@keyframes mfm-fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
2023-05-23 02:00:50 +02:00
}
2023-05-15 05:18:58 +02:00
}
</style>
<style lang="scss" scoped>
2023-06-03 23:12:08 +02:00
.mfm-object {
white-space: pre-wrap;
&.nowrap {
white-space: pre;
word-wrap: normal; // https://codeday.me/jp/qa/20190424/690106.html
overflow: hidden;
text-overflow: ellipsis;
}
::v-deep(blockquote) {
display: block;
margin: 8px 0;
padding-left: 12px;
color: var(--fgTransparentWeak);
border-left: solid 4px var(--fgTransparent);
}
2020-02-01 09:10:56 +01:00
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 13:12:00 +02:00
::v-deep(pre) {
2020-02-01 09:10:56 +01:00
font-size: 0.8em;
}
2020-02-06 09:05:19 +01:00
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 13:12:00 +02:00
> ::v-deep(code) {
2020-10-19 06:17:37 +02:00
font-size: 0.8em;
2020-02-21 22:54:35 +01:00
word-break: break-all;
2020-10-19 06:17:37 +02:00
padding: 4px 6px;
2020-02-21 22:54:35 +01:00
}
}
</style>