UNPKG

vesh-vj

Version:

VESH's JavaScript Framework

114 lines 3.51 kB
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>ueditor图片对话框</title> <script type="text/javascript" src="../internal.js"></script> <script src="../../jquery-1.8.0.min.js" type="text/javascript"></script> <script src="../../../VJ.js" type="text/javascript"></script> <script src="config.js" type="text/javascript"></script> <script src="../../../GlobalVer.js" type="text/javascript"></script> <script src="../../../ni/ni.js" type="text/javascript"></script> <!-- image dialog --> <style> div { height: 4rem; line-height: 2rem; font-family: 微软雅黑; font-size: 1rem; margin: 10px; } span span{ width: 70px; text-align: right; display: inline-block; } input { box-shadow: 0.5px 0.1px #eee; height: 1.4rem; margin-left: 0.5rem; border-radius: 5px; } select { width: 100px; min-width: 100px; height: 1.4rem; margin-left:20px; } </style> </head> <body> <div> <form id='frmInput' _> <textbox id="id" _="key:'控件ID:'"></textbox><select id="selGloble" _=""></select> <br/> <textbox id="cols" _="key:'宽度:'"></textbox><br/> <textbox id="rows" _="key:'高度:'"></textbox> </form> </div> <script type="text/javascript"> (function(V,M,$,cm,W){ new function(){ var _=this,__={}; { cm = V.merge(cm,{ Middler:{ 'VESH.view':{ textbox:{params:[ '',{ onError:function(D,I){I.update({value:D.error});}, onFocus:function(D,I){if(D.isError){I.update({value:false});}} }] } } } }); V.isDebug = true; V.inherit.apply(_,[M.Page,[cm,{ id:{data:{validate:{isRequired:'请输入控件ID'}},onKeyPress:function(D,I){ this.selGloble.update({value:''}); }}, cols:{data:{value:'10',validate:{isRequired:'请输入一个正整数',isInt:'请输入一个正整数'}}}, rows:{data:{value:'10',validate:{isRequired:'请输入一个正整数',isInt:'请输入一个正整数'}}}, selGloble:{data:{values:V.merge({'可选全局ID':''},window.top.GlobalVer)},onChange:function(D,I){ this.id.update({value:D.value}); }}, frmInput:{ onLoad:function(D,I){V.registEvent('inputtext.initData',function(val){I.update({value:val})});} }, page:{ data:{ title:'输入框' }, onLoad:function(D,I){ var _this = this; var img = editor.selection.getRange().getClosedNode(); //获取对应节点 var val = V.merge({ id:img.getAttribute("id"), type:img.getAttribute("_type") },eval('('+V.getValue(img.getAttribute("_data"),'{}')+')')); V.callEvent('inputtext.initData', [val]); dialog.onok = function () { _this.frmInput.update({valid:function(){ var val = _this.frmInput.get().value; val.data = V.toJsonString(val); //替换html editor.execCommand('inserthtml', V.format("<img src='" + editor.options.UEDITOR_HOME_URL + "dialogs/input/inputtextarea.png' id='{id}' _type='textarea' _data='{data}'/>", val)); editor.selection.clearRange(); dialog.close(false); }}); return false; }; dialog.oncancel = function(){ //必须为空 否则会循环close }; } } }]]); } }; })(VJ,VJ.viewmodel,jQuery,window.config,VJ.view); </script> </body> </html>