|
@@ -0,0 +1,39 @@
|
|
|
|
+// 运行在 mxgraph-editor 内部的 fix.js
|
|
|
|
+// 用于和 WhLayoutDesign.js 组件打配合
|
|
|
|
+
|
|
|
|
+// window.designer 代表 whLayoutDesign 对象
|
|
|
|
+// window.editorInitFn 是 whLayoutDesign 的回调对象
|
|
|
|
+(function () {
|
|
|
|
+ var editorUiInit = EditorUi.prototype.init;
|
|
|
|
+ var editorInitFn = window['editorInitFn']
|
|
|
|
+
|
|
|
|
+ EditorUi.prototype.init = function () {
|
|
|
|
+ editorUiInit.apply(this, arguments);
|
|
|
|
+ if (typeof editorInitFn === 'function') {
|
|
|
|
+ editorInitFn(this)
|
|
|
|
+ } else {
|
|
|
|
+ alert('无法找到 editorInitFn')
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // Adds required resources (disables loading of fallback properties, this can only
|
|
|
|
+ // be used if we know that all keys are defined in the language specific file)
|
|
|
|
+ mxResources.loadDefaultBundle = false;
|
|
|
|
+ var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
|
|
|
|
+ mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
|
|
|
|
+
|
|
|
|
+ // Fixes possible asynchronous requests
|
|
|
|
+ mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
|
|
|
|
+ // Adds bundle text to resources
|
|
|
|
+ mxResources.parse(xhr[0].getText());
|
|
|
|
+
|
|
|
|
+ // Configures the default graph theme
|
|
|
|
+ var themes = new Object();
|
|
|
|
+ themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
|
|
|
|
+
|
|
|
|
+ // Main
|
|
|
|
+ new EditorUi(new Editor(urlParams['chrome'] == '0', themes));
|
|
|
|
+ }, function () {
|
|
|
|
+ document.body.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
|
|
|
|
+ });
|
|
|
|
+})();
|