Bug: Fix agreement block spacing and undeletable last line

Objective

  • Remove the visual glitch in the agreement template block editor where the last line of a block cannot be deleted and an extra blank line remains, causing a visible gap between blocks when viewing the contract.
  • Make the spacing between blocks look clean and consistent so contract layout is not affected by editor behavior.

Background

  • Agreement templates are edited in the Attik tools area; each template is composed of blocks (e.g. text blocks) that are edited with a rich-text editor.
  • Product feedback from the SW region (Mar 9, 2026) reports that when editing a block there is always a line after the text that cannot be removed: you can go down one more line after your text but cannot delete it. That leaves a visible gap between blocks when viewing the contract.
  • The behavior is attributed to an editor/block glitch rather than intentional design; fixing it will improve the contract appearance and reduce confusion when building agreement templates.

Scope

Frontend

  • Block editor: Text block content is edited in attik-frontend/src/app/tools/agreements/templates/[id]/AgreementTextBlock.tsx, which uses TipTapWithVariables for the rich-text field. The editor receives content (TipTap/ProseMirror JSONContent) and persists it via onContentChange; block UI and wrapper are in AgreementBlockWrapper.tsx (e.g. mb-2 space-y-4 for block spacing).
  • Editor component: The shared editor lives in attik-frontend/src/components/tiptap/TipTapWithVariables.tsx, which uses TipTap with a Placeholder extension (emptyEditorClass, emptyNodeClass), default content, and editorProps. ProseMirror/TipTap often keeps a trailing empty paragraph or similar node so the doc always has a valid structure; that can both prevent deleting the "last" line and render as extra space.
  • Preview / output: Agreement block content is rendered for preview in AgreementTextBlock.tsx via TextContentPreview and renderTipTapToHtml; the client-facing agreement view uses AgreementContent.tsx. Any fix should ensure that stored content does not include unnecessary trailing empty nodes that produce visible gaps, and/or that the editor allows users to remove the trailing line without leaving a visible gap in the final contract.
  • In scope: identify why the last line of a block cannot be deleted (e.g. required empty node, key handling, or placeholder behavior) and why that produces a visible gap between blocks; then adjust editor behavior and/or content normalization so that (1) users can achieve the spacing they intend and (2) the gap between blocks is not dictated by an undeletable line.

Backend

  • Agreement block content is stored as JSON (e.g. content.jsonContent) on agreement template blocks; the backend serves and persists blocks via routes such as agreement/template/blocks. No change to the stored schema is required unless the fix involves normalizing or trimming content on save.

Decision needed

  • Whether to fix only in the editor (e.g. allow deletion of the trailing node when appropriate, or collapse it visually), and/or to normalize content on save or when rendering so that trailing empty paragraphs do not create a visible gap. The implementer can choose the approach that best fits TipTap/ProseMirror patterns and existing code.

References

  • Agreement template builder: attik-frontend/src/app/tools/agreements/templates/[id]/AgreementBuilderBase.tsx
  • Agreement text block and wrapper: attik-frontend/src/app/tools/agreements/templates/[id]/AgreementTextBlock.tsx, AgreementBlockWrapper.tsx
  • TipTap editor: attik-frontend/src/components/tiptap/TipTapWithVariables.tsx
  • Source: Mar 9, 2026 SW Region <> ATTIK – Features & Action Items (item 6)

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
πŸ’‘

New Features

Date

2 months ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.