PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
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 0.6.0 All 127 releases
← All changes | src/QuickEdit/lib/agent-block-descriptor.js +12 -0 3.1.23.2.1 View file →
@@ -1,11 +1,14 @@
1 1 // Single source for the agent-block selection-descriptor shape so
2 2 // DOMHighlighter's click commit and ask-ai's pill click can't drift on
3 3 // which metadata flags exist or how they're detected.
4 4
5 +import { detectBlockType } from '@quick-edit/lib/dom';
6 +
5 7 const AGENT_ATTR = 'data-extendify-agent-block-id';
6 8 const PART_ID_ATTR = 'data-extendify-part-block-id';
7 9 const PART_ATTR = 'data-extendify-part';
10 +const PART_SLUG_ATTR = 'data-extendify-part-slug';
8 11
9 12 export const buildAgentBlockDescriptor = (match) => {
10 13 if (!match) return null;
11 14 const templatePart = match.closest?.(`[${PART_ATTR}]`);
@@ -11,8 +14,11 @@
11 14 const templatePart = match.closest?.(`[${PART_ATTR}]`);
12 15 const details = {
13 16 id: match.getAttribute(AGENT_ATTR),
14 17 target: AGENT_ATTR,
18 + // local-pick + classify-block-edit gate on this; without it every edit
19 + // falls through to find-agent.
20 + blockType: detectBlockType(match),
15 21 hasNav:
16 22 !!match.querySelector('.wp-block-navigation') ||
17 23 match.classList.contains('wp-block-navigation'),
18 24 hasSiteTitle:
@@ -31,7 +37,13 @@
31 37 if (templatePart) {
32 38 details.id = templatePart.getAttribute(PART_ID_ATTR);
33 39 details.target = PART_ID_ATTR;
34 40 details.template = templatePart.getAttribute(PART_ATTR);
41 + // Part ids number their own space; without the scope the agent's read
42 + // and save land on the page post's block of the same number.
43 + details.source = {
44 + kind: 'template-part',
45 + partSlug: templatePart.getAttribute(PART_SLUG_ATTR) || '',
46 + };
35 47 }
36 48 return details;
37 49 };