mirror of
https://github.com/ctxinf/simple-disguise.git
synced 2026-07-22 05:32:12 +00:00
Change `toggleStyle` implementation, now use global document object to get workspace root element to toggle class
17 lines
459 B
TypeScript
17 lines
459 B
TypeScript
import {Plugin} from 'obsidian';
|
|
|
|
|
|
export default class SimpleDisguisePlugin extends Plugin {
|
|
async onload() {
|
|
this.addRibbonIcon('eye-off', 'Disguise', () => {
|
|
this.toggleStyle()
|
|
});
|
|
}
|
|
|
|
private toggleStyle() {
|
|
const workspaceRoot=document.querySelector('.workspace-split.mod-root')
|
|
if(!workspaceRoot)return
|
|
const alreadyDisguise=workspaceRoot.hasClass('content-disguise')
|
|
workspaceRoot.toggleClass('content-disguise',!alreadyDisguise)
|
|
}
|
|
}
|