mxgraph在Actions.js中实现文件相关操作
Posted 尔嵘
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mxgraph在Actions.js中实现文件相关操作相关的知识,希望对你有一定的参考价值。
Actions.js相关内容如下,按需修改:
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
/**
* Constructs the actions object for the given UI.
*/
function Actions(editorUi)
this.editorUi = editorUi;
this.actions = new Object();
this.init(); //初始化
;
//下载
function download(filename, text)
var element = document.createElement(\'a\');
element.setAttribute(\'href\', \'data:text/plain;charset=utf-8,\' + encodeURIComponent(text));
element.setAttribute(\'download\', filename);
element.style.display = \'none\';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
/**
* Adds the default actions.
* 添加默认动作
*/
Actions.prototype.init = function()
var ui = this.editorUi;
window.ui = ui;
var editor = ui.editor;
var graph = editor.graph;
var isGraphEnabled = function()
return Action.prototype.isEnabled.apply(this,
以上是关于mxgraph在Actions.js中实现文件相关操作的主要内容,如果未能解决你的问题,请参考以下文章