trilium/src/public/javascripts/services/note_detail_protected_session.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

import protectedSessionService from './protected_session.js';
class NoteDetailProtectedSession {
2019-05-06 00:24:59 +08:00
/**
* @param {NoteContext} ctx
*/
constructor(ctx) {
this.ctx = ctx;
this.$component = ctx.$noteTabContent.find(".protected-session-password-component");
this.$passwordForm = ctx.$noteTabContent.find(".protected-session-password-form");
this.$passwordInput = ctx.$noteTabContent.find(".protected-session-password");
this.$protectButton = ctx.$noteTabContent.find(".protect-button");
this.$protectButton.click(protectedSessionService.protectNoteAndSendToServer);
this.$unprotectButton = ctx.$noteTabContent.find(".unprotect-button");
this.$unprotectButton.click(protectedSessionService.unprotectNoteAndSendToServer);
this.$passwordForm.submit(() => {
const password = this.$passwordInput.val();
this.$passwordInput.val("");
protectedSessionService.setupProtectedSession(password);
return false;
});
2019-05-06 00:24:59 +08:00
}
show() {
this.$component.show();
}
getContent() {}
focus() {}
onNoteChange() {}
cleanup() {}
scrollToTop() {
this.$component.scrollTop(0);
}
}
export default NoteDetailProtectedSession;