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

Not working nicely with Notion #109

Open
vinismarques opened this issue Mar 27, 2023 · 9 comments
Open

Not working nicely with Notion #109

vinismarques opened this issue Mar 27, 2023 · 9 comments
Labels
bug Something isn't working plugin Will be actioned in a separate 'plugin' add-on wontfix This will not be worked on

Comments

@vinismarques
Copy link

vinismarques commented Mar 27, 2023

Seems like Notion is capturing keystrokes when I try to edit a search word, so you might end up sending shortcuts directly to the page instead of the "search keyword" field.

There was also an issue related to not finding every result on Notion. I was expecting it not to work there because none of the other extensions I tried worked, but just in case this is something you want to check out, I'm reporting here. It found one match (on the top of the page in a Table of Contents element, but not other ones that were down on the page (regular ctrl+f found them).

I did some more tests and made it work by changing the default settings. To make it find the other matches (or at least go to the other matches), I had to disable "Use CLASSIC highlighting". But now the highlighting isn't working well. It highlights only the first match and only if I enable "Use experimental browser APIs".

@ator-dev
Copy link
Member

ator-dev commented Mar 27, 2023

Hi, thank you for your interest and reporting the problem! Complex web apps (like Notion) are known to cause problems with injected behaviour, but I'm happy to work through the issues to get it working as well as possible.

You're right about the keystrokes - Notion is being overly aggressive about capturing them. I have created a workaround which will be included in the next release (:

Highlighting:

I'm impressed that you took the time to find and use the experimental options. "CLASSIC" highlighting is the method used by all other extensions, and the newer method doesn't interfere with pages but has limitations, some of which are solved by the experimental APIs. A future update will allow using non-CLASSIC highlighting on specific sites.

I recommend keeping "Use experimental browser APIs" on, as it has no negative effect on CLASSIC highlighting.

I'm a bit confused about some of your report, would you mind clarifying the following points please?

  • When I tried it, MMS found every result, but would not update properly when typing into Notion. What keywords did you use which only had one match?
  • You said the highlighting isn't working well and it highlights only the first match - this doesn't happen for me, what keywords result in this behaviour?

@ator-dev ator-dev added the bug Something isn't working label Mar 27, 2023
@vinismarques
Copy link
Author

vinismarques commented Mar 27, 2023

You said the highlighting isn't working well and it highlights only the first match - this doesn't happen for me, what keywords result in this behavior?

The word I initially tested was "bind" with the "Whole word" parameter, but it can be virtually any other word.

See the image below for a test I did with other words in mode CLASSIC. It seems like the extension is able to find/highlight only text in blocks of specific types (Code block and Table of Content), it did not find or highlight the "select" and "option" partial matches outside of code blocks (in regular text blocks or headers).

image

Disabling the option "Use CLASSIC highlighting" makes the extension find matches in regular text blocks, but still it only highlighted matches inside code blocks (it jumps to the words, but there is no highlight).

When I tried it, MMS found every result, but would not update properly when typing into Notion. What keywords did you use which only had one match?

Okay, so I did more tests and I think now I understand what could be causing this. It seems that if the search keyword is already set and I do something like refresh the page, then the extension will only find the first match. I suppose it only finds the first match because it is in the Table of Content that is loaded right at the beginning and the rest of the document loads asynchronously. To make it work (find matches in blocks that take a little longer to load), I have to remove and add the word again. I guess that doing so forces the extension to do the match for this new word considering the (now) loaded page. Knowing that I can easily solve this by waiting for the page to load makes this not a big issue, but the point above is a huge one (only finding matches in code blocks).

Another (minor) thing I noticed is that the highlights aren't being shown in the vertical scroll bar and if I go to the next found match, the scroll bar indicator is unaligned with the actual scroll bar.

@vinismarques
Copy link
Author

By the way, congrats on the impressive work you are doing here. The extension is way ahead of its competition, I can see myself using it daily. After less than a day, I really enjoy being able to find multiple words.

