diff --git a/src/components/ElementPopup.vue b/src/components/ElementPopup.vue index 02e553d..72b17f8 100644 --- a/src/components/ElementPopup.vue +++ b/src/components/ElementPopup.vue @@ -598,10 +598,29 @@ watch(isEditable, async (newValue, oldValue) => { // Watch stylesheet changes to sync values watch( - () => stylesheetStore.content, + () => stylesheetStore.customCss, () => { - if (visible.value && !stylesheetStore.isEditing) { + if (visible.value && !isUpdatingFromStore) { + isUpdatingFromStore = true; loadValuesFromStylesheet(); + nextTick(() => { + isUpdatingFromStore = false; + }); + } + } +); + +// Also watch when exiting edit mode +watch( + () => stylesheetStore.isEditing, + (isEditing, wasEditing) => { + // When exiting edit mode, reload values + if (visible.value && wasEditing && !isEditing && !isUpdatingFromStore) { + isUpdatingFromStore = true; + loadValuesFromStylesheet(); + nextTick(() => { + isUpdatingFromStore = false; + }); } } );