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',
CODE: 'monospace',
};
const fragmentEl = document.createElement('div');
const TextFormatter: FC<OwnProps> = ({
isOpen,
@ -117,8 +118,9 @@ const TextFormatter: FC<OwnProps> = ({
if (!selectedRange) {
return undefined;
}
fragmentEl.innerText = selectedRange.toString();
return selectedRange.toString();
return fragmentEl.innerHTML;
}, [selectedRange]);
const getSelectedElement = useCallback(() => {