@blocklet/editor 2.5.45 → 2.5.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,7 @@ import { useMediumZoom } from '../hooks/medium-zoom';
34
34
  import { FrameMockup, isDeviceFrame } from '../ui/FrameMockup';
35
35
  import { useSafeArea } from '../../ext/SafeAreaPlugin';
36
36
  import { UPDATE_BUSY_COMMAND } from '../../ext/BusyPlugin';
37
+ import { getDevicePixelRatio } from '../utils/images';
37
38
  const ImageAnnotation = lazy(() => import('../ui/ImageEnhancer').then((module) => ({ default: module.ImageAnnotation })));
38
39
  const ImageAnnotationView = lazy(() => import('../ui/ImageEnhancer').then((module) => ({ default: module.ImageAnnotationView })));
39
40
  const ImageEnhancer = lazy(() => import('../ui/ImageEnhancer').then((module) => ({ default: module.ImageEnhancer })));
@@ -369,12 +370,13 @@ function SimpleImageComponent({ src, altText = '', width, height, }) {
369
370
  return src;
370
371
  try {
371
372
  const qs = getQuery(src);
373
+ const dpr = getDevicePixelRatio();
372
374
  if (qs?.imageFilter)
373
375
  return src;
374
376
  // 图片剪裁,限制最大宽度
375
377
  return withQuery(src, {
376
378
  imageFilter: 'resize',
377
- w: maxContentWidth,
379
+ w: Math.round(maxContentWidth * dpr),
378
380
  });
379
381
  }
380
382
  catch {
@@ -7,3 +7,4 @@ export declare const scaleImage: ({ width, height, maxSize }: {
7
7
  height: number;
8
8
  scaleFactor: number;
9
9
  };
10
+ export declare function getDevicePixelRatio(): number;
@@ -11,3 +11,6 @@ export const scaleImage = ({ width, height, maxSize }) => {
11
11
  }
12
12
  return { width: newWidth, height: newHeight, scaleFactor };
13
13
  };
14
+ export function getDevicePixelRatio() {
15
+ return window?.devicePixelRatio || 1;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.5.45",
3
+ "version": "2.5.47",
4
4
  "main": "lib/index.js",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -73,7 +73,7 @@
73
73
  "ufo": "^1.5.4",
74
74
  "url-join": "^4.0.1",
75
75
  "zustand": "^4.5.5",
76
- "@blocklet/pdf": "2.5.45"
76
+ "@blocklet/pdf": "2.5.47"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@babel/core": "^7.25.2",