Skip to content

Commit

Permalink
fix editor access to work in canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
olvidalo committed Feb 6, 2024
1 parent 4c5da29 commit 8dd9053
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class ChordSheetsPlugin extends Plugin implements IChordSheetsPlu
// Handle chord sheet custom events sent by the editor extension

this.registerDomEvent(window, "chord-sheet-instrument-change", (event: CustomEvent<InstrumentChangeEventDetail>) => {
const editor = this.app.workspace.getActiveViewOfType(MarkdownView)?.editor;
const editor = this.app.workspace.activeEditor?.editor;
const { selectedInstrument, from } = event.detail;
if (editor) {
// @ts-expect-error, not typed
Expand All @@ -76,7 +76,7 @@ export default class ChordSheetsPlugin extends Plugin implements IChordSheetsPlu

this.registerDomEvent(window, "chord-sheet-transpose", async (event: CustomEvent<TransposeEventDetail>) => {
const {direction, blockDef} = event.detail;
const editor = this.app.workspace.getActiveViewOfType(MarkdownView)?.editor;
const editor = this.app.workspace.activeEditor?.editor;

if (editor) {
// @ts-ignore
Expand Down

0 comments on commit 8dd9053

Please sign in to comment.