From 6fa1194bd37583939c067e9f5389631a7138f1b4 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 5 Aug 2021 17:12:44 +0300 Subject: [PATCH] Follow-up (#1361) --- src/components/middle/composer/TextFormatter.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/middle/composer/TextFormatter.tsx b/src/components/middle/composer/TextFormatter.tsx index e269f364..114ac10f 100644 --- a/src/components/middle/composer/TextFormatter.tsx +++ b/src/components/middle/composer/TextFormatter.tsx @@ -40,6 +40,7 @@ const TEXT_FORMAT_BY_TAG_NAME: Record = { DEL: 'strikethrough', CODE: 'monospace', }; +const fragmentEl = document.createElement('div'); const TextFormatter: FC = ({ isOpen, @@ -117,8 +118,9 @@ const TextFormatter: FC = ({ if (!selectedRange) { return undefined; } + fragmentEl.innerText = selectedRange.toString(); - return selectedRange.toString(); + return fragmentEl.innerHTML; }, [selectedRange]); const getSelectedElement = useCallback(() => {