mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 17:49:39 +02:00
Fix minor details in new code viewer
- Automatically remove quotes around URLs pasted in input field - Fix editor not getting the focus after interacting with input field
This commit is contained in:
parent
b3821e6869
commit
4bf3fe7b5b
@ -150,6 +150,10 @@ function updatePastURLs(url) {
|
||||
/******************************************************************************/
|
||||
|
||||
async function setURL(resourceURL) {
|
||||
// For convenience, remove potentially existing quotes around the URL
|
||||
if ( /^(["']).+\1$/.test(resourceURL) ) {
|
||||
resourceURL = resourceURL.slice(1, -1);
|
||||
}
|
||||
const input = qs$('#header input[type="url"]');
|
||||
let to;
|
||||
try {
|
||||
@ -174,7 +178,8 @@ async function setURL(resourceURL) {
|
||||
cmEditor.setOption('mode', r.mime || '');
|
||||
cmEditor.setValue(r.text);
|
||||
updatePastURLs(to.href);
|
||||
cmEditor.focus();
|
||||
// For unknown reasons, calling focus() synchronously does not work...
|
||||
vAPI.setTimeout(( ) => { cmEditor.focus(); }, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user