PluginProbe
Extendify / 3.2.2
Extendify v3.2.2
3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 All 128 releases
← All changes | src/Agent/components/PageDocument.jsx +3 -5 3.1.4 → 3.2.2 View file →
@@ -1,4 +1,5 @@
1 +import { findBlockEl, scopeOf } from '@agent/lib/block-el';
1 2 import { buildSubtreeManifest } from '@agent/lib/subtree-manifest';
2 3 import { useQuickEditStore } from '@quick-edit/state/store';
3 4 import { useMemo } from '@wordpress/element';
4 5 import { __, _n, sprintf } from '@wordpress/i18n';
@@ -7,19 +8,16 @@
7 8
8 9 export const PageDocument = ({ busy }) => {
9 10 const setBlock = useQuickEditStore((s) => s.setAgentBlock);
10 11 const block = useQuickEditStore((s) => s.agentBlock);
11 - const attr = block?.target || 'data-extendify-agent-block-id';
12 12
13 13 // The same manifest the agent works from, so the count matches what it
14 14 // can actually address — not every node in the subtree.
15 15 const count = useMemo(() => {
16 16 if (!block?.id) return 1;
17 - const node = document.querySelector(
18 - `[${attr}="${CSS.escape(String(block.id))}"]`,
19 - );
17 + const node = findBlockEl(block.id, document, scopeOf(block));
20 18 return Math.max(node ? buildSubtreeManifest(node).length : 1, 1);
21 - }, [block, attr]);
19 + }, [block]);
22 20
23 21 return (
24 22 // The input darkens to gray-300 while disabled; a gray-200 chip vanishes into it.
25 23 <div