diff --git a/src/editor/components/seExplorerButton.js b/src/editor/components/seExplorerButton.js
index a51d8721..07c04e9c 100644
--- a/src/editor/components/seExplorerButton.js
+++ b/src/editor/components/seExplorerButton.js
@@ -94,12 +94,10 @@ template.innerHTML = `
-
`;
@@ -118,15 +116,16 @@ export class ExplorerButton extends HTMLElement {
// locate the component
this.$button = this._shadowRoot.querySelector('.menu-button');
this.$overall = this._shadowRoot.querySelector('.overall');
- this.$img = this._shadowRoot.querySelector('img');
+ this.$img = this._shadowRoot.querySelector('.menu-button img');
this.$menu = this._shadowRoot.querySelector('.menu');
+ this.files = [];
}
/**
* @function observedAttributes
* @returns {any} observed
*/
static get observedAttributes () {
- return ['title', 'pressed', 'disabled'];
+ return ['title', 'pressed', 'disabled', 'lib'];
}
/**
* @function attributeChangedCallback
@@ -158,6 +157,29 @@ export class ExplorerButton extends HTMLElement {
this.$div.classList.remove('disabled');
}
break;
+ case 'lib':
+ {
+ // read the json containing the list of library files.
+ const request = new XMLHttpRequest();
+ request.open('GET', newValue, true);
+ request.addEventListener('load', (resp) => {
+ if (resp.target.status >= 200 && resp.target.status < 400) {
+ const json = JSON.parse(resp.target.response);
+ const {lib} = json;
+ // eslint-disable-next-line no-unsanitized/property
+ this.$menu.innerHTML = lib.map((menu) => (
+ ``
+ )).join('');
+ } else {
+ console.error(`could not read file:${newValue}`);
+ }
+ });
+ request.addEventListener('error', (error) => {
+ console.log(error);
+ });
+ request.send();
+ }
+ break;
default:
// eslint-disable-next-line no-console
console.error(`unknown attribute: ${name}`);
@@ -229,6 +251,7 @@ export class ExplorerButton extends HTMLElement {
console.log(ev);
switch (ev.target.nodeName) {
case 'SE-EXPLORERBUTTON':
+
this.$menu.classList.add('open');
break;
case 'SE-BUTTON':
diff --git a/src/editor/shapelib/animal.json b/src/editor/extensions/ext-shapes/shapelib/animal.json
similarity index 100%
rename from src/editor/shapelib/animal.json
rename to src/editor/extensions/ext-shapes/shapelib/animal.json
diff --git a/src/editor/shapelib/arrow.json b/src/editor/extensions/ext-shapes/shapelib/arrow.json
similarity index 100%
rename from src/editor/shapelib/arrow.json
rename to src/editor/extensions/ext-shapes/shapelib/arrow.json
diff --git a/src/editor/shapelib/dialog_balloon.json b/src/editor/extensions/ext-shapes/shapelib/dialog_balloon.json
similarity index 100%
rename from src/editor/shapelib/dialog_balloon.json
rename to src/editor/extensions/ext-shapes/shapelib/dialog_balloon.json
diff --git a/src/editor/shapelib/electronics.json b/src/editor/extensions/ext-shapes/shapelib/electronics.json
similarity index 100%
rename from src/editor/shapelib/electronics.json
rename to src/editor/extensions/ext-shapes/shapelib/electronics.json
diff --git a/src/editor/shapelib/flowchart.json b/src/editor/extensions/ext-shapes/shapelib/flowchart.json
similarity index 100%
rename from src/editor/shapelib/flowchart.json
rename to src/editor/extensions/ext-shapes/shapelib/flowchart.json
diff --git a/src/editor/shapelib/game.json b/src/editor/extensions/ext-shapes/shapelib/game.json
similarity index 100%
rename from src/editor/shapelib/game.json
rename to src/editor/extensions/ext-shapes/shapelib/game.json
diff --git a/src/editor/shapelib/license-MIT-raphael.txt b/src/editor/extensions/ext-shapes/shapelib/license-MIT-raphael.txt
similarity index 100%
rename from src/editor/shapelib/license-MIT-raphael.txt
rename to src/editor/extensions/ext-shapes/shapelib/license-MIT-raphael.txt
diff --git a/src/editor/shapelib/math.json b/src/editor/extensions/ext-shapes/shapelib/math.json
similarity index 100%
rename from src/editor/shapelib/math.json
rename to src/editor/extensions/ext-shapes/shapelib/math.json
diff --git a/src/editor/shapelib/misc.json b/src/editor/extensions/ext-shapes/shapelib/misc.json
similarity index 100%
rename from src/editor/shapelib/misc.json
rename to src/editor/extensions/ext-shapes/shapelib/misc.json
diff --git a/src/editor/shapelib/music.json b/src/editor/extensions/ext-shapes/shapelib/music.json
similarity index 100%
rename from src/editor/shapelib/music.json
rename to src/editor/extensions/ext-shapes/shapelib/music.json
diff --git a/src/editor/shapelib/object.json b/src/editor/extensions/ext-shapes/shapelib/object.json
similarity index 100%
rename from src/editor/shapelib/object.json
rename to src/editor/extensions/ext-shapes/shapelib/object.json
diff --git a/src/editor/shapelib/raphael_1.json b/src/editor/extensions/ext-shapes/shapelib/raphael_1.json
similarity index 100%
rename from src/editor/shapelib/raphael_1.json
rename to src/editor/extensions/ext-shapes/shapelib/raphael_1.json
diff --git a/src/editor/shapelib/raphael_2.json b/src/editor/extensions/ext-shapes/shapelib/raphael_2.json
similarity index 100%
rename from src/editor/shapelib/raphael_2.json
rename to src/editor/extensions/ext-shapes/shapelib/raphael_2.json
diff --git a/src/editor/extensions/ext-shapes/shapelib/shapelib.json b/src/editor/extensions/ext-shapes/shapelib/shapelib.json
new file mode 100644
index 00000000..3e1fe0da
--- /dev/null
+++ b/src/editor/extensions/ext-shapes/shapelib/shapelib.json
@@ -0,0 +1,7 @@
+{
+ "lib": [
+ "basic",
+ "animal",
+ "game"
+ ]
+}
\ No newline at end of file
diff --git a/src/editor/shapelib/symbol.json b/src/editor/extensions/ext-shapes/shapelib/symbol.json
similarity index 100%
rename from src/editor/shapelib/symbol.json
rename to src/editor/extensions/ext-shapes/shapelib/symbol.json
diff --git a/src/editor/index.html b/src/editor/index.html
index 82a665cf..b47994da 100644
--- a/src/editor/index.html
+++ b/src/editor/index.html
@@ -400,7 +400,7 @@
-
+