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

Highlightr not working in +Obsidian v.15.8 (last update) + other issues #42

Open
gabrielcarus opened this issue Jul 12, 2022 · 55 comments

Comments

@gabrielcarus
Copy link

gabrielcarus commented Jul 12, 2022

Hey Chetachi!
Just leaving some issues on the plugins here, so you can take a look later, take your time to deal with your personal problems, no need to hurry!
First of all, congrats on the obsidian plugins, very nice job you did, I can see that you putted much love and effort in every single one of them. Thank you a lot.

Alright, so now the issues:

  • Highlightr stopped working in Obsidian v.15.6 (or superior), even the shortcuts.
    • 7/22/22 - Updated Obsidian to v.15.8, when using the "Ctrl+P" shortcut it works, but the Highlightr pop up don't.
  • An old problem with Highlightr, that I believe you already know, is the space after the marked text. (Remove extra whitespace #39)
  • A small detail, that would be nice to analyze, is that cMenu is taking a lot to load.
  • Snippets plugin didn't stop, but is having some basic bugs in its structure (not making possible to create new CSS Snippets through the plugin and the "hovering" when using the mouse is also bugged).

As I said, take your time alright?
That's it, best of luck 🫂


For those having the same problem, in the coments there is a ton of really good solutions.
I personally used (not so aesthetic, but is pretty useful) "Wrap with shortcuts plugin $^1$ ", you can configure hotkeys for each highlight color/font color. It won't have rounded highlights, but it can be a good option until Highlightr plugin comes back.

  • The code to highlight in obsidian is: <font style="background-color:#FFBD59A6"> text here </font>
  • The code to make colorful text is: <font style="color:#FFBD59"> text here </font>
  • The letters and numbers after the "#" are the HEX code that indicate a certain color, the "A6" indicate the transparency. You can find good pallete colors in: https://coolors.co/palettes

$^1$ copy and paste on browser: obsidian://show-plugin?id=obsidian-wrap-with-shortcuts

Peace ✌🏻

@rossoj85
Copy link

Can confirm. This just stopped working for me about 20 minutes ago.

@ikarot
Copy link

ikarot commented Jul 13, 2022

Confirm. Not working from today.

@wutsminame
Copy link

confirm

@angiedan
Copy link

I am so happy I found this post, I thought I was the only one with this issue.

@gabrielcarus gabrielcarus changed the title Highlightr not working in Obsidian v.15.6 (last update) Highlightr not working in Obsidian v.15.6 (last update) + other issues Jul 16, 2022
@toroidalGames
Copy link

Isn't working for me either

@Xieleilab
Copy link

confirm

@iMagUdspEllr
Copy link

The shortcuts and the right-click menu do not work.

@greentealatte22
Copy link

Same here. Relieved to find this posting and hope it works again!

@sialaweb
Copy link

Yes confirm, the right-click on highlight don't do anything

@gabrielcarus gabrielcarus changed the title Highlightr not working in Obsidian v.15.6 (last update) + other issues Highlightr not working in Obsidian v.15.8 (last update) + other issues Jul 22, 2022
@WALL-EEEEEEE
Copy link

confirm here.

@NikoMuffin
Copy link

Just found this plugin and not working for me, ugh.

@daamiian
Copy link

I'm now getting "focus must be in editor"

@Paddy1058
Copy link

FYI, I found a partial work a round -- by setting hotkeys for the various colors, I can now again add highlights. But setting a hot key to open the highlightr doesn't work -- it just doesn't respond, and doesn't display the choice of colors. Also, to unlighlight, right-clicking on the highlight doesn't bring up the unhighlight menu, but raises a note that "focus must be in editor" (I'm using live preview). Clicking on the highlight puts it in edit mode, then right-clicking brings up unhighlight option, and clicking then unhighlights. Hope this may help in troubleshooting. Really like this plugin when it was working normally.

See my post #41

@daamiian
Copy link

Another workaround for those who don't want to make new hotkeys:

Highlight the word, open command palette, "Highlightr" - pick a color.

This takes longer, but I have enough hotkeys as it is, so this works for me as a temporary solution.

@gabrielcarus gabrielcarus changed the title Highlightr not working in Obsidian v.15.8 (last update) + other issues Highlightr not working in +Obsidian v.15.8 (last update) + other issues Jul 27, 2022
@CharlesCollin91
Copy link

Any news about that issue ?

@KraXen72
Copy link

it is not working, +1

1 similar comment
@zokizuan
Copy link

it is not working, +1

@huyz
Copy link

huyz commented Jul 30, 2022

Hmm, single keyboard shortcut to a color works for me as a workaround

@mikelyncheski
Copy link

To be clear:

(1) Select text
(2) Right click
(3) Choose "Highlight"
(4) Nadda, nothing, zippo

Control P works fine.

@jasperdj
Copy link

Still broken on obsidian 0.15.9, highlightr 1.2.1.

@ikuygithub
Copy link

I've just installed it yesterday and was struggling for hours.
wish I noticed that its no longer available much earlier

@SimoAbjaou
Copy link

Its not working for me any more with obsidian 15.6

@KraXen72
Copy link

KraXen72 commented Aug 1, 2022

@chetachiezikeuzor could we please get a fix? thanks

@remerle
Copy link

remerle commented Aug 2, 2022

For a workaround for the broken context menu (for the Desktop app), go to your .obsidian\plugins folder or Settings -> Community Plugins -> Installed Plugins and click the folder icon:
image

Go into the highlightr-plugin folder and open main.js. Search for menu.showAtPosition and replace the following:

        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });

