File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -467,21 +467,28 @@ class SvgHighlighter extends AbstractHighlighter {
467467 */
468468 public unhighlightNode ( info : Highlight ) {
469469 const node = info . node ;
470- const previous = node . previousSibling as HTMLElement ;
471470 if ( node . hasAttribute ( 'data-sre-highlighter-bbox' ) ) {
472471 node . remove ( ) ;
473472 return ;
474473 }
475- node . removeAttribute ( 'data-mjx-enclosed' ) ;
476- if ( previous && previous . hasAttribute ( 'data-sre-highlighter-added ' ) ) {
477- info . foreground
478- ? node . setAttribute ( 'fill' , info . foreground )
479- : node . removeAttribute ( 'fill ' ) ;
480- previous . remove ( ) ;
474+ if ( node . tagName === 'svg' || node . tagName === 'MJX-CONTAINER' ) {
475+ if ( ! node . hasAttribute ( 'data-mjx-enclosed ' ) ) {
476+ node . style . backgroundColor = info . background ;
477+ }
478+ node . removeAttribute ( 'data-mjx-enclosed ' ) ;
479+ node . style . color = info . foreground ;
481480 return ;
482481 }
483- node . style . backgroundColor = info . background ;
484- node . style . color = info . foreground ;
482+ const previous = node . previousSibling as HTMLElement ;
483+ if ( previous ?. hasAttribute ( 'data-sre-highlighter-added' ) ) {
484+ previous . remove ( ) ;
485+ }
486+ node . removeAttribute ( 'data-mjx-enclosed' ) ;
487+ if ( info . foreground ) {
488+ node . setAttribute ( 'fill' , info . foreground ) ;
489+ } else {
490+ node . removeAttribute ( 'fill' ) ;
491+ }
485492 }
486493
487494 /**
Original file line number Diff line number Diff line change @@ -1023,7 +1023,7 @@ export class SpeechExplorer
10231023 this . current = node ;
10241024 this . currentMark = - 1 ;
10251025 if ( this . current ) {
1026- const parts = this . getSplitNodes ( this . current ) ;
1026+ const parts = [ ... this . getSplitNodes ( this . current ) ] ;
10271027 this . highlighter . encloseNodes ( parts , this . node ) ;
10281028 for ( const part of parts ) {
10291029 if ( ! part . getAttribute ( 'data-mjx-enclosed' ) ) {
You can’t perform that action at this time.
0 commit comments