config-sample.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // DO NOT EDIT THIS FILE!
  2. // THIS FILE IS JUST A SAMPLE; TO APPLY, YOU MUST
  3. // CREATE A NEW FILE config.js AND ADD CONTENTS
  4. // SUCH AS SHOWN BELOW INTO THAT FILE.
  5. /*globals svgEditor*/
  6. /*
  7. The config.js file is intended for the setting of configuration or
  8. preferences which must run early on; if this is not needed, it is
  9. recommended that you create an extension instead (for greater
  10. reusability and modularity).
  11. */
  12. // CONFIG AND EXTENSION SETTING
  13. /*
  14. See defaultConfig and defaultExtensions in svg-editor.js for a list
  15. of possible configuration settings.
  16. See svg-editor.js for documentation on using setConfig().
  17. */
  18. // URL OVERRIDE CONFIG
  19. svgEditor.setConfig({
  20. /**
  21. To override the ability for URLs to set URL-based SVG content,
  22. uncomment the following:
  23. */
  24. // preventURLContentLoading: true,
  25. /**
  26. To override the ability for URLs to set other configuration (including
  27. extensions), uncomment the following:
  28. */
  29. // preventAllURLConfig: true,
  30. /**
  31. To override the ability for URLs to set their own extensions,
  32. uncomment the following (note that if setConfig() is used in
  33. extension code, it will still be additive to extensions,
  34. however):
  35. */
  36. // lockExtensions: true,
  37. });
  38. svgEditor.setConfig({
  39. /*
  40. Provide default values here which differ from that of the editor but
  41. which the URL can override
  42. */
  43. }, {allowInitialUserOverride: true});
  44. // EXTENSION CONFIG
  45. svgEditor.setConfig({
  46. extensions: [
  47. // 'ext-overview_window.js', 'ext-markers.js', 'ext-connector.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-imagelib.js', 'ext-grid.js', 'ext-polygon.js', 'ext-star.js', 'ext-panning.js', 'ext-storage.js'
  48. ]
  49. // , noDefaultExtensions: false, // noDefaultExtensions can only be meaningfully used in config.js or in the URL
  50. });
  51. // OTHER CONFIG
  52. svgEditor.setConfig({
  53. // canvasName: 'default',
  54. // canvas_expansion: 3,
  55. // initFill: {
  56. // color: 'FF0000', // solid red
  57. // opacity: 1
  58. // },
  59. // initStroke: {
  60. // width: 5,
  61. // color: '000000', // solid black
  62. // opacity: 1
  63. // },
  64. // initOpacity: 1,
  65. // colorPickerCSS: null,
  66. // initTool: 'select',
  67. // wireframe: false,
  68. // showlayers: false,
  69. // no_save_warning: false,
  70. // PATH CONFIGURATION
  71. // imgPath: 'images/',
  72. // langPath: 'locale/',
  73. // extPath: 'extensions/',
  74. // jGraduatePath: 'jgraduate/images/',
  75. /*
  76. Uncomment the following to allow at least same domain (embedded) access,
  77. including file:// access.
  78. Setting as `['*']` would allow any domain to access but would be unsafe to
  79. data privacy and integrity.
  80. */
  81. // allowedOrigins: [window.location.origin || 'null'], // May be 'null' (as a string) when used as a file:// URL
  82. // DOCUMENT PROPERTIES
  83. // dimensions: [640, 480],
  84. // EDITOR OPTIONS
  85. // gridSnapping: false,
  86. // gridColor: '#000',
  87. // baseUnit: 'px',
  88. // snappingStep: 10,
  89. // showRulers: true,
  90. // EXTENSION-RELATED (GRID)
  91. // showGrid: false, // Set by ext-grid.js
  92. // EXTENSION-RELATED (STORAGE)
  93. // noStorageOnLoad: false, // Some interaction with ext-storage.js; prevent even the loading of previously saved local storage
  94. // forceStorage: false, // Some interaction with ext-storage.js; strongly discouraged from modification as it bypasses user privacy by preventing them from choosing whether to keep local storage or not
  95. // emptyStorageOnDecline: true, // Used by ext-storage.js; empty any prior storage if the user declines to store
  96. });
  97. // PREF CHANGES
  98. /**
  99. setConfig() can also be used to set preferences in addition to
  100. configuration (see defaultPrefs in svg-editor.js for a list of
  101. possible settings), but at least if you are using ext-storage.js
  102. to store preferences, it will probably be better to let your
  103. users control these.
  104. As with configuration, one may use allowInitialUserOverride, but
  105. in the case of preferences, any previously stored preferences
  106. will also thereby be enabled to override this setting (and at a
  107. higher priority than any URL preference setting overrides).
  108. Failing to use allowInitialUserOverride will ensure preferences
  109. are hard-coded here regardless of URL or prior user storage setting.
  110. */
  111. svgEditor.setConfig(
  112. {
  113. // lang: '', // Set dynamically within locale.js if not previously set
  114. // iconsize: '', // Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise
  115. /**
  116. * When showing the preferences dialog, svg-editor.js currently relies
  117. * on curPrefs instead of $.pref, so allowing an override for bkgd_color
  118. * means that this value won't have priority over block auto-detection as
  119. * far as determining which color shows initially in the preferences
  120. * dialog (though it can be changed and saved).
  121. */
  122. // bkgd_color: '#FFF',
  123. // bkgd_url: '',
  124. // img_save: 'embed',
  125. // Only shows in UI as far as alert notices
  126. // save_notice_done: false,
  127. // export_notice_done: false
  128. }
  129. );
  130. svgEditor.setConfig(
  131. {
  132. // Indicate pref settings here if you wish to allow user storage or URL settings
  133. // to be able to override your default preferences (unless other config options
  134. // have already explicitly prevented one or the other)
  135. },
  136. {allowInitialUserOverride: true}
  137. );