with

        const orig=menu.__proto__.sort; // Save the original function
        menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function
        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });
       menu.__proto__.sort=orig; // Reset the sort function

Basically, the menu.sort function relies on menu items which this plugin just ignores. So, when it hits menu.sort, the dropdown is rebuilt and the dom (which this plugin manipulates) is reset. This change just makes the sort function a no-op.

@ChriiMoral
Copy link

I'd like to confirm this is happening to me as well. The context menu doesn't work, but commands do.

@rossoj85
Copy link

rossoj85 commented Aug 4, 2022

For a workaround for the broken context menu (for the Desktop app), go to your .obsidian\plugins folder or Settings -> Community Plugins -> Installed Plugins and click the folder icon: image

Go into the highlightr-plugin folder and open main.js. Search for menu.showAtPosition and replace the following:

        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });

with

        const orig=menu.__proto__.sort; // Save the original function
        menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function
        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });
       menu.__proto__.sort=orig; // Reset the sort function

Basically, the menu.sort function relies on menu items which this plugin just ignores. So, when it hits menu.sort, the dropdown is rebuilt and the dom (which this plugin manipulates) is reset. This change just makes the sort function a no-op.

Tried this, but didn't work. Still getting the same "focus must be in editor error message"

@dasu88
Copy link

dasu88 commented Aug 5, 2022

menu.showAtPosition

According to this method of modification, it works for me, but it needs to be closed once and restart obsidian
2022-08-05_103623

@CharlesCollin91
Copy link

CharlesCollin91 commented Aug 5, 2022

Working for me too ! Just got to restart my computer, only restart obsidian didn't work.

@rossoj85
Copy link

rossoj85 commented Aug 5, 2022

Still no luck on my end...

Seems to be skipping over that menu.shotAtPosition block and going directly to the error message. Logged it out in the console to see what is going on. Anyone else on a Mac? Could that have something to do with it?

image

image

@ObsidianTTRPGProject
Copy link

Confirmed working for me. Thank you!

@davidgaryesp
Copy link

Neither original (v 1.2.1) nor patch (as posted in this thread) working for me, for latest Obsidian Desktop app (0.15.9) on macOS Catalina. BUT (1) I am a newbie and (2) something odd going on. I tried adding Console messages - but they didn't appear. As an experiment I tried renaming 'main.js' and later even deleted the whole highlightr-plugin folder from myVault/.obsidian/plugins, restarted Obsidian, but unexpectedly, console messages still indicated highlightr was still loading ok.

I don't know if this is normal/odd - but after putting the files back again out of Trash, I uninstalled and reinstalled 'highlightr', but the dates of files in that folder did not change, e.g. it was still the patched version of 'main.js' that was present (nothing was downloaded over the top of them).

It feels (rightly or wrongly) like the plugin folder (or its files) is also getting put into some other plugins location, which the app uses instead.

BTW-FWIW: Chrome released an update - maybe that upset some things?

@davidgaryesp
Copy link

I found the "other plugins location" issue, put the patched 'main.js' there, and now highlighting works!
The patched version of 'highlightr/main.js' works well for both the desktop app and the iOS app.
BUT - if your vault is in iCloud - the patch needs to be made to two instances of the 'main.js' file - thanks to an iCloud-specific (compatibility?) issue, described below...

Issue: Obsidian and iCloud (where I have put my vault) seem to have disagreements over where things should go, so those things (highlightr code) went to both locations. This "disagreement" is consistent with what I found yesterday setting up the iOS app to use the same (iCloud-based) vault as the mac desktop. More detail below...

From the mac's Finder:
The location where if I change the files this has an effect (e.g. patch works):
/Library/Mobile Documents/iCloudmd~obsidian/Documents/.obsidian/plugins/highlightr-plugin
Presented by Finder as:
image

