This commit is contained in:
Tomas Dvorak
2025-10-23 22:26:50 +02:00
parent 63700eedb2
commit 70ea0c3c91
75 changed files with 3337 additions and 1160 deletions
+20 -3
View File
@@ -91,8 +91,18 @@ export const useAllPageElementConfigs = (pageType: string) => {
setVisibility(visMap);
setElementOrder(order);
// Apply initial order to DOM if elements exist
if (order.length > 0) {
// Apply initial order to DOM only in editor/preview mode
const isEditingMode = (() => {
try {
if (typeof document !== 'undefined' && (document.body?.classList?.contains('myuibrix-edit-mode'))) return true;
const params = new URLSearchParams(window.location.search);
return params.get('myuibrix') === 'edit';
} catch {
return false;
}
})();
if (order.length > 0 && isEditingMode) {
requestAnimationFrame(() => {
applyDOMOrder(order);
});
@@ -137,7 +147,14 @@ export const useAllPageElementConfigs = (pageType: string) => {
const handleMyUIbrixReorder = ((event: CustomEvent) => {
const { order } = event.detail;
setElementOrder(order);
applyDOMOrder(order);
try {
const inEdit = document.body?.classList?.contains('myuibrix-edit-mode') || false;
if (inEdit) {
applyDOMOrder(order);
}
} catch {
// no-op
}
}) as EventListener;
// Listen for style changes from VisualStylePanel