Skip to content

Commit 8e097e1

Browse files
committed
improve code to check/addition of intent class name
1 parent bb7028e commit 8e097e1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/extensions/codemirror/CodeMirror.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ export const CodeEditor = ({
304304
if (onSelection)
305305
onSelection(v.state.selection.ranges.filter((r) => !r.empty).map(({ from, to }) => ({ from, to })));
306306

307-
if (onFocusChange && intent && !v.view.dom.className?.includes(`${eccgui}-intent--${intent}`)) {
308-
v.view.dom.className += ` ${eccgui}-intent--${intent}`;
307+
if (onFocusChange && intent && !v.view.dom.classList?.contains(`${eccgui}-intent--${intent}`)) {
308+
v.view.dom.classList.add(`${eccgui}-intent--${intent}`);
309309
}
310310

311311
if (onCursorChange) {

0 commit comments

Comments
 (0)