obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Add code block in setting that executes before each dataviewjs execution.

Open Dmytro-Shulha opened this issue 1 year ago • 0 comments

I often use dataviewjs blocks along with some js scripts of mine that I store in my vault in 'utils' folder. And each time I want to use some of the functions defined there - I have to import them, which makes my blocks look like that:

```dataviewjs
let path = app.vault.adapter.basePath + "\\utils.js"
var {prevAndNextNoteNav} = require(path);

prevAndNextNoteNav(dv, "<< {0} | {1} | {2} >>")

I would like to have an option to define js code that will execute before each dataviewjs block execution. Some kind of pre-exec block in settings, maybe. So that I can move those first two import lines to settings and have only my function execution in a note.


As an afterthought, maybe, post-exec block also would become benefitial to dataview users 🤔

Dmytro-Shulha avatar Dec 02 '23 14:12 Dmytro-Shulha