Merge tag '2023.12.1' into merge-upstream
This commit is contained in:
commit
018ff4cbda
336 changed files with 1938 additions and 1116 deletions
|
|
@ -47,6 +47,7 @@ export type AsUiMfm = AsUiComponentBase & {
|
|||
bold?: boolean;
|
||||
color?: string;
|
||||
font?: 'serif' | 'sans-serif' | 'monospace';
|
||||
onClickEv?: (evId: string) => void
|
||||
};
|
||||
|
||||
export type AsUiButton = AsUiComponentBase & {
|
||||
|
|
@ -230,6 +231,8 @@ function getMfmOptions(def: values.Value | undefined): Omit<AsUiMfm, 'id' | 'typ
|
|||
if (color) utils.assertString(color);
|
||||
const font = def.value.get('font');
|
||||
if (font) utils.assertString(font);
|
||||
const onClickEv = def.value.get('onClickEv');
|
||||
if (onClickEv) utils.assertFunction(onClickEv);
|
||||
|
||||
return {
|
||||
text: text?.value,
|
||||
|
|
@ -237,6 +240,9 @@ function getMfmOptions(def: values.Value | undefined): Omit<AsUiMfm, 'id' | 'typ
|
|||
bold: bold?.value,
|
||||
color: color?.value,
|
||||
font: font?.value,
|
||||
onClickEv: (evId: string) => {
|
||||
if (onClickEv) call(onClickEv, values.STR(evId));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export function getCopyNoteLinkMenu(note: Misskey.entities.Note, text: string):
|
|||
export function getNoteMenu(props: {
|
||||
note: Misskey.entities.Note;
|
||||
menuButton: Ref<HTMLElement>;
|
||||
translation: Ref<any>;
|
||||
translation: Ref<Misskey.entities.NotesTranslateResponse | null>;
|
||||
translating: Ref<boolean>;
|
||||
isDeleted: Ref<boolean>;
|
||||
currentClip?: Misskey.entities.Clip;
|
||||
|
|
|
|||
61
packages/frontend/src/scripts/mfm-function-picker.ts
Normal file
61
packages/frontend/src/scripts/mfm-function-picker.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Ref, nextTick } from 'vue';
|
||||
import * as os from '@/os.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { MFM_TAGS } from '@/const.js';
|
||||
|
||||
/**
|
||||
* MFMの装飾のリストを表示する
|
||||
*/
|
||||
export function mfmFunctionPicker(src: any, textArea: HTMLInputElement | HTMLTextAreaElement, textRef: Ref<string>) {
|
||||
return new Promise((res, rej) => {
|
||||
os.popupMenu([{
|
||||
text: i18n.ts.addMfmFunction,
|
||||
type: 'label',
|
||||
}, ...getFunctionList(textArea, textRef)], src);
|
||||
});
|
||||
}
|
||||
|
||||
function getFunctionList(textArea: HTMLInputElement | HTMLTextAreaElement, textRef: Ref<string>) : object[] {
|
||||
const ret: object[] = [];
|
||||
MFM_TAGS.forEach(tag => {
|
||||
ret.push({
|
||||
text: tag,
|
||||
icon: 'ti ti-icons',
|
||||
action: () => add(textArea, textRef, tag),
|
||||
});
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
function add(textArea: HTMLInputElement | HTMLTextAreaElement, textRef: Ref<string>, type: string) {
|
||||
const caretStart: number = textArea.selectionStart as number;
|
||||
const caretEnd: number = textArea.selectionEnd as number;
|
||||
|
||||
MFM_TAGS.forEach(tag => {
|
||||
if (type === tag) {
|
||||
if (caretStart === caretEnd) {
|
||||
// 単純にFunctionを追加
|
||||
const trimmedText = `${textRef.value.substring(0, caretStart)}$[${type} ]${textRef.value.substring(caretEnd)}`;
|
||||
textRef.value = trimmedText;
|
||||
} else {
|
||||
// 選択範囲を囲むようにFunctionを追加
|
||||
const trimmedText = `${textRef.value.substring(0, caretStart)}$[${type} ${textRef.value.substring(caretStart, caretEnd)}]${textRef.value.substring(caretEnd)}`;
|
||||
textRef.value = trimmedText;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const nextCaretStart: number = caretStart + 3 + type.length;
|
||||
const nextCaretEnd: number = caretEnd + 3 + type.length;
|
||||
|
||||
// キャレットを戻す
|
||||
nextTick(() => {
|
||||
textArea.focus();
|
||||
textArea.setSelectionRange(nextCaretStart, nextCaretEnd);
|
||||
});
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import isAnimated from 'is-file-animated';
|
||||
import { isWebpSupported } from './isWebpSupported';
|
||||
import { isWebpSupported } from './isWebpSupported.js';
|
||||
import type { BrowserImageResizerConfig } from 'browser-image-resizer';
|
||||
|
||||
const compressTypeMap = {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,12 @@ export function useChartTooltip(opts: { position: 'top' | 'middle' } = { positio
|
|||
const tooltipShowing = ref(false);
|
||||
const tooltipX = ref(0);
|
||||
const tooltipY = ref(0);
|
||||
const tooltipTitle = ref(null);
|
||||
const tooltipSeries = ref(null);
|
||||
const tooltipTitle = ref<string | null>(null);
|
||||
const tooltipSeries = ref<{
|
||||
backgroundColor: string;
|
||||
borderColor: string;
|
||||
text: string;
|
||||
}[] | null>(null);
|
||||
let disposeTooltipComponent;
|
||||
|
||||
os.popup(MkChartTooltip, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue