Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d6f19515

Přidáno uživatelem Pavel Fidranský před asi 6 roky(ů)

fix #20: current diagram can be downloaded as raw JSON from graph screen

Zobrazit rozdíly:

sources/imiger-core/src/main/webapp/js/components/navbar.js
37 37
			this._createSaveDiagramListItem(),
38 38
			this._createSeparatorListItem(),
39 39

  
40
			this._createDownloadDiagramListItem(),
41
			this._createSeparatorListItem(),
42

  
40 43
			this._createRefreshDiagramListItem(),
41 44
			this._createSeparatorListItem(),
42 45

  
......
408 411
		]);
409 412
	}
410 413

  
414
	_createDownloadDiagramListItem() {
415
		return DOM.h('li', {}, [
416
			DOM.h('button', {
417
				class: 'btn download-diagram-as-raw-json',
418
				title: 'Download diagram as Raw JSON',
419
				onClick: () => {
420
					const json = JSON.stringify(app.graphExporter.run());
421
					const blob = new Blob([json]);
422
					const downloadLink = DOM.h('a', {
423
						href: URL.createObjectURL(blob, {
424
							type: 'application/json',
425
						}),
426
						download: app.diagram.name + '.json',
427
						hidden: 'hidden',
428
					});
429

  
430
					document.body.appendChild(downloadLink);
431
					downloadLink.click();
432
					document.body.removeChild(downloadLink);
433
				},
434
			}, [
435
				DOM.h('img', {
436
					src: 'images/icomoon/download3.svg',
437
					alt: 'download diagram icon',
438
				}),
439
			]),
440
		]);
441
	}
442

  
411 443
	_createRefreshDiagramListItem() {
412 444
		const refreshDiagramLink = DOM.h('a', {
413 445
			href: location.href,

Také k dispozici: Unified diff