| @@ -9,8 +9,14 @@ | ||
| 9 | 9 | 'core/list', |
| 10 | 10 | 'core/quote', |
| 11 | 11 | ]); |
| 12 | 12 | |
| 13 | +// core/accordion-item locks these in place (templateLock 'all'), so the op takes the item. | |
| 14 | +const LOCKED_PARTS = new Set([ | |
| 15 | + 'core/accordion-heading', | |
| 16 | + 'core/accordion-panel', | |
| 17 | +]); | |
| 18 | + | |
| 13 | 19 | // The wrapper never reaches the model (dropped from the manifest), so "delete this |
| 14 | 20 | // button" can only name the button — walk up to the wrapper when it's the last item. |
| 15 | 21 | export const resolveDeleteTarget = (blockId, scope = null) => { |
| 16 | 22 | const el = findBlockEl(blockId, document, scope); |
| @@ -16,8 +22,12 @@ | ||
| 16 | 22 | const el = findBlockEl(blockId, document, scope); |
| 17 | 23 | if (!el) return blockId; |
| 18 | 24 | let targetId = blockId; |
| 19 | 25 | let parent = el.parentElement?.closest(BLOCK_ID_SEL); |
| 26 | + if (parent && LOCKED_PARTS.has(detectBlockType(el))) { | |
| 27 | + targetId = blockIdOf(parent); | |
| 28 | + parent = parent.parentElement?.closest(BLOCK_ID_SEL); | |
| 29 | + } | |
| 20 | 30 | while ( |
| 21 | 31 | parent && |
| 22 | 32 | LIST_WRAPPERS.has(detectBlockType(parent)) && |
| 23 | 33 | parent.querySelectorAll(BLOCK_ID_SEL).length === 1 |