zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

Example custom widget (word count) does not show up #1550

Closed sigaloid closed 3 years ago

sigaloid commented 3 years ago

1224 does not solve this, I still do not see the word count. I've edited the code to not check attribute nor whether the note is text, but it still does not show up. Has anyone else got this to work? (I'd include logs, but I bet this is a JS/CSS issue just like #1224, and not a Trilium error that logs will fix. Willing to attach logs if necessary)

App version: 0.45.8 DB version: 170 Sync version: 16 Build date: 2021-01-11T22:29:31+01:00

zadam commented 3 years ago

Hi, do you have a "fresh" installation or did you use trilium before and you upgraded to latest version?

Could you post a screenshot of the custom widget (so that attributes are shown too)?

sigaloid commented 3 years ago

Fresh install. image I did choose frontend, ran, then refreshed. Did not seem to change it.

I also tried below (doesn't check for label or notetype)

if (note.type !== 'text' || !note.hasLabel('wordCount')) { 
            //this.toggleInt(false); // hide
            return;
        }

just so it's not an issue of labeling. But that did not make it show up :disappointed:

sigaloid commented 3 years ago

Also, it does have the wordCount inherited attribute, if that matters. I made root have wordCount, then made it inheritable. Could that be an issue?

zadam commented 3 years ago

The note is missing widget label. Otherwise Trilium doesn't know that this note is supposed to be used as a widget.

sigaloid commented 3 years ago

Aha! Thank you. Another case of not reading docs carefully enough. :disappointed_relieved:

zadam commented 3 years ago

Wiki link for future reference: https://github.com/zadam/trilium/wiki/Custom-Widget