Init.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (c) 2006-2021, JGraph Ltd
  3. * Copyright (c) 2006-2021, draw.io AG
  4. */
  5. // urlParams is null when used for embedding
  6. window.urlParams = window.urlParams || {};
  7. // Public global variables
  8. window.DOM_PURIFY_CONFIG = window.DOM_PURIFY_CONFIG ||
  9. {ADD_TAGS: ['use', 'foreignObject'], FORBID_TAGS: ['form'],
  10. ALLOWED_URI_REGEXP: /^((?!javascript:).)*$/i,
  11. ADD_ATTR: ['target', 'content', 'pointer-events',
  12. 'requiredFeatures']};
  13. window.MAX_REQUEST_SIZE = window.MAX_REQUEST_SIZE || 10485760;
  14. window.MAX_AREA = window.MAX_AREA || 15000 * 15000;
  15. // URLs for save and export
  16. window.EXPORT_URL = window.EXPORT_URL || '/export';
  17. window.SAVE_URL = window.SAVE_URL || '/save';
  18. window.OPEN_URL = window.OPEN_URL || '/open';
  19. window.RESOURCES_PATH = window.RESOURCES_PATH || 'resources';
  20. window.RESOURCE_BASE = window.RESOURCE_BASE || window.RESOURCES_PATH + '/grapheditor';
  21. window.STENCIL_PATH = window.STENCIL_PATH || 'stencils';
  22. window.IMAGE_PATH = window.IMAGE_PATH || 'images';
  23. window.STYLE_PATH = window.STYLE_PATH || 'styles';
  24. window.CSS_PATH = window.CSS_PATH || 'styles';
  25. window.OPEN_FORM = window.OPEN_FORM || 'open.html';
  26. // Sets the base path, the UI language via URL param and configures the
  27. // supported languages to avoid 404s. The loading of all core language
  28. // resources is disabled as all required resources are in grapheditor.
  29. // properties. Note that in this example the loading of two resource
  30. // files (the special bundle and the default bundle) is disabled to
  31. // save a GET request. This requires that all resources be present in
  32. // each properties file since only one file is loaded.
  33. window.mxBasePath = window.mxBasePath || 'mxgraph';
  34. window.mxImageBasePath = window.mxImageBasePath || 'mxgraph/images';
  35. window.mxLanguage = window.mxLanguage || urlParams['lang'];
  36. window.mxLanguages = window.mxLanguages || ['de', 'se'];