1 回答
TA贡献1789条经验 获得超10个赞
我找到了我的意思的解决方案。
@{
Layout = null;
}
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]-->
<!DOCTYPE html>
<html>
<head>
<!--head is as past and jquery added-->
//previous repeated code collapsed for brevity
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
</head>
<body class="geEditor">
<script type="text/javascript">
// Extends EditorUi to update I/O action states based on availability of backend
(function () {
var editorUiInit = EditorUi.prototype.init;
EditorUi.prototype.init = function () {
editorUiInit.apply(this, arguments);
this.actions.get('export').setEnabled(false);
//previous repeated code collapsed for brevity
this.editor.setFilename('doc1.xml');
//save editorUi object
var editorUI = this;
//this part shal be inserted
//override EditorUi.saveFile function for customization
this.save = saveXml;
function saveXml() {
if (editorUI.editor.graph.isEditing()) {
editorUI.editor.graph.stopEditing();
}
var xml = mxUtils.getXml(editorUI.editor.getGraphXml());
//xml = encodeURIComponent(xml);
if (xml.length < MAX_REQUEST_SIZE) {
$.ajax({
type: "POST",
url: "home/save",
processData: false,
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ 'xml': xml }),
success: function (response) {
//alert(response.message);
},
error: function (ex) {
alert(ex.message);
}
});
}
else {
mxUtils.alert(mxResources.get('drawingTooLarge'));
mxUtils.popup(xml);
return;
}
};
//reset onload open function
this.open = defaultOpen;
function defaultOpen() {};
};
})();
</script>
</body>
</html>
- 1 回答
- 0 关注
- 98 浏览
添加回答
举报