mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
feat(studio): hide text panel for elements inside locked compositions
Elements inside a data-timeline-locked sub-composition now have the TEXT property panel hidden. These elements are JS-generated — editing them in the panel won't persist since the script rebuilds the DOM on load. Uses findClosestByAttribute to detect the locked ancestor.
This commit is contained in:
@@ -12,6 +12,7 @@ import type {
|
||||
} from "./domEditingTypes";
|
||||
import {
|
||||
buildStableSelector,
|
||||
findClosestByAttribute,
|
||||
getCuratedComputedStyles,
|
||||
getDataAttributes,
|
||||
getInlineStyles,
|
||||
@@ -318,6 +319,7 @@ export function resolveDomEditSelection(
|
||||
compositionPath,
|
||||
compositionSrc,
|
||||
isCompositionHost: Boolean(compositionSrc),
|
||||
isInsideLockedComposition: Boolean(findClosestByAttribute(current, ["data-timeline-locked"])),
|
||||
label: buildElementLabel(current),
|
||||
tagName: current.tagName.toLowerCase(),
|
||||
boundingBox: {
|
||||
@@ -488,7 +490,11 @@ export function getDomEditTargetKey(
|
||||
}
|
||||
|
||||
export function isTextEditableSelection(selection: DomEditSelection): boolean {
|
||||
return selection.textFields.length > 0 && !selection.isCompositionHost;
|
||||
return (
|
||||
selection.textFields.length > 0 &&
|
||||
!selection.isCompositionHost &&
|
||||
!selection.isInsideLockedComposition
|
||||
);
|
||||
}
|
||||
|
||||
// buildElementAgentPrompt is in domEditingAgentPrompt.ts
|
||||
|
||||
@@ -78,6 +78,7 @@ export interface DomEditSelection extends PatchTarget {
|
||||
compositionPath: string;
|
||||
compositionSrc?: string;
|
||||
isCompositionHost: boolean;
|
||||
isInsideLockedComposition: boolean;
|
||||
boundingBox: { x: number; y: number; width: number; height: number };
|
||||
textContent: string | null;
|
||||
dataAttributes: Record<string, string>;
|
||||
|
||||
Reference in New Issue
Block a user