2019-10-05 16:55:29 +08:00
|
|
|
import renderService from "./render.js";
|
2018-03-28 09:36:01 +08:00
|
|
|
|
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
|
|
|
}
|
2018-05-27 07:27:47 +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();
|
2018-05-27 07:27:47 +08:00
|
|
|
|
2019-11-11 04:34:15 +08:00
|
|
|
const renderNotesFound = await renderService.render(this.ctx.note, this.$noteDetailRenderContent, this.ctx);
|
|
|
|
|
|
|
|
if (!renderNotesFound) {
|
|
|
|
this.$noteDetailRenderHelp.show();
|
|
|
|
}
|
2018-05-27 07:27:47 +08:00
|
|
|
}
|
2018-05-27 07:58:08 +08:00
|
|
|
|
2019-05-04 06:16:41 +08:00
|
|
|
getContent() {}
|
|
|
|
|
2019-08-26 01:11:42 +08:00
|
|
|
show() {}
|
|
|
|
|
2019-05-04 06:16:41 +08:00
|
|
|
focus() {}
|
|
|
|
|
|
|
|
onNoteChange() {}
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
this.$noteDetailRenderContent.empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
scrollToTop() {
|
|
|
|
this.$component.scrollTop(0);
|
|
|
|
}
|
|
|
|
}
|
2018-05-27 07:27:47 +08:00
|
|
|
|
2019-05-04 06:16:41 +08:00
|
|
|
export default NoteDetailRender;
|