feat: Add fallback node for custom placement

This commit is contained in:
danymat
2022-01-29 11:40:32 +01:00
parent 71a92a7dec
commit 01b7213fbd

View File

@@ -75,7 +75,12 @@ return function(parent, data, template, required_type)
if append.position == "after" then if append.position == "after" then
local child_node = nodes:matching_child_nodes(parent, append.child_name)[1] local child_node = nodes:matching_child_nodes(parent, append.child_name)[1]
if child_node ~= nil then if not child_node and append.fallback then
local fallback = nodes:matching_child_nodes(parent, append.fallback)[1]
if fallback then
row_to_place, col_to_place, _, _ = fallback:range()
end
else
row_to_place, col_to_place, _, _ = child_node:range() row_to_place, col_to_place, _, _ = child_node:range()
end end
end end