Skip to content

Commit

Permalink
Merge pull request #117 from CanopyTax/be-defensive-when-getting-html
Browse files Browse the repository at this point in the history
be defensive when getting html
  • Loading branch information
geoctrl authored Feb 15, 2023
2 parents e0105b9 + 7bcb46a commit 46a3d0d
Show file tree
Hide file tree
Showing 4 changed files with 1,170 additions and 1,784 deletions.
8 changes: 4 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
presets: [
["@babel/preset-env", {modules: false}],
"@babel/preset-react",
],
"presets": [
["@babel/preset-env", { "modules": false }],
"@babel/preset-react"
]
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bandicoot",
"version": "4.7.0",
"version": "4.7.1",
"description": "React rich text editor",
"main": "dist/bandicoot.umd.js",
"module": "dist/bandicoot.esm.js",
Expand Down Expand Up @@ -32,10 +32,10 @@
"react-dom": ">=16.8.0"
},
"devDependencies": {
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"@babel/cli": "^7.20.7",
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"browserslist-config-canopy": "^3.1.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
Expand Down
2 changes: 1 addition & 1 deletion src/rich-text-editor.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const RichTextEditor = forwardRef((props, editorRef) => {
}

function serialize() {
let html = divRef.current.innerHTML
let html = divRef?.current?.innerHTML || ''
if (richTextContext.numSerializers() > 0) {
const dom = new DOMParser().parseFromString(html, 'text/html')
html = richTextContext.serialize(dom.body)
Expand Down
Loading

0 comments on commit 46a3d0d

Please sign in to comment.