mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
dev day #69
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user