-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvsdxImporter.html
67 lines (63 loc) · 1.59 KB
/
vsdxImporter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VSDX Importer</title>
<script type="text/javascript" src="js/app.min.js"></script>
<script type="text/javascript" src="js/extensions.min.js"></script>
<script type="text/javascript">
function doImport(vsdxBuff, callback, error, file, customParam)
{
EditorUi.prototype.createUi = function(){};
EditorUi.prototype.addTrees = function(){};
EditorUi.prototype.updateActionStates = function(){};
var editorUi = new EditorUi();
var blob = file? file : new Blob([vsdxBuff], {type: 'application/octet-stream'});
editorUi.importVisio(blob, callback, error, file? file.name : null, customParam);
};
try
{
electron.registerMsgListener('import', (vsdxBuff) =>
{
doImport(vsdxBuff, function(xml)
{
electron.sendMessage('import-success', xml);
},
function()
{
electron.sendMessage('import-error');
});
});
}
catch(e) {} //Ignore
</script>
</head>
<body>
<input type="file" id="fileUpload">
<script type="text/javascript">
document.getElementById('fileUpload').addEventListener('change', function()
{
const curFiles = this.files;
if(curFiles.length > 0)
{
function createDoneDiv(msg)
{
var doneDiv = document.createElement('div');
doneDiv.id = 'doneDiv';
doneDiv.innerHTML = msg;
document.body.appendChild(doneDiv);
};
doImport(null, function(xml)
{
window.importResXML = xml;
createDoneDiv('success');
}, function(err)
{
console.log(err)
createDoneDiv('error');
}, curFiles[0], window.customParam);
}
});
</script>
</body>
</html>