mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Fix broken import-from-file in Whitelist pane
Related discussion: - https://www.reddit.com/r/uBlockOrigin/comments/bt2d1f/
This commit is contained in:
parent
44fd5b1473
commit
85b89fbe63
1 changed files with 9 additions and 9 deletions
|
@ -157,19 +157,19 @@ const renderWhitelist = function() {
|
|||
/******************************************************************************/
|
||||
|
||||
const handleImportFilePicker = function() {
|
||||
const fileReaderOnLoadHandler = ( ) => {
|
||||
cmEditor.setValue(
|
||||
[
|
||||
cmEditor.getValue().trim(),
|
||||
this.result.trim()
|
||||
].join('\n').trim()
|
||||
);
|
||||
};
|
||||
const file = this.files[0];
|
||||
if ( file === undefined || file.name === '' ) { return; }
|
||||
if ( file.type.indexOf('text') !== 0 ) { return; }
|
||||
const fr = new FileReader();
|
||||
fr.onload = fileReaderOnLoadHandler;
|
||||
fr.onload = ev => {
|
||||
if ( ev.type !== 'load' ) { return; }
|
||||
cmEditor.setValue(
|
||||
[
|
||||
cmEditor.getValue().trim(),
|
||||
fr.result.trim()
|
||||
].join('\n').trim()
|
||||
);
|
||||
};
|
||||
fr.readAsText(file);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue