From 73bd316732544c86f320d166154af1b81664e216 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Thu, 18 Dec 2025 11:01:29 -0500 Subject: [PATCH] add ability to save widget back to catalog --- src/kiri/core/platform.js | 11 +++++++++-- src/kiri/core/widget.js | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/kiri/core/platform.js b/src/kiri/core/platform.js index 48c90282..e349dfb2 100644 --- a/src/kiri/core/platform.js +++ b/src/kiri/core/platform.js @@ -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( diff --git a/src/kiri/core/widget.js b/src/kiri/core/widget.js index 3b225a52..24e475cb 100644 --- a/src/kiri/core/widget.js +++ b/src/kiri/core/widget.js @@ -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;