hackmd-io-issues icon indicating copy to clipboard operation
hackmd-io-issues copied to clipboard

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

Open brlin-tw opened this issue 2 years ago • 0 comments

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

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

brlin-tw avatar Jan 24 '23 10:01 brlin-tw