development_environments.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* load editor js files as development environments */
  2. (function() {
  3. var DE_PREFIX = EditorJSLoader.getJSBasePath("editor.js");
  4. function _importScript(filename) {
  5. if (filename) {
  6. EditorJSLoader.loadModule(filename);
  7. }
  8. }
  9. EXCLUDE_FILES = (typeof EXCLUDE_FILES == "object") ? EXCLUDE_FILES : [];
  10. var isExcludeFile = function(filepath) {
  11. for (var i = 0; i < EXCLUDE_FILES.length; i++) {
  12. if (EXCLUDE_FILES[i] == filepath) {
  13. return true;
  14. }
  15. }
  16. return false;
  17. };
  18. // 1. import header
  19. _importScript(DE_PREFIX + "trex/header.js");
  20. // 2. import trex
  21. for (var i = 0; i < CORE_FILES.length; i++) {
  22. if (!isExcludeFile(CORE_FILES[i])) {
  23. _importScript(DE_PREFIX + CORE_FILES[i]);
  24. }
  25. }
  26. // 3. import EXT_FILES
  27. if (typeof EXT_FILES == "object") {
  28. for (i = 0; i < EXT_FILES.length; i++) {
  29. if (!isExcludeFile(EXT_FILES[i])) {
  30. _importScript(EXT_FILES[i]);
  31. }
  32. }
  33. }
  34. // 4. import projectlib
  35. if (typeof SERVICE_FILES == "object") {
  36. for (i = 0; i < SERVICE_FILES.length; i++) {
  37. if (!isExcludeFile(SERVICE_FILES[i])) {
  38. _importScript(SERVICE_FILES[i]);
  39. }
  40. }
  41. }
  42. // 5. import footer
  43. _importScript(DE_PREFIX + "trex/footer.js");
  44. })();
  45. /* show development environments indicator */
  46. (function() {
  47. function addEditorEnvIndicator() {
  48. if (window.Editor && Editor.__EDITOR_LOADED) {
  49. var indicator = document.createElement("span");
  50. indicator.innerHTML = "";
  51. $tx.setStyle(indicator, {
  52. position: "absolute",
  53. fontSize: "13px",
  54. color: "green",
  55. fontFamily: "courier,serif",
  56. right: "10px",
  57. bottom : "10px"
  58. });
  59. var canvas = Editor.getCanvas().elContainer; //$tx("tx_canvas");
  60. canvas.appendChild(indicator);
  61. } else {
  62. setTimeout(arguments.callee, 500);
  63. }
  64. }
  65. EditorJSLoader.ready(addEditorEnvIndicator);
  66. })();