I did disable it on search providers (gets too colorful for my taste) and set a few of the keyboard shortcuts. Now it integrates seamlessly into my workflow (besides the Notion part, but there's hope!). Thanks!

@ator-dev
Copy link
Member

ator-dev commented Mar 28, 2023

it did not find or highlight the "select" and "option" partial matches outside of code blocks

still it only highlighted matches inside code blocks

It took a bit of testing, but I worked out what was going on here. Turns out that in Firefox, MMS works close to perfectly with Notion. In Chrome, Notion has the most aggressive behaviour I've ever seen, instantly wiping out any custom attributes that you set (attributes determine where highlighting happens), which makes it very near impossible to manipulate. I have worked out a single way of tricking it into not recognising the change:

image

Needless to say, this results in a very hacky approach. Unfortunately I can't fix it in the production version of MMS, as it would be hard to maintain. I am interested in making 'plugins' for MMS that solve specific problems though, so maybe this could be released as a special-purpose version?


As to the rest of your problem: you are correct, it has problems when the document is reloaded. The weird thing is that I have mechanisms in place to update dynamically (c.f. DuckDuckGo's dynamic results page), and some sites still manage to slip through the cracks. I will be investigating this as part of larger stabilisation work. (:

One more issue: often when reloading the page, I noticed that turning MMS off and on again (with Alt+M twice) would cause it to have a single keyword: "-". This turned out to be because reloading caused a hyphen to be selected; MMS automatically replaces keywords with the current selection when turned on. This is intended behaviour, and unfortunately won't be solved.

@ator-dev
Copy link
Member

Thank you very much for your kind comments and review! I'm glad it's working well for most cases.

I actually have the same problem with highlighting search providers. Maybe try setting the following options as shown? 'Search-activated' highlighting will be uncoloured by default but with scroll markers and buttons visible, and pressing Alt+Shift+D will show/hide highlighting as needed.

image

@ator-dev ator-dev added wontfix This will not be worked on plugin Will be actioned in a separate 'plugin' add-on labels Mar 28, 2023
@ator-dev
Copy link
Member

ator-dev commented Mar 28, 2023

Only actionable change addressed via #110, planned for release in v1.13.3. Marked as wontfix due to infeasibility, but could be implemented by a community-maintained special-purpose version of the extension. I am planning to look into this possibility in future.

@vinismarques
Copy link
Author

In Chrome, Notion has the most aggressive behaviour I've ever seen, instantly wiping out any custom attributes that you set (attributes determine where highlighting happens), which makes it very near impossible to manipulate. I have worked out a single way of tricking it into not recognising the change

That's unfortunate, but I'm glad at least it seems to be a way to work around that.

I am interested in making 'plugins' for MMS that solve specific problems though, so maybe this could be released as a special-purpose version?

By plugins you mean installing other extensions or would that be something that could be enabled directly inside MMS?

@ator-dev
Copy link
Member

ator-dev commented Mar 30, 2023

installing other extensions or would that be something that could be enabled directly inside MMS?

Unfortunately, since I maintain a strict practice of not making website-specific code, it will have to be external. That is, a "plugin": a separate extension that interacts with MMS. In this case, it would be a version of MMS's highlighter with specific modifications, which automatically takes over when on Notion, highlighting the same keywords in a Notion-friendly way.

"Plugins" is a very recent idea. None exist for MMS yet, but you can see the plans here:

https://github.com/orgs/searchmarkers/projects/1

Most will implement very specific features that require separate menus and options. I hope that it will enhance the community once I have the time to make them!

@ator-dev
Copy link
Member

ator-dev commented Apr 15, 2023

Keystroke improvements shipped with 1.13.4, now available in the Chrome Web Store and pending for Edge (Firefox version to be updated when ported).

The new version also offers improved highlighting as per #114, which will fix some of the issues with Notion. Specifically, it should now work extremely well in Firefox, and will continue to fail in Chrome. You can track progress towards a plugin in the brand new Plugin Roadmap, which I will begin work on in a number of months.

Specialised commit: 60d0300

@ator-dev ator-dev moved this from Todo to Draft in Plugin Roadmap Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin Will be actioned in a separate 'plugin' add-on wontfix This will not be worked on
Projects
Status: Mockup
Development

No branches or pull requests

2 participants