File tree Expand file tree Collapse file tree
editor/src/browser/doc-model
extension/src/hosted/api/vscode/doc
monaco/src/browser/contrib/merge-editor/view Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,6 +335,13 @@ export class EditorDocumentModel extends Disposable implements IEditorDocumentMo
335335 if ( this . monacoModel . isDisposed ( ) ) {
336336 return false ;
337337 }
338+ /**
339+ * https://github.com/microsoft/vscode/blob/1.95.3/src/vscode-dts/vscode.d.ts#L14007
340+ * 如果文档是只读状态,说明并不能进行保存, 自然不需要 dirty 状态
341+ */
342+ if ( this . readonly ) {
343+ return false ;
344+ }
338345 return this . _persistVersionId !== this . monacoModel . getAlternativeVersionId ( ) ;
339346 }
340347
Original file line number Diff line number Diff line change @@ -179,15 +179,15 @@ export class ExtensionDocumentDataManagerImpl implements ExtensionDocumentDataMa
179179 $fireModelOptionsChangedEvent ( e : IExtensionDocumentModelOptionsChangedEvent ) {
180180 const document = this . _documents . get ( e . uri ) ;
181181 if ( document ) {
182+ if ( isDefined ( e . dirty ) ) {
183+ document . _acceptIsDirty ( e . dirty ) ;
184+ }
182185 // 和 vscode 表现保持一致,接收到 languages 变更时,发送一个 close 和一个 open 事件
183186 if ( isDefined ( e . languageId ) && e . languageId !== document . _getLanguageId ( ) ) {
184187 document . _acceptLanguageId ( e . languageId ) ;
185188 this . _onDidCloseTextDocument . fire ( document . document ) ;
186189 this . _onDidOpenTextDocument . fire ( document . document ) ;
187190 }
188- if ( isDefined ( e . dirty ) ) {
189- document . _acceptIsDirty ( e . dirty ) ;
190- }
191191 }
192192 }
193193
@@ -197,14 +197,14 @@ export class ExtensionDocumentDataManagerImpl implements ExtensionDocumentDataMa
197197 if ( ! document ) {
198198 return ;
199199 }
200+ document . _acceptIsDirty ( dirty ) ;
200201 document . onEvents ( {
201202 eol,
202203 versionId,
203204 changes,
204205 isRedoing,
205206 isUndoing,
206207 } ) ;
207- document . _acceptIsDirty ( dirty ) ;
208208
209209 let reason : vscode . TextDocumentChangeReason | undefined ;
210210
Original file line number Diff line number Diff line change 321321 display : flex ;
322322 align-content : center ;
323323 height : inherit ;
324- max-width : calc (100% - 120 px );
324+ max-width : calc (100% - 140 px );
325325 display : flex ;
326326
327327 .title {
You can’t perform that action at this time.
0 commit comments