fix ctrl+click opening the link twice/thrice, closes #1094

This commit is contained in:
zadam 2020-06-10 00:10:27 +02:00
parent 212b719ee9
commit 2d92b4931a
8 changed files with 18 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.42.6",
"version": "0.42.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -3345,9 +3345,9 @@
}
},
"electron": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/electron/-/electron-9.0.2.tgz",
"integrity": "sha512-+a3KegLvQXVjC3b6yBWwZmtWp3tHf9ut27yORAWHO9JRFtKfNf88fi1UvTPJSW8R0sUH7ZEdzN6A95T22KGtlA==",
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-9.0.3.tgz",
"integrity": "sha512-rY59wy50z0oWp/q69zq0UIzvtcM5j2BJbLAwEoLfVNS3DLt9wDZqRqSIBvLEBl+xWbafCnRA9haEqi7ssM94GA==",
"dev": true,
"requires": {
"@electron/get": "^1.0.1",

View File

@ -78,7 +78,7 @@
"yazl": "^2.5.1"
},
"devDependencies": {
"electron": "9.0.2",
"electron": "9.0.3",
"electron-builder": "22.6.0",
"electron-packager": "14.2.1",
"electron-rebuild": "1.10.1",

View File

@ -49,11 +49,7 @@ function setupGlobs() {
let message = "Uncaught error: ";
if (string.includes("Cannot read property 'defaultView' of undefined")) {
// ignore this specific error which is very common but we don't know where it comes from
// and it seems to be harmless
return true;
} else if (string.includes("script error")) {
if (string.includes("script error")) {
message += 'No details available';
} else {
message += [
@ -61,8 +57,9 @@ function setupGlobs() {
'URL: ' + url,
'Line: ' + lineNo,
'Column: ' + columnNo,
'Error object: ' + JSON.stringify(error)
].join(' - ');
'Error object: ' + JSON.stringify(error),
'Stack: ' + error && error.stack
].join(', ');
}
ws.logError(message);

View File

@ -137,7 +137,7 @@ function linkContextMenu(e) {
$(document).on('mousedown', "a[data-action='note']", goToLink);
$(document).on('mousedown', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
$(document).on('dblclick', '.note-detail-text a', goToLink);
$(document).on('mousedown', '.note-detail-text a', function (e) {
$(document).on('mousedown', '.note-detail-text a:not(.reference-link)', function (e) {
const $link = $(e.target).closest("a");
const notePath = getNotePathFromLink($link);
@ -161,6 +161,7 @@ $(document).on('mousedown', '.note-detail-text a', function (e) {
$(document).on('mousedown', '.note-detail-book a', goToLink);
$(document).on('mousedown', '.note-detail-render a', goToLink);
$(document).on('mousedown', '.note-detail-text a.reference-link', goToLink);
$(document).on('mousedown', '.note-detail-readonly-text a.reference-link', goToLink);
$(document).on('mousedown', '.note-detail-readonly-text a', goToLink);
$(document).on('mousedown', 'a.ck-link-actions__preview', goToLink);
$(document).on('click', 'a.ck-link-actions__preview', e => {

View File

@ -25,7 +25,8 @@ function logError(message) {
if (ws && ws.readyState === 1) {
ws.send(JSON.stringify({
type: 'log-error',
error: message
error: message,
stack: new Error().stack
}));
}
}

View File

@ -36,7 +36,7 @@ function init(httpServer, sessionParser) {
const message = JSON.parse(messageJson);
if (message.type === 'log-error') {
log.error('JS Error: ' + message.error);
log.info('JS Error: ' + message.error + '\r\nStack: ' + message.stack);
}
else if (message.type === 'ping') {
lastAcceptedSyncIds[ws.id] = message.lastSyncId;