diff --git a/main.ts b/main.ts index 19121f9..c4ac61b 100644 --- a/main.ts +++ b/main.ts @@ -52,9 +52,11 @@ export default class Etherpad extends Plugin { const statusBarItemEl = this.addStatusBarItem(); statusBarItemEl.setText('Status Bar Text'); - this.app.workspace.on('file-open', async (note)=>{ - this.replace_note_from_etherpad(note); - }); + this.registerEvent( + this.app.workspace.on('file-open', async (note)=>{ + this.replace_note_from_etherpad(note); + }) + ); // This adds an editor command that can perform some operation on the current editor instance this.addCommand({ @@ -109,37 +111,9 @@ export default class Etherpad extends Plugin { } }); - // This adds a complex command that can check whether the current state of the app allows execution of the command - //this.addCommand({ - // id: 'open-sample-modal-complex', - // name: 'Open sample modal (complex)', - // checkCallback: (checking: boolean) => { - // // Conditions to check - // const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView); - // if (markdownView) { - // // If checking is true, we're simply "checking" if the command can be run. - // // If checking is false, then we want to actually perform the operation. - // if (!checking) { - // new EtherpadModal(this.app).open(); - // } - - // // This command will only show up in Command Palette when the check function returns true - // return true; - // } - // } - //}); - // This adds a settings tab so the user can configure various aspects of the plugin this.addSettingTab(new EtherpadSettingTab(this.app, this)); - // If the plugin hooks up any global DOM events (on parts of the app that doesn't belong to this plugin) - // Using this function will automatically remove the event listener when this plugin is disabled. - //this.registerDomEvent(document, 'click', (evt: MouseEvent) => { - // console.log('click', evt); - //}); - - // When registering intervals, this function will automatically clear the interval when the plugin is disabled. - //this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000)); } onunload() { @@ -208,7 +182,6 @@ export default class Etherpad extends Plugin { let note_html = data.html; let note_text = td.turndown(note_html) - console.log(data.html); this.app.vault.modify(note, frontmatter_text + note_text); let url = this.get_url_for_pad_id(frontmatter.etherpad_id); new Notice(`Note was reloaded from ${url}.\nLocal edits will be discarded!`); diff --git a/manifest.json b/manifest.json index b5ddbdc..1df062a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "id": "obsidian-etherpad-plugin", "name": "Etherpad", - "version": "1.0.1", + "version": "1.0.2", "minAppVersion": "0.12.0", "description": "Etherpad Integration", "author": "egradman", "authorUrl": "https://www.gradman.com", - "isDesktopOnly": false + "isDesktopOnly": true }