Interface: Config

SVGEditor.Config

Properties:
Name Type Attributes Default Description
canvasName string <optional>
"default"

Used to namespace storage provided via ext-storage.js; you can use this if you wish to have multiple independent instances of SVG Edit on the same domain

no_save_warning boolean <optional>
false

If true, prevents the warning dialog box from appearing when closing/reloading the page. Mostly useful for testing.

imgPath string <optional>
"images/"

The path where the SVG icons are located, with trailing slash. Note that as of version 2.7, this is not configurable by URL for security reasons.

langPath string <optional>
"locale/"

The path where the language files are located, with trailing slash. Default will be changed to ../dist/locale/ if this is a modular load. Note that as of version 2.7, this is not configurable by URL for security reasons.

extPath string <optional>
"extensions/"

The path used for extension files, with trailing slash. Default will be changed to ../dist/extensions/ if this is a modular load. Note that as of version 2.7, this is not configurable by URL for security reasons.

canvgPath string <optional>
"canvg/"

The path used for canvg files, with trailing slash. Default will be changed to ../dist/ if this is a modular load.

jspdfPath string <optional>
"jspdf/"

The path used for jsPDF files, with trailing slash. Default will be changed to ../dist/ if this is a modular load.

extIconsPath string <optional>
"extensions/"

The path used for extension icons, with trailing slash.

jGraduatePath string <optional>
"jgraduate/images/"

The path where jGraduate images are located. Note that as of version 2.7, this is not configurable by URL for security reasons.

preventAllURLConfig boolean <optional>
false

Set to true to override the ability for URLs to set non-content configuration (including extension config). Must be set early, i.e., in svgedit-config-iife.js; extension loading is too late!

preventURLContentLoading boolean <optional>
false

Set to true to override the ability for URLs to set URL-based SVG content. Must be set early, i.e., in svgedit-config-iife.js; extension loading is too late!

lockExtensions boolean <optional>
false

Set to true to override the ability for URLs to set their own extensions; disallowed in URL setting. There is no need for this when preventAllURLConfig is used. Must be set early, i.e., in svgedit-config-iife.js; extension loading is too late!

noDefaultExtensions boolean <optional>
false

If set to true, prohibits automatic inclusion of default extensions (though "extensions" can still be used to add back any desired default extensions along with any other extensions). This can only be meaningfully used in svgedit-config-iife.js or in the URL

noStorageOnLoad boolean <optional>
false

Some interaction with ext-storage.js; prevent even the loading of previously saved local storage.

forceStorage boolean <optional>
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 (and may be required by law in some regions)

emptyStorageOnDecline boolean <optional>
false

Used by ext-storage.js; empty any prior storage if the user declines to store

avoidClientSide boolean <optional>
false

DEPRECATED (use avoidClientSideDownload instead); Used by ext-server_opensave.js; set to true if you wish to always save to server and not only as fallback when client support is lacking

avoidClientSideDownload boolean <optional>
false

Used by ext-server_opensave.js; set to true if you wish to always save to server and not only as fallback when client support is lacking

avoidClientSideOpen boolean <optional>
false

Used by ext-server_opensave.js; set to true if you wish to always open from the server and not only as fallback when FileReader client support is lacking

extensions Array.<string> <optional>
module:SVGEditor~defaultExtensions

Extensions to load on startup. Use an array in setConfig and comma separated file names in the URL. Extension names must begin with "ext-". Note that as of version 2.7, paths containing "/", "", or ":", are disallowed for security reasons. Although previous versions of this list would entirely override the default list, as of version 2.7, the defaults will always be added to this explicit list unless the configuration noDefaultExtensions is included.

stylesheets Array.<module:SVGEditor.Stylesheet> <optional>
["@default"]

An array of required stylesheets to load in parallel; include the value "@default" within this array to ensure all default stylesheets are loaded.

allowedOrigins Array.<string> <optional>
[]

