#99 component also load dynamic changes

This commit is contained in:
Agriya Dev5
2021-05-19 19:12:02 +05:30
parent 7b6a7d6594
commit 1ebae7c724
4 changed files with 7 additions and 12 deletions

View File

@@ -111,16 +111,6 @@ class Editor extends EditorStartup {
this.layersPanel = new LayersPanel(this); this.layersPanel = new LayersPanel(this);
this.mainMenu = new MainMenu(this); this.mainMenu = new MainMenu(this);
window.svgEditor = this; window.svgEditor = this;
this.loadComponentAndDialog();
}
/**
* @returns {void}
*/
async loadComponentAndDialog() {
// eslint-disable-next-line no-unsanitized/method
// await import(`./components/index.js`);
// eslint-disable-next-line no-unsanitized/method
await import(`./dialogs/index.js`);
} }
/** /**
* *

View File

@@ -68,6 +68,10 @@ class EditorStartup {
const self = this; const self = this;
const { i18next } = await putLocale(this.configObj.pref('lang'), this.goodLangs); const { i18next } = await putLocale(this.configObj.pref('lang'), this.goodLangs);
this.i18next = i18next; this.i18next = i18next;
// eslint-disable-next-line no-unsanitized/method
await import(`./components/index.js`);
// eslint-disable-next-line no-unsanitized/method
await import(`./dialogs/index.js`);
// allow to prepare the dom without display // allow to prepare the dom without display
this.$svgEditor.style.visibility = 'hidden'; this.$svgEditor.style.visibility = 'hidden';
try { try {

View File

@@ -1,4 +1,5 @@
/* eslint-disable max-len */ /* eslint-disable max-len */
/* globals svgEditor */
const palette = [ const palette = [
// Todo: Make into configuration item? // Todo: Make into configuration item?
'none', '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', 'none', '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff',
@@ -14,6 +15,7 @@ const palette = [
]; ];
const template = document.createElement('template'); const template = document.createElement('template');
// eslint-disable-next-line no-unsanitized/property
template.innerHTML = ` template.innerHTML = `
<style> <style>
.square { .square {
@@ -76,7 +78,7 @@ template.innerHTML = `
} }
} }
</style> </style>
<div id="palette_holder" title="Click to change fill color, shift-click to change stroke color"> <div id="palette_holder" title="${svgEditor.i18next.t('ui.palette_info')}">
<div id="js-se-palette"> <div id="js-se-palette">
</div> </div>
</div> </div>

View File

@@ -5,7 +5,6 @@ For default config and extensions (and available options) available to
*/ */
import './jquery.min.js'; import './jquery.min.js';
import './components/index.js';
import Editor from './Editor.js'; import Editor from './Editor.js';
const svgEditor = new Editor(); const svgEditor = new Editor();