mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Escape folder path in selectors
This commit is contained in:
parent
c1e7567a6e
commit
3406e6e489
2 changed files with 5 additions and 5 deletions
|
|
@ -409,7 +409,7 @@ export class FolderOverview {
|
|||
}
|
||||
|
||||
getElFromOverview(path: string): HTMLElement | null {
|
||||
const el = this.listEl.querySelector(`[data-path="${path}"]`) as HTMLElement | null;
|
||||
const el = this.listEl.querySelector(`[data-path="${CSS.escape(path)}"]`) as HTMLElement | null;
|
||||
return el;
|
||||
}
|
||||
|
||||
|
|
@ -464,4 +464,4 @@ class CustomMarkdownRenderChild extends MarkdownRenderChild {
|
|||
onunload() {
|
||||
this.folderOverview.disconnectListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ export async function addCSSClassToTitleEL(path: string, cssClass: string, plugi
|
|||
return;
|
||||
}
|
||||
fileExplorerItem.addClass(cssClass);
|
||||
const viewHeaderItems = document.querySelectorAll(`[data-path="${path}"]`);
|
||||
const viewHeaderItems = document.querySelectorAll(`[data-path="${CSS.escape(path)}"]`);
|
||||
viewHeaderItems.forEach((item) => {
|
||||
item.addClass(cssClass);
|
||||
});
|
||||
|
|
@ -134,7 +134,7 @@ export async function addCSSClassToTitleEL(path: string, cssClass: string, plugi
|
|||
export function removeCSSClassFromEL(path: string | undefined, cssClass: string, plugin: FolderNotesPlugin) {
|
||||
if (!path) return;
|
||||
const fileExplorerItem = getEl(path, plugin);
|
||||
const viewHeaderItems = document.querySelectorAll(`[data-path="${path}"]`);
|
||||
const viewHeaderItems = document.querySelectorAll(`[data-path="${CSS.escape(path)}"]`);
|
||||
viewHeaderItems.forEach((item) => {
|
||||
item.removeClass(cssClass);
|
||||
});
|
||||
|
|
@ -152,4 +152,4 @@ export function getEl(path: string, plugin: FolderNotesPlugin): HTMLElement | nu
|
|||
if (!fileExplorerItem) { return null; }
|
||||
if (fileExplorerItem.selfEl) return fileExplorerItem.selfEl;
|
||||
return fileExplorerItem.titleEl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue