Skip to content

Commit ff37dbe

Browse files
committed
Update codeit-match-braces.js
1 parent 74e908c commit ff37dbe

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

lib/plugins/codeit-match-braces.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,23 @@
172172
brace.classList.remove('brace-active');
173173
});
174174

175-
if (window.getSelection().toString().length < 2) {
176-
177-
const cursor = cd.dropper.cursor();
178-
179-
if (cursor && cursor.in('brace')) {
180-
const currentBrace = cursor.getParent();
181-
182-
if (currentBrace.id) {
183-
currentBrace.classList.add('brace-active');
184-
getPartnerBrace(currentBrace).classList.add('brace-active');
175+
if (document.activeElement === cd) {
176+
177+
if (window.getSelection().toString().length < 2) {
178+
179+
const cursor = cd.dropper.cursor();
180+
181+
if (cursor && cursor.in('brace')) {
182+
const currentBrace = cursor.getParent();
183+
184+
if (currentBrace.id) {
185+
currentBrace.classList.add('brace-active');
186+
getPartnerBrace(currentBrace).classList.add('brace-active');
187+
}
185188
}
189+
186190
}
187-
191+
188192
}
189193

190194
});

0 commit comments

Comments
 (0)