mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
dev tools: allow download
This commit is contained in:
@@ -9,6 +9,13 @@
|
|||||||
(click)="saveChanges()">
|
(click)="saveChanges()">
|
||||||
<mat-icon>save_alt</mat-icon>
|
<mat-icon>save_alt</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
color="primary"
|
||||||
|
title="Download"
|
||||||
|
(click)="download()">
|
||||||
|
<mat-icon>cloud_download</mat-icon>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@@ -26,7 +26,9 @@ export class AcaDevToolsComponent implements OnInit {
|
|||||||
|
|
||||||
const schemaUri = routeData.schemaUri;
|
const schemaUri = routeData.schemaUri;
|
||||||
const getSchema = this.http.get(routeData.schemaPath);
|
const getSchema = this.http.get(routeData.schemaPath);
|
||||||
const getConfig = this.http.get(routeData.configPath, { responseType: 'text' });
|
const getConfig = this.http.get(routeData.configPath, {
|
||||||
|
responseType: 'text'
|
||||||
|
});
|
||||||
|
|
||||||
forkJoin([getSchema, getConfig]).subscribe(
|
forkJoin([getSchema, getConfig]).subscribe(
|
||||||
([schema, config]) => {
|
([schema, config]) => {
|
||||||
@@ -69,4 +71,19 @@ export class AcaDevToolsComponent implements OnInit {
|
|||||||
sessionStorage.removeItem('aca.extension.config');
|
sessionStorage.removeItem('aca.extension.config');
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
download() {
|
||||||
|
const element = document.createElement('a');
|
||||||
|
element.setAttribute(
|
||||||
|
'href',
|
||||||
|
'data:text/plain;charset=utf-8,' + encodeURIComponent(this.code)
|
||||||
|
);
|
||||||
|
element.setAttribute('download', 'plugin.json');
|
||||||
|
element.style.display = 'none';
|
||||||
|
document.body.appendChild(element);
|
||||||
|
|
||||||
|
element.click();
|
||||||
|
|
||||||
|
document.body.removeChild(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user