UNPKG

svgedit

Version:

Powerful SVG-Editor for your browser

668 lines (600 loc) 35.3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: editor/extensions/ext-imagelib/ext-imagelib.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: editor/extensions/ext-imagelib/ext-imagelib.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>/* eslint-disable no-unsanitized/property */ /* globals seConfirm */ /** * @file ext-imagelib.js * * @license MIT * * @copyright 2010 Alexis Deveria * */ const name = "imagelib"; const loadExtensionTranslation = async function (svgEditor) { let translationModule; const lang = svgEditor.configObj.pref('lang'); try { // eslint-disable-next-line no-unsanitized/method translationModule = await import(`./locale/${lang}.js`); } catch (_error) { // eslint-disable-next-line no-console console.warn(`Missing translation (${lang}) for ${name} - using 'en'`); // eslint-disable-next-line no-unsanitized/method translationModule = await import(`./locale/en.js`); } svgEditor.i18next.addResourceBundle(lang, name, translationModule.default); }; export default { name, async init({ decode64, dropXMLInternalSubset }) { const svgEditor = this; const { $id } = svgEditor.svgCanvas; const { $svgEditor } = svgEditor; const { imgPath } = svgEditor.configObj.curConfig; await loadExtensionTranslation(svgEditor); const { svgCanvas } = svgEditor; const imgLibs = [ { name: svgEditor.i18next.t(`${name}:imgLibs_0_name`), url: 'extensions/ext-imagelib/index.html', description: svgEditor.i18next.t(`${name}:imgLibs_0_description`) }, { name: svgEditor.i18next.t(`${name}:imgLibs_1_name`), url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3', description: svgEditor.i18next.t(`${name}:imgLibs_1_description`) } ]; const allowedImageLibOrigins = imgLibs.map(({ url }) => { try { return new URL(url).origin; } catch (err) { return location.origin; } }); /** * * @returns {void} */ const closeBrowser = () => { $id("imgbrowse_holder").style.display = 'none'; document.activeElement.blur(); // make sure focus is the body to correct issue #417 }; /** * @param {string} url * @returns {void} */ const importImage = (url) => { const newImage = svgCanvas.addSVGElementFromJson({ element: 'image', attr: { x: 0, y: 0, width: 0, height: 0, id: svgCanvas.getNextId(), style: 'pointer-events:inherit' } }); svgCanvas.clearSelection(); svgCanvas.addToSelection([ newImage ]); svgCanvas.setImageURL(url); }; const pending = {}; let mode = 's'; let multiArr = []; let transferStopped = false; let preview; let submit; /** * Contains the SVG to insert. * @typedef {PlainObject} ImageLibMessage * @property {"imagelib"} namespace Required to distinguish from any other messages of app. * @property {string} href Set to same value as previous `ImageLibMetaMessage` `id`. * @property {string} data The response (as an SVG string or URL) */ /** * Used for setting meta-data before images are retrieved. * @typedef {PlainObject} ImageLibMetaMessage * @property {"imagelib"} namespace Required to distinguish from any other messages of app. * @property {string} name If the subsequent response is an SVG string or if `preview_url` * is present, will be used as the title for the preview image. When an * SVG string is present, will default to the first `&lt;title>`'s contents or * "(SVG #&lt;Length of response>)" if none is present. Otherwise, if `preview_url` * is present, will default to the empty string. Though `name` may be falsy, * it is always expected to be present for meta messages. * @property {string} id Identifier (the expected `href` for a subsequent response message); * used for ensuring the subsequent response can be tied to this `ImageLibMetaMessage` object. * @property {string} [preview_url] When import mode is multiple, used to set an image * source along with the name/title. If the subsequent response is an SVG string * and there is no `preview_url`, the default will just be to show the * name/title. If the response is not an SVG string, the default will be to * show that response (i.e., the URL). * @property {string} entry Set automatically with div holding retrieving * message (until ready to delete) * @todo Should use a separate Map instead of `entry` */ /** * @param {PlainObject} cfg * @param {string} cfg.origin * @param {ImageLibMetaMessage|ImageLibMessage|string} cfg.data String is deprecated when parsed to JSON `ImageLibMessage` * @returns {void} */ async function onMessage({ origin, data }) { let response = data; if (!response || ![ 'string', 'object' ].includes(typeof response)) { // Do nothing return; } let id; let type; try { // Todo: This block can be removed (and the above check changed to // insist on an object) if embedAPI moves away from a string to // an object (if IE9 support not needed) response = typeof response === 'object' ? response : JSON.parse(response); if (response.namespace !== 'imagelib') { return; } if (!allowedImageLibOrigins.includes('*') &amp;&amp; !allowedImageLibOrigins.includes(origin)) { // Todo: Surface this error to user? console.error(`Origin ${origin} not whitelisted for posting to ${window.origin}`); return; } const hasName = 'name' in response; const hasHref = 'href' in response; if (!hasName &amp;&amp; transferStopped) { transferStopped = false; return; } if (hasHref) { id = response.href; response = response.data; } // Hide possible transfer dialog box if (document.querySelector('se-elix-alert-dialog')) { document.querySelector('se-elix-alert-dialog').remove(); } type = hasName ? 'meta' : response.charAt(0); } catch (e) { // This block is for backward compatibility (for IAN and Openclipart); // should otherwise return if (typeof response === 'string') { const char1 = response.charAt(0); if (char1 !== '{' &amp;&amp; transferStopped) { transferStopped = false; return; } if (char1 === '|') { const secondpos = response.indexOf('|', 1); id = response.substr(1, secondpos - 1); response = response.substr(secondpos + 1); type = response.charAt(0); } } } let entry; let curMeta; let svgStr; let imgStr; switch (type) { case 'meta': { // Metadata transferStopped = false; curMeta = response; // Should be safe to add dynamic property as passed metadata pending[curMeta.id] = curMeta; // lgtm [js/remote-property-injection] const name = (curMeta.name || 'file'); const message = svgEditor.i18next.t('notification.retrieving').replace('%s', name); if (mode !== 'm') { await seConfirm(message); transferStopped = true; } else { entry = document.createElement('div'); entry.textContent = message; entry.dataset.id = curMeta.id; preview.appendChild(entry); curMeta.entry = entry; } return; } case '&lt;': svgStr = true; break; case 'd': { if (response.startsWith('data:image/svg+xml')) { const pre = 'data:image/svg+xml;base64,'; const src = response.substring(pre.length); response = decode64(src); svgStr = true; break; } else if (response.startsWith('data:image/')) { imgStr = true; break; } } // Else fall through default: // TODO: See if there's a way to base64 encode the binary data stream // const str = 'data:;base64,' + svgedit.utilities.encode64(response, true); // Assume it's raw image data // importImage(str); // Don't give warning as postMessage may have been used by something else if (mode !== 'm') { closeBrowser(); } else { pending[id].entry.remove(); } // await alert('Unexpected data was returned: ' + response, function() { // if (mode !== 'm') { // closeBrowser(); // } else { // pending[id].entry.remove(); // } // }); return; } switch (mode) { case 's': // Import one if (svgStr) { svgEditor.svgCanvas.importSvgString(response); } else if (imgStr) { importImage(response); } closeBrowser(); break; case 'm': { // Import multiple multiArr.push([ (svgStr ? 'svg' : 'img'), response ]); curMeta = pending[id]; let title; if (svgStr) { if (curMeta &amp;&amp; curMeta.name) { title = curMeta.name; } else { // Try to find a title // `dropXMLInternalSubset` is to help prevent the billion laughs attack const xml = new DOMParser().parseFromString(dropXMLInternalSubset(response), 'text/xml').documentElement; // lgtm [js/xml-bomb] title = xml.querySelector('title').textContent || '(SVG #' + response.length + ')'; } if (curMeta) { Array.from(preview.children).forEach(function (element) { if (element.dataset.id === id) { if (curMeta.preview_url) { const img = document.createElement("img"); img.src = curMeta.preview_url; const span = document.createElement("span"); span.appendChild(img); element.append(span); } else { element.textContent = title; } submit.removeAttribute('disabled'); } }); } else { const div = document.createElement("div"); div.textContent = title; preview.appendChild(div); submit.removeAttribute('disabled'); } } else { if (curMeta &amp;&amp; curMeta.preview_url) { title = curMeta.name || ''; entry = document.createElement('span'); const img = document.createElement("img"); img.src = curMeta.preview_url; entry.appendChild(img); entry.appendChild(document.createTextNode(title)); } else { entry = document.createElement("img"); entry.src = response; } if (curMeta) { Array.from(preview.children).forEach(function (element) { if (element.dataset.id === id) { element.appendChild(entry); submit.removeAttribute('disabled'); } }); } else { const div = document.createElement("div"); div.appendChild(entry); preview.appendChild(div); submit.removeAttribute('disabled'); } } break; } case 'o': { // Open if (!svgStr) { break; } closeBrowser(); const ok = await svgEditor.openPrep(); if (!ok) { return; } svgCanvas.clear(); svgCanvas.setSvgString(response); // updateCanvas(); break; } } } // Receive `postMessage` data window.addEventListener('message', onMessage, true); const insertAfter = (referenceNode, newNode) => { referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); }; const toggleMultiLoop = () => { multiArr.forEach(function(item, i){ const type = item[0]; const data = item[1]; if (type === 'svg') { svgCanvas.importSvgString(data); } else { importImage(data); } svgCanvas.moveSelectedElements(i * 20, i * 20, false); }); while (preview.firstChild) preview.removeChild(preview.firstChild); multiArr = []; $id("imgbrowse_holder").style.display = 'none'; }; /** * @param {boolean} show * @returns {void} */ const toggleMulti = (show) => { $id('lib_framewrap').style.right = (show ? 200 : 10); $id('imglib_opts').style.right = (show ? 200 : 10); if (!preview) { preview = document.createElement('div'); preview.setAttribute('id', 'imglib_preview'); // eslint-disable-next-line max-len preview.setAttribute('style', `position: absolute;top: 45px;right: 10px;width: 180px;bottom: 45px;background: #fff;overflow: auto;`); insertAfter($id('lib_framewrap'), preview); submit = document.createElement('button'); submit.setAttribute('content', 'Import selected'); submit.setAttribute('disabled', true); submit.textContent = 'Import selected'; submit.setAttribute('style', `position: absolute;bottom: 10px;right: -10px;`); $id('imgbrowse').appendChild(submit); submit.addEventListener('click', toggleMultiLoop); submit.addEventListener('touchend', toggleMultiLoop); } submit.style.display = (show) ? 'block' : 'none'; preview.style.display = (show) ? 'block' : 'none'; }; /** * * @returns {void} */ const showBrowser = () => { let browser = $id('imgbrowse'); if (!browser) { const div = document.createElement('div'); div.id = 'imgbrowse_holder'; div.innerHTML = '&lt;div id=imgbrowse class=toolbar_button>&lt;/div>'; insertAfter($svgEditor, div); browser = $id('imgbrowse'); const allLibs = svgEditor.i18next.t(`${name}:select_lib`); const divFrameWrap = document.createElement('div'); divFrameWrap.id = 'lib_framewrap'; const libOpts = document.createElement('ul'); libOpts.id = 'imglib_opts'; browser.append(libOpts); const frame = document.createElement('iframe'); frame.src = "javascript:0"; frame.style.display = 'none'; divFrameWrap.append(frame); browser.prepend(divFrameWrap); const header = document.createElement('h1'); browser.prepend(header); header.textContent = allLibs; header.setAttribute('style', `position: absolute;top: 0px;left: 0px;width: 100%;`); const button = document.createElement('button'); // eslint-disable-next-line max-len button.innerHTML = svgEditor.i18next.t('common.cancel'); browser.appendChild(button); button.addEventListener('click', function () { $id("imgbrowse_holder").style.display = 'none'; }); button.addEventListener('touchend', function () { $id("imgbrowse_holder").style.display = 'none'; }); button.setAttribute('style', `position: absolute;top: 5px;right: 10px;`); const leftBlock = document.createElement('span'); leftBlock.setAttribute('style', `position: absolute;top: 5px;left: 10px;display: inline-flex;`); browser.appendChild(leftBlock); const back = document.createElement('button'); back.style.visibility = "hidden"; // eslint-disable-next-line max-len back.innerHTML = `&lt;img class="svg_icon" src="${imgPath}/library.svg" alt="icon" width="16" height="16" />` + svgEditor.i18next.t(`${name}:show_list`); leftBlock.appendChild(back); back.addEventListener('click', function () { frame.setAttribute('src', 'about:blank'); frame.style.display = 'none'; libOpts.style.display = 'block'; header.textContent = allLibs; back.style.display = 'none'; }); back.addEventListener('touchend', function () { frame.setAttribute('src', 'about:blank'); frame.style.display = 'none'; libOpts.style.display = 'block'; header.textContent = allLibs; back.style.display = 'none'; }); back.setAttribute('style', `margin-right: 5px;`); back.style.display = 'none'; const select = document.createElement('select'); select.innerHTML = '&lt;select>&lt;option value=s>' + svgEditor.i18next.t(`${name}:import_single`) + '&lt;/option>&lt;option value=m>' + svgEditor.i18next.t(`${name}:import_multi`) + '&lt;/option>&lt;option value=o>' + svgEditor.i18next.t(`${name}:open`) + '&lt;/option>'; leftBlock.appendChild(select); select.addEventListener('change', function () { mode = this.value; switch (mode) { case 's': case 'o': toggleMulti(false); break; case 'm': // Import multiple toggleMulti(true); break; } }); select.setAttribute('style', `margin-top: 10px;`); imgLibs.forEach(function ({ name, url, description }) { const li = document.createElement('li'); libOpts.appendChild(li); li.textContent = name; li.addEventListener('click', function () { frame.setAttribute('src', url); frame.style.display = 'block'; header.textContent = name; libOpts.style.display = 'none'; back.style.display = 'block'; }); li.addEventListener('touchend', function () { frame.setAttribute('src', url); frame.style.display = 'block'; header.textContent = name; libOpts.style.display = 'none'; back.style.display = 'block'; }); const span = document.createElement("span"); span.textContent = description; li.appendChild(span); }); } else { $id("imgbrowse_holder").style.display = 'block'; } }; return { svgicons: 'ext-imagelib.xml', callback() { // Add the button and its handler(s) const buttonTemplate = document.createElement("template"); const key = name + `:buttons.0.title`; buttonTemplate.innerHTML = ` &lt;se-menu-item id="tool_imagelib" label="${key}" src="library.svg">&lt;/se-menu-item> `; insertAfter($id('tool_export'), buttonTemplate.content.cloneNode(true)); $id('tool_imagelib').addEventListener("click", () => { showBrowser(); }); const style = document.createElement('style'); style.textContent = '#imgbrowse_holder {' + 'position: absolute;' + 'top: 0;' + 'left: 0;' + 'width: 100%;' + 'height: 100%;' + 'background-color: rgba(0, 0, 0, .5);' + 'z-index: 5;' + '}' + '#imgbrowse {' + 'position: absolute;' + 'top: 25px;' + 'left: 25px;' + 'right: 25px;' + 'bottom: 25px;' + 'min-width: 300px;' + 'min-height: 200px;' + 'background: #5a6162;' + 'border: 1px outset #777;' + '}' + '#imgbrowse h1 {' + 'font-size: 20px;' + 'margin: .4em;' + 'text-align: center;' + '}' + '#lib_framewrap,' + '#imgbrowse > ul {' + 'position: absolute;' + 'top: 45px;' + 'left: 10px;' + 'right: 10px;' + 'bottom: 10px;' + 'background: white;' + 'margin: 0;' + 'padding: 0;' + '}' + '#imgbrowse > ul {' + 'overflow: auto;' + '}' + '#imgbrowse > div {' + 'border: 1px solid #666;' + '}' + '#imglib_preview > div {' + 'padding: 5px;' + 'font-size: 12px;' + '}' + '#imglib_preview img {' + 'display: block;' + 'margin: 0 auto;' + 'max-height: 100px;' + '}' + '#imgbrowse li {' + 'list-style: none;' + 'padding: .5em;' + 'background: #E8E8E8;' + 'border-bottom: 1px solid #5a6162;' + 'line-height: 1.2em;' + 'font-style: sans-serif;' + '}' + '#imgbrowse li > span {' + 'color: #666;' + 'font-size: 15px;' + 'display: block;' + '}' + '#imgbrowse li:hover {' + 'background: #FFC;' + 'cursor: pointer;' + '}' + '#imgbrowse iframe {' + 'width: 100%;' + 'height: 100%;' + 'border: 0;' + '}'; document.head.appendChild(style); } }; } }; </code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-blur.html">blur</a></li><li><a href="module-browser.html">browser</a></li><li><a href="module-clear.html">clear</a></li><li><a href="module-contextmenu.html">contextmenu</a></li><li><a href="module-coords.html">coords</a></li><li><a href="module-draw.html">draw</a></li><li><a href="module-elem-get-set%2520get%2520and%2520set%2520methods..html">elem-get-set get and set methods.</a></li><li><a href="module-event.html">event</a></li><li><a href="module-history.html">history</a></li><li><a href="module-jGraduate.html">jGraduate</a></li><li><a href="module-jPicker.html">jPicker</a></li><li><a href="module-jQueryAttr.html">jQueryAttr</a></li><li><a href="module-layer.html">layer</a></li><li><a href="module-locale.html">locale</a></li><li><a href="module-math.html">math</a></li><li><a href="module-namespaces.html">namespaces</a></li><li><a href="module-path.html">path</a></li><li><a href="module-recalculate.html">recalculate</a></li><li><a href="module-sanitize.html">sanitize</a></li><li><a href="module-select.html">select</a></li><li><a href="module-selected-elem.html">selected-elem</a></li><li><a href="module-selection.html">selection</a></li><li><a href="module-svg.html">svg</a></li><li><a href="module-svgcanvas.html">svgcanvas</a></li><li><a href="module-SVGEditor.html">SVGEditor</a></li><li><a href="module-text-actions%2520Tools%2520for%2520Text%2520edit%2520functions.html">text-actions Tools for Text edit functions</a></li><li><a href="module-undo.html">undo</a></li><li><a href="module-units.html">units</a></li><li><a href="module-utilities.html">utilities</a></li></ul><h3>Externals</h3><ul><li><a href="external-JamilihArray.html">JamilihArray</a></li><li><a href="external-jQuery.html">jQuery</a></li><li><a href="external-Math.html">Math</a></li><li><a href="external-MouseEvent.html">MouseEvent</a></li><li><a href="external-Window.html">Window</a></li></ul><h3>Namespaces</h3><ul><li><a href="external-jQuery.fn.html">fn</a></li><li><a href="external-jQuery.fn.$.fn.jPicker.defaults.html">defaults</a></li><li><a href="external-jQuery.fn.exports.jPickerMethod.html">exports.jPickerMethod</a></li><li><a href="external-jQuery.fn.jGraduateDefaults.html">jGraduateDefaults</a></li><li><a href="external-jQuery.fn.jGraduateDefaults.images.html">images</a></li><li><a href="external-jQuery.fn.jGraduateDefaults.window.html">window</a></li><li><a href="external-jQuery.jGraduate.html">jGraduate</a></li><li><a href="external-jQuery.jPicker.html">jPicker</a></li><li><a href="external-jQuery.jPicker.ColorMethods.html">ColorMethods</a></li><li><a href="module-path.html#.pathActions">pathActions</a></li><li><a href="module-svgcanvas.SvgCanvas_pathActions.html">pathActions</a></li><li><a href="module-svgcanvas.SvgCanvas_textActions.html">textActions</a></li></ul><h3>Classes</h3><ul><li><a href="BottomPanel.html">BottomPanel</a></li><li><a href="configObj.html">configObj</a></li><li><a href="Dropdown.html">Dropdown</a></li><li><a href="EditorStartup.html">EditorStartup</a></li><li><a href="ElixMenuButton.html">ElixMenuButton</a></li><li><a href="ElixNumberSpinBox.html">ElixNumberSpinBox</a></li><li><a href="ExplorerButton.html">ExplorerButton</a></li><li><a href="external-jQuery.jGraduate.Paint.html">Paint</a></li><li><a href="external-jQuery.jPicker.Color.html">Color</a></li><li><a href="FlyingButton.html">FlyingButton</a></li><li><a href="LayersPanel.html">LayersPanel</a></li><li><a href="LeftPanel.html">LeftPanel</a></li><li><a href="MainMenu.html">MainMenu</a></li><li><a href="module.exports.html">exports</a></li><li><a href="module.exports_module.exports.html">exports</a></li><li><a href="module-draw.Drawing.html">Drawing</a></li><li><a href="module-draw.Layer.html">Layer</a></li><li><a href="module-history.BatchCommand.html">BatchCommand</a></li><li><a href="module-history.ChangeElementCommand.html">ChangeElementCommand</a></li><li><a href="module-history.Command.html">Command</a></li><li><a href="module-history.HistoryRecordingService.html">HistoryRecordingService</a></li><li><a href="module-history.InsertElementCommand.html">InsertElementCommand</a></li><li><a href="module-history.MoveElementCommand.html">MoveElementCommand</a></li><li><a href="module-history.RemoveElementCommand.html">RemoveElementCommand</a></li><li><a href="module-history.UndoManager.html">UndoManager</a></li><li><a href="module-jPicker.module.exports.html">module.exports</a></li><li><a href="module-layer.Layer.html">Layer</a></li><li><a href="module-path.Path.html">Path</a></li><li><a href="module-path.Segment.html">Segment</a></li><li><a href="module-select.Selector.html">Selector</a></li><li><a href="module-select.SelectorManager.html">SelectorManager</a></li><li><a href="module-svgcanvas.SvgCanvas.html">SvgCanvas</a></li><li><a href="module-SVGEditor-Editor.html">Editor</a></li><li><a href="NumberSpinBox.html">NumberSpinBox</a></li><li><a href="PaintBox.html">PaintBox</a></li><li><a href="PlainNumberSpinBox.html">PlainNumberSpinBox</a></li><li><a href="Rulers.html">Rulers</a></li><li><a href="SeCMenuDialog.html">SeCMenuDialog</a></li><li><a href="SeCMenuLayerDialog.html">SeCMenuLayerDialog</a></li><li><a href="SeColorPicker.html">SeColorPicker</a></li><li><a href="SeEditPrefsDialog.html">SeEditPrefsDialog</a></li><li><a href="SeExportDialog.html">SeExportDialog</a></li><li><a href="SeImgPropDialog.html">SeImgPropDialog</a></li><li><a href="SEInput.html">SEInput</a></li><li><a href="SeList.html">SeList</a></li><li><a href="SeMenu.html">SeMenu</a></li><li><a href="SeMenuItem.html">SeMenuItem</a></li><li><a href="SEPalette.html">SEPalette</a></li><li><a href="SePlainAlertDialog.html">SePlainAlertDialog</a></li><li><a href="SePlainBorderButton.html">SePlainBorderButton</a></li><li><a href="SePromptDialog.html">SePromptDialog</a></li><li><a href="SESpinInput.html">SESpinInput</a></li><li><a href="SeStorageDialog.html">SeStorageDialog</a></li><li><a href="SeSvgSourceEditorDialog.html">SeSvgSourceEditorDialog</a></li><li><a href="SeText.html">SeText</a></li><li><a href="ToolButton.html">ToolButton</a></li><li><a href="TopPanel.html">TopPanel</a></li></ul><h3>Interfaces</h3><ul><li><a href="module-coords.EditorContext.html">EditorContext</a></li><li><a href="module-draw.DrawCanvasInit.html">DrawCanvasInit</a></li><li><a href="module-history.HistoryCommand.html">HistoryCommand</a></li><li><a href="module-history.HistoryEventHandler.html">HistoryEventHandler</a></li><li><a href="module-locale.LocaleEditorInit.html">LocaleEditorInit</a></li><li><a href="module-path.EditorContext.html">EditorContext</a></li><li><a href="module-recalculate.EditorContext.html">EditorContext</a></li><li><a href="module-select.SVGFactory.html">SVGFactory</a></li><li><a href="module-svgcanvas.PrivateMethods.html">PrivateMethods</a></li><li><a href="module-SVGEditor.Config.html">Config</a></li><li><a href="module-SVGEditor.Prefs.html">Prefs</a></li><li><a href="module-SVGthis.CustomHandler.html">CustomHandler</a></li><li><a href="module-units.ElementContainer.html">ElementContainer</a></li><li><a href="module-utilities.EditorContext.html">EditorContext</a></li></ul><h3>Events</h3><ul><li><a href="module-history-Command.html#event:event:history">history</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:changed">changed</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:cleared">cleared</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:contextset">contextset</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:exported">exported</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:exportedPDF">exportedPDF</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_addLangData">ext_addLangData</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_callback">ext_callback</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_canvasUpdated">ext_canvasUpdated</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_elementChanged">ext_elementChanged</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_elementTransition">ext_elementTransition</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_IDsUpdated">ext_IDsUpdated</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_langChanged">ext_langChanged</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_langReady">ext_langReady</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_mouseDown">ext_mouseDown</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_mouseMove">ext_mouseMove</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_mouseUp">ext_mouseUp</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_onNewDocument">ext_onNewDocument</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_selectedChanged">ext_selectedChanged</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_toolButtonStateUpdate">ext_toolButtonStateUpdate</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_workareaResized">ext_workareaResized</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:ext_zoomChanged">ext_zoomChanged</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:extension_added">extension_added</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:extensions_added">extensions_added</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:GenericCanvasEvent">GenericCanvasEvent</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:message">message</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:pointsAdded">pointsAdded</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:saved">saved</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:selected">selected</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:setnonce">setnonce</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:transition">transition</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:unsetnonce">unsetnonce</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:updateCanvas">updateCanvas</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:zoomDone">zoomDone</a></li><li><a href="module-svgcanvas.SvgCanvas.html#event:event:zoomed">zoomed</a></li><li><a href="module-SVGEditor.html#event:event:svgEditorReadyEvent">svgEditorReadyEvent</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-CanvasAPI.html">CanvasAPI</a></li><li><a href="tutorial-Editor.html">Editor</a></li><li><a href="tutorial-EditorAPI.html">EditorAPI</a></li><li><a href="tutorial-Events.html">Events</a></li><li><a href="tutorial-FrequentlyAskedQuestions.html">Frequently Asked Questions (FAQ)</a></li></ul><h3>Global</h3><ul><li><a href="global.html#attributeChangedCallback">attributeChangedCallback</a></li><li><a href="global.html#connectedCallback">connectedCallback</a></li><li><a href="global.html#constructor">constructor</a></li><li><a href="global.html#expireCookie">expireCookie</a></li><li><a href="global.html#findPos">findPos</a></li><li><a href="global.html#formatValueFormatthenumericvalueasastring.Thisisusedafterincrementing/decrementingthevaluetoreformatthevalueasastring.">formatValue Format the numeric value as a string. This is used after incrementing/decrementing the value to reformat the value as a string.</a></li><li><a href="global.html#get">get</a></li><li><a href="global.html#getClosest">getClosest</a></li><li><a href="global.html#getParents">getParents</a></li><li><a href="global.html#init">init</a></li><li><a href="global.html#inputsize">inputsize</a></li><li><a href="global.html#isNullish">isNullish</a></li><li><a href="global.html#loadloadConfig">load load Config</a></li><li><a href="global.html#loadFromURLLoadconfig/datafromURLifgiven">loadFromURL Load config/data from URL if given</a></li><li><a href="global.html#name">name</a></li><li><a href="global.html#observedAttributes">observedAttributes</a></li><li><a href="global.html#parseValue">parseValue</a></li><li><a href="global.html#pref">pref</a></li><li><a href="global.html#processResults">processResults</a></li><li><a href="global.html#readySignal">readySignal</a></li><li><a href="global.html#regexEscape">regexEscape</a></li><li><a href="global.html#removeStoragePrefCookie">removeStoragePrefCookie</a></li><li><a href="global.html#replaceStoragePrompt">replaceStoragePrompt</a></li><li><a href="global.html#set">set</a></li><li><a href="global.html#setupCurConfig">setupCurConfig</a></li><li><a href="global.html#setupCurPrefs">setupCurPrefs</a></li><li><a href="global.html#src">src</a></li><li><a href="global.html#stateEffects">stateEffects</a></li><li><a href="global.html#stepDown">stepDown</a></li><li><a href="global.html#stepUp">stepUp</a></li><li><a href="global.html#touchHandler">touchHandler</a></li><li><a href="global.html#updateLib">updateLib</a></li><li><a href="global.html#value">value</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Mon Nov 08 2021 09:47:00 GMT+0100 (Central European Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>