cozy-ui 110.5.0 → 110.7.0
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.
- package/CHANGELOG.md +19 -0
- package/assets/icons/ui/star-outline.svg +1 -0
- package/package.json +1 -1
- package/react/ActionsMenu/Actions/helpers.js +9 -20
- package/react/Icon/Readme.md +3 -1
- package/react/Icon/icons-sprite.js +1 -1
- package/react/Icons/StarOutline.jsx +16 -0
- package/transpiled/react/ActionsMenu/Actions/helpers.js +12 -36
- package/transpiled/react/Icon/icons-sprite.js +1 -1
- package/transpiled/react/Icons/StarOutline.js +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [110.7.0](https://github.com/cozy/cozy-ui/compare/v110.6.0...v110.7.0) (2024-07-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ActionsMenu/addImageToPdf:** Correct excessive weight when adding img ([ee7e46c](https://github.com/cozy/cozy-ui/commit/ee7e46c))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ActionsMenu/resizeImage:** Remove unnecessary param ([c6d06e8](https://github.com/cozy/cozy-ui/commit/c6d06e8))
|
|
12
|
+
|
|
13
|
+
# [110.6.0](https://github.com/cozy/cozy-ui/compare/v110.5.0...v110.6.0) (2024-07-08)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* Add StarOutline icon ([831b793](https://github.com/cozy/cozy-ui/commit/831b793))
|
|
19
|
+
|
|
1
20
|
# [110.5.0](https://github.com/cozy/cozy-ui/compare/v110.4.0...v110.5.0) (2024-07-04)
|
|
2
21
|
|
|
3
22
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="m8 10.305 2.71 1.425-.517-3.018 2.192-2.137-3.03-.44L8 3.389 6.645 6.135l-3.03.44 2.193 2.137-.518 3.018L8 10.305Zm-4.702 4.167.898-5.236L.392 5.528l5.257-.764L8 0l2.351 4.764 5.257.764-3.804 3.708.898 5.236L8 12l-4.702 2.472Z"/></svg>
|
package/package.json
CHANGED
|
@@ -92,14 +92,13 @@ export const makeBase64FromFile = async file => {
|
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* @param {HTMLImageElement} image
|
|
95
|
-
* @param {number} [maxSizeInPixel] - Maximum size before being resized
|
|
96
95
|
* @returns {number}
|
|
97
96
|
*/
|
|
98
|
-
const getImageScaleRatio =
|
|
97
|
+
const getImageScaleRatio = image => {
|
|
99
98
|
const longerSideSizeInPixel = Math.max(image.height, image.width)
|
|
100
99
|
let scaleRatio = 1
|
|
101
|
-
if (
|
|
102
|
-
scaleRatio =
|
|
100
|
+
if (MAX_RESIZE_IMAGE_SIZE < longerSideSizeInPixel) {
|
|
101
|
+
scaleRatio = MAX_RESIZE_IMAGE_SIZE / longerSideSizeInPixel
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
return scaleRatio
|
|
@@ -108,22 +107,16 @@ const getImageScaleRatio = (image, maxSize) => {
|
|
|
108
107
|
/**
|
|
109
108
|
* @param {object} opts
|
|
110
109
|
* @param {string} opts.base64 - Base64 of image
|
|
111
|
-
* @param {string} opts.type - Type of image
|
|
112
|
-
* @param {number} opts.maxSize - Maximum size before being resized
|
|
113
110
|
* @returns {Promise<string>}
|
|
114
111
|
*/
|
|
115
|
-
const resizeImage = async ({
|
|
116
|
-
base64: fileDataUri,
|
|
117
|
-
type: fileType,
|
|
118
|
-
maxSize
|
|
119
|
-
}) => {
|
|
112
|
+
const resizeImage = async ({ base64: fileDataUri }) => {
|
|
120
113
|
return new Promise((resolve, reject) => {
|
|
121
114
|
const newImage = new Image()
|
|
122
115
|
newImage.src = fileDataUri
|
|
123
116
|
newImage.onerror = reject
|
|
124
117
|
newImage.onload = () => {
|
|
125
118
|
const canvas = document.createElement('canvas')
|
|
126
|
-
const scaleRatio = getImageScaleRatio(newImage
|
|
119
|
+
const scaleRatio = getImageScaleRatio(newImage)
|
|
127
120
|
const scaledWidth = scaleRatio * newImage.width
|
|
128
121
|
const scaledHeight = scaleRatio * newImage.height
|
|
129
122
|
const quality =
|
|
@@ -138,7 +131,7 @@ const resizeImage = async ({
|
|
|
138
131
|
.getContext('2d')
|
|
139
132
|
.drawImage(newImage, 0, 0, scaledWidth, scaledHeight)
|
|
140
133
|
|
|
141
|
-
resolve(canvas.toDataURL(
|
|
134
|
+
resolve(canvas.toDataURL('image/jpeg', quality))
|
|
142
135
|
}
|
|
143
136
|
})
|
|
144
137
|
}
|
|
@@ -157,6 +150,7 @@ const fileToDataUri = async file => {
|
|
|
157
150
|
}
|
|
158
151
|
|
|
159
152
|
/**
|
|
153
|
+
* Compress image and add it to pdf
|
|
160
154
|
* @param {PDFDocument} pdfDoc
|
|
161
155
|
* @param {File} file
|
|
162
156
|
* @returns {Promise<void>}
|
|
@@ -164,14 +158,9 @@ const fileToDataUri = async file => {
|
|
|
164
158
|
const addImageToPdf = async (pdfDoc, file) => {
|
|
165
159
|
const fileDataUri = await fileToDataUri(file)
|
|
166
160
|
const resizedImage = await resizeImage({
|
|
167
|
-
base64: fileDataUri
|
|
168
|
-
type: file.type,
|
|
169
|
-
maxSize: MAX_RESIZE_IMAGE_SIZE
|
|
161
|
+
base64: fileDataUri
|
|
170
162
|
})
|
|
171
|
-
|
|
172
|
-
let img
|
|
173
|
-
if (file.type === 'image/png') img = await pdfDoc.embedPng(resizedImage)
|
|
174
|
-
if (file.type === 'image/jpeg') img = await pdfDoc.embedJpg(resizedImage)
|
|
163
|
+
const img = await pdfDoc.embedJpg(resizedImage)
|
|
175
164
|
|
|
176
165
|
const page = pdfDoc.addPage([img.width, img.height])
|
|
177
166
|
const { width: pageWidth, height: pageHeight } = page.getSize()
|
package/react/Icon/Readme.md
CHANGED
|
@@ -286,6 +286,7 @@ import Spinner from 'cozy-ui/transpiled/react/Icons/Spinner'
|
|
|
286
286
|
import SportBag from 'cozy-ui/transpiled/react/Icons/SportBag'
|
|
287
287
|
import Stack from 'cozy-ui/transpiled/react/Icons/Stack'
|
|
288
288
|
import Star from 'cozy-ui/transpiled/react/Icons/Star'
|
|
289
|
+
import StarOutline from 'cozy-ui/transpiled/react/Icons/StarOutline'
|
|
289
290
|
import Stats from 'cozy-ui/transpiled/react/Icons/Stats'
|
|
290
291
|
import Subway from 'cozy-ui/transpiled/react/Icons/Subway'
|
|
291
292
|
import Support from 'cozy-ui/transpiled/react/Icons/Support'
|
|
@@ -547,6 +548,7 @@ const icons = [
|
|
|
547
548
|
SportBag,
|
|
548
549
|
Stack,
|
|
549
550
|
Star,
|
|
551
|
+
StarOutline,
|
|
550
552
|
Stats,
|
|
551
553
|
Subway,
|
|
552
554
|
Support,
|
|
@@ -921,7 +923,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
|
921
923
|
|
|
922
924
|
const colors = ['#297EF2', '#08b442', '#B449E7', '#F52D2D', '#FF962F']
|
|
923
925
|
let i = 0
|
|
924
|
-
const availableIcons = ['album-add','album-remove','album','answer','apple','archive','arrowUp','attachment','attention','bank-check','bank','banking-add','banking','bell','benefit','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','carpooling','categories','certified','check-circle','check-list','check-square','check','checkbox','chess','child','circle-filled','clock','clock-outline','cloud-happy','cloud','collect','cocktail','comment','company','compare','compass','connector','contract','contrast','copy','cozy-circle','cozy-laugh', 'cozy-lock', 'cozy-text', 'cozy-release', 'credit-card-add','credit-card','credit','crop','cross-circle-outline','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','devices','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','electric-bike','electric-car','electric-scooter','email-notification','email','eu','euro','exchange','eye-closed','eye','face-id','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder','forbidden','from-user','gear','globe','gouv','graph-circle','grid','group-list','groups','growth','hand','heart','help','help-outlined','history','home','hourglass','image','info-outlined','info','justice','key','label-outlined','laudry','laptop','left','library','lightbulb','lightning','link-out','link','list','list-min','location','lock', 'lock-screen', 'logout','magic-trick','magnet','magnifier','merge','moped','mosaic-min','motorcycle','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','offline','online', 'openapp', 'openwith','palette','paper','paperplane','password','pen','people','percent-circle','percent','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus', 'pop-inside', 'previous','printer','qualify','radio-checked','radio-unchecked','refresh','relationship','remboursement','rename','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','scooter','select-all','setting','share-circle','share','shield','shop','sound','spinner','sport-bag','stack','star','stats','subway', 'support', 'swap', 'sync-cozy','sync','tag','target','task','team','telecom','telephone','text-info','to-the-cloud','top','train','tram','trash','trophy', 'uncloud', 'unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','water','wrench-circle','work']
|
|
926
|
+
const availableIcons = ['album-add','album-remove','album','answer','apple','archive','arrowUp','attachment','attention','bank-check','bank','banking-add','banking','bell','benefit','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','carpooling','categories','certified','check-circle','check-list','check-square','check','checkbox','chess','child','circle-filled','clock','clock-outline','cloud-happy','cloud','collect','cocktail','comment','company','compare','compass','connector','contract','contrast','copy','cozy-circle','cozy-laugh', 'cozy-lock', 'cozy-text', 'cozy-release', 'credit-card-add','credit-card','credit','crop','cross-circle-outline','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','devices','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','electric-bike','electric-car','electric-scooter','email-notification','email','eu','euro','exchange','eye-closed','eye','face-id','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder','forbidden','from-user','gear','globe','gouv','graph-circle','grid','group-list','groups','growth','hand','heart','help','help-outlined','history','home','hourglass','image','info-outlined','info','justice','key','label-outlined','laudry','laptop','left','library','lightbulb','lightning','link-out','link','list','list-min','location','lock', 'lock-screen', 'logout','magic-trick','magnet','magnifier','merge','moped','mosaic-min','motorcycle','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','offline','online', 'openapp', 'openwith','palette','paper','paperplane','password','pen','people','percent-circle','percent','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus', 'pop-inside', 'previous','printer','qualify','radio-checked','radio-unchecked','refresh','relationship','remboursement','rename','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','scooter','select-all','setting','share-circle','share','shield','shop','sound','spinner','sport-bag','stack','star','star-outline','stats','subway', 'support', 'swap', 'sync-cozy','sync','tag','target','task','team','telecom','telephone','text-info','to-the-cloud','top','train','tram','trash','trophy', 'uncloud', 'unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','water','wrench-circle','work']
|
|
925
927
|
;
|
|
926
928
|
<div style={{ fontSize: '2rem', display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)' }}>
|
|
927
929
|
<Sprite />
|
|
@@ -566,7 +566,7 @@ animation: checkmark 0.5s ease-in-out 0.16s backwards
|
|
|
566
566
|
<path d="M16 0a16 16 0 0 1 16 16h-4a12 12 0 0 0-12-12z"/>
|
|
567
567
|
</symbol><symbol id="sport-bag" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M4 5a4 4 0 1 1 8 0h.459a3 3 0 0 1 2.96 2.507l.5 2A3 3 0 0 1 12.958 13H3.042a3 3 0 0 1-2.96-3.493l.5-2A3 3 0 0 1 3.543 5H4Zm2 0a2 2 0 1 1 4 0H6Z"/></symbol><symbol id="stack" viewBox="0 0 16 16">
|
|
568
568
|
<path fill-rule="evenodd" d="M3.243 6.034L.671 4.842a.779.779 0 0 1-.396-.397c-.197-.496 0-.894.396-1.093L7.792.075c.198-.1.395-.1.594 0l7.12 3.277a.746.746 0 0 1 .494.696.746.746 0 0 1-.494.695l-2.67 1.291-.594.298-3.856 1.887a.694.694 0 0 1-.693 0c-.198-.105-3.857-1.887-3.857-1.887l-.593-.298zm12.03 4.807c.78.4.675 1.345-.086 1.756L8.421 15.9a.985.985 0 0 1-.864 0L.572 12.49a.779.779 0 0 1-.396-.397c-.197-.497 0-.894.396-1.093l.89-.397 2.472 1.192 3.627 1.73a.984.984 0 0 0 .857-.005l3.725-1.825 2.373-1.19.756.336zm.53-3.218c.197.397 0 .894-.594 1.192l-2.274 1.092-.594.3-4.058 2.036a.98.98 0 0 1-.883 0l-4.058-2.037-.594-.299L.474 8.815a.777.777 0 0 1-.396-.398c-.198-.496 0-.894.396-1.092l1.285-.596 2.176.993 3.626 1.73a.986.986 0 0 0 .858-.005l4.12-2.023 1.582-.794 1.286.596a.771.771 0 0 1 .396.397z"/>
|
|
569
|
-
</symbol><symbol id="star" viewBox="0 0 16 16">
|
|
569
|
+
</symbol><symbol id="star-outline" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="m8 10.305 2.71 1.425-.517-3.018 2.192-2.137-3.03-.44L8 3.389 6.645 6.135l-3.03.44 2.193 2.137-.518 3.018L8 10.305Zm-4.702 4.167.898-5.236L.392 5.528l5.257-.764L8 0l2.351 4.764 5.257.764-3.804 3.708.898 5.236L8 12l-4.702 2.472Z"/></symbol><symbol id="star" viewBox="0 0 16 16">
|
|
570
570
|
<path fill-rule="evenodd" d="M8 12l-4.702 2.472.898-5.236L.392 5.528l5.257-.764L8 0l2.351 4.764 5.257.764-3.804 3.708.898 5.236z"/>
|
|
571
571
|
</symbol><symbol id="stats" viewBox="0 0 16 16">
|
|
572
572
|
<path fill-rule="evenodd" d="M13 4h2a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1M7 0h2a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1M1 8h2a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1"/>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/star-outline.svg` to regenerate;
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
function SvgStarOutline(props) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 16 16" {...props}>
|
|
7
|
+
<path
|
|
8
|
+
fillRule="evenodd"
|
|
9
|
+
clipRule="evenodd"
|
|
10
|
+
d="M8 10.305l2.71 1.425-.517-3.018 2.192-2.137-3.03-.44L8 3.389 6.645 6.135l-3.03.44 2.193 2.137-.518 3.018L8 10.305zm-4.702 4.167l.898-5.236L.392 5.528l5.257-.764L8 0l2.351 4.764 5.257.764-3.804 3.708.898 5.236L8 12l-4.702 2.472z"
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default SvgStarOutline
|
|
@@ -103,16 +103,15 @@ export var makeBase64FromFile = /*#__PURE__*/function () {
|
|
|
103
103
|
}();
|
|
104
104
|
/**
|
|
105
105
|
* @param {HTMLImageElement} image
|
|
106
|
-
* @param {number} [maxSizeInPixel] - Maximum size before being resized
|
|
107
106
|
* @returns {number}
|
|
108
107
|
*/
|
|
109
108
|
|
|
110
|
-
var getImageScaleRatio = function getImageScaleRatio(image
|
|
109
|
+
var getImageScaleRatio = function getImageScaleRatio(image) {
|
|
111
110
|
var longerSideSizeInPixel = Math.max(image.height, image.width);
|
|
112
111
|
var scaleRatio = 1;
|
|
113
112
|
|
|
114
|
-
if (
|
|
115
|
-
scaleRatio =
|
|
113
|
+
if (MAX_RESIZE_IMAGE_SIZE < longerSideSizeInPixel) {
|
|
114
|
+
scaleRatio = MAX_RESIZE_IMAGE_SIZE / longerSideSizeInPixel;
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
return scaleRatio;
|
|
@@ -120,20 +119,18 @@ var getImageScaleRatio = function getImageScaleRatio(image, maxSize) {
|
|
|
120
119
|
/**
|
|
121
120
|
* @param {object} opts
|
|
122
121
|
* @param {string} opts.base64 - Base64 of image
|
|
123
|
-
* @param {string} opts.type - Type of image
|
|
124
|
-
* @param {number} opts.maxSize - Maximum size before being resized
|
|
125
122
|
* @returns {Promise<string>}
|
|
126
123
|
*/
|
|
127
124
|
|
|
128
125
|
|
|
129
126
|
var resizeImage = /*#__PURE__*/function () {
|
|
130
127
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
131
|
-
var fileDataUri
|
|
128
|
+
var fileDataUri;
|
|
132
129
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
133
130
|
while (1) {
|
|
134
131
|
switch (_context2.prev = _context2.next) {
|
|
135
132
|
case 0:
|
|
136
|
-
fileDataUri = _ref3.base64
|
|
133
|
+
fileDataUri = _ref3.base64;
|
|
137
134
|
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
138
135
|
var newImage = new Image();
|
|
139
136
|
newImage.src = fileDataUri;
|
|
@@ -141,14 +138,14 @@ var resizeImage = /*#__PURE__*/function () {
|
|
|
141
138
|
|
|
142
139
|
newImage.onload = function () {
|
|
143
140
|
var canvas = document.createElement('canvas');
|
|
144
|
-
var scaleRatio = getImageScaleRatio(newImage
|
|
141
|
+
var scaleRatio = getImageScaleRatio(newImage);
|
|
145
142
|
var scaledWidth = scaleRatio * newImage.width;
|
|
146
143
|
var scaledHeight = scaleRatio * newImage.height;
|
|
147
144
|
var quality = scaledWidth >= MAX_IMAGE_SIDE_SIZE || scaledHeight >= MAX_IMAGE_SIDE_SIZE ? 0.35 : 0.75;
|
|
148
145
|
canvas.width = scaledWidth;
|
|
149
146
|
canvas.height = scaledHeight;
|
|
150
147
|
canvas.getContext('2d').drawImage(newImage, 0, 0, scaledWidth, scaledHeight);
|
|
151
|
-
resolve(canvas.toDataURL(
|
|
148
|
+
resolve(canvas.toDataURL('image/jpeg', quality));
|
|
152
149
|
};
|
|
153
150
|
}));
|
|
154
151
|
|
|
@@ -200,6 +197,7 @@ var fileToDataUri = /*#__PURE__*/function () {
|
|
|
200
197
|
};
|
|
201
198
|
}();
|
|
202
199
|
/**
|
|
200
|
+
* Compress image and add it to pdf
|
|
203
201
|
* @param {PDFDocument} pdfDoc
|
|
204
202
|
* @param {File} file
|
|
205
203
|
* @returns {Promise<void>}
|
|
@@ -221,38 +219,16 @@ var addImageToPdf = /*#__PURE__*/function () {
|
|
|
221
219
|
fileDataUri = _context4.sent;
|
|
222
220
|
_context4.next = 5;
|
|
223
221
|
return resizeImage({
|
|
224
|
-
base64: fileDataUri
|
|
225
|
-
type: file.type,
|
|
226
|
-
maxSize: MAX_RESIZE_IMAGE_SIZE
|
|
222
|
+
base64: fileDataUri
|
|
227
223
|
});
|
|
228
224
|
|
|
229
225
|
case 5:
|
|
230
226
|
resizedImage = _context4.sent;
|
|
231
|
-
|
|
232
|
-
if (!(file.type === 'image/png')) {
|
|
233
|
-
_context4.next = 10;
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
_context4.next = 9;
|
|
238
|
-
return pdfDoc.embedPng(resizedImage);
|
|
239
|
-
|
|
240
|
-
case 9:
|
|
241
|
-
img = _context4.sent;
|
|
242
|
-
|
|
243
|
-
case 10:
|
|
244
|
-
if (!(file.type === 'image/jpeg')) {
|
|
245
|
-
_context4.next = 14;
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
_context4.next = 13;
|
|
227
|
+
_context4.next = 8;
|
|
250
228
|
return pdfDoc.embedJpg(resizedImage);
|
|
251
229
|
|
|
252
|
-
case
|
|
230
|
+
case 8:
|
|
253
231
|
img = _context4.sent;
|
|
254
|
-
|
|
255
|
-
case 14:
|
|
256
232
|
page = pdfDoc.addPage([img.width, img.height]);
|
|
257
233
|
_page$getSize = page.getSize(), pageWidth = _page$getSize.width, pageHeight = _page$getSize.height;
|
|
258
234
|
page.drawImage(img, {
|
|
@@ -262,7 +238,7 @@ var addImageToPdf = /*#__PURE__*/function () {
|
|
|
262
238
|
height: img.height
|
|
263
239
|
});
|
|
264
240
|
|
|
265
|
-
case
|
|
241
|
+
case 12:
|
|
266
242
|
case "end":
|
|
267
243
|
return _context4.stop();
|
|
268
244
|
}
|