import OptionsTab from "./options_tab.js"; const TPL = `

Images

(pasted HTML can contain references to online images, Trilium will find those references and download the images so that they are available offline)

`; export default class ImageOptions extends OptionsTab { get tabTitle() { return "Images" } lazyRender() { this.$widget = $(TPL); this.$imageMaxWidthHeight = this.$widget.find("#image-max-width-height"); this.$imageJpegQuality = this.$widget.find("#image-jpeg-quality"); this.$imageMaxWidthHeight.on('change', () => { this.updateOption('imageMaxWidthHeight', this.$imageMaxWidthHeight.val()); }); this.$imageJpegQuality.on('change', () => { this.updateOption('imageJpegQuality', this.$imageJpegQuality.val()); }); this.$downloadImagesAutomatically = this.$widget.find("#download-images-automatically"); this.$downloadImagesAutomatically.on("change", () => { const isChecked = this.$downloadImagesAutomatically.prop("checked"); this.updateOption('downloadImagesAutomatically', isChecked ? 'true' : 'false'); }); this.$enableImageCompression = this.$widget.find("#image-compresion-enabled"); this.$imageCompressionWrapper = this.$widget.find("#image-compression-enabled-wraper"); this.$enableImageCompression.on("change", () => { const isChecked = this.$enableImageCompression.prop("checked"); this.updateOption('compressImages', isChecked ? 'true' : 'false'); this.setImageCompression(isChecked); }); } setImageCompression(isChecked) { if (isChecked) { this.$imageCompressionWrapper.removeClass("disabled-field"); } else { this.$imageCompressionWrapper.addClass("disabled-field"); } } optionsLoaded(options) { this.$imageMaxWidthHeight.val(options['imageMaxWidthHeight']); this.$imageJpegQuality.val(options['imageJpegQuality']); const downloadImagesAutomatically = options['downloadImagesAutomatically'] === 'true'; this.$downloadImagesAutomatically.prop('checked', downloadImagesAutomatically); const compressImages = options['compressImages'] === 'true'; this.$enableImageCompression.prop('checked', compressImages); this.setImageCompression(compressImages); } }