bgunnarsson / BG-Icon-Picker

Icon picker for Umbraco v7 and v8
4 stars 4 forks source link

First icon gets skipped #24

Closed snoek8 closed 3 years ago

snoek8 commented 4 years ago

Inside the while loop in bgPicker.dialog.controller.js you get the next match before the first one is added to the array so the first one gets skipped. You can easily fix it changing it to this:

`if (hasMatches) { var match = styleRegex.exec(response.data);

            while (match !== null) {
                // check if match has populated array
                if (match !== null && match.length > 1) {
                    //c heck if array already contains match and not on exclude list
                    if (!(matches.indexOf(match[1]) > 0)) {
                        matches.push(match[1]);
                        hasMatches = true;
                    }
                }

        match = styleRegex.exec(response.data);
            }
        }`
imoshep commented 3 years ago

Hi, this is still here (on version 1.0.1). I reached the same conclusion on the fix.