From 64cffe647720684caea9c5dc54dc328d4dc3e51c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 9 Jan 2022 21:19:18 -0800 Subject: [PATCH] fix: Remove usage of direct HTML access --- app/components/ContentEditable.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/components/ContentEditable.tsx b/app/components/ContentEditable.tsx index 21ad646d31c8..1ec8e4d58ec3 100644 --- a/app/components/ContentEditable.tsx +++ b/app/components/ContentEditable.tsx @@ -42,7 +42,7 @@ const ContentEditable = React.forwardRef( ) => { const innerRef = React.useRef(null); const ref = forwardedRef || innerRef; - const [innerHTML, setInnerHTML] = React.useState(value); + const [innerValue, setInnerValue] = React.useState(value); const lastValue = React.useRef(""); const wrappedEvent = ( @@ -75,7 +75,7 @@ const ContentEditable = React.forwardRef( React.useEffect(() => { if (value !== ref.current?.innerText) { - setInnerHTML(value); + setInnerValue(value); } }, [value, ref]); @@ -88,12 +88,12 @@ const ContentEditable = React.forwardRef( onBlur={wrappedEvent(onBlur)} onKeyDown={wrappedEvent(onKeyDown)} data-placeholder={placeholder} + suppressContentEditableWarning role="textbox" - dangerouslySetInnerHTML={{ - __html: innerHTML, - }} {...rest} - /> + > + {innerValue} + {children} );