1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 01:59:38 +02:00

Fix hint helper in element picker's text editor

Regression from:
- 262a1a044f
This commit is contained in:
Raymond Hill 2020-12-03 07:34:50 -05:00
parent 210ec6b1aa
commit 1de8349045
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 7 additions and 6 deletions

View File

@ -61,12 +61,11 @@ let cachedUserFilters = '';
const responseHandler = function(response) {
if ( response instanceof Object === false ) { return; }
if ( response.hintUpdateToken !== undefined ) {
const firstVisit = hintUpdateToken === 0;
const mode = cmEditor.getMode();
if ( mode.setHints instanceof Function ) {
mode.setHints(response, firstVisit);
mode.setHints(response);
}
if ( firstVisit ) {
if ( hintUpdateToken === 0 ) {
mode.parser.expertMode = response.expertMode !== false;
}
hintUpdateToken = response.hintUpdateToken;

View File

@ -66,7 +66,7 @@
if ( hints instanceof Object ) {
const mode = cmEditor.getMode();
if ( mode.setHints instanceof Function ) {
mode.setHints(hints, true);
mode.setHints(hints);
}
}

View File

@ -35,6 +35,7 @@ const scriptletNames = new Map();
const preparseDirectiveTokens = new Map();
const preparseDirectiveHints = [];
const originHints = [];
let hintHelperRegistered = false;
/******************************************************************************/
@ -361,7 +362,7 @@ CodeMirror.defineMode('ubo-static-filtering', function() {
style = style.trim();
return style !== '' ? style : null;
},
setHints: function(details, firstVisit = false) {
setHints: function(details) {
if ( Array.isArray(details.redirectResources) ) {
for ( const [ name, desc ] of details.redirectResources ) {
const displayText = desc.aliasOf !== ''
@ -389,7 +390,8 @@ CodeMirror.defineMode('ubo-static-filtering', function() {
originHints.push(hint);
}
}
if ( firstVisit ) {
if ( hintHelperRegistered === false ) {
hintHelperRegistered = true;
initHints();
}
},