outline / rich-markdown-editor

The open source React and Prosemirror based markdown editor that powers Outline. Want to try it out? Create an account:
https://www.getoutline.com
BSD 3-Clause "New" or "Revised" License
2.87k stars 588 forks source link

`onClickLink` not working #478

Closed sklinov closed 3 years ago

sklinov commented 3 years ago

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/rich-markdown-editor-kbbyu?file=/src/App.tsx
  2. See that wikipedia link is recognized as a link, but the cursor is not changed on hover.
  3. Click on 'http://wikipedia.org'
  4. See that nothing happens.

In some other cases (like in my main project), onClickLink is not being invoked, but the link is clickable and shows default behavior. UPD: when updated from v. 11.7.0 to 11.12.0-0 onClickLink started working only with command button pressed

Expected behavior Invoke onClickLink function and follow its instructions when clicked on a link.

Version 11.12.0-0

Screenshots

Desktop (please complete the following information):

tommoor commented 3 years ago

The link you shared doesn't include the content, but onClickLink is only triggered in readOnly mode currently, this should be documented. It becomes difficult to edit a link if clicking on it opens it when editing, but if a good pattern can be found to enable both I'd accept a PR.

sklinov commented 3 years ago

@tommoor Sorry about that, looks like autosave wasn't turned on. Thanks for your comment about onClickLink, I'll think of a workaround for my case then. Maybe I'll use a common pattern of CTRL/CMD + Click combination to open a link.