Skip to content

Commit

Permalink
feat: 1.desktop support
Browse files Browse the repository at this point in the history
  • Loading branch information
JuckZ committed Feb 21, 2023
1 parent 4eb95af commit 10a2afe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ import {
updateDBConditionally,
} from './utils/db/db';
import { insertAfterHandler, setBanner } from './utils/content';
import {
changeToolbarPopover,
getEditorPositionFromIndex,
loadCustomViewContainer,
unloadCustomViewContainer,
} from './utils/editor';
import { getLocalRandom, searchPicture } from './utils/genBanner';
import { loadSQL } from './utils/db/sqljs';
import { PomodoroStatus, initiateDB } from './utils/promotodo';
Expand Down Expand Up @@ -1106,6 +1112,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin {
);
menu.showAtMouseEvent(event);
});
loadCustomViewContainer(this);
}

private watchVault() {
Expand All @@ -1122,7 +1129,9 @@ export default class AwesomeBrainManagerPlugin extends Plugin {
media.addEventListener('change', callback);
// Remove listener when we unload
this.register(() => media.removeEventListener('change', callback));

this.registerDomEvent(activeDocument, 'mouseup', async (e: MouseEvent) => {
changeToolbarPopover(this.app, e);
});
window.addEventListener(eventTypes.pomodoroChange, this.pomodoroChange.bind(this));
window.addEventListener(eventTypes.mdbChange, this.mdbChange.bind(this));
[
Expand All @@ -1142,6 +1151,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin {
}

override async onunload(): Promise<void> {
unloadCustomViewContainer();
toggleBlast('0');
this.app.workspace.detachLeavesOfType(POMODORO_HISTORY_VIEW);
this.style.detach();
Expand Down
1 change: 0 additions & 1 deletion src/utils/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const elId = 'custom-view-container';
export const customEl = createEl('div', {
attr: {
id: elId,
style: 'position: fixed;',
},
});

Expand Down

0 comments on commit 10a2afe

Please sign in to comment.