Skip to content

Commit

Permalink
fix(QEditor): Guard against null ref (quasarframework#13020)
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosPaunovic authored Apr 1, 2022
1 parent 7f8f0f7 commit 49bb623
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ui/src/components/editor/QEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,14 @@ export default createComponent({
}

function onFocusin (e) {
const root = rootRef.value

if (
rootRef.value.contains(e.target) === true
root !== null
&& root.contains(e.target) === true
&& (
e.relatedTarget === null
|| rootRef.value.contains(e.relatedTarget) !== true
|| root.contains(e.relatedTarget) !== true
)
) {
const prop = `inner${ isViewingSource.value === true ? 'Text' : 'HTML' }`
Expand All @@ -382,11 +385,14 @@ export default createComponent({
}

function onFocusout (e) {
const root = rootRef.value

if (
rootRef.value.contains(e.target) === true
root !== null
&& root.contains(e.target) === true
&& (
e.relatedTarget === null
|| rootRef.value.contains(e.relatedTarget) !== true
|| root.contains(e.relatedTarget) !== true
)
) {
eVm.caret.savePosition()
Expand Down

0 comments on commit 49bb623

Please sign in to comment.