If you look at the documentation fro app.workspace.activeLeaf it suggests that you should use app.workspace.getActiveViewOfType(). However, this function requires a Constructor<T>
like the constructor reference ( or whatever this is called) to MarkdownView
.
My problem is this: How do I get that reference when calling these functions from within a dataviewjs script, or other javascript code?
I know that QuickAdd
exposes these classes/constructors in their user scripts through the params.obsidian.*
structures. But I don’t know how to get this params
from within dataviewjs. Is it the same as doing the following, and is this an acceptable approach:
```dataviewjs
const obsidian = require('obsidian')
const activeView = app.workspace.getActiveViewOfType(obsidian.MarkdownView)
...
```
In other words, are there better ways of getting the activeView
other than using app.workspace.activeLeaf
, or the method above, and what would that be?