Skip to content

Commit 43cf0b9

Browse files
fix issue with rockpagebuilder
1 parent 3dd54a4 commit 43cf0b9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

InputfieldRockColorPicker.module.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function getModuleInfo()
1414
{
1515
return [
1616
'title' => 'RockColorPicker Inputfield',
17-
'version' => '1.0.0',
17+
'version' => '1.0.1',
1818
'summary' => 'Module to choose a color from a palette',
1919
'icon' => 'paint-brush',
2020
'requires' => [
@@ -25,7 +25,9 @@ public static function getModuleInfo()
2525

2626
public function colors()
2727
{
28-
return $this->master()->colors()->get($this->name);
28+
$name = $this->name;
29+
if ($i = strpos($name, "_repeater")) $name = substr($name, 0, $i);
30+
return $this->master()->colors()->get($name);
2931
}
3032

3133
public function master(): RockColorPicker
@@ -39,12 +41,16 @@ public function master(): RockColorPicker
3941
*/
4042
public function ___render()
4143
{
42-
$this->master()->loadAssets();
4344
$val = $this->value;
4445
if ($val instanceof WireData) $val = $val->name;
4546
return $this->wire->files->render(
4647
__DIR__ . "/InputfieldMarkup.php",
4748
['f' => $this, 'value' => $val]
4849
);
4950
}
51+
52+
public function renderReady(Inputfield $parent = null, $renderValueMode = false)
53+
{
54+
$this->master()->loadAssets();
55+
}
5056
}

RockColorPicker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ $(document).on("click", ".InputfieldRockColorPicker svg", function () {
1717
util.addClass(el, "selected");
1818
util.attr(input, "value", util.data(el, "col"));
1919
}
20+
$(input).change(); // trigger change event (important for rockpagebuilder)
2021
});
2122
$(document).bind("keypress", function (e) {
2223
// support space+enter to change color

0 commit comments

Comments
 (0)