Skip to content

Commit

Permalink
14.1.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgraph committed Dec 31, 2020
1 parent 407987f commit 0077370
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 51 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
31-DEC-2020: 14.1.5

- Desktop fixes for File API clash

30-DEC-2020: 14.1.4

- Fixes marker rounding errors
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.1.4
14.1.5
91 changes: 68 additions & 23 deletions src/main/webapp/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,28 +572,57 @@ app.on('ready', e =>
app.on('second-instance', (event, commandLine, workingDirectory) => {
//Create another window
let win = createWindow()

win.webContents.on('did-finish-load', function()
{
ipcMain.once('app-load-finished', (evt, data) =>
{

let loadEvtCount = 0;

function loadFinished()
{
loadEvtCount++;

if (loadEvtCount == 2)
{
//Open the file if new app request is from opening a file
var potFile = commandLine.pop();

if (fs.existsSync(potFile))
{
win.webContents.send('args-obj', {args: [potFile]});
}
});

}
}

//Order of these two events is not guaranteed, so wait for them async.
//TOOD There is still a chance we catch another window 'app-load-finished' if user created multiple windows quickly
ipcMain.once('app-load-finished', loadFinished);

win.webContents.on('did-finish-load', function()
{
win.webContents.zoomFactor = 1;
win.webContents.setVisualZoomLevelLimits(1, 1);
loadFinished();
});
})
}

let win = createWindow()

let loadEvtCount = 0;

function loadFinished()
{
loadEvtCount++;

if (loadEvtCount == 2)
{
//Sending entire program is not allowed in Electron 9 as it is not native JS object
win.webContents.send('args-obj', {args: program.args, create: program.create});
}
}

//Order of these two events is not guaranteed, so wait for them async.
//TOOD There is still a chance we catch another window 'app-load-finished' if user created multiple windows quickly
ipcMain.once('app-load-finished', loadFinished);

win.webContents.on('did-finish-load', function()
{
if (firstWinFilePath != null)
Expand All @@ -610,14 +639,9 @@ app.on('ready', e =>

firstWinLoaded = true;

ipcMain.once('app-load-finished', (evt, data) =>
{
//Sending entire program is not allowed in Electron 9 as it is not native JS object
win.webContents.send('args-obj', {args: program.args, create: program.create});
});

win.webContents.zoomFactor = 1;
win.webContents.setVisualZoomLevelLimits(1, 1);
loadFinished();
});

let updateNoAvailAdded = false;
Expand Down Expand Up @@ -779,15 +803,27 @@ app.on('will-finish-launching', function()
{
let win = createWindow();

let loadEvtCount = 0;

function loadFinished()
{
loadEvtCount++;

if (loadEvtCount == 2)
{
win.webContents.send('args-obj', {args: [path]});
}
}

//Order of these two events is not guaranteed, so wait for them async.
//TOOD There is still a chance we catch another window 'app-load-finished' if user created multiple windows quickly
ipcMain.once('app-load-finished', loadFinished);

win.webContents.on('did-finish-load', function()
{
ipcMain.once('app-load-finished', (evt, data) =>
{
win.webContents.send('args-obj', {args: [path]});
});

win.webContents.zoomFactor = 1;
win.webContents.setVisualZoomLevelLimits(1, 1);
loadFinished();
});
}
else
Expand Down Expand Up @@ -1066,9 +1102,13 @@ function exportVsdx(event, args, directFinalize)
show : false
});

win.webContents.on('did-finish-load', function()
{
ipcMain.once('app-load-finished', (evt, data) =>
let loadEvtCount = 0;

function loadFinished()
{
loadEvtCount++;

if (loadEvtCount == 2)
{
win.webContents.send('export-vsdx', args);

Expand Down Expand Up @@ -1106,8 +1146,13 @@ function exportVsdx(event, args, directFinalize)
event.reply('export-success', data);
}
});
});
});
}
}

//Order of these two events is not guaranteed, so wait for them async.
//TOOD There is still a chance we catch another window 'app-load-finished' if user created multiple windows quickly
ipcMain.once('app-load-finished', loadFinished);
win.webContents.on('did-finish-load', loadFinished);
};

//TODO Use canvas to export images if math is not used to speedup export (no capturePage). Requires change to export3.html also
Expand Down
20 changes: 10 additions & 10 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/webapp/js/diagramly/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3826,7 +3826,7 @@ App.prototype.pickFile = function(mode)
{
peer.pickFile();
}
else if (mode == App.MODE_DEVICE && 'showOpenFilePicker' in window)
else if (mode == App.MODE_DEVICE && 'showOpenFilePicker' in window && !EditorUi.isElectronApp)
{
window.showOpenFilePicker().then(mxUtils.bind(this, function(fileHandles)
{
Expand Down Expand Up @@ -4661,7 +4661,7 @@ App.prototype.createFile = function(title, data, libs, mode, done, replace, fold
this.fileCreated(file, libs, replace, done, clibs);
}), error);
}
else if (!tempFile && mode == App.MODE_DEVICE && 'showSaveFilePicker' in window)
else if (!tempFile && mode == App.MODE_DEVICE && 'showSaveFilePicker' in window && !EditorUi.isElectronApp)
{
complete();

Expand Down
11 changes: 11 additions & 0 deletions src/main/webapp/js/diagramly/ElectronApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,17 @@ mxStencilRegistry.allowEval = false;

LocalFile.prototype.saveFile = function(revision, success, error, unloading, overwrite)
{
//Safeguard in case saveFile is called from online code in the future
if (typeof success !== 'function')
{
if (typeof unloading === 'function')
{
//Call error
unloading({message: 'This is a bug, please report!'}); //Original draw.io function parameters are (title, revision, success, error, useCurrentData)
}
return;
}

if (!this.savingFile)
{
var fn = mxUtils.bind(this, function()
Expand Down
Loading

0 comments on commit 0077370

Please sign in to comment.