ciyon_ai/web/docs/edit.html
2026-04-15 17:28:46 +08:00

76 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>文档编辑</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
</head>
<body>
<div class="ciy-caption sti top0" id="id_name" style="z-index: 1;"></div>
<div class="char4 row px4 py4">
<div class="col-24">
<ciy-markdown com="content" imgwidth="1000" />
</div>
</div>
<div style="height:3rem;"></div>
<div class="fix bottom1 right1">
<button type="button" class="btn def" onclick="edit()">更新(Ctrl+S)</button>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript" src="/jscss/ciycmp.js"></script>
<script type="text/javascript" src="/jscss/ciycmp2.js"></script>
<script type="text/javascript" src="/jscss/ciytable.js"></script>
<script type="text/javascript" src="./common.js"></script>
<script type="text/javascript">
'use strict';
var Glob = {};
ciyfn.pageload(function () {
ciyfn.callfunc('init', {}, function (json) {
document.title = json.data.name;
$5('#id_name').text(json.data.name);
Glob.edit = json.data;
ciyfn.ajax({
url: '/ud/docs/' + json.data.id + '_' + json.data.uptimes + '.txt', method: 'GET', success: txt => {
ciycmp({ dom: $5('[com=content]'), width: 'pc', path: '{Y}/{m}{d}/docs', value: txt, onchange:chgmd});
}, fail: () => {
ciycmp({ dom: $5('[com=content]'), width: 'pc', path: '{Y}/{m}{d}/docs', value: '', onchange:chgmd });
}
});
// }
// , btns: ["提交", "*关闭"]
// , cb: function (opn) {
// if (opn.btn == "关闭")
// return opn.close();
// opn.inputs.id = id;
// opn.inputs.pant = $5('[name=pant]').val();
// if (ciyfn.throttle(opn.dombtn)) return;
// }
// });
});
$5(document).on('keydown', function (e) {
if (e.ctrlKey && e.keyCode == 83) {//Ctrl+S
e.preventDefault();
edit();
}
});
});
function chgmd() {
$5('button').removeClass('def');
}
function edit() {
var postparam = ciyfn.getform(document);
postparam.id = Glob.edit.id;
ciyfn.callfunc('uptxt', postparam, function (json) {
Glob.edit.uptimes = json.uptimes;
$5('button').addClass('def');
});
}
</script>
</body>
</html>