The location where (if I change the files) this has no effect:
/Library/Mobile Documents/iCloudmd~obsidian/Documents/Obsidian iCloud Vault 001/.obsidian/plugins/highlightr-plugin
Presented by Finder as:
image

Incidentally, as I found when setting up a shared vault for desktop and iOS apps yesterday...
Desktop recognises the first one as "root".
iOS app only recognises the second one.

I guess Obsidian have handled that (in their code) by ensuring plugin downloads get copied to both locations.
In each app/device's case, renaming (only) its particularly-located '.highlightr' files causes it (only) to pop up a "failure to load" message. Pretty conclusive then.

I imagine the best fix would be for clear and separate concepts of "Obsidian Root in iCloud" and "Obsidian Vault " (within Obsidian Root). There could be more than one Obsidian Vault in iCloud. I'm guessing that there might be confusion somewhere(s) "under the hood" about these.

@heliocarbex
Copy link

For a workaround for the broken context menu (for the Desktop app), go to your .obsidian\plugins folder or Settings -> Community Plugins -> Installed Plugins and click the folder icon: image

Go into the highlightr-plugin folder and open main.js. Search for menu.showAtPosition and replace the following:

        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });

with

        const orig=menu.__proto__.sort; // Save the original function
        menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function
        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });
       menu.__proto__.sort=orig; // Reset the sort function

Basically, the menu.sort function relies on menu items which this plugin just ignores. So, when it hits menu.sort, the dropdown is rebuilt and the dom (which this plugin manipulates) is reset. This change just makes the sort function a no-op.

This worked for me! I installed right now the plugin.

@celesica
Copy link

For a workaround for the broken context menu (for the Desktop app), go to your .obsidian\plugins folder or Settings -> Community Plugins -> Installed Plugins and click the folder icon: image

Go into the highlightr-plugin folder and open main.js. Search for menu.showAtPosition and replace the following:

        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });

with

        const orig=menu.__proto__.sort; // Save the original function
        menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function
        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });
       menu.__proto__.sort=orig; // Reset the sort function

Basically, the menu.sort function relies on menu items which this plugin just ignores. So, when it hits menu.sort, the dropdown is rebuilt and the dom (which this plugin manipulates) is reset. This change just makes the sort function a no-op.

Thank you! This fixed mine as well~

@Paddy1058
Copy link

Yup, works for me too; thanks much!

@architaktus
Copy link

For a workaround for the broken context menu (for the Desktop app), go to your .obsidian\plugins folder or Settings -> Community Plugins -> Installed Plugins and click the folder icon: image

Go into the highlightr-plugin folder and open main.js. Search for menu.showAtPosition and replace the following:

        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });

with

        const orig=menu.__proto__.sort; // Save the original function
        menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function
        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });
       menu.__proto__.sort=orig; // Reset the sort function

Basically, the menu.sort function relies on menu items which this plugin just ignores. So, when it hits menu.sort, the dropdown is rebuilt and the dom (which this plugin manipulates) is reset. This change just makes the sort function a no-op.

Bravo! It works! Thanks!

@ikuygithub
Copy link

The last update of this plugin is last December so it is already fossilized.
Not too hopeful

@timowei
Copy link

timowei commented Aug 17, 2022

For a workaround for the broken context menu (for the Desktop app), go to your .obsidian\plugins folder or Settings -> Community Plugins -> Installed Plugins and click the folder icon: image

Go into the highlightr-plugin folder and open main.js. Search for menu.showAtPosition and replace the following:

        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });

with

        const orig=menu.__proto__.sort; // Save the original function
        menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function
        menu.showAtPosition({
            x: coords.right + 25,
            y: coords.top + 20,
        });
       menu.__proto__.sort=orig; // Reset the sort function

Basically, the menu.sort function relies on menu items which this plugin just ignores. So, when it hits menu.sort, the dropdown is rebuilt and the dom (which this plugin manipulates) is reset. This change just makes the sort function a no-op.

It works on the lastest ver 0.15.9! lovely! Big big thx~~

@grandgooroo
Copy link

Thx !

@asoonami
Copy link

asoonami commented Aug 27, 2022

The workaround by @remerle fixed the Highlightr issue with context menu not showing on v.0.15.9
Thanks for posting, much appreciated.

Workaround:
#42 (comment)

@SimoAbjaou
Copy link

Thanks for the workaround.

@jldeen
Copy link

jldeen commented Aug 31, 2022

Just a heads up - the workaround in #42 (comment) works great on up to Obsidan version v0.15.9. If you are using v0.16.0, you will have to add one line:

menu.setUseNativeMenu(false);

