feat(app): save/load diagrams#19
Conversation
…g-from-fil-c0e04ef Diagram load and save functionality
…termdraw-c-fe3186e refactor(opentui): extract save dialog control helpers
|
Note: this comment is generated, and comes from reviewing the PR for ~15 minutes with an agent The stdin loading flow makes sense to me: stdin is used to read the document, and then the app falls back to That seems like a reasonable Unix approach, but the failure mode needs to be handled more explicitly. In an environment without a controlling TTY, this currently fails with a raw error like:
|
|
Note: this comment is generated, and comes from reviewing the PR for ~15 minutes with an agent A couple thoughts after reviewing this:
For an editable native document format, I’d expect load/save to round-trip cleanly: open a document, save it again, and keep the same object positions unless the user actually changed them in the editor. Also, small API/UX suggestion: I’d prefer This comment was generated by Pi using openai/gpt-5 |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…25d0d Address reviewer's feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed the comments. Let me know if anything else is needed |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e121 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@PabloZaiden Thanks! Merged. |
This pull request introduces native
.td.jsondiagram documents to termDRAW, allowing users to save and reopen editable diagrams. It adds support for loading and saving these documents via the CLI and app, updates the user interface and documentation, and includes comprehensive tests for the new diagram input logic. The changes are grouped into new feature support, CLI/app integration, documentation, and testing.New Feature: Native Diagram Documents
.td.jsondiagram documents, which can be opened and saved for continued editing. Users can now open diagrams withtermdraw --diagram <file>ortermdraw --diagram -to read from stdin, and save diagrams withCtrl+Din the app. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]CLI and App Integration
main.tsx) to support loading diagrams from files or stdin, and to save diagrams in native format. Added helpers for reading from stdin, parsing arguments, and handling diagram save paths. The app now passesinitialDocumentanddiagramPathprops and handlesonSaveDiagramevents for saving the editable document. [1] [2] [3] [4] [5] [6]Documentation Updates
README.mdandCHANGELOG.mdto document native diagram support, new CLI options, and to clarify the distinction between exporting rendered art and saving editable diagrams. [1] [2] [3] [4] [5]Testing
These changes make it possible to persist, reopen, and continue editing diagrams, delivering a more robust and user-friendly workflow for termDRAW users.