feat: Divi tree editor and quality warnings
TreeEditor (position/insert/move/remove/duplicate on the BlockTree) and Warnings (post-write quality checks), plus S18's outline breadth limit on the 2a Outline/DiviOutlineAbility. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -36,7 +36,8 @@ final class DiviOutlineAbility implements Ability
|
||||
{
|
||||
return 'Liest den Aufbau einer Divi-Seite: Knoten mit Pfad-ID (s0, s0.r1, s0.r1.c0.m2), Modultyp, '
|
||||
. 'Admin-Label, Textauszug und Preset. Liefert tree_rev – Pflicht für jede Divi-Änderung. '
|
||||
. 'Optional nur ein Teilbaum (id) oder begrenzte Tiefe (depth).';
|
||||
. 'Optional nur ein Teilbaum (id), begrenzte Tiefe (depth) oder begrenzte Breite je Ebene (limit); '
|
||||
. 'abgeschnittene Kinder zeigt "truncated".';
|
||||
}
|
||||
|
||||
public function inputSchema(): array
|
||||
@@ -52,6 +53,13 @@ final class DiviOutlineAbility implements Ability
|
||||
'maximum' => 10,
|
||||
'description' => 'Maximale Tiefe unterhalb des Startknotens (0 = nur der Knoten).',
|
||||
],
|
||||
'limit' => [
|
||||
'type' => 'integer',
|
||||
'minimum' => 1,
|
||||
'maximum' => 500,
|
||||
'description' => 'Höchstzahl Kind-Knoten je Elternknoten (Standard: '
|
||||
. Outline::DEFAULT_LIMIT . '). Überzählige Kinder werden abgeschnitten (truncated).',
|
||||
],
|
||||
],
|
||||
'required' => ['post_id'],
|
||||
'additionalProperties' => false,
|
||||
@@ -83,16 +91,26 @@ final class DiviOutlineAbility implements Ability
|
||||
'children' => ['type' => 'integer'],
|
||||
'editable' => ['type' => 'boolean'],
|
||||
'depth' => ['type' => 'integer'],
|
||||
'truncated' => [
|
||||
'type' => 'boolean',
|
||||
'description' => 'Weitere Kinder dieses Knotens wurden wegen "limit" abgeschnitten.',
|
||||
],
|
||||
],
|
||||
'required' => [
|
||||
'id', 'type', 'label', 'excerpt', 'info', 'presets', 'children', 'editable', 'depth',
|
||||
'truncated',
|
||||
],
|
||||
],
|
||||
],
|
||||
'truncated' => [
|
||||
'type' => 'boolean',
|
||||
'description' => 'Irgendwo im Baum wurden Kind-Knoten wegen "limit" abgeschnitten (auch auf '
|
||||
. 'oberster Ebene, die kein eigenes "truncated" an einem Knoten zeigen kann).',
|
||||
],
|
||||
'edit_url' => ['type' => 'string'],
|
||||
'hints' => ['type' => 'array', 'items' => ['type' => 'string']],
|
||||
],
|
||||
'required' => ['post_id', 'tree_rev', 'rev', 'outline', 'nodes', 'hints'],
|
||||
'required' => ['post_id', 'tree_rev', 'rev', 'outline', 'nodes', 'truncated', 'hints'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -129,7 +147,12 @@ final class DiviOutlineAbility implements Ability
|
||||
}
|
||||
|
||||
$outline = new Outline($this->design->read()->presetNames());
|
||||
$rows = $outline->rows($page->index, $rootId, isset($input['depth']) ? (int) $input['depth'] : null);
|
||||
$rows = $outline->rows(
|
||||
$page->index,
|
||||
$rootId,
|
||||
isset($input['depth']) ? (int) $input['depth'] : null,
|
||||
isset($input['limit']) ? (int) $input['limit'] : null
|
||||
);
|
||||
|
||||
return [
|
||||
'post_id' => (int) $page->post->ID,
|
||||
@@ -139,6 +162,7 @@ final class DiviOutlineAbility implements Ability
|
||||
'rev' => Rev::ofPost($page->post),
|
||||
'outline' => $outline->text($rows),
|
||||
'nodes' => $rows,
|
||||
'truncated' => $outline->wasTruncated(),
|
||||
'edit_url' => $page->editUrl(),
|
||||
'hints' => $this->hints($page, $rows),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user