Fix handling of modified widget type.

It wasn't working if a Transform changed the widget type to a webcomponent
This commit is contained in:
nathan 2022-07-08 09:24:03 -06:00
parent a80d810926
commit ff6d0ef785
2 changed files with 4 additions and 4 deletions

View File

@ -239,7 +239,7 @@ function send_template()
preg_match_all('/(^|\s)([a-z0-9_-]+)="([^"]*)"/i', $matches[4], $attrs, PREG_PATTERN_ORDER); preg_match_all('/(^|\s)([a-z0-9_-]+)="([^"]*)"/i', $matches[4], $attrs, PREG_PATTERN_ORDER);
$attrs = array_combine($attrs[2], $attrs[3]); $attrs = array_combine($attrs[2], $attrs[3]);
if(!$matches[2] || in_array($matches[2], ['sort'])) if(!$matches[2] || in_array($matches[2], ['sort']) || ($matches[2] == "custom" && !$attrs['widget_type']))
{ {
return $matches[0]; return $matches[0];
} }

View File

@ -796,7 +796,7 @@ export class et2_widget extends ClassWithAttributes
// Get the constructor - if the widget is readonly, use the special "_ro" // Get the constructor - if the widget is readonly, use the special "_ro"
// constructor if it is available // constructor if it is available
if (typeof et2_registry[_nodeName] === "undefined") if(typeof et2_registry[_nodeName] === "undefined" && typeof window.customElements.get(_nodeName) == "undefined")
{ {
_nodeName = 'placeholder'; _nodeName = 'placeholder';
} }
@ -806,9 +806,9 @@ export class et2_widget extends ClassWithAttributes
constructor = et2_registry[_nodeName + "_ro"]; constructor = et2_registry[_nodeName + "_ro"];
} }
if(typeof window.customElements.get(_node.nodeName.toLowerCase()) !== "undefined") if(typeof window.customElements.get(_nodeName) !== "undefined")
{ {
widget = loadWebComponent(_node.nodeName.toLowerCase(), _node, this); widget = loadWebComponent(_nodeName, _node, this);
} }
else else
{ {