Skip to content

Commit

Permalink
Merge pull request #40 from Voark/fix-onload
Browse files Browse the repository at this point in the history
Fix Onload Error
  • Loading branch information
ArianaKhit authored Apr 24, 2022
2 parents 5e8f0a5 + 007b878 commit 8183dc8
Show file tree
Hide file tree
Showing 4 changed files with 317 additions and 124 deletions.
101 changes: 83 additions & 18 deletions main.js

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ export default class TextSnippets extends Plugin {
}
});

if(this.settings.isWYSISWYG) {
let editor = this.app.workspace.activeLeaf.view.sourceMode.cmEditor;
this.settings.isWYSISWYG = (typeof editor.wordAt === 'function');
this.registerDomEvent(document, 'keydown', (event: KeyboardEvent) => this.handleKeyDown(editor, event));
}
if (this.settings.isWYSISWYG) {
this.app.workspace.onLayoutReady(() => {
let editor = this.app.workspace.activeLeaf.view.sourceMode.cmEditor;
this.settings.isWYSISWYG = (typeof editor.wordAt === 'function');
this.registerDomEvent(document, 'keydown', (event) => this.handleKeyDown(editor, event));
}
)}

this.addSettingTab(new TextSnippetsSettingsTab(this.app, this));
await this.saveSettings();
}

onunload() {
async onunload() {
console.log("Unloading text snippet plugin");


Expand Down
Loading

0 comments on commit 8183dc8

Please sign in to comment.