

let param=$M.param()
let domGlobal=$M.find(param.id)
let style=$M.style(dom)


setTimeout
(
    ()=>
    {
        $M.find('#pre').listener
        (
            'tap',(event)=>
            {
                let dom=domGlobal.parentNode
        
                let main=dom.getAttribute('main')
                if(main!==null)
                {
                    alert('父元素不可用')
                    return
                }
                $Seo.temp(dom)
            }
        )

        $M.find('#par').listener
        (
            'tap',(event)=>
            {
                let dom=domGlobal.parentNode
        
                let main=dom.getAttribute('main')
                if(main!==null)
                {
                    alert('父元素不可用')
                    return
                }
        
                $Seo.temp(dom)
                let query=new $Seo.getSelect(dom)
                $Route.push('layout@content@slideDetail@com',{id:query.querys})
            }
        )

        $M.find('#del').listener
        (
            'tap',(event)=>
            {
                let dom=domGlobal.parentNode
                let main=dom.getAttribute('main')
                if(main!==null)
                {
                    alert('父元素不可用')
                    return
                }
                $M.removeChild(domGlobal)
        
                $Seo.temp(dom)
                let query=new $Seo.getSelect(dom)
                $Route.push('layout@content@slideDetail@com',{id:query.querys})
                
            }
        )

        $M.find('#dar').listener
        (
            'tap',(event,dom)=>
            {

                $Draw.swap
                (
                    dom,
                    '启用拖动','禁止拖动',
                    ()=>
                    {
                        $Drag.able(domGlobal)
                        $Drag.copy(domGlobal,'1')
                    },
                    ()=>
                    {
                        $Drag.unAble(domGlobal)
                    }
                )
            }
        )


        $M.find('#ent').listener
        (
            'tap',(event,dom)=>
            {

                $Draw.swap
                (
                    dom,
                    '允许进入','禁止进入',
                    ()=>
                    {
                        $Drag.dragGoal(domGlobal)
                    },
                    ()=>
                    {
                        $Drag.unDragGoal(domGlobal)
                    }
                )
            }
        )


        $M.find('#eni').listener
        (
            'tap',(event,dom)=>
            {

                $Draw.swap
                (
                    dom,
                    '允许插入','禁止插入',
                    ()=>
                    {
                        domGlobal.setAttribute('contentEditable','true')
                        domGlobal.contentEditable=true
                    },
                    ()=>
                    {
                        domGlobal.removeAttribute('contentEditable')
                        domGlobal.contentEditable=false
                    }
                )
            }
        )
    },1500
)



let obj={
    常用:{
        '显示':{
            type:2,
            name:'display',
            list:[
                'flex',
                'block',
                'inline',
                'inline-block'
            ]
        },
        '背景':{
            type:1,
            name:'background-color',
        }
        ,'颜色':{
            type:1,
            name:'color',
        }
        ,'字号':{
            type:1,
            name:'font-size',
        }
        ,'字体':{
            type:2,
            name:'font-family',
            list:[
                'sans-serif',
                'Microsoft YaHei',
                'MingLiu'
            ]
        }
        ,'对齐':{
            type:2,
            name:'text-align',
            list:[
                'center',
                'start',
                'end'
            ]
        }
        ,'宽度':{
            type:1,
            name:'width',
        }
        ,'高度':{
            type:1,
            name:'height',
        }
        ,'内边距':{
            type:1,
            name:'padding',
        }
        ,'外边距':{
            type:1,
            name:'margin',
        }
    }
    ,flex:{
        'flexs-轴方向':{
            type:2,
            name:'flex-direction',
            list:[
                'row',
                'row-reverse',
                'column',
                'column-reverse'
            ]
        }
        ,'flexs-轴换行':{
            type:2,
            name:'flex-wrap',
            list:[
                'nowrap',
                'wrap',
                'wrap-reverse'
            ]
        }
        ,'flexs-轴对齐':{
            type:2,
            name:'justify-content',
            list:[
                'flex-start',
                'flex-end',
                'center',
                'space-between',
                'space-around'
            ]
        }
        ,'flexs-交叉轴对齐':{
            type:2,
            name:'align-items',
            list:[
                'flex-start',
                'flex-end',
                'center',
                'baseline',
                'stretch'
            ]
        }
        ,'flexs-多轴线对齐':{
            type:2,
            name:'align-items',
            list:[
                'flex-start',
                'flex-end',
                'center',
                'space-between',
                'space-around',
                'stretch'
            ]
        }
        ,'flex-项目序号':{
            type:1,
            name:'order',
        }
        ,'flex-项目空间空余放大比':{
            type:1,
            name:'flex-grow',
        }
        ,'flex-项目空间不足缩小比':{
            type:1,
            name:'flex-shrink',
        }
        ,'flex-项目交叉轴对齐':{
            type:2,
            name:'align-self',
            list:[
                'flex-start',
                'flex-end',
                'center',
                'baseline',
                'stretch'
            ]
        }
    }
}


for (const key in obj) 
{
    let curPar=obj[key]

    for (const key in curPar) 
    {
        let cur=curPar[key]
        if(style[cur.name])
        {
            cur.value=style[cur.name]
        }
        else
        {
            cur.value=''
        }
    }
    
}


let renderObj={
    curr:{
        tag:domGlobal.tagName
        ,attr:$Edit.getAttr(domGlobal.attributes)
    }
    ,par:{
        tag:domGlobal.parentNode.tagName
        ,attr:$Edit.getAttr(domGlobal.parentNode.attributes)
    }
    ,cur:param.id
    ,obj
}


$M.dispatch('html','slide-detail-index-update',{param:renderObj,type:'com'})

