Skip to content

Commit cb990d0

Browse files
committed
Disable click-to-edit inside iframes
Skip enabling click-to-edit when the page is loaded inside an iframe to prevent unintended interactions in embedded contexts.
1 parent 56dfec3 commit cb990d0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/useContentLink/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ export function useContentLink(
144144

145145
// Stable method references that call through to the controller
146146
const enableClickToEdit = useCallback((opts?: ClickToEditOptions) => {
147+
// Never enable click-to-edit inside an iframe
148+
if (typeof window !== 'undefined' && window.parent !== window) {
149+
return;
150+
}
151+
147152
// If hoverOnly is true, check if the device supports hover
148153
if (opts?.hoverOnly) {
149154
const supportsHover =

0 commit comments

Comments
 (0)