Skip to content

Commit d610ebc

Browse files
committed
🚧 Improve JSON Text parsing and validation.
- Fixed escaped characters including the backslash in the rendered text. - Json Text Components now require a content key. - Fixed text component arrays not allowing a newline after the opening bracket. - Fixed invalid error while parsing score object. - Fixed `translate` being named `tl` for some weird reason.
1 parent c61bc55 commit d610ebc

File tree

5 files changed

+279
-39
lines changed

5 files changed

+279
-39
lines changed

src/components/textDisplayElementPanel.svelte

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,26 @@
106106
overflow-y: auto;
107107
white-space: nowrap;
108108
margin-top: 0px;
109+
margin-left: 2px;
109110
"
110111
/>
111-
{#if $error}
112-
<textarea readonly>{$error}</textarea>
113-
{/if}
114112
</div>
113+
{#if $error}
114+
<textarea readonly>{$error}</textarea>
115+
{/if}
115116
</div>
116117

117118
<style>
118119
.label {
119120
margin-bottom: -3px !important;
120121
}
121122
textarea {
123+
margin-right: 20px;
124+
margin-left: 2px;
122125
color: var(--color-error);
123126
background-color: var(--color-back);
124127
padding: 4px 8px;
125-
word-wrap: unset;
126-
text-wrap: nowrap;
128+
text-wrap: pretty;
127129
overflow: scroll;
128130
height: 10rem;
129131
font-size: small;

src/outliner/textDisplay.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ export class TextDisplay extends ResizableOutlinerElement {
302302
console.error(e)
303303
this.textError.set(e.message as string)
304304
this._updating = false
305+
text = new JsonText({ text: 'Invalid JSON Text!', color: 'red' })
305306
}
306307
this._newText = undefined
307308
this._newLineWidth = undefined

0 commit comments

Comments
 (0)