task(G3): title block with attributes - frame + attributed texts (ATTDEF convention), auto-insert as layout frame block

This commit is contained in:
Agent Zero
2026-08-29 02:46:51 +02:00
parent 1eb6a99025
commit bbb469e25e
5 changed files with 285 additions and 1 deletions
+13 -1
View File
@@ -12,7 +12,7 @@
*/
import * as Y from 'yjs';
import { YjsDocument } from '../../crdt/YjsDocument';
import type { CADElement, CADLayer, LayoutDefinition } from '../../types/cad.types';
import type { CADElement, CADLayer, LayoutDefinition, BlockDefinition } from '../../types/cad.types';
export class CADDocument {
private readonly ydoc: YjsDocument;
@@ -99,6 +99,18 @@ export class CADDocument {
});
}
// ── Blöcke (Task G3 — bewusst NICHT undo-getrackt, siehe UndoManager-Kommentar) ──
/** Eine Blockdefinition per ID (oder undefined). */
getBlock(id: string): BlockDefinition | undefined {
return this.ydoc.data.blocks.get(id);
}
/** Fügt eine Blockdefinition hinzu (überschreibt gleiche ID). */
addBlock(block: BlockDefinition): void {
this.ydoc.data.blocks.set(block.id, block);
}
// ── Schreiben ────────────────────────────────────────────
/** Fügt ein Element hinzu (einzelner Aufruf = eigener Undo-Schritt). */