From 0487ed73f13fb60018a24690ded2111244ee5f42 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Fri, 3 May 2024 15:29:16 -0600 Subject: [PATCH 01/12] [6540] Check if field is inherited when registering --- ui/guest/src/elementRegistry.ts | 10 ++++++++-- ui/guest/src/react/ZoneMenu.tsx | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index d56055e2f6..6f27e28aa1 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -23,7 +23,8 @@ import { getCachedModel, hasCachedModel, isInheritedField, - model$ + model$, + getModelIdFromInheritedField } from './contentController'; import { take } from 'rxjs/operators'; import * as Model from '@craftercms/studio-ui/utils/model'; @@ -189,7 +190,12 @@ export function completeDeferredRegistration(id: number): void { if (fieldIds.length > 0) { fieldIds.forEach((fieldId) => { - const iceId = iceRegistry.register({ modelId, index, fieldId }); + let modelIdToRegister = modelId; + // If the field is inherited, the modelId to register is the one that contains the field + if (isInheritedField(modelId, fieldId)) { + modelIdToRegister = getModelIdFromInheritedField(modelId, fieldId); + } + const iceId = iceRegistry.register({ modelId: modelIdToRegister, index, fieldId }); if (!registry[iceId]) { registry[iceId] = []; } diff --git a/ui/guest/src/react/ZoneMenu.tsx b/ui/guest/src/react/ZoneMenu.tsx index e387faa977..4aefe45fc0 100644 --- a/ui/guest/src/react/ZoneMenu.tsx +++ b/ui/guest/src/react/ZoneMenu.tsx @@ -180,7 +180,7 @@ export function ZoneMenu(props: ZoneMenuProps) { const itemFieldId = isNodeSelectorItem ? nodeSelectorItemRecord.fieldId : fieldId; const itemIndex = isNodeSelectorItem ? nodeSelectorItemRecord.index : index; const parentModelId = getParentModelId(itemModelId, models, modelHierarchyMap); - const path = models[parentModelId ?? itemModelId].craftercms.path; + const path = modelPath; return { path, itemModelId, itemFieldId, itemIndex }; }; @@ -263,7 +263,7 @@ export function ZoneMenu(props: ZoneMenuProps) { e.preventDefault(); e.stopPropagation(); execOperation(() => { - if (recordType === 'component' && nodeSelectorItemRecord) { + if ((recordType === 'component' || recordType === 'node-selector-item') && nodeSelectorItemRecord) { sortUpItem(nodeSelectorItemRecord.modelId, nodeSelectorItemRecord.fieldId, nodeSelectorItemRecord.index); } else { sortUpItem(modelId, fieldId, index); From 47bd36e9597caac0739299b7c7c6bb8c1486b7a2 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Mon, 6 May 2024 14:35:19 -0600 Subject: [PATCH 02/12] [6540] Add inheritorsModelIdsMap to properly render instances to inherited node-selectors when dragging from BrowseComponents panel --- ui/guest/src/elementRegistry.ts | 3 +++ ui/guest/src/react/GuestProxy.tsx | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index 6f27e28aa1..8d0f5f6d52 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -49,6 +49,8 @@ let db: LookupTable = {}; // Lookup table of element record id arrays, indexed by iceId let registry: LookupTable = {}; +export const inheritorsModelIdsMap = {}; + export function get(id: number): ElementRecord { const record = db[id]; record && nullOrUndefined(record.label) && setLabel(record); @@ -194,6 +196,7 @@ export function completeDeferredRegistration(id: number): void { // If the field is inherited, the modelId to register is the one that contains the field if (isInheritedField(modelId, fieldId)) { modelIdToRegister = getModelIdFromInheritedField(modelId, fieldId); + inheritorsModelIdsMap[`${modelIdToRegister}-${fieldId}`] = modelId; } const iceId = iceRegistry.register({ modelId: modelIdToRegister, index, fieldId }); if (!registry[iceId]) { diff --git a/ui/guest/src/react/GuestProxy.tsx b/ui/guest/src/react/GuestProxy.tsx index c4e9f5fce8..4ce88650b1 100644 --- a/ui/guest/src/react/GuestProxy.tsx +++ b/ui/guest/src/react/GuestProxy.tsx @@ -17,7 +17,7 @@ import React, { useEffect, useRef } from 'react'; import { useGuestContext, useSelector } from './GuestContext'; import * as ElementRegistry from '../elementRegistry'; -import { getParentElementFromICEProps } from '../elementRegistry'; +import { getParentElementFromICEProps, inheritorsModelIdsMap } from '../elementRegistry'; import * as iceRegistry from '../iceRegistry'; import $ from '../jquery'; import { @@ -422,9 +422,15 @@ export function GuestProxy() { ifrm.onload = function () { spinner.remove(); - const itemElement = ifrm.contentWindow.document.documentElement.querySelector( + let itemElement = ifrm.contentWindow.document.documentElement.querySelector( `[data-craftercms-model-id="${modelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` ); + if (!itemElement) { + const inheritedModelId = inheritorsModelIdsMap[`${modelId}-${fieldId}`]; + itemElement = ifrm.contentWindow.document.documentElement.querySelector( + `[data-craftercms-model-id="${inheritedModelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` + ); + } let component = document.createElement('div'); component.innerHTML = itemElement?.outerHTML; component = component.firstChild as HTMLDivElement; From 55a9f51c2ec1ca9560a23c4b3ca191668e102996 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Mon, 6 May 2024 17:16:40 -0600 Subject: [PATCH 03/12] [6540] Update get parent model id to register --- ui/guest/src/elementRegistry.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index 8d0f5f6d52..ec25f5d455 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -136,18 +136,18 @@ export function register(payload: ElementRecordRegistration): number { ? fieldId : fieldId.split(',').map((str) => str.trim()); - function create() { + function create(inheritanceParentModelId?: string) { // Create/register the physical record db[id] = { id, element, - modelId, + modelId: inheritanceParentModelId ?? modelId, index, label, fieldId: fieldIds, iceIds, complete: false, - inherited: fieldIds.some((fieldId) => isInheritedField(modelId, fieldId)) + inherited: fieldIds.some((fieldId) => isInheritedField(inheritanceParentModelId ?? modelId, fieldId)) }; } @@ -157,11 +157,13 @@ export function register(payload: ElementRecordRegistration): number { // for the model to be loaded. if (isInheritedField(model.craftercms.id, fieldId)) { byPathFetchIfNotLoaded(model.craftercms.sourceMap?.[fieldId]).subscribe((response) => { + const modelIdToRegister = response.craftercms.id; + inheritorsModelIdsMap[`${modelIdToRegister}-${fieldId}`] = modelId; model$(response.craftercms.id) .pipe(take(1)) .subscribe(() => { - create(); - completeDeferredRegistration(id); + create(modelIdToRegister); + completeDeferredRegistration(id, modelIdToRegister); }); }); } else { @@ -186,19 +188,13 @@ export function register(payload: ElementRecordRegistration): number { return id; } -export function completeDeferredRegistration(id: number): void { +export function completeDeferredRegistration(id: number, inheritanceParentModelId?: string): void { const record = db[id]; const { modelId, index, fieldId: fieldIds, iceIds } = record; if (fieldIds.length > 0) { fieldIds.forEach((fieldId) => { - let modelIdToRegister = modelId; - // If the field is inherited, the modelId to register is the one that contains the field - if (isInheritedField(modelId, fieldId)) { - modelIdToRegister = getModelIdFromInheritedField(modelId, fieldId); - inheritorsModelIdsMap[`${modelIdToRegister}-${fieldId}`] = modelId; - } - const iceId = iceRegistry.register({ modelId: modelIdToRegister, index, fieldId }); + const iceId = iceRegistry.register({ modelId: inheritanceParentModelId ?? modelId, index, fieldId }); if (!registry[iceId]) { registry[iceId] = []; } @@ -206,7 +202,7 @@ export function completeDeferredRegistration(id: number): void { !iceIds.includes(iceId) && iceIds.push(iceId); }); } else { - const iceId = iceRegistry.register({ modelId, index }); + const iceId = iceRegistry.register({ modelId: inheritanceParentModelId ?? modelId, index }); if (!registry[iceId]) { registry[iceId] = []; } From 473c4911e6ded7841ae15195f45dd849efc7a85c Mon Sep 17 00:00:00 2001 From: jvega190 Date: Tue, 7 May 2024 12:11:05 -0600 Subject: [PATCH 04/12] [6540] Update byPathFetchIfNotLoaded to avoid returning already returned models --- ui/guest/src/contentController.ts | 2 ++ ui/guest/src/elementRegistry.ts | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/guest/src/contentController.ts b/ui/guest/src/contentController.ts index 360db06585..86e4f0b20e 100644 --- a/ui/guest/src/contentController.ts +++ b/ui/guest/src/contentController.ts @@ -170,6 +170,7 @@ export function byPathFetchIfNotLoaded(path: string): Observable Boolean(paths[path])), map((paths) => paths[path]), map((modelId) => models$.value[modelId]) @@ -185,6 +186,7 @@ export function getContentInstanceByPath(path: string): ContentInstance { return models$.value[modelId]; } +// TODO: check when value is in actual model and not coming from level-descriptor export function isInheritedField(modelId: string, fieldId: string): boolean { return !!getCachedModel(modelId).craftercms.sourceMap?.[fieldId]; } diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index ec25f5d455..8370d9af2a 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -23,8 +23,7 @@ import { getCachedModel, hasCachedModel, isInheritedField, - model$, - getModelIdFromInheritedField + model$ } from './contentController'; import { take } from 'rxjs/operators'; import * as Model from '@craftercms/studio-ui/utils/model'; From f8a3866bb238b4b8c877d563dd913efc05adef2b Mon Sep 17 00:00:00 2001 From: jvega190 Date: Tue, 7 May 2024 13:05:07 -0600 Subject: [PATCH 05/12] [6540] Remove comment --- ui/guest/src/contentController.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/guest/src/contentController.ts b/ui/guest/src/contentController.ts index 86e4f0b20e..14be227eeb 100644 --- a/ui/guest/src/contentController.ts +++ b/ui/guest/src/contentController.ts @@ -186,7 +186,6 @@ export function getContentInstanceByPath(path: string): ContentInstance { return models$.value[modelId]; } -// TODO: check when value is in actual model and not coming from level-descriptor export function isInheritedField(modelId: string, fieldId: string): boolean { return !!getCachedModel(modelId).craftercms.sourceMap?.[fieldId]; } From 0b743beb68dc024fc6377b769cd05d8d29370184 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Wed, 8 May 2024 11:50:07 -0600 Subject: [PATCH 06/12] [6540] Remove unnecessary map in byPathFetchIfNotLoaded --- ui/guest/src/contentController.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/guest/src/contentController.ts b/ui/guest/src/contentController.ts index 14be227eeb..77867c48cf 100644 --- a/ui/guest/src/contentController.ts +++ b/ui/guest/src/contentController.ts @@ -172,8 +172,7 @@ export function byPathFetchIfNotLoaded(path: string): Observable Boolean(paths[path])), - map((paths) => paths[path]), - map((modelId) => models$.value[modelId]) + map((paths) => models$.value[paths[path]]) ); } else { requestedPaths[path] = true; From 108f55eaed6bd1adb631141e43118f35219dc4a0 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Wed, 8 May 2024 12:09:01 -0600 Subject: [PATCH 07/12] [6540] Add inheritorsModelIdsMap to flush function --- ui/guest/src/elementRegistry.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index 8370d9af2a..f9e8efa406 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -48,7 +48,7 @@ let db: LookupTable = {}; // Lookup table of element record id arrays, indexed by iceId let registry: LookupTable = {}; -export const inheritorsModelIdsMap = {}; +export let inheritorsModelIdsMap = {}; export function get(id: number): ElementRecord { const record = db[id]; @@ -446,6 +446,7 @@ export function flush(): void { db = {}; registry = {}; iceRegistry.flush(); + inheritorsModelIdsMap = {}; } export function getRegistry(): typeof db { From 88e62beec890e0efe8fe9fda982c84db0e0e6473 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Wed, 8 May 2024 12:16:34 -0600 Subject: [PATCH 08/12] [6540] Add recordType 'node-selector-item' to onMoveDown validation --- ui/guest/src/react/ZoneMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/guest/src/react/ZoneMenu.tsx b/ui/guest/src/react/ZoneMenu.tsx index 4aefe45fc0..201a8b16ac 100644 --- a/ui/guest/src/react/ZoneMenu.tsx +++ b/ui/guest/src/react/ZoneMenu.tsx @@ -276,7 +276,7 @@ export function ZoneMenu(props: ZoneMenuProps) { e.preventDefault(); e.stopPropagation(); execOperation(() => { - if (recordType === 'component' && nodeSelectorItemRecord) { + if ((recordType === 'component' || recordType === 'node-selector-item') && nodeSelectorItemRecord) { sortDownItem(nodeSelectorItemRecord.modelId, nodeSelectorItemRecord.fieldId, nodeSelectorItemRecord.index); } else { sortDownItem(modelId, fieldId, index); From 883682bff90bbc17359396884091ac5e1605a7b1 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Wed, 8 May 2024 12:31:45 -0600 Subject: [PATCH 09/12] [6540] Rollback - not needed anymore --- ui/guest/src/react/ZoneMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/guest/src/react/ZoneMenu.tsx b/ui/guest/src/react/ZoneMenu.tsx index 201a8b16ac..c570c3c056 100644 --- a/ui/guest/src/react/ZoneMenu.tsx +++ b/ui/guest/src/react/ZoneMenu.tsx @@ -263,7 +263,7 @@ export function ZoneMenu(props: ZoneMenuProps) { e.preventDefault(); e.stopPropagation(); execOperation(() => { - if ((recordType === 'component' || recordType === 'node-selector-item') && nodeSelectorItemRecord) { + if (recordType === 'component' && nodeSelectorItemRecord) { sortUpItem(nodeSelectorItemRecord.modelId, nodeSelectorItemRecord.fieldId, nodeSelectorItemRecord.index); } else { sortUpItem(modelId, fieldId, index); @@ -276,7 +276,7 @@ export function ZoneMenu(props: ZoneMenuProps) { e.preventDefault(); e.stopPropagation(); execOperation(() => { - if ((recordType === 'component' || recordType === 'node-selector-item') && nodeSelectorItemRecord) { + if (recordType === 'component' && nodeSelectorItemRecord) { sortDownItem(nodeSelectorItemRecord.modelId, nodeSelectorItemRecord.fieldId, nodeSelectorItemRecord.index); } else { sortDownItem(modelId, fieldId, index); From 0007efa8ec1989dd5493a9f6993281442b5a4699 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Fri, 17 May 2024 09:45:19 -0600 Subject: [PATCH 10/12] [6670] Rename inheritorsModelIdsMap => fieldHeirsMap, create util for fieldHeirsMap key generation --- ui/guest/src/elementRegistry.ts | 18 ++++++++++++------ ui/guest/src/react/GuestProxy.tsx | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index f9e8efa406..0a4fbc0fc0 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -48,7 +48,13 @@ let db: LookupTable = {}; // Lookup table of element record id arrays, indexed by iceId let registry: LookupTable = {}; -export let inheritorsModelIdsMap = {}; +// A map that contains the IDs of models that inherit an certain field from given inheritance parent model +// { [`${inheritanceParentId}:${fieldId}`]: [inheritanceTargetId1, inheritanceTargetId2, etc] } +export let fieldHeirsMap = {}; + +export function createFieldHeirsKey(inheritanceParentId: string, fieldId: string): string { + return `${inheritanceParentId}:${fieldId}`; +} export function get(id: number): ElementRecord { const record = db[id]; @@ -156,13 +162,13 @@ export function register(payload: ElementRecordRegistration): number { // for the model to be loaded. if (isInheritedField(model.craftercms.id, fieldId)) { byPathFetchIfNotLoaded(model.craftercms.sourceMap?.[fieldId]).subscribe((response) => { - const modelIdToRegister = response.craftercms.id; - inheritorsModelIdsMap[`${modelIdToRegister}-${fieldId}`] = modelId; + const sourceModelId = response.craftercms.id; + fieldHeirsMap[createFieldHeirsKey(sourceModelId, fieldId)] = modelId; model$(response.craftercms.id) .pipe(take(1)) .subscribe(() => { - create(modelIdToRegister); - completeDeferredRegistration(id, modelIdToRegister); + create(sourceModelId); + completeDeferredRegistration(id, sourceModelId); }); }); } else { @@ -446,7 +452,7 @@ export function flush(): void { db = {}; registry = {}; iceRegistry.flush(); - inheritorsModelIdsMap = {}; + fieldHeirsMap = {}; } export function getRegistry(): typeof db { diff --git a/ui/guest/src/react/GuestProxy.tsx b/ui/guest/src/react/GuestProxy.tsx index 4ce88650b1..31eae97850 100644 --- a/ui/guest/src/react/GuestProxy.tsx +++ b/ui/guest/src/react/GuestProxy.tsx @@ -17,7 +17,7 @@ import React, { useEffect, useRef } from 'react'; import { useGuestContext, useSelector } from './GuestContext'; import * as ElementRegistry from '../elementRegistry'; -import { getParentElementFromICEProps, inheritorsModelIdsMap } from '../elementRegistry'; +import { getParentElementFromICEProps, fieldHeirsMap, createFieldHeirsKey } from '../elementRegistry'; import * as iceRegistry from '../iceRegistry'; import $ from '../jquery'; import { @@ -426,7 +426,7 @@ export function GuestProxy() { `[data-craftercms-model-id="${modelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` ); if (!itemElement) { - const inheritedModelId = inheritorsModelIdsMap[`${modelId}-${fieldId}`]; + const inheritedModelId = fieldHeirsMap[createFieldHeirsKey(modelId, fieldId)]; itemElement = ifrm.contentWindow.document.documentElement.querySelector( `[data-craftercms-model-id="${inheritedModelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` ); From 64ed79eef068245f8c1514831f905622221ed086 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Fri, 17 May 2024 11:25:09 -0600 Subject: [PATCH 11/12] [6540] Get inheritedModelId from element retrieved from record --- ui/guest/src/elementRegistry.ts | 10 ---------- ui/guest/src/react/GuestProxy.tsx | 13 +++++-------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/ui/guest/src/elementRegistry.ts b/ui/guest/src/elementRegistry.ts index 0a4fbc0fc0..80339697b0 100644 --- a/ui/guest/src/elementRegistry.ts +++ b/ui/guest/src/elementRegistry.ts @@ -48,14 +48,6 @@ let db: LookupTable = {}; // Lookup table of element record id arrays, indexed by iceId let registry: LookupTable = {}; -// A map that contains the IDs of models that inherit an certain field from given inheritance parent model -// { [`${inheritanceParentId}:${fieldId}`]: [inheritanceTargetId1, inheritanceTargetId2, etc] } -export let fieldHeirsMap = {}; - -export function createFieldHeirsKey(inheritanceParentId: string, fieldId: string): string { - return `${inheritanceParentId}:${fieldId}`; -} - export function get(id: number): ElementRecord { const record = db[id]; record && nullOrUndefined(record.label) && setLabel(record); @@ -163,7 +155,6 @@ export function register(payload: ElementRecordRegistration): number { if (isInheritedField(model.craftercms.id, fieldId)) { byPathFetchIfNotLoaded(model.craftercms.sourceMap?.[fieldId]).subscribe((response) => { const sourceModelId = response.craftercms.id; - fieldHeirsMap[createFieldHeirsKey(sourceModelId, fieldId)] = modelId; model$(response.craftercms.id) .pipe(take(1)) .subscribe(() => { @@ -452,7 +443,6 @@ export function flush(): void { db = {}; registry = {}; iceRegistry.flush(); - fieldHeirsMap = {}; } export function getRegistry(): typeof db { diff --git a/ui/guest/src/react/GuestProxy.tsx b/ui/guest/src/react/GuestProxy.tsx index 31eae97850..0159782efb 100644 --- a/ui/guest/src/react/GuestProxy.tsx +++ b/ui/guest/src/react/GuestProxy.tsx @@ -17,7 +17,7 @@ import React, { useEffect, useRef } from 'react'; import { useGuestContext, useSelector } from './GuestContext'; import * as ElementRegistry from '../elementRegistry'; -import { getParentElementFromICEProps, fieldHeirsMap, createFieldHeirsKey } from '../elementRegistry'; +import { getParentElementFromICEProps } from '../elementRegistry'; import * as iceRegistry from '../iceRegistry'; import $ from '../jquery'; import { @@ -381,6 +381,9 @@ export function GuestProxy() { spinner = spinner.firstChild as HTMLDivElement; const daddy = getParentElementFromICEProps(modelId, fieldId, targetIndex); + // 'daddy' element contains the model of the item that inherits field. Retrieving the model for latter usage + // when rendering the new component. + const inheritedModelId = daddy.getAttribute('data-craftercms-model-id'); // If daddy has children, get the closest one to the one that is being added, and get its width to set it // to the spinner container. @@ -423,14 +426,8 @@ export function GuestProxy() { ifrm.onload = function () { spinner.remove(); let itemElement = ifrm.contentWindow.document.documentElement.querySelector( - `[data-craftercms-model-id="${modelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` + `[data-craftercms-model-id="${inheritedModelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` ); - if (!itemElement) { - const inheritedModelId = fieldHeirsMap[createFieldHeirsKey(modelId, fieldId)]; - itemElement = ifrm.contentWindow.document.documentElement.querySelector( - `[data-craftercms-model-id="${inheritedModelId}"][data-craftercms-field-id="${fieldId}"][data-craftercms-index="${targetIndex}"]` - ); - } let component = document.createElement('div'); component.innerHTML = itemElement?.outerHTML; component = component.firstChild as HTMLDivElement; From 64ca8380fb15e4f0e1b7a59c7629ad893fd62c48 Mon Sep 17 00:00:00 2001 From: jvega190 Date: Fri, 15 Nov 2024 15:34:07 -0600 Subject: [PATCH 12/12] [6540] Fix incorrect lock when moving items from ZoneMenu actions --- ui/guest/src/react/ZoneMenu.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/guest/src/react/ZoneMenu.tsx b/ui/guest/src/react/ZoneMenu.tsx index 2146ffb1c1..695f6128ba 100644 --- a/ui/guest/src/react/ZoneMenu.tsx +++ b/ui/guest/src/react/ZoneMenu.tsx @@ -221,8 +221,7 @@ export function ZoneMenu(props: ZoneMenuProps) { const itemModelId = isNodeSelectorItem ? nodeSelectorItemRecord.modelId : modelId; const itemFieldId = isNodeSelectorItem ? nodeSelectorItemRecord.fieldId : fieldId; const itemIndex = isNodeSelectorItem ? nodeSelectorItemRecord.index : index; - const parentModelId = getParentModelId(itemModelId, models, modelHierarchyMap); - const path = modelPath; + const path = models[itemModelId]?.craftercms.path ?? modelPath; return { path, itemModelId, itemFieldId, itemIndex }; };