Add ext path to config (#815)
* Add extPath to config object * Update ext-shapes.js * Update EditorStartup.js * Fix linter issue * Update EditorStartup.jsmaster
parent
cdc85a515b
commit
6d804f2fb9
|
@ -132,6 +132,7 @@ export default class ConfigObj {
|
|||
// PATH CONFIGURATION
|
||||
// The following path configuration items are disallowed in the URL (as should any future path configurations)
|
||||
imgPath: './images',
|
||||
extPath: './extensions',
|
||||
// DOCUMENT PROPERTIES
|
||||
// Change the following to a preference (already in the Document Properties dialog)?
|
||||
dimensions: [640, 480],
|
||||
|
|
|
@ -628,7 +628,8 @@ class EditorStartup {
|
|||
/**
|
||||
* @type {module:SVGthis.ExtensionObject}
|
||||
*/
|
||||
const imported = await import(`./extensions/${encodeURIComponent(extname)}/${encodeURIComponent(extname)}.js`)
|
||||
const extPath = this.configObj.curConfig.extPath
|
||||
const imported = await import(`${extPath}/${encodeURIComponent(extname)}/${encodeURIComponent(extname)}.js`)
|
||||
const { name = extname, init: initfn } = imported.default
|
||||
return this.addExtension(name, (initfn && initfn.bind(this)), { langParam: 'en' }) /** @todo change to current lng */
|
||||
} catch (err) {
|
||||
|
|
|
@ -40,8 +40,9 @@ export default {
|
|||
return {
|
||||
callback () {
|
||||
if ($id('tool_shapelib') === null) {
|
||||
const extPath = svgEditor.configObj.curConfig.extPath
|
||||
const buttonTemplate = `
|
||||
<se-explorerbutton id="tool_shapelib" title="${svgEditor.i18next.t(`${name}:buttons.0.title`)}" lib="./extensions/ext-shapes/shapelib/"
|
||||
<se-explorerbutton id="tool_shapelib" title="${svgEditor.i18next.t(`${name}:buttons.0.title`)}" lib="${extPath}/ext-shapes/shapelib/"
|
||||
src="shapelib.svg"></se-explorerbutton>
|
||||
`
|
||||
canv.insertChildAtIndex($id('tools_left'), buttonTemplate, 9)
|
||||
|
|
Loading…
Reference in New Issue