feat: add position, scale , fg, and bg MFM from v13

This commit is contained in:
ThatOneCalculator 2023-02-12 20:25:23 -08:00
parent abff66eada
commit fa23360f13
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
3 changed files with 43 additions and 3 deletions

View File

@ -254,6 +254,35 @@ export default defineComponent({
style = `transform: ${rotate}(${degrees}deg); transform-origin: center center;`; style = `transform: ${rotate}(${degrees}deg); transform-origin: center center;`;
break; break;
} }
case "position": {
if (!defaultStore.state.advancedMfm) break;
const x = parseFloat(token.props.args.x ?? "0");
const y = parseFloat(token.props.args.y ?? "0");
style = `transform: translateX(${x}em) translateY(${y}em);`;
break;
}
case "scale": {
if (!defaultStore.state.advancedMfm) {
style = "";
break;
}
const x = Math.min(parseFloat(token.props.args.x ?? "1"), 5);
const y = Math.min(parseFloat(token.props.args.y ?? "1"), 5);
style = `transform: scale(${x}, ${y});`;
break;
}
case "fg": {
let color = token.props.args.color;
if (!/^[0-9a-f]{3,6}$/i.test(color)) color = "f00";
style = `color: #${color};`;
break;
}
case "bg": {
let color = token.props.args.color;
if (!/^[0-9a-f]{3,6}$/i.test(color)) color = "f00";
style = `background-color: #${color};`;
break;
}
} }
if (style == null) { if (style == null) {
return h("span", {}, [ return h("span", {}, [

View File

@ -224,9 +224,16 @@ export function getNoteMenu(props: {
} }
function showReactions(): void { function showReactions(): void {
os.popup(defineAsyncComponent(() => import('@/components/MkReactedUsersDialog.vue')), { os.popup(
noteId: appearNote.id, defineAsyncComponent(
}, {}, 'closed'); () => import("@/components/MkReactedUsersDialog.vue"),
),
{
noteId: appearNote.id,
},
{},
"closed",
);
} }
async function translate(): Promise<void> { async function translate(): Promise<void> {

View File

@ -10,6 +10,10 @@ export const MFM_TAGS = [
"x2", "x2",
"x3", "x3",
"x4", "x4",
"scale",
"position",
"fg",
"bg",
"font", "font",
"blur", "blur",
"rainbow", "rainbow",