@@ -11,7 +11,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
1111import { getContenteditableElement , getTopAloneElement } from "../wysiwyg/getBlock" ;
1212import { replaceFileName } from "../../editor/rename" ;
1313import { transaction } from "../wysiwyg/transaction" ;
14- import { getAssetName , getDisplayName , pathPosix } from "../../util/pathName" ;
14+ import { getAssetName , getDisplayName , isEncryptedBox , pathPosix } from "../../util/pathName" ;
1515import { genEmptyElement } from "../../block/util" ;
1616import { updateListOrder } from "../wysiwyg/list" ;
1717import { escapeHtml } from "../../util/escape" ;
@@ -458,14 +458,18 @@ export const genHintItemHTML = (item: IBlock) => {
458458export const hintRef = ( key : string , protyle : IProtyle , source : THintSource ) : IHintData [ ] => {
459459 const nodeElement = hasClosestBlock ( getEditorRange ( protyle . wysiwyg . element ) . startContainer ) ;
460460 protyle . hint . genLoading ( protyle ) ;
461- fetchPost ( "/api/search/searchRefBlock" , {
461+ const refParam : IObject = {
462462 k : key ,
463463 id : nodeElement ? nodeElement . getAttribute ( "data-node-id" ) : protyle . block . parentID ,
464464 beforeLen : Math . floor ( ( Math . max ( protyle . element . clientWidth / 2 , 320 ) - 58 ) / 28.8 ) ,
465465 rootID : source === "av" ? "" : protyle . block . rootID ,
466466 isDatabase : source === "av" ,
467467 isSquareBrackets : [ "[[" , "【【" ] . includes ( protyle . hint . splitChar )
468- } , ( response ) => {
468+ } ;
469+ if ( isEncryptedBox ( protyle . notebookId ) ) {
470+ refParam . notebook = protyle . notebookId ;
471+ }
472+ fetchPost ( "/api/search/searchRefBlock" , refParam , ( response ) => {
469473 const dataList : IHintData [ ] = [ ] ;
470474 if ( response . data . newDoc ) {
471475 const newFileName = Lute . UnEscapeHTMLStr ( replaceFileName ( response . data . k ) ) ;
@@ -514,13 +518,17 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
514518 }
515519 protyle . hint . genLoading ( protyle ) ;
516520 const nodeElement = hasClosestBlock ( getEditorRange ( protyle . wysiwyg . element ) . startContainer ) ;
517- fetchPost ( "/api/search/searchRefBlock" , {
521+ const embedParam : IObject = {
518522 k : key ,
519523 isDatabase : false ,
520524 beforeLen : Math . floor ( ( Math . max ( protyle . element . clientWidth / 2 , 320 ) - 58 ) / 28.8 ) ,
521525 id : nodeElement ? nodeElement . getAttribute ( "data-node-id" ) : protyle . block . parentID ,
522526 rootID : protyle . block . rootID ,
523- } , ( response ) => {
527+ } ;
528+ if ( isEncryptedBox ( protyle . notebookId ) ) {
529+ embedParam . notebook = protyle . notebookId ;
530+ }
531+ fetchPost ( "/api/search/searchRefBlock" , embedParam , ( response ) => {
524532 const dataList : IHintData [ ] = [ ] ;
525533 response . data . blocks . forEach ( ( item : IBlock ) => {
526534 dataList . push ( {
0 commit comments