Used by ext-xdomain-messaging.js to indicate which origins are permitted for cross-domain messaging (e.g., between the embedded editor and main editor code). Besides explicit domains, one might add '*' to allow all domains (not recommended for privacy/data integrity of your user's content!), window.location.origin for allowing the same origin (should be safe if you trust all apps on your domain), 'null' to allow file:/// URL usage

colorPickerCSS null | PlainObject <optional>
null

Object of CSS properties mapped to values (for jQuery) to apply to the color picker. See http://api.jquery.com/css/#css-properties. A null value (the default) will cause the CSS to default to left with a position equal to that of the fill_color or stroke_color element minus 140, and a bottom equal to 40

paramurl string <optional>

This was available via URL only. Allowed an un-encoded URL within the query string (use "url" or "source" with a data: URI instead)

canvas_expansion Float <optional>
3

The minimum area visible outside the canvas, as a multiple of the image dimensions. The larger the number, the more one can scroll outside the canvas.

initFill PlainObject <optional>

Init fill properties

Properties
Name Type Attributes Default Description
color string <optional>
"FF0000"

The initial fill color. Must be a hex code string. Defaults to solid red.

opacity Float <optional>
1

The initial fill opacity. Must be a number between 0 and 1

initStroke PlainObject <optional>

Init stroke properties

Properties
Name Type Attributes Default Description
width Float <optional>
5

The initial stroke width. Must be a positive number.

color string <optional>
"000000"

The initial stroke color. Must be a hex code. Defaults to solid black.

opacity Float <optional>
1

The initial stroke opacity. Must be a number between 0 and 1.

text PlainObject

Text style properties

Properties
Name Type Attributes Default Description
stroke_width Float <optional>
0

Text stroke width

font_size Float <optional>
24

Text font size

font_family string <optional>
"serif"

Text font family

initOpacity Float <optional>
1

Initial opacity (multiplied by 100)

dimensions module:SVGEditor.XYDimensions <optional>
[640, 480]

The default width/height of a new document. Use an array in setConfig (e.g., [800, 600]) and comma separated numbers in the URL.

gridSnapping boolean <optional>
false

Enable snap to grid by default. Set in Editor Options.

gridColor string <optional>
"#000"

Accepts hex, e.g., '#000'. Set in Editor Options. Defaults to black.

baseUnit string <optional>
"px"

Set in Editor Options.

snappingStep Float <optional>
10

Set the default grid snapping value. Set in Editor Options.

showRulers boolean <optional>
true

Initial state of ruler display (v2.6). Set in Editor Options.

initTool string <optional>
"select"

The initially selected tool. Must be either the ID of the button for the tool, or the ID without tool_ prefix (e.g., "select").

wireframe boolean <optional>
false

Start in wireframe mode

showlayers boolean <optional>
false

Open the layers side-panel by default.

exportWindowType "new" | "same" <optional>
"new"

Can be "new" or "same" to indicate whether new windows will be generated for each export; the window.name of the export window is namespaced based on the canvasName (and incremented if "new" is selected as the type). Introduced 2.8.

showGrid boolean <optional>
false

Set by ext-grid.js; determines whether or not to show the grid by default

show_outside_canvas boolean <optional>
true

Defines whether or not elements outside the canvas should be visible. Set and used in svgcanvas.js.

selectNew boolean <optional>
true

If true, will replace the selection with the current element and automatically select element objects (when not in "path" mode) after they are created, showing their grips (v2.6). Set and used in svgcanvas.js (mouseUp).

Source:
Tutorials:
To Do:
  • Some others could be preferences as well (e.g., preventing URL changing of extensions, defaultExtensions, stylesheets, colorPickerCSS); Change the following to preferences and add pref controls where missing to the UI (e.g., `canvas_expansion`, `initFill`, `initStroke`, `text`, `initOpacity`, `dimensions`, `initTool`, `wireframe`, `showlayers`, `gridSnapping`, `gridColor`, `baseUnit`, `snappingStep`, `showRulers`, `exportWindowType`, `showGrid`, `show_outside_canvas`, `selectNew`)?