Update formspec_ast and fs51

This commit is contained in:
luk3yx 2022-02-13 16:43:16 +13:00
parent a9b41bef47
commit dcf790c8db
5 changed files with 6 additions and 7 deletions

View File

@ -46,7 +46,7 @@ local function export(tree, backport_func)
for _, node in ipairs(tree) do for _, node in ipairs(tree) do
if node.type == 'dropdown' or node.type == 'textlist' then if node.type == 'dropdown' or node.type == 'textlist' then
node.selected_id, node.selected_idx = node.selected_idx, nil node.selected_id, node.selected_idx = node.selected_idx, nil
node.choices, node.item = node.item, nil node.choices, node.items = node.items, nil
-- Later versions of the digustuff mod require a height field even -- Later versions of the digustuff mod require a height field even
-- for formspec version 1. -- for formspec version 1.
node.h = node.h or 0.81 node.h = node.h or 0.81

@ -1 +1 @@
Subproject commit 0ba38e041e3db427e1853b57b70ba96a5c1a51d0 Subproject commit f9b29ba6e307451cfd07f98eed389e0a93d3bb30

2
fs51

@ -1 +1 @@
Subproject commit 329056cbea8c65e5bce00337cbe4ab4944335149 Subproject commit 3037ba3f0107576d139184cb7c869b623fdce178

View File

@ -76,8 +76,7 @@ local property_names = {
h = 'Height', h = 'Height',
w = 'Width', w = 'Width',
drawborder = 'Draw border', drawborder = 'Draw border',
item = 'Items', listelems = 'Items',
listelem = 'Items',
selected_idx = 'Selected item', selected_idx = 'Selected item',
props = 'Properties', props = 'Properties',
opt = 'Options', opt = 'Options',

View File

@ -191,7 +191,7 @@ end
function elems.textlist(node) function elems.textlist(node)
local res = make('div') local res = make('div')
for i, item in ipairs(node.listelem) do for i, item in ipairs(node.listelems) do
local elem = make('div') local elem = make('div')
if item:sub(1, 1) ~= '#' then if item:sub(1, 1) ~= '#' then
elem.textContent = item elem.textContent = item
@ -223,7 +223,7 @@ function elems.dropdown(node, base, default_callbacks, scale)
res.style.height = (2 * 15/13 * 0.35 * scale) .. 'px' res.style.height = (2 * 15/13 * 0.35 * scale) .. 'px'
end end
local select = make('select') local select = make('select')
for i, item in ipairs(node.item) do for i, item in ipairs(node.items) do
local e = make('option', {textContent = item}, {name = i}) local e = make('option', {textContent = item}, {name = i})
if i == node.selected_idx then if i == node.selected_idx then
e:setAttribute('selected', 'selected') e:setAttribute('selected', 'selected')