maxGraph/packages/html/stories/stashed/grapheditor/www/index.html

111 lines
4.0 KiB
HTML
Raw Normal View History

2012-05-21 20:32:26 +00:00
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]-->
<!DOCTYPE html>
<html>
<head>
2013-11-11 12:31:46 +00:00
<title>Grapheditor</title>
2013-09-09 13:25:52 +00:00
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
2012-05-21 20:32:26 +00:00
<link rel="stylesheet" type="text/css" href="styles/grapheditor.css">
<script type="text/javascript">
// Parses URL parameters. Supported parameters are:
// - lang=xy: Specifies the language of the user interface.
// - touch=1: Enables a touch-style user interface.
// - storage=local: Enables HTML5 local storage.
2014-11-28 08:55:09 +00:00
// - chrome=0: Chromeless mode.
2021-03-21 01:24:29 +00:00
let urlParams = (function(url)
2012-05-21 20:32:26 +00:00
{
2021-03-21 01:24:29 +00:00
let result = {};
let idx = url.lastIndexOf('?');
2012-05-21 20:32:26 +00:00
if (idx > 0)
{
2021-03-21 01:24:29 +00:00
let params = url.substring(idx + 1).split('&');
2012-05-21 20:32:26 +00:00
2021-03-21 01:24:29 +00:00
for (let i = 0; i < params.length; i++)
2012-05-21 20:32:26 +00:00
{
idx = params[i].indexOf('=');
if (idx > 0)
{
result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
}
}
}
return result;
})(window.location.href);
2016-07-20 10:42:34 +00:00
// Default resources are included in grapheditor resources
mxLoadResources = false;
2012-05-21 20:32:26 +00:00
</script>
2016-05-09 10:56:11 +00:00
<script type="text/javascript" src="js/Init.js"></script>
2017-11-30 09:21:18 +00:00
<script type="text/javascript" src="deflate/pako.min.js"></script>
<script type="text/javascript" src="deflate/base64.js"></script>
2014-10-03 12:49:36 +00:00
<script type="text/javascript" src="jscolor/jscolor.js"></script>
<script type="text/javascript" src="sanitizer/sanitizer.min.js"></script>
Finish converting core to ts, JSDoc conversion, consistency+convention changes, example bugfixes (#70) * reorganised directories; removed mx prefix * reduced directory hierarchies; removed mx prefix; type fixes * convert remaining javascript to ts * fix/add types * add type defs * type updates; moved codecs to where they're used * reorganise constants into enums+type additions * removed "Function:" and "Variable:" prefixes from comments, as they aren't needed in JSDoc * removed "Function:", "Variable:" and "Class:" prefixes from comments, as they aren't needed in JSDoc * removed "Function:" prefixes from comments, as they aren't needed in JSDoc * minor changes * convert code example blocks to markdown * module casing updates * converted parameter function documentation to JSDoc * documentation+type updates * removed react subdir (for now) * reorganised various `utils` functions into different files * type updates/bugfixes/workarounds * rename Rubberband and CellEditor to be *Handler to match the other plugins * move codec classes to where they're used to reduce cyclic dependencies * move codec classes to where they're used to reduce cyclic dependencies * type updates/reorganize layout file structure * renamed various files for consistency * import fixes * renamed GraphHandler SelectionHander and various fixes * convert EventObject parameters to objects * add basic better-docs config * update better-docs config * bugfix for shared variables in Graph persisting across instances * fixed accessing handlers in examples; renamed Model to GraphModel * fixed accessing handlers in examples; renamed Model to GraphModel * restored selection model * bugfix * renamed getModel to getDataModel * changed to use graph.batchUpdate() to reduce lines of code * changed to use graph.batchUpdate() to reduce lines of code * finished annotations+added TypeDoc * convert remaining Cell[] instances to CellArray * convert NaturalDocs links to JSDoc
2022-01-08 01:49:35 +00:00
<script type="text/javascript" src="../../../src/js/Client.js"></script>
2014-05-15 19:58:36 +00:00
<script type="text/javascript" src="js/EditorUi.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Editor.js"></script>
2014-10-09 13:52:12 +00:00
<script type="text/javascript" src="js/Sidebar.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Graph.js"></script>
2018-02-28 22:01:56 +00:00
<script type="text/javascript" src="js/Format.js"></script>
2012-07-31 14:06:36 +00:00
<script type="text/javascript" src="js/Shapes.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Actions.js"></script>
<script type="text/javascript" src="js/Menus.js"></script>
<script type="text/javascript" src="js/Toolbar.js"></script>
<script type="text/javascript" src="js/Dialogs.js"></script>
</head>
2012-06-14 12:43:20 +00:00
<body class="geEditor">
2012-05-21 20:32:26 +00:00
<script type="text/javascript">
2015-08-28 13:41:48 +00:00
// Extends EditorUi to update I/O action states based on availability of backend
2012-05-21 20:32:26 +00:00
(function()
{
2021-03-21 01:24:29 +00:00
let editorUiInit = EditorUi.prototype.init;
2012-05-21 20:32:26 +00:00
EditorUi.prototype.init = function()
{
editorUiInit.apply(this, arguments);
this.actions.get('export').setEnabled(false);
// Updates action states which require a backend
2016-05-09 10:56:11 +00:00
if (!Editor.useLocalStorage)
2012-05-21 20:32:26 +00:00
{
mxUtils.post(OPEN_URL, '', mxUtils.bind(this, function(req)
{
2021-03-21 01:24:29 +00:00
let enabled = req.getStatus() != 404;
2016-05-09 10:56:11 +00:00
this.actions.get('open').setEnabled(enabled || Graph.fileSupport);
this.actions.get('import').setEnabled(enabled || Graph.fileSupport);
2012-05-21 20:32:26 +00:00
this.actions.get('save').setEnabled(enabled);
this.actions.get('saveAs').setEnabled(enabled);
this.actions.get('export').setEnabled(enabled);
}));
}
};
2016-03-01 09:16:15 +00:00
// 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)
Finish converting core to ts, JSDoc conversion, consistency+convention changes, example bugfixes (#70) * reorganised directories; removed mx prefix * reduced directory hierarchies; removed mx prefix; type fixes * convert remaining javascript to ts * fix/add types * add type defs * type updates; moved codecs to where they're used * reorganise constants into enums+type additions * removed "Function:" and "Variable:" prefixes from comments, as they aren't needed in JSDoc * removed "Function:", "Variable:" and "Class:" prefixes from comments, as they aren't needed in JSDoc * removed "Function:" prefixes from comments, as they aren't needed in JSDoc * minor changes * convert code example blocks to markdown * module casing updates * converted parameter function documentation to JSDoc * documentation+type updates * removed react subdir (for now) * reorganised various `utils` functions into different files * type updates/bugfixes/workarounds * rename Rubberband and CellEditor to be *Handler to match the other plugins * move codec classes to where they're used to reduce cyclic dependencies * move codec classes to where they're used to reduce cyclic dependencies * type updates/reorganize layout file structure * renamed various files for consistency * import fixes * renamed GraphHandler SelectionHander and various fixes * convert EventObject parameters to objects * add basic better-docs config * update better-docs config * bugfix for shared variables in Graph persisting across instances * fixed accessing handlers in examples; renamed Model to GraphModel * fixed accessing handlers in examples; renamed Model to GraphModel * restored selection model * bugfix * renamed getModel to getDataModel * changed to use graph.batchUpdate() to reduce lines of code * changed to use graph.batchUpdate() to reduce lines of code * finished annotations+added TypeDoc * convert remaining Cell[] instances to CellArray * convert NaturalDocs links to JSDoc
2022-01-08 01:49:35 +00:00
Translations.loadDefaultBundle = false;
let bundle = Translations.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
Translations.getSpecialBundle(RESOURCE_BASE, mxLanguage);
2016-03-01 09:16:15 +00:00
// Fixes possible asynchronous requests
mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function(xhr)
{
// Adds bundle text to resources
Finish converting core to ts, JSDoc conversion, consistency+convention changes, example bugfixes (#70) * reorganised directories; removed mx prefix * reduced directory hierarchies; removed mx prefix; type fixes * convert remaining javascript to ts * fix/add types * add type defs * type updates; moved codecs to where they're used * reorganise constants into enums+type additions * removed "Function:" and "Variable:" prefixes from comments, as they aren't needed in JSDoc * removed "Function:", "Variable:" and "Class:" prefixes from comments, as they aren't needed in JSDoc * removed "Function:" prefixes from comments, as they aren't needed in JSDoc * minor changes * convert code example blocks to markdown * module casing updates * converted parameter function documentation to JSDoc * documentation+type updates * removed react subdir (for now) * reorganised various `utils` functions into different files * type updates/bugfixes/workarounds * rename Rubberband and CellEditor to be *Handler to match the other plugins * move codec classes to where they're used to reduce cyclic dependencies * move codec classes to where they're used to reduce cyclic dependencies * type updates/reorganize layout file structure * renamed various files for consistency * import fixes * renamed GraphHandler SelectionHander and various fixes * convert EventObject parameters to objects * add basic better-docs config * update better-docs config * bugfix for shared variables in Graph persisting across instances * fixed accessing handlers in examples; renamed Model to GraphModel * fixed accessing handlers in examples; renamed Model to GraphModel * restored selection model * bugfix * renamed getModel to getDataModel * changed to use graph.batchUpdate() to reduce lines of code * changed to use graph.batchUpdate() to reduce lines of code * finished annotations+added TypeDoc * convert remaining Cell[] instances to CellArray * convert NaturalDocs links to JSDoc
2022-01-08 01:49:35 +00:00
Translations.parse(xhr[0].getText());
2016-03-01 09:16:15 +00:00
// Configures the default graph theme
2021-03-21 01:24:29 +00:00
let themes = {};
2016-03-01 09:16:15 +00:00
themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
// Main
2016-04-06 08:10:17 +00:00
new EditorUi(new Editor(urlParams['chrome'] == '0', themes));
2016-03-01 09:16:15 +00:00
}, function()
{
document.body.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
});
2012-05-21 20:32:26 +00:00
})();
</script>
</body>
</html>