@@ -3882,7 +3882,8 @@ data-type="fold"${viewOccurrenceID ? ` data-view-occurrence-id="${encodeURICompo
38823882 rect = nodeElement . getBoundingClientRect ( ) ;
38833883 space = 0 ;
38843884 }
3885- let horizontalAnchorLeft = rect . left ;
3885+ // 页签栏只用于垂直定位;水平方向和其他块一样以整个块的外边界为基准。
3886+ let horizontalAnchorLeft = tabsHeader ? tabsHeader . parentElement . getBoundingClientRect ( ) . left : rect . left ;
38863887 if ( listItem && element . classList . contains ( "protyle-action" ) &&
38873888 element . parentElement . getAttribute ( "data-type" ) === "NodeListItem" ) {
38883889 const listItemElement = element . parentElement ;
@@ -3891,6 +3892,8 @@ data-type="fold"${viewOccurrenceID ? ` data-view-occurrence-id="${encodeURICompo
38913892 horizontalAnchorLeft = getListGutterAnchorLeft ( rect . left , contentLeft , isRTL ) ;
38923893 }
38933894 const buttonCount = html . split ( "</button>" ) . length - 1 ;
3895+ // 所有块标与内容统一留出间距,并在判断是否压缩时计入这段空间。
3896+ const gutterGap = 4 ;
38943897 const getNaturalLeft = ( width : number ) => {
38953898 let left = horizontalAnchorLeft - width - space ;
38963899 if ( nodeElement . getAttribute ( "data-type" ) === "NodeBlockQueryEmbed" && buttonCount === 1 ) {
@@ -3900,7 +3903,7 @@ data-type="fold"${viewOccurrenceID ? ` data-view-occurrence-id="${encodeURICompo
39003903 // 为数据库行
39013904 left = nodeElement . getBoundingClientRect ( ) . left - width - space + parseInt ( getComputedStyle ( nodeElement ) . paddingLeft ) ;
39023905 }
3903- return left ;
3906+ return left - gutterGap ;
39043907 } ;
39053908 let naturalLeft = getNaturalLeft ( this . naturalWidth || this . element . clientWidth ) ;
39063909 let compressed = naturalLeft < this . element . parentElement . getBoundingClientRect ( ) . left ;
@@ -3951,7 +3954,7 @@ data-type="fold"${viewOccurrenceID ? ` data-view-occurrence-id="${encodeURICompo
39513954 const top = Math . max ( rect . top + marginHeight , contentTop , foldElement ? foldElement . getBoundingClientRect ( ) . top : 0 ) ;
39523955 this . element . style . top = `${ getFixedGutterPosition ( top , fixedContainerRect ?. top ) } px` ;
39533956 // 压缩模式需加 2,否则和折叠标题无法对齐
3954- const left = compressed ? horizontalAnchorLeft - this . element . clientWidth - space / 2 + 3 :
3957+ const left = compressed ? horizontalAnchorLeft - this . element . clientWidth - space / 2 + 3 - gutterGap :
39553958 getNaturalLeft ( this . element . clientWidth ) ;
39563959 this . element . style . left = `${ getFixedGutterPosition ( left , fixedContainerRect ?. left ) } px` ;
39573960 }
0 commit comments