File tree Expand file tree Collapse file tree
packages/alex/src/core/editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,11 +160,11 @@ class EditorHistoryServiceOverride extends EditorHistoryService {
160160 uri,
161161 position : { lineNumber } ,
162162 } = state ;
163- // 非 file 协议外部无法处理,直接内部打开
163+ const documentModel = select ( ( props ) => props . documentModel ) ;
164164 if ( uri . scheme !== 'file' ) {
165+ documentModel . onFilepathChange ?.( '' ) ;
165166 return super . restoreState ( state ) ;
166167 }
167- const documentModel = select ( ( props ) => props . documentModel ) ;
168168 const onLineNumberChange = ( ) => {
169169 documentModel . onLineNumberChange ?.( lineNumber || 1 ) ;
170170 } ;
@@ -502,11 +502,12 @@ class EditorSpecialContribution
502502 source ?: monaco . editor . ICodeEditor ,
503503 sideBySide ?: boolean
504504 ) {
505- // 非 file 协议外部无法处理,直接内部打开
505+ // 非 file 协议路径设置为空,以触发 props 变化
506+ const documentModel = select ( ( props ) => props . documentModel ) ;
506507 if ( input . resource . scheme !== 'file' ) {
508+ documentModel . onFilepathChange ?.( '' ) ;
507509 return raw ( ) ;
508510 }
509- const documentModel = select ( ( props ) => props . documentModel ) ;
510511 const onLineNumberChange = ( ) => {
511512 if ( input . options ?. selection ) {
512513 documentModel . onLineNumberChange ?.( input . options ?. selection . startLineNumber || 1 ) ;
You can’t perform that action at this time.
0 commit comments