@@ -2126,76 +2126,74 @@ export class WYSIWYG {
2126
2126
event . stopPropagation ( ) ;
2127
2127
event . preventDefault ( ) ;
2128
2128
hideElements ( [ "dialog" , "toolbar" ] , protyle ) ;
2129
- if ( range . toString ( ) !== "" && ! event . shiftKey ) {
2130
- // 选择不打开引用
2131
- return ;
2132
- }
2133
- let refBlockId : string ;
2134
- if ( blockRefElement ) {
2135
- refBlockId = blockRefElement . getAttribute ( "data-id" ) ;
2136
- } else if ( aElement ) {
2137
- refBlockId = aLink . substring ( 16 , 38 ) ;
2138
- }
2139
- checkFold ( refBlockId , ( zoomIn , action , isRoot ) => {
2140
- // 块引用跳转后需要短暂高亮目标块 https://github.com/siyuan-note/siyuan/issues/11542
2141
- if ( ! isRoot ) {
2142
- action . push ( Constants . CB_GET_HL ) ;
2143
- }
2144
- /// #if MOBILE
2145
- openMobileFileById ( protyle . app , refBlockId , zoomIn ? [ Constants . CB_GET_ALL ] : [ Constants . CB_GET_HL , Constants . CB_GET_CONTEXT , Constants . CB_GET_ROOTSCROLL ] ) ;
2146
- activeBlur ( ) ;
2147
- hideKeyboardToolbar ( ) ;
2148
- /// #else
2149
- if ( event . shiftKey ) {
2150
- openFileById ( {
2151
- app : protyle . app ,
2152
- id : refBlockId ,
2153
- position : "bottom" ,
2154
- action,
2155
- zoomIn
2156
- } ) ;
2157
- window . dispatchEvent ( new KeyboardEvent ( "keydown" , { key : "Escape" } ) ) ;
2158
- } else if ( event . altKey ) {
2159
- openFileById ( {
2160
- app : protyle . app ,
2161
- id : refBlockId ,
2162
- position : "right" ,
2163
- action,
2164
- zoomIn
2165
- } ) ;
2166
- } else if ( ctrlIsPressed ) {
2167
- openFileById ( {
2168
- app : protyle . app ,
2169
- id : refBlockId ,
2170
- keepCursor : true ,
2171
- action : zoomIn ? [ Constants . CB_GET_HL , Constants . CB_GET_ALL ] : [ Constants . CB_GET_HL , Constants . CB_GET_CONTEXT , Constants . CB_GET_ROOTSCROLL ] ,
2172
- zoomIn
2173
- } ) ;
2174
- } else {
2175
- openFileById ( {
2176
- app : protyle . app ,
2177
- id : refBlockId ,
2178
- action,
2179
- zoomIn
2180
- } ) ;
2181
- }
2182
- /// #endif
2183
- } ) ;
2184
- /// #if !MOBILE
2185
- if ( protyle . model ) {
2186
- // 打开双链需记录到后退中 https://github.com/siyuan-note/insider/issues/801
2187
- let blockElement : HTMLElement | false ;
2129
+ if ( range . toString ( ) === "" || event . shiftKey ) {
2130
+ let refBlockId : string ;
2188
2131
if ( blockRefElement ) {
2189
- blockElement = hasClosestBlock ( blockRefElement ) ;
2132
+ refBlockId = blockRefElement . getAttribute ( "data-id" ) ;
2190
2133
} else if ( aElement ) {
2191
- blockElement = hasClosestBlock ( aElement ) ;
2134
+ refBlockId = aLink . substring ( 16 , 38 ) ;
2192
2135
}
2193
- if ( blockElement ) {
2194
- pushBack ( protyle , getEditorRange ( this . element ) , blockElement ) ;
2136
+ checkFold ( refBlockId , ( zoomIn , action , isRoot ) => {
2137
+ // 块引用跳转后需要短暂高亮目标块 https://github.com/siyuan-note/siyuan/issues/11542
2138
+ if ( ! isRoot ) {
2139
+ action . push ( Constants . CB_GET_HL ) ;
2140
+ }
2141
+ /// #if MOBILE
2142
+ openMobileFileById ( protyle . app , refBlockId , zoomIn ? [ Constants . CB_GET_ALL ] : [ Constants . CB_GET_HL , Constants . CB_GET_CONTEXT , Constants . CB_GET_ROOTSCROLL ] ) ;
2143
+ activeBlur ( ) ;
2144
+ hideKeyboardToolbar ( ) ;
2145
+ /// #else
2146
+ if ( event . shiftKey ) {
2147
+ openFileById ( {
2148
+ app : protyle . app ,
2149
+ id : refBlockId ,
2150
+ position : "bottom" ,
2151
+ action,
2152
+ zoomIn
2153
+ } ) ;
2154
+ window . dispatchEvent ( new KeyboardEvent ( "keydown" , { key : "Escape" } ) ) ;
2155
+ } else if ( event . altKey ) {
2156
+ openFileById ( {
2157
+ app : protyle . app ,
2158
+ id : refBlockId ,
2159
+ position : "right" ,
2160
+ action,
2161
+ zoomIn
2162
+ } ) ;
2163
+ } else if ( ctrlIsPressed ) {
2164
+ openFileById ( {
2165
+ app : protyle . app ,
2166
+ id : refBlockId ,
2167
+ keepCursor : true ,
2168
+ action : zoomIn ? [ Constants . CB_GET_HL , Constants . CB_GET_ALL ] : [ Constants . CB_GET_HL , Constants . CB_GET_CONTEXT , Constants . CB_GET_ROOTSCROLL ] ,
2169
+ zoomIn
2170
+ } ) ;
2171
+ } else {
2172
+ openFileById ( {
2173
+ app : protyle . app ,
2174
+ id : refBlockId ,
2175
+ action,
2176
+ zoomIn
2177
+ } ) ;
2178
+ }
2179
+ /// #endif
2180
+ } ) ;
2181
+ /// #if !MOBILE
2182
+ if ( protyle . model ) {
2183
+ // 打开双链需记录到后退中 https://github.com/siyuan-note/insider/issues/801
2184
+ let blockElement : HTMLElement | false ;
2185
+ if ( blockRefElement ) {
2186
+ blockElement = hasClosestBlock ( blockRefElement ) ;
2187
+ } else if ( aElement ) {
2188
+ blockElement = hasClosestBlock ( aElement ) ;
2189
+ }
2190
+ if ( blockElement ) {
2191
+ pushBack ( protyle , getEditorRange ( this . element ) , blockElement ) ;
2192
+ }
2195
2193
}
2194
+ /// #endif
2195
+ return ;
2196
2196
}
2197
- /// #endif
2198
- return ;
2199
2197
}
2200
2198
/// #if MOBILE
2201
2199
// https://github.com/siyuan-note/siyuan/issues/10513
0 commit comments