Skip to content

Use public Lexical state APIs for shortcut handling - #25

Merged
samuelstroschein merged 2 commits into
mainfrom
fix/lexical-public-state
Sep 24, 2026
Merged

samuelstroschein merged 2 commits into
mainfrom
fix/lexical-public-state

Conversation

@samuelstroschein

Copy link
Copy Markdown
Member

Summary

This follow-up closes two integration issues found during the Lexical 0.51 review:

  • Persist link hrefs in serialized Lexical node state, so joining blocks can preserve links without reading private _nodeMap state.
  • Ignore an asynchronous Mod+K result if the originally selected node has been removed or its selection is no longer valid.
  • Replace private EditorState._selection / _nodeMap reads in Markdown shortcut handling with EditorState.read, $getSelection, and $getNodeByKey.

No additional Changeset is needed: these fixes harden behavior included in the already merged changesets for this release.

Verification

  • pnpm run ci — passed (173 package tests)
  • pnpm test:demo — passed (35 Chromium checks, no page errors)
  • Reviewed by the Zettel integration reviewer and Atelier's independent read-only reviewer.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T03:49:39.403809Z 2ae767a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ae767a961

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!unresolved.length) continue;
const next = marks.filter((mark) => !unresolved.includes(mark));
const href = (child instanceof ZettelSpanNode || child instanceof ZettelImageNode ? child.getLinkHref() : undefined) ?? $previousLinkHref(child, unresolved);
const href = child instanceof ZettelSpanNode || child instanceof ZettelImageNode ? child.getLinkHref() : undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve link targets when the href cache is absent

When a block join moves linked content whose node has no cached linkHref, this now treats the link as unresolvable and removes its mark. This affects ZettelBreakNode and ZettelInlineHtmlNode, which may legally carry link marks but never receive the new cache, as well as spans and images restored from Lexical JSON saved before this commit. Deleting a boundary after loading such content therefore silently strips the link; retain a previous-state lookup fallback or migrate/cache hrefs for every linkable inline node.

Useful? React with 👍 / 👎.

@samuelstroschein
samuelstroschein merged commit 24f5476 into main Sep 24, 2026
1 check passed
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.

2 participants