allow to set <overlay legacy="true"> to disable new web-components for the whole xet-file

also disable (not working) r/w et2-select web-component again
This commit is contained in:
Ralf Becker 2022-01-20 22:09:48 +02:00
parent d02afcbe54
commit 7e4bdece84
3 changed files with 7 additions and 5 deletions

View File

@ -59,7 +59,9 @@ function send_template()
$cache_read = microtime(true);
}
else*/
if(($str = file_get_contents($path)) !== false)
if(($str = file_get_contents($path)) !== false &&
// eTemplate marked as legacy, return unchanged template without web-components / et2-prefix
!preg_match('/<overlay[^>]* legacy="true"/', $str))
{
// fix <menulist...><menupopup type="select-*"/></menulist> --> <select type="select-*" .../>
$str = preg_replace('#<menulist([^>]*)>[\r\n\s]*<menupopup([^>]+>)[\r\n\s]*</menulist>#', '<select$1$2', $str);
@ -85,9 +87,9 @@ function send_template()
// add et2-prefix for <select-* or <date-* readonly="true"
if (($matches[1] === 'select' || in_array($matches[1].$matches[2], ['date','date-time'])) &&
isset($attrs['readonly']) && !in_array($attrs['readonly'], ['false', '0']) ||
isset($attrs['readonly']) && !in_array($attrs['readonly'], ['false', '0']) /*||
// also add it for untyped/simple <select without search or tags attribute
$matches[1] === 'select' && empty($matches[2]) && !isset($attrs['type']) && !isset($attrs['search']) && !isset($attrs['tags']))
$matches[1] === 'select' && empty($matches[2]) && !isset($attrs['type']) && !isset($attrs['search']) && !isset($attrs['tags'])*/)
{
return '<et2-'.$matches[1].$matches[2].' '.$matches[3].'></et2-'.$matches[1].$matches[2].'>';
}

View File

@ -162,7 +162,7 @@ export class et2_box extends et2_baseWidget implements et2_IDetachedDOM
}
}
et2_register_widget(et2_box, ["old-vbox", "old-box"]);
et2_register_widget(et2_box, ["vbox", "box", "old-vbox", "old-box"]);
/**
* Details widget implementation

View File

@ -199,6 +199,6 @@ export class et2_hbox extends et2_baseWidget
}
}
}
et2_register_widget(et2_hbox, ["old-hbox"]);
et2_register_widget(et2_hbox, ["hbox", "old-hbox"]);