@file-viewer/renderer-image 2.1.26 → 2.1.28

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.
Files changed (2) hide show
  1. package/dist/image.js +11 -2
  2. package/package.json +2 -2
package/dist/image.js CHANGED
@@ -108,7 +108,7 @@ const createLightbox = (documentRef, src, t) => {
108
108
  };
109
109
  };
110
110
  export default async function renderImage(buffer, target, type, context) {
111
- var _a;
111
+ var _a, _b;
112
112
  const t = createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options);
113
113
  const documentRef = target.ownerDocument || document;
114
114
  const src = await resolveImageUrl(buffer, type);
@@ -125,6 +125,13 @@ export default async function renderImage(buffer, target, type, context) {
125
125
  const image = documentRef.createElement('img');
126
126
  image.alt = t('image.alt');
127
127
  image.src = src;
128
+ const normalizedType = (type || '').trim().toLowerCase();
129
+ (_a = context === null || context === void 0 ? void 0 : context.registerThumbnailAdapter) === null || _a === void 0 ? void 0 : _a.call(context, {
130
+ capture: () => normalizedType === 'heic' || normalizedType === 'heif'
131
+ ? null
132
+ : new Blob([buffer], { type: getImageBlobType(normalizedType) }),
133
+ getTarget: () => image,
134
+ });
128
135
  stage.append(image);
129
136
  root.append(stage);
130
137
  const lightbox = createLightbox(documentRef, src, t);
@@ -242,11 +249,13 @@ export default async function renderImage(buffer, target, type, context) {
242
249
  subscribe: zoomEmitter.subscribe,
243
250
  });
244
251
  target.replaceChildren(createStyle(documentRef), root);
245
- (((_a = context === null || context === void 0 ? void 0 : context.surface) === null || _a === void 0 ? void 0 : _a.shadowRoot) || target).append(lightbox.element);
252
+ (((_b = context === null || context === void 0 ? void 0 : context.surface) === null || _b === void 0 ? void 0 : _b.shadowRoot) || target).append(lightbox.element);
246
253
  updateViewportSize();
247
254
  return {
248
255
  $el: target,
249
256
  unmount() {
257
+ var _a;
258
+ (_a = context === null || context === void 0 ? void 0 : context.registerThumbnailAdapter) === null || _a === void 0 ? void 0 : _a.call(context, null);
250
259
  unregisterFileViewerZoomProvider(root);
251
260
  resizeObserver.disconnect();
252
261
  image.removeEventListener('load', updateViewportSize);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-image",
3
- "version": "2.1.26",
3
+ "version": "2.1.28",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone image renderer plugin for Flyfish File Viewer with native image preview, HEIC/HEIF conversion, lightbox, and unified zoom support.",
@@ -54,7 +54,7 @@
54
54
  "LICENSE"
55
55
  ],
56
56
  "dependencies": {
57
- "@file-viewer/core": "2.1.26",
57
+ "@file-viewer/core": "2.1.28",
58
58
  "heic2any": "^0.0.4"
59
59
  },
60
60
  "devDependencies": {