@cdc/editor 4.23.11 → 4.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/editor",
3
- "version": "4.23.11",
3
+ "version": "4.24.1",
4
4
  "description": "React component for generating a new component entry",
5
5
  "moduleName": "CdcEditor",
6
6
  "main": "dist/cdceditor",
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@cdc/chart": "^4.23.11",
28
- "@cdc/core": "^4.23.11",
29
- "@cdc/dashboard": "^4.23.11",
30
- "@cdc/data-bite": "^4.23.11",
31
- "@cdc/map": "^4.23.11",
32
- "@cdc/markup-include": "^4.23.11",
33
- "@cdc/waffle-chart": "^4.23.11",
27
+ "@cdc/chart": "^4.24.1",
28
+ "@cdc/core": "^4.24.1",
29
+ "@cdc/dashboard": "^4.24.1",
30
+ "@cdc/data-bite": "^4.24.1",
31
+ "@cdc/map": "^4.24.1",
32
+ "@cdc/markup-include": "^4.24.1",
33
+ "@cdc/waffle-chart": "^4.24.1",
34
34
  "axios": "^1.6.0",
35
35
  "d3": "^7.0.0",
36
36
  "html-react-parser": "^3.0.8",
@@ -43,5 +43,5 @@
43
43
  "react": "^18.2.0",
44
44
  "react-dom": "^18.2.0"
45
45
  },
46
- "gitHead": "ecad213667a3cb96c921eaddba43a31c84caaa08"
46
+ "gitHead": "a352a3f74f4b681191e3244061dbb3621f36eec3"
47
47
  }
package/src/CdcEditor.jsx CHANGED
@@ -24,6 +24,11 @@ export default function CdcEditor({ config: configObj = { newViz: true }, hostna
24
24
  const [tempConfig, setTempConfig] = useState(null)
25
25
  const [errors, setErrors] = useState([])
26
26
 
27
+ const setTempConfigAndUpdate = config => {
28
+ updateVizConfig(JSON.parse(JSON.stringify(config)))
29
+ setTempConfig(config)
30
+ }
31
+
27
32
  const [currentViewport, setCurrentViewport] = useState('lg')
28
33
  const [dimensions, setDimensions] = useState([])
29
34
 
@@ -127,18 +132,22 @@ export default function CdcEditor({ config: configObj = { newViz: true }, hostna
127
132
  return strippedConfig
128
133
  }
129
134
 
130
- // Temp Config is for changes made in the components proper - to prevent render cycles. Regular config is for changes made in the first two tabs.
131
- useEffect(() => {
132
- if (null !== tempConfig) {
135
+ const updateVizConfig = newTempConfig => {
136
+ if (null !== newTempConfig) {
133
137
  // Remove runtime/unnecessary items from config before saving to WCMS, performance optimization
134
- let strippedConfig = stripConfig(tempConfig)
138
+ let strippedConfig = stripConfig(newTempConfig)
135
139
 
136
140
  const parsedData = JSON.stringify(strippedConfig)
137
141
  // Emit the data in a regular JS event so it can be consumed by anything.
138
142
  const event = new CustomEvent('updateVizConfig', { detail: parsedData, bubbles: true })
139
143
  window.dispatchEvent(event)
140
144
  }
141
- }, [tempConfig])
145
+ }
146
+
147
+ // Temp Config is for changes made in the components proper - to prevent render cycles. Regular config is for changes made in the first two tabs.
148
+ useEffect(() => {
149
+ updateVizConfig(tempConfig)
150
+ }, [JSON.stringify(tempConfig)])
142
151
 
143
152
  useEffect(() => {
144
153
  let strippedConfig = stripConfig(config)
@@ -180,7 +189,7 @@ export default function CdcEditor({ config: configObj = { newViz: true }, hostna
180
189
  globalActive,
181
190
  setGlobalActive,
182
191
  tempConfig,
183
- setTempConfig,
192
+ setTempConfig: setTempConfigAndUpdate,
184
193
  sharepath,
185
194
  isDebug
186
195
  }