Files
zszq-trs/YLErpWeb/Views/Ueditor/Config.cshtml
T
2025-05-19 15:44:20 +08:00

66 lines
2.1 KiB
Plaintext

@{ var id = ViewData["id"];}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>配置</title>
<link href="~/Statics/libs/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<style>
html, body { min-height: 100%; }
.btn { min-width: 70px; }
</style>
</head>
<body>
<div class="p-2" id="container">
<script id="ueContainer" type="text/plain">
</script>
<div class="mt-4 text-center">
<button type="button" class="btn btn-primary" onclick="saveCont()">保存</button>
<button type="button" class="btn btn-secondary" onclick="closeMe()">关闭</button>
</div>
</div>
<script src="~/Statics/libs/jquery/jquery-3.5.1.min.js?v=@(HtmlUtil.JsVersion)"></script>
<script src="~/Scripts/ueditor/ueditor.config.js?v=@(HtmlUtil.JsVersion)"></script>
<script src="~/Scripts/ueditor/ueditor.all.min.js?v=@(HtmlUtil.JsVersion)"></script>
<script>
$(function () {
UE.delEditor('ueContainer');
setUeditor(1);
});
function setUeditor(seq) {
var height = $(window).height();
if (height < 10 && seq < 10) {
setTimeout(function () { setUeditor(seq + 1); }, 100);
return;
}
var ue = UE.getEditor('ueContainer', {
autoHeight: false,
wordCount: false,
autoHeightEnabled: false,
initialFrameHeight: height - 200
});
}
function saveCont() {
if (typeof parent.saveUeditorConfig === 'function') {
parent.saveUeditorConfig('@id', UE.getEditor('ueContainer').getContent() || '');
closeMe();
} else {
alert('缺少parent.saveUeditorConfig函数');
}
}
function closeMe() {
if (typeof parent.closeUeditorConfig === 'function') {
parent.closeUeditorConfig();
} else {
alert('缺少parent.closeUeditorConfig函数');
}
}
</script>
</body>
</html>