Add focusing on obsidian elements

This commit is contained in:
Idrees Hassan
2025-11-13 18:41:37 -05:00
parent c312500f19
commit 71bb8204e2
10 changed files with 151 additions and 17 deletions

View File

@@ -42,6 +42,17 @@ export class Context {
throw new Error("Method not implemented");
}
/**
* @returns {string[]} A list of CSS selectors for focusable elements
*/
getFocusableElements() {
return ["img", "video", ".birb-sticky-note"];
}
getFocusElementTopMargin() {
return 80;
}
/**
* @returns {string} The current path of the active page in this context
*/
@@ -245,6 +256,21 @@ class ObsidianContext extends Context {
this.putSaveData({});
}
/** @override */
getFocusElementTopMargin() {
return 10;
}
/** @override */
getFocusableElements() {
const elements = [
".workspace-leaf",
".cm-callout",
".HyperMD-codeblock-begin"
];
return super.getFocusableElements().concat(elements);
}
/** @override */
areStickyNotesEnabled() {
return false;