|
10 | 10 | recentlyCopied, |
11 | 11 | indent, |
12 | 12 | indentSize, |
| 13 | + shouldOptimise = true |
13 | 14 | } = $props(); |
14 | 15 | </script> |
15 | 16 |
|
|
27 | 28 | onclick={() => { |
28 | 29 | navigator.clipboard.writeText( |
29 | 30 | "/tellraw @s " + |
30 | | - convert(editor.getJSON(), "standard", outputVersion), |
| 31 | + convert(editor.getJSON(), "standard", outputVersion, shouldOptimise), |
31 | 32 | ); |
32 | 33 | recentlyCopied = true; |
33 | 34 | setTimeout(() => (recentlyCopied = false), 2000); |
|
36 | 37 | </button> |
37 | 38 | <code class="inline-block w-full overflow-auto max-h-56" |
38 | 39 | >/tellraw @s {editor |
39 | | - ? convert(editor.getJSON(), "standard", outputVersion) |
| 40 | + ? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise) |
40 | 41 | : "Loading..."} |
41 | 42 | </code> |
42 | 43 | </div> |
|
47 | 48 | class="p-1 text-lg hover:bg-zinc-900 active:bg-white/10 rounded-md font-medium" |
48 | 49 | onclick={() => { |
49 | 50 | navigator.clipboard.writeText( |
50 | | - `[lore=${convert(editor.getJSON(), "item_lore", outputVersion)}]`, |
| 51 | + `[lore=${convert(editor.getJSON(), "item_lore", outputVersion, shouldOptimise)}]`, |
51 | 52 | ); |
52 | 53 | recentlyCopied = true; |
53 | 54 | setTimeout(() => (recentlyCopied = false), 2000); |
|
57 | 58 | {#if outputVersion == "new"} |
58 | 59 | <code class="inline-block w-full overflow-auto max-h-56" |
59 | 60 | >[lore={editor |
60 | | - ? convert(editor.getJSON(), "item_lore", outputVersion) |
| 61 | + ? convert(editor.getJSON(), "item_lore", outputVersion, shouldOptimise) |
61 | 62 | : "Loading..."}] |
62 | 63 | </code> |
63 | 64 | {:else} |
64 | 65 | <code class="inline-block w-full overflow-auto max-h-56" |
65 | 66 | >[lore={editor |
66 | | - ? `'${translate(editor.getJSON(), "item_lore", false, 0, outputVersion)}'` |
| 67 | + ? `'${translate(editor.getJSON(), { |
| 68 | + exportType: "item_lore", |
| 69 | + exportVersion: outputVersion, |
| 70 | + optimise: shouldOptimise |
| 71 | + })}` |
67 | 72 | : "Loading..."}] |
68 | 73 | </code> |
69 | 74 | {/if} |
|
77 | 82 | navigator.clipboard.writeText( |
78 | 83 | translate( |
79 | 84 | editor.getJSON(), |
80 | | - "standard", |
81 | | - indent, |
82 | | - indentSize, |
83 | | - outputVersion, |
| 85 | + { |
| 86 | + exportType: "standard", |
| 87 | + exportVersion: outputVersion, |
| 88 | + indent, |
| 89 | + indentSize, |
| 90 | + optimise: shouldOptimise |
| 91 | + } |
84 | 92 | ), |
85 | 93 | ); |
86 | 94 | recentlyCopied = true; |
|
92 | 100 | ><pre>{editor |
93 | 101 | ? translate( |
94 | 102 | editor.getJSON(), |
95 | | - "standard", |
96 | | - indent, |
97 | | - indentSize, |
98 | | - outputVersion, |
| 103 | + { |
| 104 | + exportType: "standard", |
| 105 | + exportVersion: outputVersion, |
| 106 | + indent, |
| 107 | + indentSize, |
| 108 | + optimise: shouldOptimise |
| 109 | + } |
99 | 110 | ) |
100 | 111 | : "Loading..."}</pre> |
101 | 112 | </code> |
|
0 commit comments