Skip to content

Commit

Permalink
Attach class to workspace-leaf with injected Todoist query (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebrynes7 authored Oct 19, 2020
1 parent 48b2274 commit a487c21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- You can now check for plugin updates in the Todoist plugin settings.
- The JSON query is now validated and errors are presented in a more user-friendly fashion:
![Query parsing error example](./assets/query-parsing-error-example.png)
- Any `workspace-leaf` which has an injected query will have the `contains-todoist-query` CSS class attached. This allows you to style these leafs independently of the others.

### 🔃 Changed

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ _Tested with Obsidian 0.8.14 and Volcano 1.2.1, your results may vary!_

### General

There are a few CSS classes in the generated DOM, which you can use to customize the rendering of the list:
Any `workspace-leaf` which has an injected Todoist query will have the `contains-todoist-query` class attached to it.

There are also few CSS classes in the generated DOM, which you can use to customize the rendering of the list:

- `.todoist-query-title`: Attached to the header that contains the query title.
- `.todoist-refresh-button`: Attached to the refresh button.
Expand Down
5 changes: 4 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@ export default class TodoistPlugin<TBase extends Settings> {
});
}

const workspaceLeaf = root.closest(".workspace-leaf");
workspaceLeaf.classList.add("contains-todoist-query");

const injection = {
component: queryNode,
workspaceLeaf: root.closest(".workspace-leaf"),
workspaceLeaf: workspaceLeaf,
};

debug({
Expand Down

0 comments on commit a487c21

Please sign in to comment.