refactor: MkCodeをブロックとインラインで別コンポーネント化する (#13026)

* Create MkCodeInline.vue

* Update MkCode.vue

* Update MkMisskeyFlavoredMarkdown.ts

* Update flash.vue

* Update MkCodeInline.vue
This commit is contained in:
FineArchs
2024-01-18 12:16:12 +09:00
committed by GitHub
parent 1e237a7df5
commit fc7cd636a3
4 changed files with 30 additions and 16 deletions

View File

@@ -4,8 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<code v-if="inline" :class="$style.codeInlineRoot">{{ code }}</code>
<div v-else :class="$style.codeBlockRoot">
<div :class="$style.codeBlockRoot">
<button :class="$style.codeBlockCopyButton" class="_button" @click="copy">
<i class="ti ti-copy"></i>
</button>
@@ -36,7 +35,6 @@ import copyToClipboard from '@/scripts/copy-to-clipboard.js';
const props = defineProps<{
code: string;
lang?: string;
inline?: boolean;
}>();
const show = ref(!defaultStore.state.dataSaver.code);
@@ -66,16 +64,6 @@ function copy() {
}
}
.codeInlineRoot {
display: inline-block;
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
overflow-wrap: anywhere;
color: #D4D4D4;
background: #1E1E1E;
padding: .1em;
border-radius: .3em;
}
.codeBlockFallbackRoot {
display: block;
overflow-wrap: anywhere;