import * as path from 'path' ; import * as fs from 'fs' ; import { AbsoluteUrlMapper } from './mapper' ; import { ImageCache } from '../util/imagecache' ; export const relativeToOpenFileUrlMapper = { map ( fileName , imagePath ) { let absoluteImagePath ; const pathName = path . normalize ( imagePath ) ; if ( pathName ) { let testImagePath = path . join ( fileName , '..' , pathName ) ; if ( ImageCache . has ( testImagePath ) || fs . existsSync ( testImagePath ) ) { absoluteImagePath = testImagePath ; } } return absoluteImagePath ; } , refreshConfig ( ) { } , } ;