This commit is contained in:
Alexander Zinchuk 2021-08-05 17:12:44 +03:00
parent 2feae100ba
commit 6fa1194bd3

View File

@ -40,6 +40,7 @@ const TEXT_FORMAT_BY_TAG_NAME: Record<string, keyof ISelectedTextFormats> = {
DEL: 'strikethrough', DEL: 'strikethrough',
CODE: 'monospace', CODE: 'monospace',
}; };
const fragmentEl = document.createElement('div');
const TextFormatter: FC<OwnProps> = ({ const TextFormatter: FC<OwnProps> = ({
isOpen, isOpen,
@ -117,8 +118,9 @@ const TextFormatter: FC<OwnProps> = ({
if (!selectedRange) { if (!selectedRange) {
return undefined; return undefined;
} }
fragmentEl.innerText = selectedRange.toString();
return selectedRange.toString(); return fragmentEl.innerHTML;
}, [selectedRange]); }, [selectedRange]);
const getSelectedElement = useCallback(() => { const getSelectedElement = useCallback(() => {