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

Format component.

Fix bug with DOM children hooked update.
parent e4732f08
...@@ -248,8 +248,8 @@ NS.apply = function(a,b) { ...@@ -248,8 +248,8 @@ NS.apply = function(a,b) {
if( type !== 'object' ){ if( type !== 'object' ){
// TODO : add hook // TODO : add hook
if( type === 'function' ){ if( type === 'function' ){
//var tmp = D.Text();//( {cls: 'zero-wrapper'} ); var tmp = D.Text('');//( {cls: 'zero-wrapper'} );
//el.appendChild( tmp ); el.appendChild( tmp );
var list = []; var list = [];
subEl( function(){ subEl( function(){
...@@ -259,7 +259,7 @@ NS.apply = function(a,b) { ...@@ -259,7 +259,7 @@ NS.apply = function(a,b) {
var fragment = document.createDocumentFragment(); var fragment = document.createDocumentFragment();
D.appendChild( fragment, [].slice.call( arguments ) ); D.appendChild( fragment, [].slice.call( arguments ) );
list = [].slice.call(fragment.childNodes); list = [].slice.call(fragment.childNodes);
el.appendChild(fragment); el.insertBefore(fragment, tmp);
} ) } )
}else if( subEl !== void 0 && subEl !== false && subEl !== null ){ }else if( subEl !== void 0 && subEl !== false && subEl !== null ){
el.appendChild( D.Text( subEl ) ); el.appendChild( D.Text( subEl ) );
......
var textCache = {}; var textCache = {};
String.Typography = function(text, cfg) { String.Typography = function(text, cfg) {
const {html} = cfg; const {html} = cfg || {};
if(typeof text !== 'string') if(typeof text !== 'string')
return text; return text;
...@@ -169,3 +169,4 @@ String.Search = function(string, search) { ...@@ -169,3 +169,4 @@ String.Search = function(string, search) {
return yep; return yep;
}; };
export const Typography = String.Typography;
\ No newline at end of file
...@@ -19,12 +19,15 @@ export default D.declare('view.block.Header', () => { ...@@ -19,12 +19,15 @@ export default D.declare('view.block.Header', () => {
</button> </button>
<div cls={D.cls({'hidden': tempPageMenuHidden})}>{ <div cls={D.cls({'hidden': tempPageMenuHidden})}>{
Object.keys(Page).map(name=> Object.keys(Page)
<button class="temp-button" type={'button'} onClick={() => store.set('navigation.current', name)}>{name}</button> .map( name =>
<button class="temp-button" type={'button'} onClick={() => store.set('navigation.current', name)}>
{name}
</button>
) )
}</div> }</div>
</div> </div>
<IF condition={NOT(store.valEqual( 'navigation.current', 'login'))}> <IF condition={NOT(store.valEqual( 'navigation.current', 'Login'))}>
<div className="page-header__wrapper"> <div className="page-header__wrapper">
<a href="#" class="page-header__logo" aria-label={"Логотип ВкусВилл"}> <a href="#" class="page-header__logo" aria-label={"Логотип ВкусВилл"}>
<Logo width="116" height="41"/> <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
import './accountPage.scss'; import './accountPage.scss';
import User from "/svg/user.svg"; import User from "/svg/user.svg";
import Rating from '../../block/ratingBlock/Rating.jsx'; import Rating from '../../block/ratingBlock/Rating.jsx';
import Format from "../../cmp/format/Format";
const Account = D.declare('view.page.Account', () => { const Account = D.declare('view.page.Account', () => {
return <div class="account-page"> return <div class="account-page">
...@@ -26,6 +27,7 @@ const Account = D.declare('view.page.Account', () => { ...@@ -26,6 +27,7 @@ const Account = D.declare('view.page.Account', () => {
</div> </div>
<div class="account-page__content"> <div class="account-page__content">
<div class="account-page__content-inner"> <div class="account-page__content-inner">
<Format html={true}>
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
...@@ -68,6 +70,7 @@ const Account = D.declare('view.page.Account', () => { ...@@ -68,6 +70,7 @@ const Account = D.declare('view.page.Account', () => {
lists lists
Start with 'Lorem Start with 'Lorem
ipsum dolor sit amet...' ipsum dolor sit amet...'
</Format>
</div> </div>
</div> </div>
</div> </div>
......
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