Skip to content

Commit

Permalink
unregister file-open. desktopOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Gradman authored and Eric Gradman committed Mar 16, 2022
1 parent 16cab40 commit 4c927e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 34 deletions.
37 changes: 5 additions & 32 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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!`);
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 4c927e7

Please sign in to comment.