Skip to content

fix(visimer): restore the rendered label when an edit is cancelled (#6509) - #45

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Oct 14, 2026
Merged

inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown

Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.

…6509)

* fix(visimer): restore the rendered label when an in-place edit is cancelled

Escape on an in-place label edit wrote the raw label text from the diagram
source back into the label with innerHTML. That text never passed through
mermaid's sanitizer. The canvas now saves the label nodes that mermaid
rendered when the edit opens and puts them back on Escape. If a render
replaced the label during the edit, the canvas also repaints it from source.

The reinject after a mid-edit render now moves the typed nodes into the new
label instead of re-parsing them as HTML.

* refactor(visimer): repaint a swapped label with a direct render call

The Escape path set renderHeldByEdit only to reach the held-render block
below it. Call scheduleRender directly instead. scheduleRender restarts one
debounce timer, so a second call from the held-render block is harmless.

* refactor(visimer): drop prose comments and pin the label swap in the repaint test

The new and rewritten prose comments in view.ts and inplace.test.ts are
outside the default comment allowlist. The Escape rule stays as a single
STOP marker. The comments that described the removed innerHTML reinject are
deleted with it.

The repaint test now checks that the in-flight render replaced the label,
and that the new label is still editable, before it sends Escape. Without
that check, a late swap would let the test pass without reaching the
repaint branch.

GitOrigin-RevId: ca5cd6619147dd31d292ad6bd3282c5125156669
@inkeep-oss-sync
inkeep-oss-sync Bot merged commit 2951fe2 into main Oct 14, 2026
@inkeep-oss-sync
inkeep-oss-sync Bot deleted the copybara/sync branch October 14, 2026 23:50
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.

1 participant