File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -555,12 +555,17 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
555
555
// https://github.com/siyuan-note/siyuan/issues/5185
556
556
if ( range . startOffset === 0 && range . startContainer . nodeType === 3 ) {
557
557
const previousSibling = hasPreviousSibling ( range . startContainer ) as HTMLElement ;
558
- if ( previousSibling && previousSibling . nodeType !== 3 && previousSibling . getAttribute ( "data-type" ) . indexOf ( "inline-math" ) > - 1 ) {
558
+ if ( previousSibling &&
559
+ previousSibling . nodeType !== 3 &&
560
+ previousSibling . getAttribute ( "data-type" ) ?. indexOf ( "inline-math" ) > - 1
561
+ ) {
559
562
protyle . toolbar . showRender ( protyle , previousSibling ) ;
560
563
return ;
561
564
} else if ( ! previousSibling &&
562
- range . startContainer . parentElement . previousSibling && range . startContainer . parentElement . previousSibling . isSameNode ( range . startContainer . parentElement . previousElementSibling ) &&
563
- range . startContainer . parentElement . previousElementSibling . getAttribute ( "data-type" ) . indexOf ( "inline-math" ) > - 1 ) {
565
+ range . startContainer . parentElement . previousSibling &&
566
+ range . startContainer . parentElement . previousSibling . isSameNode ( range . startContainer . parentElement . previousElementSibling ) &&
567
+ range . startContainer . parentElement . previousElementSibling . getAttribute ( "data-type" ) ?. indexOf ( "inline-math" ) > - 1
568
+ ) {
564
569
protyle . toolbar . showRender ( protyle , range . startContainer . parentElement . previousElementSibling ) ;
565
570
return ;
566
571
}
You can’t perform that action at this time.
0 commit comments