Revert "tweak mfm cheat sheet style"

This reverts commit 4f19ccb040.
This commit is contained in:
fly_mc 2024-10-23 00:40:33 +08:00
parent 4f19ccb040
commit 5aaecdc344

View file

@ -90,6 +90,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div :class="$style.footerRight">
<button v-tooltip="i18n.ts.previewNoteText" class="_button" :class="[$style.footerButton, { [$style.previewButtonActive]: showPreview }]" @click="showPreview = !showPreview"><i class="ti ti-eye"></i></button>
<button v-tooltip="'MFM Cheatsheet'" class="_button" :class="$style.footerButton" @click="MFMWindow"><i class="ti ti-note"></i></button>
<!--<button v-tooltip="i18n.ts.more" class="_button" :class="$style.footerButton" @click="showingOptions = !showingOptions"><i class="ti ti-dots"></i></button>-->
</div>
</footer>
@ -105,6 +106,7 @@ import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor';
import { toASCII } from 'punycode/';
import autosize from 'autosize';
import { host, url } from '@@/js/config.js';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
import MkNotePreview from '@/components/MkNotePreview.vue';
@ -152,6 +154,7 @@ const props = withDefaults(defineProps<{
autofocus?: boolean;
freezeAfterPosted?: boolean;
mock?: boolean;
updateMode?: boolean;
}>(), {
initialVisibleUsers: () => [],
autofocus: true,
@ -372,6 +375,15 @@ function watchForDraft() {
watch(reactionAcceptance, () => saveDraft());
}
function MFMWindow() {
const { dispose } = os.popup(
defineAsyncComponent(() => import('@/components/MkMfmWindow.vue')),
{},
{
closed: () => dispose(),
});
}
function checkMissingMention() {
if (visibility.value === 'specified') {
const ast = mfm.parse(text.value);
@ -569,6 +581,8 @@ function clear() {
files.value = [];
poll.value = null;
quoteId.value = null;
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onKeydown(ev: KeyboardEvent) {
@ -577,6 +591,8 @@ function onKeydown(ev: KeyboardEvent) {
// justEndedComposition.value is for Safari, which keyDown occurs after compositionend.
// ev.isComposing is for another browsers.
if (ev.key === 'Escape' && !justEndedComposition.value && !ev.isComposing) emit('esc');
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onKeyup(ev: KeyboardEvent) {
@ -585,6 +601,8 @@ function onKeyup(ev: KeyboardEvent) {
function onCompositionUpdate(ev: CompositionEvent) {
imeText.value = ev.data;
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onCompositionEnd(ev: CompositionEvent) {
@ -641,6 +659,8 @@ async function onPaste(ev: ClipboardEvent) {
upload(file, `${fileName}.txt`);
});
}
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onDragover(ev) {
@ -796,6 +816,7 @@ async function post(ev?: MouseEvent) {
visibility: visibility.value,
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(u => u.id) : undefined,
reactionAcceptance: reactionAcceptance.value,
noteId: props.updateMode ? props.initialNote?.id : undefined,
};
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== '') {
@ -832,7 +853,7 @@ async function post(ev?: MouseEvent) {
}
posting.value = true;
misskeyApi('notes/create', postData, token).then(() => {
misskeyApi(props.updateMode ? 'notes/update' : 'notes/create', postData, token).then(() => {
if (props.freezeAfterPosted) {
posted.value = true;
} else {
@ -1048,6 +1069,7 @@ onMounted(() => {
}
nextTick(() => watchForDraft());
nextTick(() => textareaEl.value && autosize(textareaEl.value));
});
});
@ -1064,6 +1086,7 @@ defineExpose({
&.modal {
width: 100%;
max-width: 520px;
overflow-y: auto;
}
}
@ -1338,7 +1361,7 @@ html[data-color-scheme=light] .preview {
}
.footerRight {
flex: 0;
flex: 0.3;
margin-left: auto;
display: grid;
grid-auto-flow: row;