For those on the Edge builds and using Lua to build widgets (tables returning markdown, html etc.): you now need to wrap these tables in widget.new, see: https://silverbullet.md/Space%20Lua#Widgets
What you get in return for this breaking change, is the ability to attach event handlers, so you can now build a custom button widget like so:
```space-lua
function myButton(text)
return widget.new {
html = "<button>" .. text .. "</button>",
events = {
click = function()
editor.flashNotification("Clicked " .. text)
end
}
}
end
```
${myButton("Button 1")}
${myButton("Button 2")}
Great!
I think, this again opens great possibilities!
Might come to a solution for my Idea here:
Already tried this out and I’m able to generate an input field, which fires an event on change of the inputtext.
However, I could not figure out, yet, how to get to the text I put in…
Looks like I miss a puzzle piece again
My Example:
```space-lua
function myInputField(text)
return widget.new {
html = text .."<input type=\"text\">",
events = {
change = function()
editor.flashNotification("changed " .. text)
end
}
}
end
Ok so this suggests you do indeed get the event object (the isTrusted thing is part of the event), but the javascript → Lua table mapping may not be including all useful event data. I’d have to see how to handle this in a more useful way.