mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Electron: Fixes #598: Allow opening any URL with a valid protocol in an external app
This commit is contained in:
parent
ced14e578f
commit
b08dcdfd90
@ -24,6 +24,7 @@ const {clipboard} = require('electron')
|
|||||||
const md5 = require('md5');
|
const md5 = require('md5');
|
||||||
const mimeUtils = require('lib/mime-utils.js').mime;
|
const mimeUtils = require('lib/mime-utils.js').mime;
|
||||||
const ArrayUtils = require('lib/ArrayUtils');
|
const ArrayUtils = require('lib/ArrayUtils');
|
||||||
|
const urlUtils = require('lib/urlUtils');
|
||||||
|
|
||||||
require('brace/mode/markdown');
|
require('brace/mode/markdown');
|
||||||
// https://ace.c9.io/build/kitchen-sink.html
|
// https://ace.c9.io/build/kitchen-sink.html
|
||||||
@ -379,8 +380,6 @@ class NoteTextComponent extends React.Component {
|
|||||||
|
|
||||||
const newBody = this.mdToHtml_.handleCheckboxClick(msg, this.state.note.body);
|
const newBody = this.mdToHtml_.handleCheckboxClick(msg, this.state.note.body);
|
||||||
this.saveOneProperty('body', newBody);
|
this.saveOneProperty('body', newBody);
|
||||||
} else if (msg.toLowerCase().indexOf('http') === 0) {
|
|
||||||
require('electron').shell.openExternal(msg);
|
|
||||||
} else if (msg === 'percentScroll') {
|
} else if (msg === 'percentScroll') {
|
||||||
this.ignoreNextEditorScroll_ = true;
|
this.ignoreNextEditorScroll_ = true;
|
||||||
this.setEditorPercentScroll(arg0);
|
this.setEditorPercentScroll(arg0);
|
||||||
@ -441,6 +440,8 @@ class NoteTextComponent extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error('Unsupported item type: ' + item.type_);
|
throw new Error('Unsupported item type: ' + item.type_);
|
||||||
}
|
}
|
||||||
|
} else if (urlUtils.urlProtocol(msg)) {
|
||||||
|
require('electron').shell.openExternal(msg);
|
||||||
} else {
|
} else {
|
||||||
bridge().showErrorMessageBox(_('Unsupported link or message: %s', msg));
|
bridge().showErrorMessageBox(_('Unsupported link or message: %s', msg));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user