| @@ -6,8 +6,9 @@ | ||
| 6 | 6 | |
| 7 | 7 | const AGENT_ATTR = 'data-extendify-agent-block-id'; |
| 8 | 8 | const PART_ID_ATTR = 'data-extendify-part-block-id'; |
| 9 | 9 | const PART_ATTR = 'data-extendify-part'; |
| 10 | +const PART_SLUG_ATTR = 'data-extendify-part-slug'; | |
| 10 | 11 | |
| 11 | 12 | export const buildAgentBlockDescriptor = (match) => { |
| 12 | 13 | if (!match) return null; |
| 13 | 14 | const templatePart = match.closest?.(`[${PART_ATTR}]`); |
| @@ -36,7 +37,13 @@ | ||
| 36 | 37 | if (templatePart) { |
| 37 | 38 | details.id = templatePart.getAttribute(PART_ID_ATTR); |
| 38 | 39 | details.target = PART_ID_ATTR; |
| 39 | 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 | + }; | |
| 40 | 47 | } |
| 41 | 48 | return details; |
| 42 | 49 | }; |