diff --git a/app/editor/index.tsx b/app/editor/index.tsx index cab6dcf48..c812e32ec 100644 --- a/app/editor/index.tsx +++ b/app/editor/index.tsx @@ -879,7 +879,13 @@ const observe = ( callback(match as HTMLElement); } }); - observer.observe(targetNode, { childList: true, subtree: true }); + + if (targetNode.querySelector(selector)) { + callback(targetNode.querySelector(selector) as HTMLElement); + } else { + observer.observe(targetNode, { childList: true, subtree: true }); + } + return observer; };