@@ -275,7 +275,11 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
275
275
}
276
276
}
277
277
if ( colType === "block" ) {
278
- cellValue . isDetached = true ;
278
+ if ( typeof value === "object" && value . id ) {
279
+ cellValue . isDetached = false ;
280
+ } else {
281
+ cellValue . isDetached = true ;
282
+ }
279
283
}
280
284
return cellValue ;
281
285
} ;
@@ -365,9 +369,6 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
365
369
if ( type === "updated" || type === "created" || document . querySelector ( ".av__mask" ) ) {
366
370
return ;
367
371
}
368
- if ( type === "block" && ( cellElements . length > 1 || ! cellElements [ 0 ] . getAttribute ( "data-detached" ) ) ) {
369
- return ;
370
- }
371
372
const blockElement = hasClosestBlock ( cellElements [ 0 ] ) ;
372
373
if ( ! blockElement ) {
373
374
return ;
@@ -688,6 +689,11 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
688
689
} ) ;
689
690
newValue = oldValue . mSelect . concat ( newMSelectValue ) ;
690
691
}
692
+ } else if ( type === "block" && typeof value === "string" && oldValue . block . id ) {
693
+ newValue = {
694
+ content : value ,
695
+ id : oldValue . block . id
696
+ } ;
691
697
}
692
698
const cellValue = genCellValue ( type , newValue ) ;
693
699
cellValue . id = cellId ;
@@ -703,26 +709,16 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
703
709
if ( objEquals ( cellValue , oldValue ) ) {
704
710
return ;
705
711
}
706
- if ( type === "block" && ! item . dataset . detached ) {
707
- const newId = Lute . NewNodeID ( ) ;
708
- doOperations . push ( {
709
- action : "unbindAttrViewBlock" ,
710
- id : rowID ,
711
- nextID : newId ,
712
- avID,
713
- } ) ;
714
- rowElement . dataset . id = newId ;
715
- item . dataset . blockId = newId ;
716
- } else {
717
- doOperations . push ( {
718
- action : "updateAttrViewCell" ,
719
- id : cellId ,
720
- avID,
721
- keyID : colId ,
722
- rowID,
723
- data : cellValue
724
- } ) ;
725
- }
712
+
713
+ doOperations . push ( {
714
+ action : "updateAttrViewCell" ,
715
+ id : cellId ,
716
+ avID,
717
+ keyID : colId ,
718
+ rowID,
719
+ data : cellValue
720
+ } ) ;
721
+
726
722
undoOperations . push ( {
727
723
action : "updateAttrViewCell" ,
728
724
id : cellId ,
0 commit comments