Commit 2682f572 by Иван Кубота

Format component.

Fix bug with DOM children hooked update.
parent e4732f08
......@@ -248,8 +248,8 @@ NS.apply = function(a,b) {
if( type !== 'object' ){
// TODO : add hook
if( type === 'function' ){
//var tmp = D.Text();//( {cls: 'zero-wrapper'} );
//el.appendChild( tmp );
var tmp = D.Text('');//( {cls: 'zero-wrapper'} );
el.appendChild( tmp );
var list = [];
subEl( function(){
......@@ -259,7 +259,7 @@ NS.apply = function(a,b) {
var fragment = document.createDocumentFragment();
D.appendChild( fragment, [].slice.call( arguments ) );
list = [].slice.call(fragment.childNodes);
el.appendChild(fragment);
el.insertBefore(fragment, tmp);
} )
}else if( subEl !== void 0 && subEl !== false && subEl !== null ){
el.appendChild( D.Text( subEl ) );
......
var textCache = {};
String.Typography = function(text, cfg) {
const {html} = cfg;
const {html} = cfg || {};
if(typeof text !== 'string')
return text;
......@@ -168,4 +168,5 @@ String.Search = function(string, search) {
}
return yep;
};
\ No newline at end of file
};
export const Typography = String.Typography;
\ No newline at end of file
......@@ -19,12 +19,15 @@ export default D.declare('view.block.Header', () => {
</button>
<div cls={D.cls({'hidden': tempPageMenuHidden})}>{
Object.keys(Page).map(name=>
<button class="temp-button" type={'button'} onClick={() => store.set('navigation.current', name)}>{name}</button>
)
Object.keys(Page)
.map( name =>
<button class="temp-button" type={'button'} onClick={() => store.set('navigation.current', name)}>
{name}
</button>
)
}</div>
</div>
<IF condition={NOT(store.valEqual( 'navigation.current', 'login'))}>
<IF condition={NOT(store.valEqual( 'navigation.current', 'Login'))}>
<div className="page-header__wrapper">
<a href="#" class="page-header__logo" aria-label={"Логотип ВкусВилл"}>
<Logo width="116" height="41"/>
......
import { Typography } from "../../../text/String.Typography";
const Format = D.declare( 'view.cmp.Format', (cfg, children) => {
const html = Typography(children.join(' '), {html: cfg.html});
const div = <div/>
div.innerHTML = html;
return <>
{[...div.childNodes]}
</>
} );
export default Format;
export { Format };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment