|
344 | 344 | <button |
345 | 345 | class="flex items-center px-3 py-2 hover:bg-white/3 cursor-pointer" |
346 | 346 | onclick={loadDialog.open}>Load</button> |
347 | | - <button |
348 | | - class="bg-zinc-800 hover:bg-zinc-700 font-mono px-1 rounded-md ml-3 select-none" |
349 | | - use:tippy={{ content: "Click to toggle", placement: "top" }} |
350 | | - onclick={() => { |
351 | | - const ov = outputVersion; |
352 | | - if (ov == "new") { |
353 | | - outputVersion = "old"; |
354 | | - } else { |
355 | | - outputVersion = "new"; |
356 | | - } |
357 | | - }}>{outputVersion == "new" ? "1.21.5+" : "pre 1.21.5"}</button> |
358 | 347 | <div class="flex-grow"></div> |
359 | 348 | <a |
360 | 349 | href="https://discord.datapackhub.net/" |
|
507 | 496 | placement: "bottom", |
508 | 497 | }} |
509 | 498 | aria-label="Redo"><IconRedo /></button> |
510 | | - |
511 | | - <div class="h-5 w-px bg-zinc-600 mx-2"></div> |
512 | | - |
513 | | - <div class="flex items-center gap-2"> |
514 | | - <p>Optimise?</p> |
515 | | - <button |
516 | | - use:tippy={{ |
517 | | - content: "Optimising makes the output smaller, but makes it harder to edit", |
518 | | - placement: "bottom", |
519 | | - }} |
520 | | - class="size-8 aspect-square bg-zinc-950 rounded-md flex flex-col items-center" |
521 | | - onclick={() => (shouldOptimise = !shouldOptimise)}> |
522 | | - {#if shouldOptimise} |
523 | | - <IconTick class="m-auto text-lg" /> |
524 | | - {/if} |
525 | | - </button> |
526 | | - </div> |
527 | 499 |
|
528 | 500 | <div class="flex-grow"></div> |
529 | 501 |
|
|
552 | 524 | : "Loading..."}</code> |
553 | 525 | <br /> |
554 | 526 | {/if} |
555 | | - <div class="bg-zinc-950 p-3 max-h-56 overflow-auto"> |
556 | | - <div class="flex max-w-screen items-start space-x-2"> |
| 527 | + <div class="bg-zinc-950 p-3"> |
| 528 | + <div class="flex max-w-screen items-start space-x-2 max-h-56 overflow-auto"> |
557 | 529 | <button |
558 | 530 | class="p-1 text-lg hover:bg-zinc-900 active:bg-white/10 rounded-md font-medium" |
559 | 531 | onclick={() => { |
|
575 | 547 | ? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise) |
576 | 548 | : "Loading..."} |
577 | 549 | </code> |
| 550 | + </p> |
| 551 | + </div> |
| 552 | + {#if doesContentExist} |
| 553 | + <div class="flex items-center space-x-2 mt-2 select-none"> |
| 554 | + <p class="font-lexend text-xs text-white/60 nomob"> |
| 555 | + {editor |
| 556 | + ? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise).length |
| 557 | + : 0} characters |
| 558 | + </p> |
| 559 | + <p class="font-lexend text-xs text-white/60 nomob"> |
| 560 | + {getTextComponentCount()} components |
| 561 | + </p> |
| 562 | + <p class="font-lexend text-xs text-white/60 nomob"> |
| 563 | + • |
| 564 | + </p> |
| 565 | + <p class="font-lexend text-xs text-white/60"> |
| 566 | + Click to change output settings: |
| 567 | + </p> |
578 | 568 | <button |
579 | 569 | class="bg-zinc-800 hover:bg-zinc-700 font-mono px-1 rounded-md ml-1 select-none" |
580 | | - use:tippy={{ content: "Click to toggle", placement: "top" }} |
| 570 | + use:tippy={{ content: "Click to toggle the output version. 1.21.5 drastically changed the format of text components, so make sure you select the correct version.", placement: "top" }} |
581 | 571 | onclick={() => { |
582 | 572 | const ov = outputVersion; |
583 | 573 | if (ov == "new") { |
|
586 | 576 | outputVersion = "new"; |
587 | 577 | } |
588 | 578 | }}>{outputVersion == "new" ? "1.21.5+" : "pre 1.21.5"}</button> |
589 | | - </p> |
590 | | - </div> |
591 | | - {#if doesContentExist} |
592 | | - <div class="flex items-center space-x-3 mt-2 select-none"> |
593 | | - <p class="font-lexend text-xs text-white/60"> |
594 | | - {editor |
595 | | - ? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise).length |
596 | | - : 0} characters |
597 | | - </p> |
598 | | - <p class="font-lexend text-xs text-white/60"> |
599 | | - {getTextComponentCount()} components |
600 | | - </p> |
| 579 | + <button |
| 580 | + class="bg-zinc-800 hover:bg-zinc-700 font-mono px-1 rounded-md ml-1 select-none" |
| 581 | + use:tippy={{ content: "Click to toggle whether the output should be optimised (shortest possible output), or expanded (easier to edit manually).", placement: "top" }} |
| 582 | + onclick={() => shouldOptimise = !shouldOptimise}>{shouldOptimise ? "optimised" : "expanded"}</button> |
601 | 583 | </div> |
602 | 584 | {/if} |
603 | 585 | </div> |
|
689 | 671 | {indentSize} |
690 | 672 | {recentlyCopied} /> |
691 | 673 |
|
692 | | -<Modal title="Import from NBT" bind:this={importDialog} big key="I"> |
| 674 | +<Modal title="Import from NBT" bind:this={importDialog} key="I"> |
693 | 675 | <div class="flex flex-col w-full space-y-2"> |
694 | 676 | <p> |
695 | 677 | Paste your text components below to import them into the editor. This will |
696 | 678 | clear the current contents of the editor! |
697 | 679 | </p> |
698 | | - <input |
699 | | - class="flex items-start bg-zinc-950 p-3 rounded-lg font-minecraft" |
| 680 | + <textarea |
| 681 | + class="flex items-start bg-zinc-950 p-3 rounded-lg font-minecraft h-32" |
700 | 682 | placeholder="Paste NBT text components here" |
701 | | - bind:value={importText} /> |
| 683 | + bind:value={importText} ></textarea> |
702 | 684 |
|
703 | 685 | <button |
704 | 686 | onclick={importToEditor} |
|
0 commit comments