Skip to content

Commit

Permalink
Don't patch workspace prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed Apr 30, 2024
1 parent 2d116ef commit d485c98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Editor/MarkdownEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ export function MarkdownEditor({
EditorView.domEventHandlers({
focus: (evt) => {
view.activeEditor = this.owner;
this.app.workspace.activeEditor = this.owner;
if (Platform.isMobile) {
view.contentEl.addClass('is-mobile-editing');
}

evt.win.setTimeout(() => {
this.app.workspace.activeEditor = this.owner;
if (Platform.isMobile) {
this.app.mobileToolbar.update();
}
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
TFile,
TFolder,
ViewState,
Workspace,
WorkspaceLeaf,
debounce,
} from 'obsidian';
Expand Down Expand Up @@ -753,15 +752,16 @@ export default class KanbanPlugin extends Plugin {
});

this.register(
around(Workspace.prototype, {
around(this.app.workspace, {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
setActiveLeaf(next) {
return function (...args) {
next.apply(this, args);
const leaf = args[0];
if (!leaf) return;
if (!this.isAttached(leaf)) return;
if (leaf?.view instanceof KanbanView && leaf.view.activeEditor) {
if (leaf.view instanceof KanbanView && leaf.view.activeEditor) {
this.activeEditor = leaf.view.activeEditor;
}
};
Expand Down

0 comments on commit d485c98

Please sign in to comment.