Skip to content

Commit 1708e54

Browse files
committed
🐛 Fix function inputs consuming HTML tags
Fixes #474
1 parent 26e960f commit 1708e54

3 files changed

Lines changed: 6 additions & 181 deletions

File tree

src/components/customCodeJar.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
let codeJarElement: HTMLPreElement | undefined
1010
1111
function highlight(code: string, syntax?: string) {
12-
if (!syntax) return code
12+
if (!syntax) {
13+
const element = document.createElement('div')
14+
element.textContent = code
15+
return element.innerHTML
16+
}
1317
return Prism.highlight(code, Prism.languages[syntax], syntax)
1418
}
1519
@@ -44,7 +48,6 @@
4448
{highlight}
4549
bind:value
4650
on:change={() => forceNoWrap()}
47-
preserveIdent
4851
history
4952
class={'language-' + (syntax ?? 'plaintext')}
5053
style={`

src/components/dialogItems/codeInput.svelte

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
1414
value.get()
1515
16-
let codeJarElement: HTMLPreElement | undefined
17-
1816
let warningText = ''
1917
let errorText = ''
2018
@@ -33,20 +31,6 @@
3331
unsub()
3432
})
3533
36-
const onKeydown = (e: Event) => {
37-
if (!(e instanceof KeyboardEvent)) return
38-
if (e.key === 'Tab' || e.key === 'Enter') {
39-
e.stopPropagation()
40-
} else if ((e.code === 'KeyZ' || e.code === 'KeyY') && e.ctrlKey) {
41-
// CodeJar doesn't capture undo correctly. So we have to fudge it a little.
42-
requestAnimationFrame(() => {
43-
if (codeJarElement?.textContent != undefined) {
44-
$value = codeJarElement.textContent
45-
}
46-
})
47-
}
48-
}
49-
5034
function onReset() {
5135
$value = defaultValue
5236
onValueChange()
@@ -59,7 +43,7 @@
5943
<div class="dialog_bar form_bar custom">
6044
<label class="name_space_left" for={id}>{label}</label>
6145

62-
<div class="content codejar-container" on:keydown={onKeydown}>
46+
<div class="content codejar-container">
6347
<CustomCodeJar
6448
{syntax}
6549
bind:value={$value}

test-packs/latest/blueprints/armor_stand_latest.ajblueprint

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@
873873
"shadow": true,
874874
"seeThrough": true,
875875
"onSummonFunction": "",
876-
"preciseRotationFix": false,
877876
"configs": {
878877
"default": {
879878
"on_apply_function": "",
@@ -930,7 +929,6 @@
930929
"item": "minecraft:diamond",
931930
"itemDisplay": "none",
932931
"onSummonFunction": "say I'm a Diamond!",
933-
"preciseRotationFix": false,
934932
"configs": {
935933
"default": {
936934
"on_apply_function": "",
@@ -961,90 +959,6 @@
961959
}
962960
}
963961
}
964-
},
965-
{
966-
"name": "cube",
967-
"box_uv": false,
968-
"rescale": false,
969-
"locked": false,
970-
"light_emission": 0,
971-
"render_order": "default",
972-
"allow_mirror_modeling": true,
973-
"from": [-38, 0, -13],
974-
"to": [-26, 1, -1],
975-
"autouv": 0,
976-
"color": 2,
977-
"origin": [-32, 0, -7],
978-
"faces": {
979-
"north": {
980-
"uv": [12, 44, 24, 45],
981-
"texture": 0
982-
},
983-
"east": {
984-
"uv": [0, 44, 12, 45],
985-
"texture": 0
986-
},
987-
"south": {
988-
"uv": [36, 44, 48, 45],
989-
"texture": 0
990-
},
991-
"west": {
992-
"uv": [24, 44, 36, 45],
993-
"texture": 0
994-
},
995-
"up": {
996-
"uv": [12, 32, 24, 44],
997-
"texture": 0
998-
},
999-
"down": {
1000-
"uv": [24, 32, 36, 44],
1001-
"texture": 0
1002-
}
1003-
},
1004-
"type": "cube",
1005-
"uuid": "a5106dee-70c2-6b1a-f446-7275ffb9c916"
1006-
},
1007-
{
1008-
"name": "cube",
1009-
"box_uv": false,
1010-
"rescale": false,
1011-
"locked": false,
1012-
"light_emission": 0,
1013-
"render_order": "default",
1014-
"allow_mirror_modeling": true,
1015-
"from": [-38, 0, 1],
1016-
"to": [-26, 1, 13],
1017-
"autouv": 0,
1018-
"color": 2,
1019-
"origin": [-32, 0, 7],
1020-
"faces": {
1021-
"north": {
1022-
"uv": [12, 44, 24, 45],
1023-
"texture": 0
1024-
},
1025-
"east": {
1026-
"uv": [0, 44, 12, 45],
1027-
"texture": 0
1028-
},
1029-
"south": {
1030-
"uv": [36, 44, 48, 45],
1031-
"texture": 0
1032-
},
1033-
"west": {
1034-
"uv": [24, 44, 36, 45],
1035-
"texture": 0
1036-
},
1037-
"up": {
1038-
"uv": [12, 32, 24, 44],
1039-
"texture": 0
1040-
},
1041-
"down": {
1042-
"uv": [24, 32, 36, 44],
1043-
"texture": 0
1044-
}
1045-
},
1046-
"type": "cube",
1047-
"uuid": "b54db0a5-ee46-f8fd-f26f-d87e34896dcf"
1048962
}
1049963
],
1050964
"outliner": [
@@ -1053,7 +967,6 @@
1053967
"origin": [0, 0, 0],
1054968
"color": 0,
1055969
"onSummonFunction": "",
1056-
"preciseRotationFix": false,
1057970
"configs": {
1058971
"default": {
1059972
"billboard": "fixed",
@@ -1084,7 +997,6 @@
1084997
"origin": [0, 0, 0],
1085998
"color": 0,
1086999
"onSummonFunction": "",
1087-
"preciseRotationFix": false,
10881000
"configs": {
10891001
"default": {
10901002
"billboard": "fixed",
@@ -1115,7 +1027,6 @@
11151027
"origin": [0, 1, 6],
11161028
"color": 0,
11171029
"onSummonFunction": "",
1118-
"preciseRotationFix": false,
11191030
"configs": {
11201031
"default": {
11211032
"on_apply_function": "",
@@ -1144,76 +1055,11 @@
11441055
}
11451056
]
11461057
},
1147-
{
1148-
"name": "baseplate_pivot_a2",
1149-
"origin": [-32, 0.5, -7],
1150-
"color": 0,
1151-
"onSummonFunction": "",
1152-
"preciseRotationFix": false,
1153-
"configs": {
1154-
"default": {
1155-
"on_apply_function": "",
1156-
"billboard": "fixed",
1157-
"override_brightness": false,
1158-
"brightness_override": 0,
1159-
"enchanted": false,
1160-
"glowing": false,
1161-
"override_glow_color": false,
1162-
"glow_color": "#ffffff",
1163-
"invisible": false,
1164-
"shadow_radius": 0,
1165-
"shadow_strength": 1
1166-
},
1167-
"variants": {}
1168-
},
1169-
"uuid": "37f6cf1d-c8fc-620f-91a2-59bd597c3759",
1170-
"export": true,
1171-
"mirror_uv": false,
1172-
"isOpen": true,
1173-
"locked": false,
1174-
"visibility": true,
1175-
"autouv": 0,
1176-
"selected": false,
1177-
"children": ["a5106dee-70c2-6b1a-f446-7275ffb9c916"]
1178-
},
1179-
{
1180-
"name": "baseplate_pivot_a3",
1181-
"origin": [-32, 0.5, 7],
1182-
"color": 0,
1183-
"onSummonFunction": "",
1184-
"preciseRotationFix": true,
1185-
"configs": {
1186-
"default": {
1187-
"on_apply_function": "",
1188-
"billboard": "fixed",
1189-
"override_brightness": false,
1190-
"brightness_override": 0,
1191-
"enchanted": false,
1192-
"glowing": false,
1193-
"override_glow_color": false,
1194-
"glow_color": "#ffffff",
1195-
"invisible": false,
1196-
"shadow_radius": 0,
1197-
"shadow_strength": 1
1198-
},
1199-
"variants": {}
1200-
},
1201-
"uuid": "4dea286c-8490-d441-ee02-c3d24d47d034",
1202-
"export": true,
1203-
"mirror_uv": false,
1204-
"isOpen": true,
1205-
"locked": false,
1206-
"visibility": true,
1207-
"autouv": 0,
1208-
"selected": false,
1209-
"children": ["b54db0a5-ee46-f8fd-f26f-d87e34896dcf"]
1210-
},
12111058
{
12121059
"name": "armor_stand_root",
12131060
"origin": [0, 1, 0],
12141061
"color": 0,
12151062
"onSummonFunction": "",
1216-
"preciseRotationFix": false,
12171063
"configs": {
12181064
"default": {
12191065
"billboard": "fixed",
@@ -1245,7 +1091,6 @@
12451091
"origin": [0, 12, 0],
12461092
"color": 0,
12471093
"onSummonFunction": "",
1248-
"preciseRotationFix": false,
12491094
"configs": {
12501095
"default": {
12511096
"billboard": "fixed",
@@ -1279,7 +1124,6 @@
12791124
"origin": [0, 12, 0],
12801125
"color": 0,
12811126
"onSummonFunction": "",
1282-
"preciseRotationFix": false,
12831127
"configs": {
12841128
"default": {
12851129
"billboard": "fixed",
@@ -1313,7 +1157,6 @@
13131157
"origin": [0, 24, 0],
13141158
"color": 0,
13151159
"onSummonFunction": "",
1316-
"preciseRotationFix": false,
13171160
"configs": {
13181161
"default": {
13191162
"billboard": "fixed",
@@ -1382,7 +1225,6 @@
13821225
"origin": [0, 23, 0],
13831226
"color": 0,
13841227
"onSummonFunction": "",
1385-
"preciseRotationFix": false,
13861228
"configs": {
13871229
"default": {
13881230
"billboard": "fixed",
@@ -1432,7 +1274,6 @@
14321274
"origin": [-6, 23, 0],
14331275
"color": 0,
14341276
"onSummonFunction": "",
1435-
"preciseRotationFix": false,
14361277
"configs": {
14371278
"default": {
14381279
"billboard": "fixed",
@@ -1482,7 +1323,6 @@
14821323
"origin": [6, 23, 0],
14831324
"color": 0,
14841325
"onSummonFunction": "",
1485-
"preciseRotationFix": false,
14861326
"configs": {
14871327
"default": {
14881328
"billboard": "fixed",
@@ -1541,7 +1381,6 @@
15411381
"origin": [2, 12, 0],
15421382
"color": 0,
15431383
"onSummonFunction": "",
1544-
"preciseRotationFix": false,
15451384
"configs": {
15461385
"default": {
15471386
"billboard": "fixed",
@@ -1589,7 +1428,6 @@
15891428
"origin": [-2, 12, 0],
15901429
"color": 0,
15911430
"onSummonFunction": "",
1592-
"preciseRotationFix": false,
15931431
"configs": {
15941432
"default": {
15951433
"billboard": "fixed",

0 commit comments

Comments
 (0)