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

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-10-05 16:55:29 +08:00
import renderService from "./render.js";
2019-05-04 06:16:41 +08:00
class NoteDetailRender {
/**
2019-05-09 01:55:24 +08:00
* @param {TabContext} ctx
2019-05-04 06:16:41 +08:00
*/
constructor(ctx) {
this.ctx = ctx;
2019-05-09 01:55:24 +08:00
this.$component = ctx.$tabContent.find('.note-detail-render');
this.$noteDetailRenderHelp = ctx.$tabContent.find('.note-detail-render-help');
this.$noteDetailRenderContent = ctx.$tabContent.find('.note-detail-render-content');
this.$renderButton = ctx.$tabContent.find('.render-button');
2019-05-04 06:16:41 +08:00
2019-11-10 00:39:48 +08:00
this.$renderButton.on('click', () => this.render()); // long form!
2019-05-04 06:16:41 +08:00
}
2019-05-12 18:58:55 +08:00
async render() {
2019-05-04 06:16:41 +08:00
this.$component.show();
2019-10-05 16:55:29 +08:00
this.$noteDetailRenderHelp.hide();
const renderNotesFound = await renderService.render(this.ctx.note, this.$noteDetailRenderContent, this.ctx);
if (!renderNotesFound) {
this.$noteDetailRenderHelp.show();
}
}
2018-05-27 07:58:08 +08:00
2019-05-04 06:16:41 +08:00
getContent() {}
show() {}
2019-05-04 06:16:41 +08:00
focus() {}
onNoteChange() {}
cleanup() {
this.$noteDetailRenderContent.empty();
}
scrollToTop() {
this.$component.scrollTop(0);
}
}
2019-05-04 06:16:41 +08:00
export default NoteDetailRender;