feat: simplified document editor + optional blocks
Schema: - Block: new optional fields `optional` (boolean) and `optionalLabel` (string) - DocBody: new field `disabledBlockIds` — IDs of optional blocks turned off on this instance - Renderer skips blocks whose id is in disabledBlockIds Template authoring (BlocksEditor): - Each block card has «Опциональный» checkbox + custom label input - Optional blocks visually highlighted (amber border) Document editing (DocumentEdit): - New «Расширенный режим» toggle in header (default off → simple mode) - Simple mode: only document header, lines, and «Дополнительные пункты» section listing optional blocks as checkboxes - Advanced mode: also shows full BlocksEditor (previous behavior) - Toggling optional block updates body.disabledBlockIds; renderer/PDF reflects it Workflow: автор шаблона помечает спорные блоки как опциональные → пользователь при создании документа просто отмечает галочки, не залезая в контент. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -288,7 +288,11 @@ export function renderDocumentHtml(
|
||||
rubInWords?: (cents: number) => string;
|
||||
} = {},
|
||||
): string {
|
||||
const blocksHtml = body.blocks.map((b) => renderBlock(b, ctx, opts.rubInWords)).join('\n');
|
||||
const disabled = new Set(body.disabledBlockIds ?? []);
|
||||
const blocksHtml = body.blocks
|
||||
.filter((b) => !disabled.has(b.id))
|
||||
.map((b) => renderBlock(b, ctx, opts.rubInWords))
|
||||
.join('\n');
|
||||
const title = opts.title ?? `Документ ${ctx.doc.number}`;
|
||||
|
||||
return `<!doctype html>
|
||||
|
||||
Reference in New Issue
Block a user