From a0e859ebcb7fbb26b01131be4e79933da6d41efb Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Tue, 20 Sep 2022 14:07:00 -0400 Subject: [PATCH] client: Make MFM cheatsheet interactive again This reverts commit 9f0f5d1ab1aa6535dbf3e073876993a0517f4ca3. Commit cb87d03fe9d3ac01af26583d4cc124739d73d59d made the preview_* variables const and non-reactive likely by accident, which resulted in build errors and the examples no longer interactive. This makes the preview variables reactive, allowing the examples to be interactive once again. Changelog: Fixed --- packages/client/src/pages/mfm-cheat-sheet.vue | 115 +++++++++--------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/packages/client/src/pages/mfm-cheat-sheet.vue b/packages/client/src/pages/mfm-cheat-sheet.vue index 5d133b04d..efbf29ca6 100644 --- a/packages/client/src/pages/mfm-cheat-sheet.vue +++ b/packages/client/src/pages/mfm-cheat-sheet.vue @@ -9,7 +9,7 @@

{{ i18n.ts._mfm.mentionDescription }}

- +
@@ -19,7 +19,7 @@

{{ i18n.ts._mfm.hashtagDescription }}

- +
@@ -29,7 +29,7 @@

{{ i18n.ts._mfm.urlDescription }}

- +
@@ -39,7 +39,7 @@

{{ i18n.ts._mfm.linkDescription }}

- +
@@ -49,7 +49,7 @@

{{ i18n.ts._mfm.emojiDescription }}

- +
@@ -59,7 +59,7 @@

{{ i18n.ts._mfm.boldDescription }}

- +
@@ -69,7 +69,7 @@

{{ i18n.ts._mfm.smallDescription }}

- +
@@ -79,7 +79,7 @@

{{ i18n.ts._mfm.quoteDescription }}

- +
@@ -89,7 +89,7 @@

{{ i18n.ts._mfm.centerDescription }}

- +
@@ -99,7 +99,7 @@

{{ i18n.ts._mfm.inlineCodeDescription }}

- +
@@ -109,7 +109,7 @@

{{ i18n.ts._mfm.blockCodeDescription }}

- +
@@ -119,7 +119,7 @@

{{ i18n.ts._mfm.inlineMathDescription }}

- +
@@ -130,7 +130,7 @@

{{ i18n.ts._mfm.searchDescription }}

- +
@@ -141,7 +141,7 @@

{{ i18n.ts._mfm.flipDescription }}

- +
@@ -151,7 +151,7 @@

{{ i18n.ts._mfm.fontDescription }}

- +
@@ -161,7 +161,7 @@

{{ i18n.ts._mfm.x2Description }}

- +
@@ -171,7 +171,7 @@

{{ i18n.ts._mfm.x3Description }}

- +
@@ -181,7 +181,7 @@

{{ i18n.ts._mfm.x4Description }}

- +
@@ -191,7 +191,7 @@

{{ i18n.ts._mfm.blurDescription }}

- +
@@ -201,7 +201,7 @@

{{ i18n.ts._mfm.jellyDescription }}

- +
@@ -211,7 +211,7 @@

{{ i18n.ts._mfm.tadaDescription }}

- +
@@ -221,7 +221,7 @@

{{ i18n.ts._mfm.jumpDescription }}

- +
@@ -231,7 +231,7 @@

{{ i18n.ts._mfm.bounceDescription }}

- +
@@ -241,7 +241,7 @@

{{ i18n.ts._mfm.spinDescription }}

- +
@@ -251,7 +251,7 @@

{{ i18n.ts._mfm.shakeDescription }}

- +
@@ -261,7 +261,7 @@

{{ i18n.ts._mfm.twitchDescription }}

- +
@@ -271,7 +271,7 @@

{{ i18n.ts._mfm.rainbowDescription }}

- +
@@ -281,7 +281,7 @@

{{ i18n.ts._mfm.sparkleDescription }}

- MFM + MFM
@@ -291,7 +291,7 @@

{{ i18n.ts._mfm.rotateDescription }}

