Skip to content

step-recorder: fix selection - #93

Merged
feedthejim merged 1 commit into
mainfrom
step-recorder-fix
Feb 12, 2021
Merged

feedthejim merged 1 commit into
mainfrom
step-recorder-fix

Conversation

@feedthejim

Copy link
Copy Markdown

I was not checking that the element focus was within the editor, so if you clicked outside and then tried to record, the path generation went on forever

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 12, 2021
@feedthejim
feedthejim merged commit b90d94e into main Feb 12, 2021
@yangshun
yangshun deleted the step-recorder-fix branch February 12, 2021 18:28
etrepum pushed a commit to etrepum/lexical that referenced this pull request Oct 31, 2026
## Description

Merges main at cfcd3c4, which brings meta#9600 (escape a literal bracket only where it would start a link). It conflicted with this branch in four files:

- `MarkdownExport.ts`: text escaping keeps this branch's `shouldPreserveNewLines` backslash handling and `toCharacterReference`, and routes default-mode text through meta#9600's `$escapeLiteralBrackets` instead of writing every bracket as a reference. meta#9600's bracket helpers sit beside this branch's piece joining.
- `importTextMatchTransformer.ts`: `matchLink` combines meta#9600's code-span rules (no link opens inside a code span, or has its `](` or `)` in one) with this branch's bounded search (stop at the last `](`, jump over escaped openers, start at the real opener). A search rejected for a code span now jumps to the code span's end or the label's last character, since every `[` before it finds the same rejected link. The code spans come from the line's format scan when the code transformer is present. A link with an empty label after its real opener, as in `x[[](u)`, now stays text as meta#9600 has it, like `[](u)` does, rather than becoming an empty link that dropped `](u)`.
- `LexicalMarkdown.test.ts`: `[hello]](https://lexical.dev)[world](...)` exports as `[hello]&meta#93;(https://lexical.dev)[world](https://lexical.dev)`: meta#9600's bracket escape, plus this branch's spoiled scheme so that GFM readers do not run the URL on into the next link.
- `MarkdownEscaping.test.ts`: both sides made the same change to the unbalanced-link test; main's version is kept.

## Test plan

Command: `pnpm exec vitest run --project unit packages/lexical-markdown packages/lexical-mdast packages/lexical-playground/__tests__/unit scripts/__tests__/unit/treeShakingSource.test.ts`

### After

```
 Test Files  46 passed (46)
      Tests  1599 passed (1599)
```

`matchLink` was compared with main's on 150,000 random lines of brackets, parentheses, escapes and backticks, using the same code spans: no differences. Export and import round trips of 20,000 random paragraphs with links, brackets, formats and bare URLs found none that main reads back correctly and this branch does not, in either `@lexical/markdown` or `@lexical/mdast`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants