Skip to content

Commit 47d532a

Browse files
committed
Fix export name format jpg -> jpeg
1 parent 9c6b91b commit 47d532a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/core/context.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export function normalizeCachePolicy(v) {
4747
* @returns {Object}
4848
*/
4949
export function createContext(options = {}) {
50-
const resolvedFormat = options.format ?? 'png'
50+
let resolvedFormat = options.format ?? 'png'
51+
if (resolvedFormat === 'jpg') resolvedFormat = 'jpeg'
5152
/** @type {CachePolicy} */
5253
const cachePolicy = normalizeCachePolicy(options.cache)
5354

@@ -88,7 +89,7 @@ export function createContext(options = {}) {
8889
quality: options.quality ?? 0.92,
8990
dpr: options.dpr ?? (window.devicePixelRatio || 1),
9091
backgroundColor:
91-
options.backgroundColor ?? (['jpg', 'jpeg', 'webp'].includes(resolvedFormat) ? '#ffffff' : null),
92+
options.backgroundColor ?? (['jpeg', 'webp'].includes(resolvedFormat) ? '#ffffff' : null),
9293
filename: options.filename ?? 'snapDOM',
9394

9495
// NEW flags (user-friendly)

0 commit comments

Comments
 (0)