I've found this:
But I think that's correct this way, right?
I installed nodebb and by default images i upload to topics are opened in new tab. I can not find option to open em in modal, so im wondring, is there option like that, or do i have to change / install theme to get that ability?
Seems like https://github.com/psychobunny/nodebb-plugin-gallery needs to be updated to latest NodeBB.
Oh, so it's an plugin. Cool. Ill give it a look and try to patch what needs to be patched. If i make it work, ill submit my code.
FYI this plugin works only if user has "delay image loading" disabled (checked on nodebb 1.5.2)
I'm guessing it has something to do with delayed images missing some data plugin needs.
Yes, as i guessed, when option "delay image loading" iis enabled (and it's enabled by default), images are missing a lot of information that they have when they are finally loaded. They ar emissing src, they are missing parent <a> and some other stuff.
Whole image loading / not loading thing is done in https://github.com/NodeBB/NodeBB/blob/master/public/src/client/topic/images.js and there is no single hook in there that would enable some plugin magic.
I solved my problem by:
Now im wondering how could i make this permanent so it can survive next nodebb update? Plugin par is easy, ill just create my own plugin that wont update from github, but nodebb part is out of my knowlage base (im fresh to nodebb so i have no idea what are my options)
Is there a way for me to insert this kind of trigger permanently or at least update proof? Is there a reason (security or otherwise) there is no image trigger inside nodebb? If there is no reason, would you be willing to insert hook like that so image plugins can use it?
Only other way around it (without adding hook to nodebb code) that i know is that i remake plugin so that it hacks and slash generated image code on server side and or user side and basically force what i need out of it. That sounds kinda silly and i'm pretty much sure i'm missing something (i'm pretty much new to nodejs too) that would make this more "elegant" solution.
I did find one plugin that does something similar:
Looks like a lot of unneeded code which could be all skipped if there was image hook available.
Send a pull request with the hook so we can review.
Im going to bed right now, but ill do that first thing in the morning.
Here you go.
After i slept on it, i changed position of hook so it works for both "delay loading" turned on and off. Original place was working only for delay loading turned on so it needed one more hook inside "unloadImages" function and i prefer solutions with less code.