vesh-cli
Version:
码农村nodejs版本VESH框架脚手架搭建器
146 lines (144 loc) • 6.33 kB
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;
margin-right: 10px;
}
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;
}
textarea
{
background-color: #fff;
border: 1px solid #c8cacc;
border-radius: 5px;
box-shadow: 1px 2px 5px #ebeaea inset;
padding: 5px;
width: 84%;
height: 200px;
display: inline-block;
resize: none;
vertical-align: bottom;
margin: 11px 0 0 8px;
}
</style>
</head>
<body>
<div>
<form id='frmInput' _>
<textbox id="id" _="key:'控件ID:'"></textbox>
<select id="selGloble" _="">
</select>
<br />
<textarea id="def" placehold="默认值" _="key:'默认值:',title:'默认值',cols:120,rows:20,fixed:true"></textarea>
</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 }); } }
}]
},
textarea: { path: '../../../module/part/textarea.js', params: [{ middler: true }, '', {
onError: function (D, I) { D.error = V.format(D.error, { key: D.key }); I.update({ value: D.error, addclass: 'p_error' }); },
onClick: function (D, I) { I.update({ removeClass: 'p_error' }); if (D.isError) I.update({ value: false, isError: false }); }
}]
}
}
}
});
V.isDebug = true;
V.inherit.apply(_, [M.Page, [cm, {
id: { data: { validate: { isRequired: '请输入控件ID'} }, onKeyPress: function (D, I) {
this.selGloble.update({ value: '' });
}
},
def: { data: { validate1: { isRequired: '请输入默认值'}} },
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"), '{}') + ')'));
val.def = V.decHtml(val.def);
V.callEvent('inputtext.initData', [val]);
dialog.onok = function () {
_this.frmInput.update({ valid: function () {
var val = _this.frmInput.get().value;
val.cols = 10; val.rows = 10;
val.def = V.encHtml(val.def);
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>