I have the same issue with v2 compatible plug
can you share your configuration ?
Can you just remove the default_color
setting if you have it ? My guess is this is just the default color overriding it globally across light and dark modes. Thatâs a setting that carried over from the older version that I inherited - might be worth removing it now since itâs just causing confusion.
I donât have this setting configure. Take a look of my CONFIG file:
config.set {
plugs = {
"github:joekrill/silverbullet-treeview/treeview.plug.js",
"ghr:MrMugame/silversearch",
"github:logeshg5/silverbullet-plantuml/plantuml.plug.js",
"ghr:deepkn/silverbullet-graphview"
},
graphview = {
ignoredPrefixes = {
"Library",
"template",
"Journaux"
}
},
...
Hmm.. thatâs really odd. That configuration works just fine for me on dark mode. Can you maybe just hard refresh the page and make sure that the worker for the plug has restarted? Was it working fine for you on v1?
I try a reload UI, reload system and update Plug and the issue still there.
Now, I change my Config file like this to see someting :
config.set {
plugs = {
"github:joekrill/silverbullet-treeview/treeview.plug.js",
"ghr:MrMugame/silversearch",
"github:logeshg5/silverbullet-plantuml/plantuml.plug.js",
"ghr:deepkn/silverbullet-graphview"
},
graphview = {
ignoredPrefixes = {
"Library",
"template",
"Journaux"
},
default_color = "ffffff",
colormap = {
path = {
java = "96020e",
spring = "0bbd02",
projet = "ffc533",
personne = "01017a"
},
tag = {
maison = "02bdb6"
}
}
},
....
and itâs look like this:
If you remove the âdefault_colorâ from this (working) configuration of yours, does it f** it up ? This has to be some override acting up - but this is confusing to me as well. Let me dig into it a little.
Iâve discovered a very odd bug (and added a github bug report) for a behavior where overwritten images (uploading an image and naming it the same as an existing one) creates a perpetually present orphan node in the graph that cannot seemingly be removed.
They appear as orphaned files with the same name as connected ones, and link to said connected images. If using the local graph view, they even show as a second âhubâ in the graph.
Anyone have any ideas where this data might be being stored so it can be purged?
Thank you for the bug report. Iâll have to take a look at this to make sure that the plug is not doing anything funky - but in general, it just makes a regular lua query to SB itself to fetch the nodes and links data. And this would mean that itâs possible that the orphaned nodes are still in SBâs index. Are you getting two entries if you specifically query for the name in SB itself? What about after forcing a reindex of the space ?
Did look into this a bit - my suspicion is silverbullet is not setting the darkmode
property correctly upon startup. The plug reads that to set some sensible default colors in dark mode and light mode - turns out if I just toggle the dark mode once and back, everything is good. Just that once dark mode is set and the silverbullet reloads or opens a new tab, the setting is honored, but the property itself is not set. Could you check if toggling the dark mode once does the job for you as well, even without the default_color
setting in CONFIG?
Unless thereâs something not in the command list, Iâve tried all the commands that say anything like refresh, re-index, etc. and tried deleting and reinstalling the plug, so Iâm thinking it might be part of the database but Iâm not sure how to verify. Images donât show when searching for something since they arenât pages (Iâm not very familiar with LUA).
@StellasFun Toggle dark mode twice, this should fix it.
@deepkn You should be using editor.getUiOption("darkMode")
not clientStore.get("darkMode")
. And careful, it can be undefined in which case you should use the system default. Although it may make sense to change that.
Thank you @MrMugame - released a new version with the darkmode fix, some UI polish etc. @StellasFun Looking into the other bug of multiple image entries in the index - been a bit busy, will update soon.
I donât think itâs fixed. So letâs do a little deep dive into how this works.
So the editor preact component has a state object which has all the necessary state for the UI and also has a uiOptions
property, which contains stuff like darkMode, vimMode or newly the clean syntax mode. This state object is in ram and is populated on every load of the component. This is done using a syscall, namely the editor.setUiOption
syscall, by a core plug. What itâs doing is looking if there is a stored value in the clientStore
on editor:init
and if there is it sets the uiOption
using the syscall to said value. This stored value in the clientStore
is in turn set by the Toggle Dark Mode
command (which also reloads the editor, so another editor:init
is fired). The reason the clientStore
is used here is so the value persists across reloads.
The issue here now is that the type of the property looks like this darkMode?: boolean
. It can be undefined, in which case the component will use a media query to determine the system preference. Now why is it undefined? Because it wasnât set from the clientStore
why was it not set from the clientStore
? Because it didnât contain a value/was undefined.
This is exactly what you are seeing, after a wipe. The clientStore
is undefined, so no uiOption
will be set and thus the editor will chose the system preference (e.g. dark mode). Your code gets the uiOption
/ clientStore
casts that to a boolean which will be undefined
â false
, which means white mode. This is there itâs failing. After you toggle the dark mode the value will be written to the clientStore
and will be correct.
So donât ask me why itâs typed like that, in my opinion this is hugely confusing and causes bugs like that, but whatever. So you have a few options at fixing this.
undefined
case.document.documentElement.dataset.theme
value as this will be set correctly.(I hinted as using getUiOption
as this would internally be the value thatâs certainly correct. While the clientStore
is just used for caching. Normally they should mirror each other, but you may never know âŚ)