File tree Expand file tree Collapse file tree
src/plugins/editor-monaco/monaco-contribution Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,23 +26,19 @@ const lazyMonacoContribution = ({ system }) => {
2626
2727 // store current version ID of the model
2828 disposables . push (
29- monaco . editor . onDidCreateEditor ( ( editor ) => {
30- disposables . push (
31- monaco . editor . onDidCreateModel ( ( model ) => {
32- const versionId = model . getVersionId ( ) ;
33- const alternativeVersionId = model . getAlternativeVersionId ( ) ;
29+ monaco . editor . onDidCreateModel ( ( model ) => {
30+ const setModelVersions = ( ) => {
31+ const versionId = model . getVersionId ( ) ;
32+ const alternativeVersionId = model . getAlternativeVersionId ( ) ;
3433
35- editorActions . setModelVersionId ( versionId , { alternativeVersionId } ) ;
36- } )
37- ) ;
34+ editorActions . setModelVersionId ( versionId , { alternativeVersionId } ) ;
35+ } ;
3836
39- disposables . push (
40- editor . onDidChangeModelContent ( ( ) => {
41- const model = editor . getModel ( ) ;
42- const versionId = model . getVersionId ( ) ;
43- const alternativeVersionId = model . getAlternativeVersionId ( ) ;
37+ setModelVersions ( ) ;
4438
45- editorActions . setModelVersionId ( versionId , { alternativeVersionId } ) ;
39+ disposables . push (
40+ model . onDidChangeContent ( ( ) => {
41+ setModelVersions ( ) ;
4642 } )
4743 ) ;
4844 } )
You can’t perform that action at this time.
0 commit comments