logseq / plugins

Documentation site of Logseq plugins
https://plugins-doc.logseq.com/
19 stars 2 forks source link

🧩 logseq.provideUI #14

Open utterances-bot opened 9 months ago

utterances-bot commented 9 months ago

https://plugins-doc.logseq.com/logseq/provideUI

5hir0kur0 commented 9 months ago

Is there a way to know whether the provided slot was invalid? I have a plugin that uses onMacroRendererSlotted but the UI needs to be updated every few seconds and I use a JavaScript timeout for that. However, when the user edits the block etc. the slot can become invalid. Logseq detects this and prints a message like can not resolve selector target #slot__whppb9x3. It would be great if provideUI could throw an exception instead of just printing to the console, so I can stop trying to update the invalid slot in this case.

Sansui233 commented 6 months ago

Here are supported methods defined in https://github.com/logseq/logseq/blob/master/libs/src/helpers.ts#L422-L451

    'click',
    'focus',
    'focusin',
    'focusout',
    'blur',
    'dblclick',
    'keyup',
    'keypress',
    'keydown',
    'change',
    'input',
    'contextmenu',

Notice that use data-on-focusout instead of data-on-focus-out

Works fine except on-blur, which does not bubble.

daviddavo commented 2 months ago

In case I'm using onBlockRendererSlotted for a block, is it possible to keep rendering using Markdown? How does "template" work?