From what I can tell, this will force Obsidian to use DOM rather than the new native menu in v0.16.0. You can see this declared in the v16 API Docs.

Note: This only works on the Desktop app.

So, the full replacement text would look like:

menu.setUseNativeMenu(false);
        
const orig=menu.__proto__.sort; // Save the original function
menu.__proto__.sort = function() {}; // Replace the sort function with a no-op function

menu.showAtPosition({
    x: coords.right + 25,
    y: coords.top + 20,
});
menu.__proto__.sort=orig; // Reset the sort function

@chetachiezikeuzor
Copy link
Owner

Hello friend @gabrielcarus ! Thank you for your notes!

  • Highlightr stopped working in Obsidian v.15.6 (or superior), even the shortcuts.

    • 7/22/22 - Updated Obsidian to v.15.8, when using the "Ctrl+P" shortcut it works, but the Highlightr pop up don't.

I just released an update for Highlightr that should be much more compatible with Obsidian API. Please let me know if there are any issues with it!

This should be fixed in the update, though I'm still working on a function that is more intelligent.

  • A small detail, that would be nice to analyze, is that cMenu is taking a lot to load.

I'll have to completely redo cMenu at this point. Hoping to get this done soon.

  • Snippets plugin didn't stop, but is having some basic bugs in its structure (not making possible to create new CSS Snippets through the plugin and the "hovering" when using the mouse is also bugged).

I've also released an update for MySnippets. You should be able to create new snippets now.

And thank you everyone for being so patient 🙏🏽!

@boris73
Copy link

boris73 commented Sep 13, 2022

FYI, MacOs 12.5.1, Obsidian 0.15.9 on Highlightr 12.2.2 still has issue with the menu not showing up when you click highlight.

"Ctrl+P" shortcut still works though

@loune20
Copy link

loune20 commented Sep 15, 2022

Sadly this fix doesn't work for me (the menu doesn't show up and I have the "focus must be on editor" issue), but command palette shortcut works.
This is with Obisidan v0.15.9 and Highlightr 1.2.2. on Ubuntu 20.04.5 LTS

@HinPeng
Copy link

HinPeng commented Sep 16, 2022

@boris73 @loune20
Seems the method above is not working with Highlightr 1.2.2. Downgrade to 1.2.1 and it will work.

@axelson
Copy link

axelson commented Sep 17, 2022

FYI, MacOs 12.5.1, Obsidian 0.15.9 on Highlightr 12.2.2 still has issue with the menu not showing up when you click highlight.

"Ctrl+P" shortcut still works though

That sounds like this new issue: #47

@loune20
Copy link

loune20 commented Sep 19, 2022

@boris73 @loune20
Seems the method above is not working with Highlightr 1.2.2. Downgrade to 1.2.1 and it will work.

That worked, thank you so much for pointing that out !
I can now highlight and unhighlight normally, except if I select an highlighted word. In that case, I don't have the "unhighligh" button in the context menu and if I click the "highlight" button, I get the "focus must be in editor" error ; I mention it in case it's useful for anyone but that's a great fix for me

@wlo2
Copy link

wlo2 commented Sep 19, 2022

Still not working on latest Windows 10 version, please fix!

@Vanillemilch
Copy link

Vanillemilch commented Oct 10, 2022

commenting out _menu.SetUseNativeMenu(false); and restarting worked for me.

image

@wlo2
Copy link

wlo2 commented Oct 10, 2022

@Vanillemilch, thank you, works indeed!

@mnott
Copy link

mnott commented Oct 18, 2022

Oddly, and probably unrelated to the menu, I get yellow as a color, but nothing else - looks as if the tag "mark" has a predefined color and ignores everything else. If I replace it manually by "span", it works. Anyone had that?

@ichmoimeyo
Copy link

@Vanillemilch, thank you - that fixed it.

@xinzihou
Copy link

xinzihou commented May 6, 2023

Sadly this fix doesn't work for me (the menu doesn't show up and I have the "focus must be on editor" issue), but command palette shortcut works. This is with Obisidan v0.15.9 and Highlightr 1.2.2. on Ubuntu 20.04.5 LTS

Thank you for pointing that out! I have the same issue with Obsidian v0.14.6 (latest version for my device) and Highlightr 1.2.2. Shortcut for opening the highlight options doesn't work, right click menu doesn't work, but shortcuts for individual colours work. I downgraded the plugin to 1.2.1 and it finally works normally. I just upgraded it yesterday and hopefully the bug could be fixed for 1.2.2!

@xinzihou
Copy link

xinzihou commented May 6, 2023

It worked for me, but weirdly none of the highlighter symbols show colours now.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests