@onehat/ui 0.3.325 → 0.3.327
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@ const downloadWithFetch = (url, options = {}, win = null) => {
|
|
|
6
6
|
if (!win) {
|
|
7
7
|
const
|
|
8
8
|
winName = 'Download',
|
|
9
|
-
opts = '
|
|
9
|
+
opts = 'location=0,menubar=0,scrollbars=0';
|
|
10
10
|
win = window.open('', winName, opts);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -25,11 +25,13 @@ import Xmark from '../../Components/Icons/Xmark.js'
|
|
|
25
25
|
import withAlert from '../../Components/Hoc/withAlert.js';
|
|
26
26
|
import withData from '../../Components/Hoc/withData.js';
|
|
27
27
|
import downloadInBackground from '../../Functions/downloadInBackground.js';
|
|
28
|
+
import downloadWithFetch from '../../Functions/downloadWithFetch.js';
|
|
28
29
|
import _ from 'lodash';
|
|
29
30
|
|
|
30
31
|
const
|
|
31
32
|
EXPANDED_MAX = 100,
|
|
32
|
-
COLLAPSED_MAX = 4
|
|
33
|
+
COLLAPSED_MAX = 4,
|
|
34
|
+
isPwa = !!window?.navigator?.standalone;
|
|
33
35
|
|
|
34
36
|
function FileCardCustom(props) {
|
|
35
37
|
const
|
|
@@ -187,6 +189,16 @@ function AttachmentsElement(props) {
|
|
|
187
189
|
doDelete(id);
|
|
188
190
|
}
|
|
189
191
|
},
|
|
192
|
+
onDownload = (id, url) => {
|
|
193
|
+
if (isPwa) {
|
|
194
|
+
// This doesn't work because iOS doesn't allow you to open another window within a PWA.
|
|
195
|
+
// downloadWithFetch(url);
|
|
196
|
+
|
|
197
|
+
alert('Files cannot be downloaded and viewed within an iOS PWA. Please use the Safari browser instead.');
|
|
198
|
+
} else {
|
|
199
|
+
downloadInBackground(url);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
190
202
|
doDelete = (id) => {
|
|
191
203
|
Repository.deleteById(id);
|
|
192
204
|
Repository.save();
|
|
@@ -282,6 +294,7 @@ function AttachmentsElement(props) {
|
|
|
282
294
|
<FileMosaic
|
|
283
295
|
{...file}
|
|
284
296
|
backgroundBlurImage={false}
|
|
297
|
+
onDownload={onDownload}
|
|
285
298
|
{..._fileMosaic}
|
|
286
299
|
/>}
|
|
287
300
|
{!useFileMosaic &&
|