blockly-fluid 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -61,8 +61,10 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
61
61
  if (typeof input.default === "function") (input.default = input.default());
62
62
  if (typeof input.options === "function") (input.options = input.options());
63
63
 
64
- if (!Blocks[`shadow_dropdown_${token}`]) {
65
- Blocks[`shadow_dropdown_${token}`] = {
64
+ const shadowDropdownName = `shadow_dropdown_${name.length}_${name}_${token.length}_${token}`;
65
+
66
+ if (!Blocks[shadowDropdownName]) {
67
+ Blocks[shadowDropdownName] = {
66
68
  layout: "DROPDOWN",
67
69
  fields: {
68
70
  DROPDOWN: {
@@ -81,14 +83,16 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
81
83
  };
82
84
  };
83
85
 
84
- valueInput.connection.setShadowDom(new DOMParser().parseFromString(`<shadow type="shadow_dropdown_${escapeXml(token)}}"></shadow>`, "text/xml").firstChild);
86
+ valueInput.connection.setShadowDom(new DOMParser().parseFromString(`<shadow type="${escapeXml(shadowDropdownName)}}"></shadow>`, "text/xml").firstChild);
85
87
  };
86
88
 
87
89
  if (input.variable) {
88
90
  if (typeof input.variable === "function") (input.variable = input.variable());
89
91
 
90
- if (!Blocks[`shadow_variable_${token}`]) {
91
- Blocks[`shadow_variable_${token}`] = {
92
+ const shadowVariableName = `shadow_variable_${name.length}_${name}_${token.length}_${token}`;
93
+
94
+ if (!Blocks[shadowVariableName]) {
95
+ Blocks[shadowVariableName] = {
92
96
  layout: "VARIABLE",
93
97
  fields: {
94
98
  VARIABLE: {
@@ -105,7 +109,7 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
105
109
  };
106
110
  };
107
111
 
108
- valueInput.connection.setShadowDom(new DOMParser().parseFromString(`<shadow type="shadow_variable_${escapeXml(token)}"><field name="VARIABLE">${input.variable}</field></shadow>`, "text/xml").firstChild);
112
+ valueInput.connection.setShadowDom(new DOMParser().parseFromString(`<shadow type="${escapeXml(shadowVariableName)}"><field name="VARIABLE">${input.variable}</field></shadow>`, "text/xml").firstChild);
109
113
  };
110
114
 
111
115
  if (input.shadow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly-fluid",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A flexible proxy wrapper for Blockly blocks.",
5
5
  "main": "index.js",
6
6
  "scripts": {