You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught TypeError: Cannot read property 'match' of undefined
at isRgb (?editor_console=true:1447)
at init (?editor_console=true:789)
at HTMLInputElement.<anonymous> (?editor_console=true:693)
at Function.each (VM229 jquery-2.1.0.js:381)
at jQuery.fn.init.each (VM229 jquery-2.1.0.js:137)
at jQuery.fn.init.minicolors (?editor_console=true:692)
at HTMLInputElement.<anonymous> (?editor_console=true:656)
at Function.each (VM229 jquery-2.1.0.js:381)
at jQuery.fn.init.each (VM229 jquery-2.1.0.js:137)
at jQuery.fn.init.minicolors (?editor_console=true:653)
The problem occurs since Minicolors converts the swatch color strings to RGB objects. When settings are updated, a deep merge is performed. When the passed swatches array is shorter, only the first items are overwritten resulting in an array with mixes strings and RGB objects. The conversion from strings to RGB object is then performed again and fails when it encounters the left over RGB object.
Minicolors can not handle when settings are updated with a shorter
array of swatches than initially passed (see
claviska/jquery-minicolors#287).
Minicolors converts the swatch strings to object and stores the
converted settings. When settings are updated, the new settings and
the old are deeply merged. If the new settings contain less swatch
colors, merging in the old settings adds a bunch of items to the
swatches array that have already been converted to objects. When
Minicolor proceeds to process the settings then, it cannot handle the
already converted items in the swatches array.
Minicolors stores its settings via `jQuery#data`. So before updating
the settings, we now remove the `swatches` property from the stored
settings. This way the settings object resulting from the deep merge
will only contan the new swatch color values.
REDMINE-17994
When creating an instance with swatches
updating it with a shorter array of swatches
causes an exception of the form:
The problem occurs since Minicolors converts the swatch color strings to RGB objects. When settings are updated, a deep merge is performed. When the passed
swatches
array is shorter, only the first items are overwritten resulting in an array with mixes strings and RGB objects. The conversion from strings to RGB object is then performed again and fails when it encounters the left over RGB object.Reproduction case using version 2.3.5:
https://jsfiddle.net/majuckvn/5/
The text was updated successfully, but these errors were encountered: