File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ declare interface BlockStyleMap {
55}
66
77declare interface BlockAttributeMap {
8- [ key : string ] : string ;
8+ [ key : string ] : string | number | null | undefined ;
99}
1010
1111declare interface BlockOptions {
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ watchEffect(() => {
114114 props .block .getStyle (" bottom" );
115115 props .block .getStyle (" right" );
116116 props .block .getStyle (" position" );
117+ props .block .rawStyles ;
117118 const parentBlock = props .block .getParentBlock ();
118119 parentBlock ?.getStyle (" display" );
119120 parentBlock ?.getStyle (" justifyContent" );
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ const pasteObj = (e: ClipboardEvent) => {
7474 const map = new Map (Object .entries (props .obj ));
7575 try {
7676 const objString = text .match (/ {[^ {}] + }/ )?.[0 ];
77- if (! objString ) return new Error (" Invalid object" );
77+ if (! objString ) throw new Error (" Invalid object" );
7878 const obj = new Function (" return " + objString )();
7979 if (typeof obj === " object" ) {
8080 for (const [key, value] of Object .entries (obj )) {
@@ -91,7 +91,6 @@ const pasteObj = (e: ClipboardEvent) => {
9191 }
9292 map .delete (" " );
9393 }
94- e .preventDefault ();
9594 emit (" update:obj" , mapToObject (map ));
9695 }
9796};
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class Block implements BlockOptions {
3333 referenceBlockId ?: string ;
3434 isRepeaterBlock ?: boolean ;
3535 visibilityCondition ?: string ;
36- customAttributes ? : BlockAttributeMap ;
36+ customAttributes : BlockAttributeMap ;
3737 constructor ( options : BlockOptions ) {
3838 this . element = options . element ;
3939 this . innerHTML = options . innerHTML ;
@@ -409,7 +409,12 @@ class Block implements BlockOptions {
409409 return store . findParentBlock ( this . blockId ) ;
410410 }
411411 canHaveChildren ( ) : boolean {
412- return ( this . isContainer ( ) || this . isRoot ( ) || this . isDiv ( ) ) && ! this . isExtendedFromComponent ( ) ;
412+ return ! (
413+ this . isImage ( ) ||
414+ this . isSVG ( ) ||
415+ ( this . isText ( ) && ! this . isLink ( ) ) ||
416+ this . isExtendedFromComponent ( )
417+ ) ;
413418 }
414419 updateStyles ( styles : BlockStyleObjects ) {
415420 this . baseStyles = Object . assign ( { } , this . baseStyles , styles . baseStyles ) ;
Original file line number Diff line number Diff line change @@ -110,15 +110,25 @@ const blockController = {
110110 } ,
111111 setRawStyles : ( rawStyles : BlockStyleMap ) => {
112112 store . selectedBlocks . forEach ( ( block ) => {
113- block . rawStyles = rawStyles ;
113+ Object . keys ( block . rawStyles ) . forEach ( ( key ) => {
114+ if ( ! rawStyles [ key ] ) {
115+ delete block . rawStyles [ key ] ;
116+ }
117+ } ) ;
118+ Object . assign ( block . rawStyles , rawStyles ) ;
114119 } ) ;
115120 } ,
116121 getCustomAttributes : ( ) => {
117122 return blockController . isBLockSelected ( ) && store . selectedBlocks [ 0 ] . customAttributes ;
118123 } ,
119124 setCustomAttributes : ( customAttributes : BlockAttributeMap ) => {
120125 store . selectedBlocks . forEach ( ( block ) => {
121- block . customAttributes = customAttributes ;
126+ Object . keys ( block . customAttributes ) . forEach ( ( key ) => {
127+ if ( ! customAttributes [ key ] ) {
128+ delete block . customAttributes [ key ] ;
129+ }
130+ } ) ;
131+ Object . assign ( block . customAttributes , customAttributes ) ;
122132 } ) ;
123133 } ,
124134 getParentBlock : ( ) => {
You can’t perform that action at this time.
0 commit comments