import {Constants} from "../constants"; import {pathPosix} from "../util/pathName"; import {getAllModels} from "../layout/getAll"; export const renderAssetsPreview = (pathString: string) => { if (!pathString) { return ""; } const type = pathPosix().extname(pathString).toLowerCase(); if (Constants.SIYUAN_ASSETS_IMAGE.includes(type)) { return ``; } else if (Constants.SIYUAN_ASSETS_AUDIO.includes(type)) { return ``; } else if (Constants.SIYUAN_ASSETS_VIDEO.includes(type)) { return ``; } else { return pathString; } }; export const pdfResize = () => { getAllModels().asset.find(item => { const pdfInstance = item.pdfObject const {pdfDocument, pdfViewer} = pdfInstance if (!pdfDocument) { return } const currentScaleValue = pdfViewer.currentScaleValue if ( currentScaleValue === 'auto' || currentScaleValue === 'page-fit' || currentScaleValue === 'page-width' ) { // Note: the scale is constant for 'page-actual'. pdfViewer.currentScaleValue = currentScaleValue } pdfViewer.update() }) }