fix: improve bidirectional sync between stylesheet and ElementPopup fields
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 17s
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 17s
Replace content watcher with customCss watcher and add isEditing watcher to properly sync field values when CSS is edited in StylesheetViewer. Changes: - Watch customCss instead of content for real-time updates - Watch isEditing to reload values when exiting edit mode - Use isUpdatingFromStore + nextTick to prevent circular updates - Ensure popup fields stay in sync with stylesheet changes Now when editing CSS manually in the Code tab, ElementPopup fields update automatically when exiting edit mode. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
93df05c49f
commit
b692047ff2
1 changed files with 21 additions and 2 deletions
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue