add ability to save widget back to catalog

This commit is contained in:
Stewart Allen 2025-12-18 11:01:29 -05:00
commit 73bd316732
2 changed files with 14 additions and 4 deletions

View file

@ -559,11 +559,18 @@ function platformChanged() {
},[
h.div({ class: "widpop" }, [
h.div({ class: "widopt" }, [
h.button(
{
title: "save",
onclick() { w.saveToCatalog(null,true) }
},
[ h.i({ class:"fas fa-save" }) ]
),
h.button(
{
title: "rename",
onclick() { api.widgets.rename(w)
}},
onclick() { api.widgets.rename(w) }
},
[ h.i({ class:"fas fa-pen-to-square" }) ]
),
h.button(

View file

@ -98,8 +98,11 @@ class Widget {
this.support = false;
}
saveToCatalog(filename) {
if (this.grouped) {
saveToCatalog(filename, overwrite) {
if (!filename) {
filename = this.meta.file;
}
if (this.grouped && !overwrite) {
return this;
}
const widget = this;