hackmdio / hackmdio/hackmd-io-issues

Note creation prompt triggered at the wrong character when the link text contains square brackets []

Open
#317 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
40
Forks
9
PR merge metrics
No merged PRs in 30d

Description

### Is this a hackmd.io issue?

- [x] Yes, the bug happens on https://hackmd.io
- [ ] No. If it's a self-hosted CodiMD instance, please fire up the issue in the repo of CodiMD: https://github.com/hackmdio/codimd

### What's the problem

When the link text contains square brackets the note creation prompt is triggered at the closing square bracket inside the link text instead of where it should be.

#### Current behaviour

Refer the following screen recording for bug reproduction:

[bug reproduction screen recording](https://user-images.githubusercontent.com/13408130/214266882-45c9c781-4ffa-40ed-b98c-36399b5ae355.webm)

Provide steps to reproduce:

1. Enter `[link text containing [] square brackets]`
2. Press ← once, notice no note creation prompt appears when it should be
3. Move the cursor to the closing square bracket in the link text, and notice that the note creation prompt incorrectly triggered.

If possible, create a note with reproducible content and share the link with us.

note link: https://hackmd.io/pgbK2PrpTHmOxwcSZ3n2Pw

#### Expected behaviour

Note creation prompt appears at the outer closing square bracket

#### Environment

I use HackMD on:

**Desktop**
- OS: Ubuntu 22.04 AMD64
- Browser: Firefox
- Browser Version: 109.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.