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: "widpop" }, [
h.div({ class: "widopt" }, [ h.div({ class: "widopt" }, [
h.button(
{
title: "save",
onclick() { w.saveToCatalog(null,true) }
},
[ h.i({ class:"fas fa-save" }) ]
),
h.button( h.button(
{ {
title: "rename", title: "rename",
onclick() { api.widgets.rename(w) onclick() { api.widgets.rename(w) }
}}, },
[ h.i({ class:"fas fa-pen-to-square" }) ] [ h.i({ class:"fas fa-pen-to-square" }) ]
), ),
h.button( h.button(

View file

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