trilium/src/public/javascripts/services/note_detail_render.js
zadam 7539e6a616 Merge branch 'stable'
# Conflicts:
#	src/services/consistency_checks.js
2019-11-10 21:35:11 +01:00

45 lines
No EOL
1.1 KiB
JavaScript

import renderService from "./render.js";
class NoteDetailRender {
/**
* @param {TabContext} ctx
*/
constructor(ctx) {
this.ctx = ctx;
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');
this.$renderButton.on('click', () => this.render()); // long form!
}
async render() {
this.$component.show();
this.$noteDetailRenderHelp.hide();
const renderNotesFound = await renderService.render(this.ctx.note, this.$noteDetailRenderContent, this.ctx);
if (!renderNotesFound) {
this.$noteDetailRenderHelp.show();
}
}
getContent() {}
show() {}
focus() {}
onNoteChange() {}
cleanup() {
this.$noteDetailRenderContent.empty();
}
scrollToTop() {
this.$component.scrollTop(0);
}
}
export default NoteDetailRender;