File tree 3 files changed +22
-10
lines changed
3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,12 @@ All notable changes to this project will be documented in this file. See [standa
4
4
5
5
### [ 1.3.5] ( https://github.com/DTStack/molecule/compare/v1.3.4...v1.3.5 ) (2023-12-29)
6
6
7
-
8
7
### Bug Fixes
9
8
10
- * fix model's value not change and add onEditorInstanceMount event ([ eb93979] ( https://github.com/DTStack/molecule/commit/eb939798a0dd09dd46a7c1d8966a744c5749b0ca ) )
11
- * fix stylelint ([ f126404] ( https://github.com/DTStack/molecule/commit/f126404bfa0b631923c985bc6679f73800bb7182 ) )
12
- * ** scrollBar:** disable clickable when hide track ([ e15b8b6] ( https://github.com/DTStack/molecule/commit/e15b8b68200654863bce5077d4b98b8682f37781 ) )
13
- * update types ([ c8d8a1f] ( https://github.com/DTStack/molecule/commit/c8d8a1fea19060ceb313986482d9fef8791ca124 ) )
9
+ - fix model's value not change and add onEditorInstanceMount event ([ eb93979] ( https://github.com/DTStack/molecule/commit/eb939798a0dd09dd46a7c1d8966a744c5749b0ca ) )
10
+ - fix stylelint ([ f126404] ( https://github.com/DTStack/molecule/commit/f126404bfa0b631923c985bc6679f73800bb7182 ) )
11
+ - ** scrollBar:** disable clickable when hide track ([ e15b8b6] ( https://github.com/DTStack/molecule/commit/e15b8b68200654863bce5077d4b98b8682f37781 ) )
12
+ - update types ([ c8d8a1f] ( https://github.com/DTStack/molecule/commit/c8d8a1fea19060ceb313986482d9fef8791ca124 ) )
14
13
15
14
### [ 1.3.4] ( https://github.com/DTStack/molecule/compare/v1.3.3...v1.3.4 ) (2023-06-12)
16
15
Original file line number Diff line number Diff line change @@ -208,9 +208,12 @@ describe('Test EditorService', () => {
208
208
expect ( groups ?. length ) . toBe ( 1 ) ;
209
209
210
210
const setValFn = jest . fn ( ) ;
211
+ const getValFn = jest . fn ( ) ;
211
212
( MonacoEditor . getModel as jest . Mock ) . mockImplementation ( ( ) => ( {
212
213
setValue : setValFn ,
214
+ getValue : getValFn ,
213
215
} ) ) ;
216
+
214
217
act ( ( ) => {
215
218
editor . updateTab ( {
216
219
id : mockTab . id ,
Original file line number Diff line number Diff line change 1
1
import 'reflect-metadata' ;
2
2
import { singleton , container } from 'tsyringe' ;
3
- import { cloneDeep } from 'lodash' ;
3
+ import { cloneDeep , isString } from 'lodash' ;
4
4
import { Component } from 'mo/react' ;
5
5
import {
6
6
EditorModel ,
@@ -337,8 +337,13 @@ export class EditorService
337
337
const model = MonacoEditor . getModel (
338
338
Uri . parse ( tab . id . toString ( ) )
339
339
) ;
340
- if ( model ) {
341
- model . setValue ( editorValue || '' ) ;
340
+ const currentValue = model ?. getValue ( ) ;
341
+ if (
342
+ model &&
343
+ isString ( editorValue ) &&
344
+ currentValue !== editorValue
345
+ ) {
346
+ model . setValue ( editorValue ) ;
342
347
}
343
348
this . updateGroup ( groupId , group ) ;
344
349
@@ -362,8 +367,13 @@ export class EditorService
362
367
const model = MonacoEditor . getModel (
363
368
Uri . parse ( tab . id . toString ( ) )
364
369
) ;
365
- if ( model ) {
366
- model . setValue ( editorValue || '' ) ;
370
+ const currentValue = model ?. getValue ( ) ;
371
+ if (
372
+ model &&
373
+ isString ( editorValue ) &&
374
+ currentValue !== editorValue
375
+ ) {
376
+ model . setValue ( editorValue ) ;
367
377
}
368
378
} ) ;
369
379
You can’t perform that action at this time.
0 commit comments