config-sample.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. extension config), 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. // exportWindowType: 'new', // 'same'
  68. // wireframe: false,
  69. // showlayers: false,
  70. // no_save_warning: false,
  71. // PATH CONFIGURATION
  72. // imgPath: 'images/',
  73. // langPath: 'locale/',
  74. // extPath: 'extensions/',
  75. // jGraduatePath: 'jgraduate/images/',
  76. /*
  77. Uncomment the following to allow at least same domain (embedded) access,
  78. including file:// access.
  79. Setting as `['*']` would allow any domain to access but would be unsafe to
  80. data privacy and integrity.
  81. */
  82. // allowedOrigins: [window.location.origin || 'null'], // May be 'null' (as a string) when used as a file:// URL
  83. // DOCUMENT PROPERTIES
  84. // dimensions: [640, 480],
  85. // EDITOR OPTIONS
  86. // gridSnapping: false,
  87. // gridColor: '#000',
  88. // baseUnit: 'px',
  89. // snappingStep: 10,
  90. // showRulers: true,
  91. // EXTENSION-RELATED (GRID)
  92. // showGrid: false, // Set by ext-grid.js
  93. // EXTENSION-RELATED (STORAGE)
  94. // noStorageOnLoad: false, // Some interaction with ext-storage.js; prevent even the loading of previously saved local storage
  95. // 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
  96. // emptyStorageOnDecline: true, // Used by ext-storage.js; empty any prior storage if the user declines to store
  97. });
  98. // PREF CHANGES
  99. /**
  100. setConfig() can also be used to set preferences in addition to
  101. configuration (see defaultPrefs in svg-editor.js for a list of
  102. possible settings), but at least if you are using ext-storage.js
  103. to store preferences, it will probably be better to let your
  104. users control these.
  105. As with configuration, one may use allowInitialUserOverride, but
  106. in the case of preferences, any previously stored preferences
  107. will also thereby be enabled to override this setting (and at a
  108. higher priority than any URL preference setting overrides).
  109. Failing to use allowInitialUserOverride will ensure preferences
  110. are hard-coded here regardless of URL or prior user storage setting.
  111. */
  112. svgEditor.setConfig(
  113. {
  114. // lang: '', // Set dynamically within locale.js if not previously set
  115. // iconsize: '', // Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise
  116. /**
  117. * When showing the preferences dialog, svg-editor.js currently relies
  118. * on curPrefs instead of $.pref, so allowing an override for bkgd_color
  119. * means that this value won't have priority over block auto-detection as
  120. * far as determining which color shows initially in the preferences
  121. * dialog (though it can be changed and saved).
  122. */
  123. // bkgd_color: '#FFF',
  124. // bkgd_url: '',
  125. // img_save: 'embed',
  126. // Only shows in UI as far as alert notices
  127. // save_notice_done: false,
  128. // export_notice_done: false
  129. }
  130. );
  131. svgEditor.setConfig(
  132. {
  133. // Indicate pref settings here if you wish to allow user storage or URL settings
  134. // to be able to override your default preferences (unless other config options
  135. // have already explicitly prevented one or the other)
  136. },
  137. {allowInitialUserOverride: true}
  138. );