store
2 months ago
GenerateBgImage.js
2 months ago
block-duplicate-helper.js
2 months ago
capitalize.js
2 months ago
color-code-to-class.js
2 months ago
color-slug-to-color-code.js
2 months ago
common.scss
2 weeks ago
convert-to-grid.js
2 months ago
default-color-palette.js
2 months ago
delete-from-array.js
2 months ago
depModules.js
2 months ago
disable-links.js
2 weeks ago
empty-string-to-undefined.js
2 months ago
example-data.js
2 months ago
fixBrokenUnicode.js
2 months ago
font-awesome-new.js
2 weeks ago
font-awesome-version.js
2 months ago
font-awesome.js
2 months ago
formatNumCol.js
2 months ago
gradient-slug-to-gradient-code.js
2 months ago
heading-level-utils.js
2 months ago
hex-to-rgba.js
2 months ago
horizontal-scroll-controls.js
2 months ago
icon-label.js
2 weeks ago
is-excludes-blocks.js
2 months ago
is-gradient-style.js
2 months ago
is-hex-color.js
2 months ago
is-not-json.js
2 months ago
is-parent-reusable-block.js
21 hours ago
merge-colors.js
2 months ago
multi-array-flaten.js
2 months ago
removeProperty.js
2 months ago
replaceClientId.js
2 months ago
sanitizeSlug.js
2 months ago
settings-page-url.js
2 weeks ago
strip-html.js
2 months ago
taxonomy-utils.js
2 months ago
to-number.js
2 months ago
to-preset-spacing-var.js
2 months ago
unit-options.js
2 months ago
wrap-unwrap.js
2 months ago
fixBrokenUnicode.js
22 lines
| 1 | export const isValidJson = (value) => { |
| 2 | try { |
| 3 | JSON.parse(value); |
| 4 | } catch (e) { |
| 5 | return false; |
| 6 | } |
| 7 | return true; |
| 8 | }; |
| 9 | |
| 10 | export const fixBrokenUnicode = (text) => { |
| 11 | if (!text || typeof text !== 'string') { |
| 12 | return text; |
| 13 | } |
| 14 | if (!isValidJson(text)) { |
| 15 | text = text.replace(/u003c/g, '<'); |
| 16 | text = text.replace(/u003e/g, '>'); |
| 17 | text = text.replace(/u0022/g, '"'); |
| 18 | } |
| 19 | |
| 20 | return text; |
| 21 | }; |
| 22 |