@cdc/markup-include 4.25.3-6 → 4.25.3
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/dist/cdcmarkupinclude.js +1850 -1844
- package/package.json +3 -3
- package/src/CdcMarkupInclude.tsx +9 -8
- package/src/components/EditorPanel.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/markup-include",
|
|
3
|
-
"version": "4.25.3
|
|
3
|
+
"version": "4.25.3",
|
|
4
4
|
"description": "React component for displaying HTML content from an outside link",
|
|
5
5
|
"moduleName": "CdcMarkupInclude",
|
|
6
6
|
"main": "dist/cdcmarkupinclude",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cdc/core": "^4.25.3
|
|
30
|
+
"@cdc/core": "^4.25.3",
|
|
31
31
|
"axios": "^1.6.0",
|
|
32
32
|
"chroma": "0.0.1",
|
|
33
33
|
"chroma-js": "^2.1.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-dom": "^18.2.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "b09566f5a7d57c8d0109e5f407257729d6b36846"
|
|
43
43
|
}
|
package/src/CdcMarkupInclude.tsx
CHANGED
|
@@ -75,7 +75,7 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
|
|
|
75
75
|
dispatch({ type: 'SET_CONFIG', payload: newConfig })
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const loadConfig =
|
|
78
|
+
const loadConfig = async () => {
|
|
79
79
|
let response = configObj || (await (await fetch(configUrl)).json())
|
|
80
80
|
let responseData = response.data ?? {}
|
|
81
81
|
|
|
@@ -89,7 +89,7 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
|
|
|
89
89
|
|
|
90
90
|
updateConfig({ ...configObj, ...processedConfig })
|
|
91
91
|
dispatch({ type: 'SET_LOADING', payload: false })
|
|
92
|
-
}
|
|
92
|
+
}
|
|
93
93
|
|
|
94
94
|
// Custom Functions
|
|
95
95
|
useEffect(() => {
|
|
@@ -116,7 +116,7 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
|
|
|
116
116
|
}
|
|
117
117
|
}, [markupError])
|
|
118
118
|
|
|
119
|
-
const loadConfigMarkupData =
|
|
119
|
+
const loadConfigMarkupData = async () => {
|
|
120
120
|
dispatch({ type: 'SET_MARKUP_ERROR', payload: null })
|
|
121
121
|
|
|
122
122
|
if (srcUrl) {
|
|
@@ -147,7 +147,7 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
|
|
|
147
147
|
} else {
|
|
148
148
|
dispatch({ type: 'SET_URL_MARKUP', payload: '' })
|
|
149
149
|
}
|
|
150
|
-
}
|
|
150
|
+
}
|
|
151
151
|
|
|
152
152
|
const filterOutConditions = (workingData, conditionList) => {
|
|
153
153
|
const { columnName, isOrIsNotEqualTo, value } = conditionList[0]
|
|
@@ -212,11 +212,12 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
|
|
|
212
212
|
let parse
|
|
213
213
|
let hasBody = false
|
|
214
214
|
if (markup && markup !== '' && markup !== null) {
|
|
215
|
-
|
|
215
|
+
const markupString = markup.toString()
|
|
216
|
+
if (markupString.match(/<body[^>]*>/i) && markupString.match(/<\/body\s*>/i)) {
|
|
216
217
|
hasBody = true
|
|
217
|
-
parse =
|
|
218
|
+
parse = markupString.match(/<body[^>]*>([^<]*(?:(?!<\/?body)<[^<]*)*)<\/body\s*>/i)
|
|
218
219
|
} else {
|
|
219
|
-
parse =
|
|
220
|
+
parse = markupString
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
|
|
@@ -239,7 +240,7 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
|
|
|
239
240
|
//Reload any functions when config is updated
|
|
240
241
|
useEffect(() => {
|
|
241
242
|
loadConfigMarkupData().catch(err => console.log(err))
|
|
242
|
-
}, [
|
|
243
|
+
}, [config])
|
|
243
244
|
|
|
244
245
|
let content = <Loading />
|
|
245
246
|
|