Conversation
| parser.href = rawHref | ||
| const { href, hash } = parser | ||
|
|
||
| if (!rawHref) return // not checked href because parser will create file://... string for [empty link]() |
There was a problem hiding this comment.
Can you remove this redundant line please?
There was a problem hiding this comment.
OK, no problem. I've removed it.
| return | ||
| } | ||
|
|
||
| const regexIsTagLink = /^:tag:#([\w]+)$/ |
There was a problem hiding this comment.
Can you remove the # since we decided to remove # from tag link in the previous PR?
There was a problem hiding this comment.
I've removed it but there is a new issue introduced by this change - see comment below.
|
@AWolf81 ping |
|
@ZeroX-DG Sorry, for not responding. I've thought your requested changes are easy to fix but there is a new issue once I've removed the Codemirror is changing the link handling with-out the I need to do more debugging for this. Do you have an idea what could cause this? An easy fix would be to use the |
|
CodeMirror used to do weird things in the markdown syntax. For example: So I think it's CodeMirror Markdown parsing issue. Currently Boostnote used its' own CodeMirror mode, so we can fix this by overriding the rule in mode I think. But I'm not quite sure how to do it yet. I'll see if I can find out a way to fix this but in the mean time u are welcome to help me investigate on it. |
|
@ZeroX-DG OK, I've found the location of the problem. It's inside var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/iThere is a The other issue with During testing, I've found another issue: If your search term is matching |
|
It's tempting to switch back to the |
|
Yes, you're right. We should try to fix it. I've changed the regex URL_re in gfm by removing the Do you know how I can overwrite or replace the gfm inside the bfm mode? |
|
That's a hard problem, I'm still investigating how we can do that. I wonder if we create our custom |
|
@ZeroX-DG Yes, that was a hard one. I've added gfm with a modified regex to Boostnote. I removed the I've also fixed the other issue with the search term hitting a link. Just highlighting of the link looks a bit off but the click handler is working as expected. (I also added this to normal link handler - code duplication is OK here as it's only used in two locations) |
|
The highlighting works flawless on my side. I think this looks cool. Can you show me the highlighting bug on your side @AWolf81 ? BTW I have no idea with |
|
@ZeroX-DG I wouldn't say it's a bug. I just think this could be improved. Hovered search term screenshot: And here with-out a search term and correct light blue highlighting: I'm not sure if I'm a bit too critical here but fixing this could be a bit tricky as the yellow highlighting is conflicting the hover effect and that there a multiple spans involved. I think that could be also fixed later as the click handling is working as expected. |
|
@AWolf81 I see. I think it's gonna be very tricky to fix the highlighting for the search term. Since it's not a major issue, I don't think with should hold this PR and fix it. I think for now this PR looks great, I'll approve it and get it merge first. Then we can find a way to deal with that search term highlighting stuff. |
|
A possible solution for that issue is by using markText to create our own link element |





Description
I've added the missing link handling for
:tag,:line&:notelinks in editor (ctrl+click handling). This branch is based on branchfeature-tag-linksso this PR is waiting for PR #3002 to be approved/merged.I first wanted to move the script from MarkdownPreview link handling to a file that we can use at both location but I think it's OK to have some code duplication at two locations.
It's also not identical code but pretty similar. If there is a location where I can put the
specialLinkHandlermethod, I can add it but I think it's also OK like I have added it.You can test the link handling with the following Markdown (requires some updates so tags & notes are available):
Issue fixed
#3364
Type of changes
Checklist:
Screenshot:
Code decisions:
eventEmitter.emitmethod inhyperlink.jsas importing fromeventEmitter.jswas not working. I think that's OK as only the emit method is needed here.dispatch:pushadded tobrowser/main/main.jsit's used to dispatch a push action toconnected-routerso it's possible to change the route for tag link handling. Not sure about the naming but I think it is OK. Location of the listener is also OK in main.js or is there a better location?innerTextof the clicked node, trims whitespaces (in case there are some - probably optional) and remove the braces.