mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Fix spurious filter conversion when pasting in editor
This commit is contained in:
parent
891b750de2
commit
6b7f929ec5
1 changed files with 5 additions and 1 deletions
|
|
@ -448,9 +448,13 @@ function parseNetworkFilter(parser) {
|
|||
/******************************************************************************/
|
||||
|
||||
export function parseFilters(text) {
|
||||
if ( text.startsWith('---') ) { return; }
|
||||
if ( text.endsWith('---') ) { return; }
|
||||
const lines = text.split(/\n/);
|
||||
if ( lines.some(a => a.startsWith(' ')) ) { return; }
|
||||
const rules = [];
|
||||
const parser = new sfp.AstFilterParser({ trustedSource: true });
|
||||
for ( const line of text.split(/\n/) ) {
|
||||
for ( const line of lines ) {
|
||||
parser.parse(line);
|
||||
if ( parser.isNetworkFilter() === false ) { continue; }
|
||||
const rule = parseNetworkFilter(parser);
|
||||
|
|
|
|||
Loading…
Reference in a new issue