Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal HTML notelinks does not work in the mobile app #6515

Closed
JackGruber opened this issue May 14, 2022 · 9 comments
Closed

Internal HTML notelinks does not work in the mobile app #6515

JackGruber opened this issue May 14, 2022 · 9 comments
Labels
bug It's a bug high High priority issues mobile All mobile platforms

Comments

@JackGruber
Copy link
Contributor

When an HTML link is used instead of the markdown notation to refer to another note, the link does not work in the mobile app.

Environment

Joplin version: 2.7.2
Platform: Android
OS specifics: 10

Steps to reproduce

  1. Create a note with the following content (Replace the ID by a reale noteid)
Works: [Test](:/cfbca1500bad4524a623092c8f598a67)
Works not: <a href=":/cfbca1500bad4524a623092c8f598a67">Test</a>
  1. Test both links on the desktop app, both works
  2. Test both links on the mobile app, only the first one works

Describe what you expected to happen

Internal links with HTML notation should work

@JackGruber JackGruber added the bug It's a bug label May 14, 2022
@laurent22 laurent22 added mobile All mobile platforms high High priority issues labels May 14, 2022
@JackGruber JackGruber changed the title Internal HTML notelinks do not work in the mobile app Internal HTML notelinks does not work in the mobile app May 14, 2022
@NicoleSigaud
Copy link

NicoleSigaud commented May 19, 2022

What I got so far for a link as image is nesting, which worked fine either on Windows and Android:
[![](:/imagepath)](:/linkpath)
As for the dimensions of the image, I found that
[<img src=':/imagepath' style="width:25%; height:25%" />](:/linkpath) -- works both on Android and Windows
The only thing is that the Joplin blue logo appears before the main image, indicating a link.

Now for NoteOverview, the last thing I tried was
text: "[{{image}}](:/{{id}})" and that solved my problem

@Daeraxa
Copy link
Collaborator

Daeraxa commented May 19, 2022

@NicoleSigaud Your comments are about image links, the issue detailed here is about links to notes.

@Tolu-Mals
Copy link
Contributor

Tolu-Mals commented May 27, 2022

I was able to reproduce this on an android emulator and physical android device.

@NicoleSigaud
Copy link

@Tolu-Mals I'm glad you did! SO, as for the Joplin small logo before the links, it's there for good, isn't it?

@Tolu-Mals
Copy link
Contributor

@NicoleSigaud Yes

@laurent22
Copy link
Owner

@Tolu-Mals, did you look into this issue? What happens when the link is clicked - is there any error or message in the console? If not, you'll probably need to find where the click event is caught and how it is currently processed.

@Tolu-Mals
Copy link
Contributor

Tolu-Mals commented Jun 7, 2022

Yes I looked into the issue. There's only a console warning "Possible unhandled promise rejection".

I can see that the event is being processed inside the useOnMessage hook. I'll take a look at it.

I also plan to log out html that's been used in the Webview to see what I can find.

@Tolu-Mals
Copy link
Contributor

So I logged the html generated in useSource to the console.

Output when using HTML Links

<p><a href=":/60ee5b0b0835484a887bb76e5bf9d109" class="jop-noMdConv">Note 1</a></p>

Output when using MD Notation Links

<p><a data-from-md data-resource-id='60ee5b0b0835484a887bb76e5bf9d109' href='#' ontouchstart='if (typeof(t) !== "undefined" && !!t) { clearTimeout(t); t = null; } else { t = setTimeout(() => { t = null; window.joplinPostMessage_("longclick:60ee5b0b0835484a887bb76e5bf9d109"); }, 500); }' ontouchend='if (!!t) {clearTimeout(t); t=null; window.joplinPostMessage_("joplin://60ee5b0b0835484a887bb76e5bf9d109");}' ontouchcancel='if (!!t) {clearTimeout(t); t=null; ontouchmove="if (!!t) {clearTimeout(t); t=null;'><span class="resource-icon fa-joplin"></span>First Note</a></p>

I'm still looking into why this happens and how to fix it.

@Tolu-Mals
Copy link
Contributor

Tolu-Mals commented Jun 8, 2022

I discovered that the link_open rule doesn't work for html notation links. The link_open rule uses the link_replacement function to convert links into joplin file links, but this only works for markdown notation links.

I discovered this by adding console.log() inside the link_open rule. I get the log when a regular markdown link is present in the note, but not when a html notation link is present.

I'll read the documentation on markdown-it plugins to see how to fix this.

But I don't understand why the desktop app is able to open html notation joplin file links since it uses the same renderer the mobile app does. Does the desktop app handle links in a different way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug high High priority issues mobile All mobile platforms
Projects
None yet
Development

No branches or pull requests

5 participants