@@ -427,9 +427,21 @@ const server = {
427427 file [ "config" ] [ k ] = { } ;
428428 }
429429
430- for ( let key in value ) {
431- file [ "config" ] [ k ] [ key ] = value [ key ] ;
432- }
430+ // for(let key in value){
431+ // file["config"][k][key] = value[key];
432+ // }
433+
434+ // ⚠️ 上面的处理方式会导致部分配置项被遗漏,以致协同编辑的时候多视图出现不一致的情况,调整处理的策略为直接替换配置项:
435+ // 可能的配置项为:
436+ // columnlen: {0: 65, 1: 186, 2: 52}
437+ // customHeight: {0: 1, 5: 1, 6: 1}
438+ // customWidth: {0: 1, 1: 1, 2: 1}
439+ // merge: {2_1: {…}, 4_2: {…}, 6_2: {…} }
440+ // rowlen: {0: 19, 5: 93, 6: 117}
441+ if ( value && ( typeof value == "object" ) ) {
442+ file [ "config" ] [ k ] = value ;
443+ }
444+
433445 }
434446
435447 if ( index == Store . currentSheetIndex ) { //更新数据为当前表格数据
@@ -694,7 +706,14 @@ const server = {
694706 file [ "column" ] += len ;
695707
696708 for ( let i = 0 ; i < data . length ; i ++ ) {
697- data [ i ] . splice ( st_i , 0 , addData [ i ] ) ;
709+ // data[i].splice(st_i, 0, addData[i]);
710+
711+ // 备注:区分插入的位置(可能是左侧插入或者右侧插入)
712+ if ( direction == "lefttop" ) {
713+ data [ i ] . splice ( st_i , 0 , addData [ i ] ) ;
714+ } else {
715+ data [ i ] . splice ( st_i + 1 , 0 , addData [ i ] ) ;
716+ }
698717 }
699718 }
700719
0 commit comments