@@ -15,7 +15,7 @@ import {
1515 getSelectionPosition ,
1616} from "../util/selection" ;
1717import { genHintItemHTML , hintEmbed , hintRef , hintSlash } from "./extend" ;
18- import { newFileByRefHint , newFileInProtyle } from "../../util/newFile" ;
18+ import { getBlockRefAnchorText , newFileByRefHint , newFileInProtyle } from "../../util/newFile" ;
1919import { isAbnormalItem , upDownHint } from "../../util/upDownHint" ;
2020import { setPosition } from "../../util/setPosition" ;
2121import { getContenteditableElement , hasNextSibling , hasPreviousSibling } from "../wysiwyg/getBlock" ;
@@ -575,7 +575,7 @@ ${genHintItemHTML(item)}
575575 protyle . toolbar . range = range ;
576576 const refElement = protyle . toolbar . setInlineMark ( protyle , "block-ref" , "range" , {
577577 type : "id" ,
578- color : `${ id } ${ Constants . ZWSP } ${ refIsS ? "s" : "d" } ${ Constants . ZWSP } ${ ( refIsS ? fileNames [ 0 ] : realFileName ) . substring ( 0 , window . siyuan . config . editor . blockRefDynamicAnchorTextMaxLen ) } `
578+ color : `${ id } ${ Constants . ZWSP } ${ refIsS ? "s" : "d" } ${ Constants . ZWSP } ${ getBlockRefAnchorText ( refIsS ? fileNames [ 0 ] : realFileName ) } `
579579 } ) ;
580580 if ( refElement [ 0 ] ) {
581581 protyle . toolbar . range . setEnd ( refElement [ 0 ] . lastChild , refElement [ 0 ] . lastChild . textContent . length ) ;
@@ -689,7 +689,7 @@ ${genHintItemHTML(item)}
689689 } else if ( value === Constants . ZWSP + 4 ) {
690690 // 新建文档
691691 newFileInProtyle ( protyle , ( createDocId , createDocTitle ) => {
692- insertHTML ( `<span data-type="block-ref" data-id="${ createDocId } " data-subtype="d">${ createDocTitle } </span>` , protyle ) ;
692+ insertHTML ( `<span data-type="block-ref" data-id="${ createDocId } " data-subtype="d">${ getBlockRefAnchorText ( createDocTitle ) } </span>` , protyle ) ;
693693 } ) ;
694694 return ;
695695 } else if ( value === Constants . ZWSP + 6 ) {
@@ -698,10 +698,10 @@ ${genHintItemHTML(item)}
698698 fetchPost ( "/api/filetree/createDoc" , {
699699 notebook : protyle . notebookId ,
700700 path : pathPosix ( ) . join ( getDisplayName ( protyle . path , false , true ) , newSubDocId + ".sy" ) ,
701- title : window . siyuan . languages . untitled ,
701+ title : "" ,
702702 md : ""
703703 } , ( ) => {
704- insertHTML ( `<span data-type="block-ref" data-id="${ newSubDocId } " data-subtype="d">${ window . siyuan . languages . untitled } </span>` , protyle ) ;
704+ insertHTML ( `<span data-type="block-ref" data-id="${ newSubDocId } " data-subtype="d">${ getBlockRefAnchorText ( "" ) } </span>` , protyle ) ;
705705 /// #if MOBILE
706706 openMobileFileById ( protyle . app , newSubDocId , [ Constants . CB_GET_CONTEXT , Constants . CB_GET_OPENNEW ] ) ;
707707 /// #else
0 commit comments