Skip to content

Commit

Permalink
fix: Fixes issue with maintaining a CSS snippet for callouts
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Mar 29, 2022
1 parent a7752d9 commit f7efbbc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/callout/manager.ts
Expand Up @@ -24,12 +24,14 @@ export default class CalloutManager extends Component {

onload() {
//build sheet for custom admonitions

document.head.appendChild(this.style);

for (const admonition of Object.values(
this.plugin.data.userAdmonitions
)) {
this.addAdmonition(admonition);
}

this.setUseSnippet();

this.plugin.registerEditorSuggest(new CalloutSuggest(this.plugin));
Expand Down Expand Up @@ -215,12 +217,7 @@ export default class CalloutManager extends Component {
}
setUseSnippet() {
if (this.plugin.data.useSnippet) {
this.style.detach();
this.updateSnippet();
} else {
if (!this.style.parentElement) {
document.head.appendChild(this.style);
}
}
}
async updateSnippet() {
Expand Down

0 comments on commit f7efbbc

Please sign in to comment.