Skip to content

feat: allow renaming history entries#1918

Open
mvanhorn wants to merge 4 commits intomermaid-js:developfrom
mvanhorn:feat/rename-history-entries
Open

feat: allow renaming history entries#1918
mvanhorn wants to merge 4 commits intomermaid-js:developfrom
mvanhorn:feat/rename-history-entries

Conversation

@mvanhorn
Copy link
Copy Markdown

History entries get random slug names, making it hard to find a specific save point. This adds a rename button so you can give entries meaningful names.

Click the edit icon next to any entry name. The name turns into a text input. Hit Enter or click away to save. Escape to cancel. The new name persists to localStorage through the existing store.

Two files changed:

  • history.ts: added renameHistoryEntry(id, newName)
  • History.svelte: added edit icon button + inline text input

Per @sidharthv96's UX spec in #967.

Fixes #967

This contribution was developed with AI assistance (Codex).

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for mermaidjs ready!

Name Link
🔨 Latest commit c15c0f2
🔍 Latest deploy log https://app.netlify.com/projects/mermaidjs/deploys/69d90d38f8731800088cb7f2
😎 Deploy Preview https://deploy-preview-1918--mermaidjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Add an edit button next to each history entry name. Clicking it turns
the name into an editable text input. Press Enter or click away to save,
Escape to cancel. The rename persists to localStorage via the existing
store pattern.

Fixes mermaid-js#967
@mvanhorn mvanhorn force-pushed the feat/rename-history-entries branch from 9cfaf91 to 1d9695d Compare March 31, 2026 12:57
@sidharthv96
Copy link
Copy Markdown
Member

Hi @mvanhorn,

PR looks good, need some more tweaks to handle edge cases.

  • Make the field required to stop empty names
  • Tweak css to handle very long names that push other things out. Use ellipsis.
  • Move the edit button to the right side of the name text, and make it a bit smaller.
  • Add tests
image

… tests

- Make rename input required and reject empty names in both UI and store
- Add CSS truncation with ellipsis for long entry names (max 150px)
- Move edit button inline next to name text, smaller icon
- Add rename test coverage (rename manual, auto, targeted entry)
- Fix pre-existing eslint error on external revision link (add rel=external)
@mvanhorn
Copy link
Copy Markdown
Author

mvanhorn commented Apr 1, 2026

Addressed in 47649f6:

  • Rename input has required + trim guard so empty names are rejected at both UI and store level
  • Long names truncate with ellipsis at 150px, full name visible on hover via title
  • Edit icon moved inline next to the name text, smaller (3.5x3.5)
  • Added 3 rename tests covering manual, auto, and targeted-entry-only scenarios
  • Also fixed a pre-existing eslint no-navigation-without-resolve error on the revision link by adding rel="external"

@sidharthv96
Copy link
Copy Markdown
Member

image

Can you please move the edit icon to the right of the title?
Similar to how it's in GitHub

image

@sidharthv96
Copy link
Copy Markdown
Member

Long names truncate with ellipsis at 150px, full name visible on hover via title

Instead of hardcoding to 150px, please use flex, so that it will grow as required within the available space. Now a lot of space is wasted by the truncation.

image image

- Edit icon now appears inline to the right of the name (like GitHub)
- Name truncation uses flex + min-w-0 instead of hardcoded 150px
- Name grows within available space, only truncates when needed
@mvanhorn
Copy link
Copy Markdown
Author

mvanhorn commented Apr 2, 2026

Addressed both in 9c4acc3:

  • Edit icon is now inline to the right of the name text
  • Replaced the hardcoded 150px max-width with flex layout -- the name grows within available space and only truncates with ellipsis when it actually needs to

@sidharthv96
Copy link
Copy Markdown
Member

Replaced the hardcoded 150px max-width with flex layout -- the name grows within available space and only truncates with ellipsis when it actually needs to

Current behaviour is pushing the other icons off the screen, forcing a scroll, it is not truncating with ellipsis.

image

Remove min-w-fit from history list container and add overflow-hidden
to the name row so long names truncate with ellipsis instead of
pushing action icons off screen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mvanhorn
Copy link
Copy Markdown
Author

Fixed in c15c0f2 - the min-w-fit on the history list container was preventing the name from being constrained, so it grew past the available space instead of truncating. Removed that and added overflow-hidden to the name row so ellipsis kicks in properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to rename history entries

2 participants