- {#if outputVersion == "new"}
+ {#if $outputVersion.index > 0}
Toggle JSON mode (for use in json files)
@@ -46,7 +25,7 @@
{/if}
- As {outputVersion == "new" ? " " : "JSON "}text components:
+ As {$outputVersion.index > 0 ? " " : "JSON "}text components:
-
-
diff --git a/src/lib/components/MiniEditor.svelte b/src/lib/components/text/MiniEditor.svelte
similarity index 93%
rename from src/lib/components/MiniEditor.svelte
rename to src/lib/components/text/MiniEditor.svelte
index b723f65..e83a798 100644
--- a/src/lib/components/MiniEditor.svelte
+++ b/src/lib/components/text/MiniEditor.svelte
@@ -4,15 +4,20 @@
import Color from "@tiptap/extension-color";
import Placeholder from "@tiptap/extension-placeholder";
import { TextStyle } from "@tiptap/extension-text-style";
- import Underline from "@tiptap/extension-underline";
import StarterKit from "@tiptap/starter-kit";
import { onDestroy, onMount } from "svelte";
import IconColor from "~icons/tabler/palette";
import IconSquare from "~icons/tabler/square-filled";
import IconHollow from "~icons/tabler/square-x";
- import { convertToTextOrEmpty, snbtToDocument } from "../text/nbt";
+ import { convertToTextOrEmpty, snbtToDocument } from "../../text/nbt";
+ import {
+ colorMap,
+ defaultColorLUT,
+ trueMarkOrUndefined,
+ } from "$lib/text/general";
+ import { addTypeSpecificValues } from "$lib/text/nbt_or_json";
import {
ClickEventMark,
FontsExtension,
@@ -21,12 +26,6 @@
ShadowColorMark,
} from "$lib/tiptap/extensions/index";
import TextStyleButtons from "./TextStyleButtons.svelte";
- import {
- colorMap,
- defaultColorLUT,
- trueMarkOrUndefined,
- } from "$lib/text/general";
- import { addTypeSpecificValues } from "$lib/text/nbt_or_json";
let {
value = $bindable(),
@@ -42,7 +41,17 @@
editor = new Editor({
element: element,
extensions: [
-
+ StarterKit,
+ Color,
+ TextStyle,
+ Obfuscation,
+ ClickEventMark,
+ HoverEventMark,
+ ShadowColorMark,
+ FontsExtension,
+ Placeholder.configure({
+ placeholder: placeholder,
+ }),
],
onTransaction: ({ editor: newEditor }) => {
// force re-render so `editor.isActive` works as expected
diff --git a/src/lib/components/MiniRenderer.svelte b/src/lib/components/text/MiniRenderer.svelte
similarity index 93%
rename from src/lib/components/MiniRenderer.svelte
rename to src/lib/components/text/MiniRenderer.svelte
index fa1b43f..4792a5a 100644
--- a/src/lib/components/MiniRenderer.svelte
+++ b/src/lib/components/text/MiniRenderer.svelte
@@ -1,24 +1,23 @@
@@ -533,7 +560,6 @@
convert(
editor!.getJSON(),
"standard",
- outputVersion,
shouldOptimise,
),
);
@@ -550,56 +576,74 @@
{editor
- ? convert(tiptapJSON!, "standard", outputVersion, shouldOptimise)
+ ? convert(tiptapJSON!, "standard", shouldOptimise)
: "Loading..."}
- {#if doesContentExist}
-
-
- {editor
- ? convert(tiptapJSON!, "standard", outputVersion, shouldOptimise)
- .length
- : 0} characters
-
-
- {getTextComponentCount()} components
-
+
+
+ click to change output settings:
+
-
•
+
+ {#if versionPopup}
+
+ {#if versionPopupConfirmationVisible}
+
+
+
Warning:
+
Changing to an earlier version could remove some elements of your text that are unsupported in this version.
+
+
+
+
+
+
+ {/if}
+
+
+ version
+ description
+
+ {#each versions as v}
+
+ {/each}
+
* unreleased minecraft version
+
+
+ {/if}
-
- click to change output settings:
-
-
+ aria-label="Click to change the output version."
+ onclick={() => {versionPopup = !versionPopup}}>{$outputVersion.friendly}
+
+
+
-
•
+
•
-
-
- {/if}
+
+
@@ -667,7 +711,7 @@