File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -794,29 +794,31 @@ export class BlockNoteEditor<
794794 editor : this ,
795795 } ) ;
796796 if ( replaceWith ) {
797- const blockInfo = getBlockInfoFromTransaction (
798- state . tr ,
799- ) ;
797+ const cursorPosition =
798+ this . getTextCursorPosition ( ) ;
800799
801- // TODO this is weird, why do we need it?
802800 if (
803- blockInfo . isBlockContainer &&
804- blockInfo . blockContent . node . type . spec
805- . content === "inline* "
801+ this . schema . blockSchema [
802+ cursorPosition . block . type
803+ ] . content !== "inline"
806804 ) {
807- const tr = state . tr . deleteRange (
808- range . from ,
809- range . to ,
810- ) ;
811- updateBlockTr (
812- tr ,
813- blockInfo . bnBlock . beforePos ,
814- replaceWith ,
815- range . from ,
816- range . to ,
817- ) ;
818805 return undefined ;
819806 }
807+
808+ const blockInfo = getBlockInfoFromTransaction (
809+ state . tr ,
810+ ) ;
811+ const tr = state . tr . deleteRange (
812+ range . from ,
813+ range . to ,
814+ ) ;
815+
816+ updateBlockTr (
817+ tr ,
818+ blockInfo . bnBlock . beforePos ,
819+ replaceWith ,
820+ ) ;
821+ return undefined ;
820822 }
821823 return null ;
822824 } ,
You can’t perform that action at this time.
0 commit comments