mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[MIGRATION] - Something happened on the way to heaven
This commit is contained in:
@@ -53,7 +53,9 @@ export class ClipboardService {
|
||||
this.document.execCommand('copy');
|
||||
}
|
||||
this.notify(message);
|
||||
} catch {}
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +78,9 @@ export class ClipboardService {
|
||||
document.execCommand('copy');
|
||||
}
|
||||
this.notify(message);
|
||||
} catch {}
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
|
||||
private notify(message) {
|
||||
|
@@ -22,36 +22,38 @@ export interface FileInfo {
|
||||
}
|
||||
|
||||
export class FileUtils {
|
||||
|
||||
static flatten(folder: any): Promise<FileInfo[]> {
|
||||
const reader = folder.createReader();
|
||||
const files: FileInfo[] = [];
|
||||
return new Promise((resolve) => {
|
||||
const iterations = [];
|
||||
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
||||
(function traverse() {
|
||||
reader.readEntries((entries) => {
|
||||
if (!entries.length) {
|
||||
Promise.all(iterations).then(() => resolve(files));
|
||||
} else {
|
||||
iterations.push(Promise.all(entries.map((entry) => {
|
||||
if (entry.isFile) {
|
||||
return new Promise<void>((resolveFile) => {
|
||||
entry.file((file: File) => {
|
||||
files.push({
|
||||
entry,
|
||||
file,
|
||||
relativeFolder: entry.fullPath.replace(/\/[^/]*$/, '')
|
||||
iterations.push(
|
||||
Promise.all(
|
||||
entries.map((entry) => {
|
||||
if (entry.isFile) {
|
||||
return new Promise<void>((resolveFile) => {
|
||||
entry.file((file: File) => {
|
||||
files.push({
|
||||
entry,
|
||||
file,
|
||||
relativeFolder: entry.fullPath.replace(/\/[^/]*$/, '')
|
||||
});
|
||||
resolveFile();
|
||||
});
|
||||
});
|
||||
resolveFile();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return FileUtils.flatten(entry).then((result) => {
|
||||
files.push(...result);
|
||||
});
|
||||
}
|
||||
})));
|
||||
} else {
|
||||
return FileUtils.flatten(entry).then((result) => {
|
||||
files.push(...result);
|
||||
});
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
// Try calling traverse() again for the same dir, according to spec
|
||||
traverse();
|
||||
}
|
||||
|
Reference in New Issue
Block a user