- MFM + MFM
@@ -305,35 +305,34 @@ import { definePageMetadata } from '@/scripts/page-metadata'; import { i18n } from '@/i18n'; import { instance } from '@/instance'; -const preview_mention = '@example'; -const preview_hashtag = '#test'; -const preview_url = 'https://example.com'; -const preview_link = `[${i18n.ts._mfm.dummy}](https://example.com)`; -const preview_emoji = instance.emojis.length ? `:${instance.emojis[0].name}:` : ':emojiname:'; -const preview_bold = `**${i18n.ts._mfm.dummy}**`; -const preview_small = `${i18n.ts._mfm.dummy}`; -const preview_center = `
${i18n.ts._mfm.dummy}
`; -const preview_inlineCode = '`<: "Hello, world!"`'; -const preview_blockCode = '```\n~ (#i, 100) {\n\t<: ? ((i % 15) = 0) "FizzBuzz"\n\t\t.? ((i % 3) = 0) "Fizz"\n\t\t.? ((i % 5) = 0) "Buzz"\n\t\t. i\n}\n```'; -const preview_inlineMath = '\\(x= \\frac{-b\' \\pm \\sqrt{(b\')^2-ac}}{a}\\)'; -const preview_quote = `> ${i18n.ts._mfm.dummy}`; -const preview_search = `${i18n.ts._mfm.dummy} ๆคœ็ดข`; -const preview_jelly = '$[jelly ๐Ÿฎ] $[jelly.speed=5s ๐Ÿฎ]'; -const preview_tada = '$[tada ๐Ÿฎ] $[tada.speed=5s ๐Ÿฎ]'; -const preview_jump = '$[jump ๐Ÿฎ] $[jump.speed=5s ๐Ÿฎ]'; -const preview_bounce = '$[bounce ๐Ÿฎ] $[bounce.speed=5s ๐Ÿฎ]'; -const preview_shake = '$[shake ๐Ÿฎ] $[shake.speed=5s ๐Ÿฎ]'; -const preview_twitch = '$[twitch ๐Ÿฎ] $[twitch.speed=5s ๐Ÿฎ]'; -const preview_spin = '$[spin ๐Ÿฎ] $[spin.left ๐Ÿฎ] $[spin.alternate ๐Ÿฎ]\n$[spin.x ๐Ÿฎ] $[spin.x,left ๐Ÿฎ] $[spin.x,alternate ๐Ÿฎ]\n$[spin.y ๐Ÿฎ] $[spin.y,left ๐Ÿฎ] $[spin.y,alternate ๐Ÿฎ]\n\n$[spin.speed=5s ๐Ÿฎ]'; -const preview_flip = `$[flip ${i18n.ts._mfm.dummy}]\n$[flip.v ${i18n.ts._mfm.dummy}]\n$[flip.h,v ${i18n.ts._mfm.dummy}]`; -const preview_font = `$[font.serif ${i18n.ts._mfm.dummy}]\n$[font.monospace ${i18n.ts._mfm.dummy}]\n$[font.cursive ${i18n.ts._mfm.dummy}]\n$[font.fantasy ${i18n.ts._mfm.dummy}]`; -const preview_x2 = '$[x2 ๐Ÿฎ]'; -const preview_x3 = '$[x3 ๐Ÿฎ]'; -const preview_x4 = '$[x4 ๐Ÿฎ]'; -const preview_blur = `$[blur ${i18n.ts._mfm.dummy}]`; -const preview_rainbow = '$[rainbow ๐Ÿฎ] $[rainbow.speed=5s ๐Ÿฎ]'; -const preview_sparkle = '$[sparkle ๐Ÿฎ]'; -const preview_rotate = '$[rotate ๐Ÿฎ]'; +let preview_mention = $ref('@example'); +let preview_hashtag = $ref('#test'); +let preview_url = $ref('https://example.com'); +let preview_link = $ref(`[${i18n.ts._mfm.dummy}](https://example.com)`); +let preview_emoji = $ref(instance.emojis.length ? `:${instance.emojis[0].name}:` : ':emojiname:'); +let preview_bold = $ref(`**${i18n.ts._mfm.dummy}**`); +let preview_small = $ref(`${i18n.ts._mfm.dummy}`); +let preview_center = $ref(`
${i18n.ts._mfm.dummy}
`); +let preview_inlineCode = $ref('`<: "Hello, world!"`'); +let preview_blockCode = $ref('```\n~ (#i, 100) {\n\t<: ? ((i % 15) = 0) "FizzBuzz"\n\t\t.? ((i % 3) = 0) "Fizz"\n\t\t.? ((i % 5) = 0) "Buzz"\n\t\t. i\n}\n```'); +let preview_inlineMath = $ref('\\(x= \\frac{-b\' \\pm \\sqrt{(b\')^2-ac}}{a}\\)'); +let preview_quote = $ref(`> ${i18n.ts._mfm.dummy}`); +let preview_jelly = $ref('$[jelly ๐Ÿฎ] $[jelly.speed=5s ๐Ÿฎ]'); +let preview_tada = $ref('$[tada ๐Ÿฎ] $[tada.speed=5s ๐Ÿฎ]'); +let preview_jump = $ref('$[jump ๐Ÿฎ] $[jump.speed=5s ๐Ÿฎ]'); +let preview_bounce = $ref('$[bounce ๐Ÿฎ] $[bounce.speed=5s ๐Ÿฎ]'); +let preview_shake = $ref('$[shake ๐Ÿฎ] $[shake.speed=5s ๐Ÿฎ]'); +let preview_twitch = $ref('$[twitch ๐Ÿฎ] $[twitch.speed=5s ๐Ÿฎ]'); +let preview_spin = $ref('$[spin ๐Ÿฎ] $[spin.left ๐Ÿฎ] $[spin.alternate ๐Ÿฎ]\n$[spin.x ๐Ÿฎ] $[spin.x,left ๐Ÿฎ] $[spin.x,alternate ๐Ÿฎ]\n$[spin.y ๐Ÿฎ] $[spin.y,left ๐Ÿฎ] $[spin.y,alternate ๐Ÿฎ]\n\n$[spin.speed=5s ๐Ÿฎ]'); +let preview_flip = $ref(`$[flip ${i18n.ts._mfm.dummy}]\n$[flip.v ${i18n.ts._mfm.dummy}]\n$[flip.h,v ${i18n.ts._mfm.dummy}]`); +let preview_font = $ref(`$[font.serif ${i18n.ts._mfm.dummy}]\n$[font.monospace ${i18n.ts._mfm.dummy}]\n$[font.cursive ${i18n.ts._mfm.dummy}]\n$[font.fantasy ${i18n.ts._mfm.dummy}]`); +let preview_x2 = $ref('$[x2 ๐Ÿฎ]'); +let preview_x3 = $ref('$[x3 ๐Ÿฎ]'); +let preview_x4 = $ref('$[x4 ๐Ÿฎ]'); +let preview_blur = $ref(`$[blur ${i18n.ts._mfm.dummy}]`); +let preview_rainbow = $ref('$[rainbow ๐Ÿฎ] $[rainbow.speed=5s ๐Ÿฎ]'); +let preview_sparkle = $ref('$[sparkle ๐Ÿฎ]'); +let preview_rotate = $ref('$[rotate ๐Ÿฎ]'); definePageMetadata({ title: i18n.ts._mfm.cheatSheet,