import server from "./server.js"; import linkService from "./link.js"; import utils from "./utils.js"; const MIN_ZOOM_LEVEL = 1; const MAX_ZOOM_LEVEL = 6; const ZOOMS = { 1: 100, 2: 49, 3: 32, 4: 24, 5: 19, 6: 16 }; class NoteDetailBook { /** * @param {TabContext} ctx */ constructor(ctx) { this.ctx = ctx; this.$component = ctx.$tabContent.find('.note-detail-book'); this.$content = this.$component.find('.note-detail-book-content'); this.$zoomInButton = this.$component.find('.book-zoom-in'); this.$zoomOutButton = this.$component.find('.book-zoom-out'); this.setZoom(1); this.$zoomInButton.click(() => this.setZoom(this.zoomLevel - 1)); this.$zoomOutButton.click(() => this.setZoom(this.zoomLevel + 1)); } setZoom(zoomLevel) { this.zoomLevel = zoomLevel; this.$zoomInButton.prop("disabled", zoomLevel === MIN_ZOOM_LEVEL); this.$zoomOutButton.prop("disabled", zoomLevel === MAX_ZOOM_LEVEL); this.$content.find('.note-book').css("flex-basis", ZOOMS[zoomLevel] + "%"); } async render() { this.$content.empty(); for (const childNote of await this.ctx.note.getChildNotes()) { this.$content.append( $('