diff --git a/CHANGELOG.md b/CHANGELOG.md index a234474..4ddd4de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed built-in update checker as Obsidian has one for plugins now! +### 🐛 Bug Fixes + +- Fixed an issue where queries didn't resolve on first load. + ## [1.6.1] - 2021-01-06 ### 🐛 Bug Fixes diff --git a/src/queryInjector.ts b/src/queryInjector.ts index 2c6e2c4..7f0fdd6 100644 --- a/src/queryInjector.ts +++ b/src/queryInjector.ts @@ -21,7 +21,7 @@ export default class QueryInjector { onNewBlock(el: HTMLElement, ctx: MarkdownPostProcessorContext) { const node = el.querySelector( - 'pre[class*="language-todoist"]' + 'code[class*="language-todoist"]' ); if (!node) { @@ -69,8 +69,9 @@ export default class QueryInjector { context: query, }); - const root = pendingQuery.node.parentElement; - root.removeChild(pendingQuery.node); + const parent = pendingQuery.node.parentElement; + const root = parent.parentElement; + root.removeChild(parent); const child = new InjectedQuery(root, (root: HTMLElement) => { if (query.isOk()) {