@@ -46,7 +46,7 @@ import {
4646
4747export const CustomEditor = {
4848 // Get the text content of a block node, including the text content of its children and formula nodes
49- getBlockTextContent ( node : Node , depth : number = Infinity ) : string {
49+ getBlockTextContent ( node : Node , depth : number = Infinity ) : string {
5050 if ( Text . isText ( node ) ) {
5151 if ( node . formula ) {
5252 return node . formula ;
@@ -77,7 +77,7 @@ export const CustomEditor = {
7777 . join ( '' ) ;
7878 } ,
7979
80- setBlockData < T = BlockData > ( editor : YjsEditor , blockId : string , updateData : T , select ?: boolean ) {
80+ setBlockData < T = BlockData > ( editor : YjsEditor , blockId : string , updateData : T , select ?: boolean ) {
8181
8282 if ( editor . readOnly ) {
8383 return ;
@@ -118,7 +118,7 @@ export const CustomEditor = {
118118
119119 } ,
120120 // Insert break line at the specified path
121- insertBreak ( editor : YjsEditor , at ?: BaseRange ) {
121+ insertBreak ( editor : YjsEditor , at ?: BaseRange ) {
122122 const sharedRoot = getSharedRoot ( editor ) ;
123123 const newAt = getSelectionOrThrow ( editor , at ) ;
124124
@@ -132,7 +132,7 @@ export const CustomEditor = {
132132
133133 } ,
134134
135- deleteBlockBackward ( editor : YjsEditor , at ?: BaseRange ) {
135+ deleteBlockBackward ( editor : YjsEditor , at ?: BaseRange ) {
136136 console . trace ( 'deleteBlockBackward' , editor . selection , at ) ;
137137
138138 const sharedRoot = getSharedRoot ( editor ) ;
@@ -172,7 +172,7 @@ export const CustomEditor = {
172172 }
173173 } ,
174174
175- deleteBlockForward ( editor : YjsEditor , at ?: BaseRange ) {
175+ deleteBlockForward ( editor : YjsEditor , at ?: BaseRange ) {
176176 const sharedRoot = getSharedRoot ( editor ) ;
177177 const newAt = getSelectionOrThrow ( editor , at ) ;
178178
@@ -192,15 +192,15 @@ export const CustomEditor = {
192192 }
193193 } ,
194194
195- deleteEntireDocument ( editor : YjsEditor ) {
195+ deleteEntireDocument ( editor : YjsEditor ) {
196196 handleDeleteEntireDocumentWithTxn ( editor ) ;
197197 } ,
198198
199- removeRange ( editor : YjsEditor , at : BaseRange ) {
199+ removeRange ( editor : YjsEditor , at : BaseRange ) {
200200 removeRangeWithTxn ( editor , getSharedRoot ( editor ) , at ) ;
201201 } ,
202202
203- tabEvent ( editor : YjsEditor , event : KeyboardEvent ) {
203+ tabEvent ( editor : YjsEditor , event : KeyboardEvent ) {
204204 const type = event . shiftKey ? 'tabBackward' : 'tabForward' ;
205205 const sharedRoot = getSharedRoot ( editor ) ;
206206 const { selection } = editor ;
@@ -286,7 +286,7 @@ export const CustomEditor = {
286286 } ) ;
287287 } ,
288288
289- toggleToggleList ( editor : YjsEditor , blockId : string ) {
289+ toggleToggleList ( editor : YjsEditor , blockId : string ) {
290290 const sharedRoot = getSharedRoot ( editor ) ;
291291 const data = dataStringTOJson ( getBlock ( blockId , sharedRoot ) . get ( YjsEditorKey . block_data ) ) as ToggleListBlockData ;
292292 const { selection } = editor ;
@@ -310,7 +310,7 @@ export const CustomEditor = {
310310 } , selected ) ;
311311 } ,
312312
313- toggleTodoList ( editor : YjsEditor , blockId : string , shiftKey : boolean ) {
313+ toggleTodoList ( editor : YjsEditor , blockId : string , shiftKey : boolean ) {
314314 const sharedRoot = getSharedRoot ( editor ) ;
315315 const block = getBlock ( blockId , sharedRoot ) ;
316316 const data = dataStringTOJson ( block . get ( YjsEditorKey . block_data ) ) as TodoListBlockData ;
@@ -344,7 +344,7 @@ export const CustomEditor = {
344344 } ) ;
345345 } ,
346346
347- toggleMark ( editor : ReactEditor , {
347+ toggleMark ( editor : ReactEditor , {
348348 key, value,
349349 } : {
350350 key : EditorMarkFormat , value : boolean | string
@@ -358,23 +358,23 @@ export const CustomEditor = {
358358 }
359359 } ,
360360
361- getTextNodes ( editor : ReactEditor ) {
361+ getTextNodes ( editor : ReactEditor ) {
362362 return getSelectionTexts ( editor ) ;
363363 } ,
364364
365- addMark ( editor : ReactEditor , {
365+ addMark ( editor : ReactEditor , {
366366 key, value,
367367 } : {
368368 key : EditorMarkFormat , value : boolean | string | Mention
369369 } ) {
370370 editor . addMark ( key , value ) ;
371371 } ,
372372
373- removeMark ( editor : ReactEditor , key : EditorMarkFormat ) {
373+ removeMark ( editor : ReactEditor , key : EditorMarkFormat ) {
374374 editor . removeMark ( key ) ;
375375 } ,
376376
377- turnToBlock < T extends BlockData > ( editor : YjsEditor , blockId : string , type : BlockType , data : T ) {
377+ turnToBlock < T extends BlockData > ( editor : YjsEditor , blockId : string , type : BlockType , data : T ) {
378378 const operations : ( ( ) => void ) [ ] = [ ] ;
379379 const sharedRoot = getSharedRoot ( editor ) ;
380380 const sourceBlock = getBlock ( blockId , sharedRoot ) ;
@@ -395,7 +395,7 @@ export const CustomEditor = {
395395 return newBlockId ;
396396 } ,
397397
398- isBlockActive ( editor : YjsEditor , type : BlockType ) {
398+ isBlockActive ( editor : YjsEditor , type : BlockType ) {
399399 try {
400400 const [ node ] = getBlockEntry ( editor ) ;
401401
@@ -405,7 +405,7 @@ export const CustomEditor = {
405405 }
406406 } ,
407407
408- hasMark ( editor : ReactEditor , key : string ) {
408+ hasMark ( editor : ReactEditor , key : string ) {
409409 const selection = editor . selection ;
410410
411411 if ( ! selection ) return false ;
@@ -429,7 +429,7 @@ export const CustomEditor = {
429429 return marks ? ! ! marks [ key ] : false ;
430430 } ,
431431
432- getAllMarks ( editor : ReactEditor ) {
432+ getAllMarks ( editor : ReactEditor ) {
433433 const selection = editor . selection ;
434434
435435 if ( ! selection ) return [ ] ;
@@ -452,7 +452,7 @@ export const CustomEditor = {
452452 return [ marks ] ;
453453 } ,
454454
455- isMarkActive ( editor : ReactEditor , key : string ) {
455+ isMarkActive ( editor : ReactEditor , key : string ) {
456456 const selection = editor . selection ;
457457
458458 if ( ! selection ) return false ;
@@ -476,7 +476,7 @@ export const CustomEditor = {
476476 return marks ? ! ! marks [ key ] : false ;
477477 } ,
478478
479- addChildBlock ( editor : YjsEditor , blockId : string , type : BlockType , data : BlockData ) {
479+ addChildBlock ( editor : YjsEditor , blockId : string , type : BlockType , data : BlockData ) {
480480 const sharedRoot = getSharedRoot ( editor ) ;
481481 const parent = getBlock ( blockId , sharedRoot ) ;
482482
@@ -510,7 +510,7 @@ export const CustomEditor = {
510510 }
511511 } ,
512512
513- addBlock ( editor : YjsEditor , blockId : string , direction : 'below' | 'above' , type : BlockType , data : BlockData ) {
513+ addBlock ( editor : YjsEditor , blockId : string , direction : 'below' | 'above' , type : BlockType , data : BlockData ) {
514514 const parent = getParent ( blockId , editor . sharedRoot ) ;
515515 const index = getBlockIndex ( blockId , editor . sharedRoot ) ;
516516
@@ -540,15 +540,15 @@ export const CustomEditor = {
540540 }
541541 } ,
542542
543- addBelowBlock ( editor : YjsEditor , blockId : string , type : BlockType , data : BlockData ) {
543+ addBelowBlock ( editor : YjsEditor , blockId : string , type : BlockType , data : BlockData ) {
544544 return CustomEditor . addBlock ( editor , blockId , 'below' , type , data ) ;
545545 } ,
546546
547- addAboveBlock ( editor : YjsEditor , blockId : string , type : BlockType , data : BlockData ) {
547+ addAboveBlock ( editor : YjsEditor , blockId : string , type : BlockType , data : BlockData ) {
548548 return CustomEditor . addBlock ( editor , blockId , 'above' , type , data ) ;
549549 } ,
550550
551- deleteBlock ( editor : YjsEditor , blockId : string ) {
551+ deleteBlock ( editor : YjsEditor , blockId : string ) {
552552 const sharedRoot = getSharedRoot ( editor ) ;
553553 const parent = getParent ( blockId , sharedRoot ) ;
554554
@@ -601,7 +601,7 @@ export const CustomEditor = {
601601 ReactEditor . focus ( editor ) ;
602602 } ,
603603
604- duplicateBlock ( editor : YjsEditor , blockId : string , prevId ?: string ) {
604+ duplicateBlock ( editor : YjsEditor , blockId : string , prevId ?: string ) {
605605 const sharedRoot = getSharedRoot ( editor ) ;
606606 const block = getBlock ( blockId , sharedRoot ) ;
607607
@@ -631,7 +631,7 @@ export const CustomEditor = {
631631 return newBlockId ;
632632 } ,
633633
634- pastedText ( editor : YjsEditor , text : string ) {
634+ pastedText ( editor : YjsEditor , text : string ) {
635635 if ( ! beforePasted ( editor ) )
636636 return ;
637637
@@ -640,7 +640,7 @@ export const CustomEditor = {
640640 Transforms . insertNodes ( editor , { text } , { at : point , select : true , voids : false } ) ;
641641 } ,
642642
643- highlight ( editor : ReactEditor ) {
643+ highlight ( editor : ReactEditor ) {
644644 const selection = editor . selection ;
645645
646646 if ( ! selection ) return ;
0 commit comments