fix(pdf): support the raw path under win32 that included backslash for pdf local resource

This commit is contained in:
charlie
2021-10-03 15:20:46 +08:00
committed by Tienson Qin
parent 26530d9282
commit e62e2d8ed6
3 changed files with 16 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
import path from 'path'
if (typeof window === 'undefined') {
global.window = {}
}
@@ -265,4 +267,15 @@ export const writeClipboard = (text, isHtml) => {
})
}
})
}
}
export const toPosixPath = (input) => {
return input && input.replace(/\\+/g, '/')
}
export const nodePath = Object.assign({}, path, {
basename (input) {
input = toPosixPath(input)
return path.basename(input)
}
})