colorpicker hotkey popup: find colors in attributes

This commit is contained in:
tophf 2018-01-07 12:51:22 +03:00
parent 825fd00a80
commit 5941dd4338

View File

@ -40,11 +40,11 @@
!CSS.supports('color', 'hsl(1turn, 2%, 3%)') && /deg|g?rad|turn/, !CSS.supports('color', 'hsl(1turn, 2%, 3%)') && /deg|g?rad|turn/,
].filter(Boolean).map(rx => rx.source).join('|') || '^$', 'i'), ].filter(Boolean).map(rx => rx.source).join('|') || '^$', 'i'),
}; };
const RX_DETECT = new RegExp('(^|[\\s():,/])' + const RX_DETECT = new RegExp('(^|[\\s(){}[\\]:,/"=])' +
'(' + '(' +
RX_COLOR.hex.source + '|' + RX_COLOR.hex.source + '|' +
'(?:rgb|hsl)a?(?=\\()|(?:' + [...colorConverter.NAMED_COLORS.keys()].join('|') + ')' + '(?:rgb|hsl)a?(?=\\()|(?:' + [...colorConverter.NAMED_COLORS.keys()].join('|') + ')' +
'(?=[\\s;()/]|$)' + '(?=[\\s;(){}[\\]/"]|$)' +
')', 'gi'); ')', 'gi');
const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy; const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy;