Skip to content

Commit

Permalink
Updates based on Review Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkboswell committed Jul 31, 2023
1 parent aac8b21 commit 97a4325
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Reflection",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "An Obsidian Plugin for seeing daily and weekly notes from this day in years past.",
"description": "Shows daily and weekly notes from this day in years past.",
"author": "Brandon Boswell",
"authorUrl": "https://brandonkboswell.com/",
"fundingUrl": "https://link.brandonkboswell.com/coffee",
Expand Down
4 changes: 2 additions & 2 deletions src/ReflectionDay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
try {
await MarkdownRenderer.renderMarkdown(markdown, markdownRenderWrapper, currentFile, view);
} catch (error) {
console.log('Markdown Error', error)
// Likely Markdown Error from other plugins
}
title = file.basename;
content = markdownRenderWrapper.innerHTML;
Expand Down Expand Up @@ -119,4 +119,4 @@
cursor: pointer;
}
}
</style>
</style>
12 changes: 2 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, Keymap } from 'obsidian';
import { Plugin, Keymap, moment } from 'obsidian';
import ReflectionSection from "./ReflectionSection.svelte";
import {
getAllDailyNotes,
Expand All @@ -25,7 +25,6 @@ let reflectionClass = "reflection-container"
let leafRegistry = {}

function removeElementsByClass(domNodeToSearch, className){
console.log('Removing', domNodeToSearch, className)
const elements = domNodeToSearch.getElementsByClassName(className);
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
Expand All @@ -41,7 +40,6 @@ export default class Reflection extends Plugin {

async runOnLeaf(leaf) {
if (!this.ready) {
console.log('Not Ready, Re-initing');
await this.init();
}

Expand All @@ -62,12 +60,10 @@ export default class Reflection extends Plugin {

handleRegisterEvents() {
this.registerEvent(this.app.workspace.on('active-leaf-change', async (leaf) => {
console.log('active-leaf-change', leaf);
this.runOnLeaf(leaf);
}));

this.registerEvent(this.app.workspace.on('window-open', async () => {
console.log('window-open');
this.updateAllLeaves();
}));
}
Expand Down Expand Up @@ -237,18 +233,14 @@ export default class Reflection extends Plugin {
}

async init() {
console.log('Loading Reflection Plugin');

// Sometimes this loads before the dependencies are ready
// This stops that from throwing an unncessary error
try {
await this.establishNoteCaches();
await this.gatherPeriodicNoteSettings();
this.ready = true;

console.log('Reflection is ready')
} catch(e) {
console.log('Dependencies not yet ready', e);
// Dependencies not yet ready
}
}

Expand Down

0 comments on commit 97a4325

Please sign in to comment.