@@ -497,6 +497,9 @@ export const fromRedactor = (el: any, options?:IHtmlToJsonOptions) : IAnyObject
497497 ]
498498 )
499499 }
500+ if ( el . parentNode ?. nodeName === 'FIGURE' ) {
501+ return children
502+ }
500503 }
501504
502505 if ( ELEMENT_TAGS [ nodeName ] ) {
@@ -874,7 +877,7 @@ const getImageAttributes = (elementAttrs: any, childAttrs: any, extraAttrs: any)
874877 ...extraAttrs
875878 } ,
876879 "asset-caption" : extraAttrs [ "asset-caption" ] ,
877- "link" : extraAttrs . link
880+ "link" : extraAttrs . link ?? extraAttrs . anchorLink
878881 }
879882 }
880883 if ( elementAttrs ?. attrs ?. [ "redactor-attributes" ] ?. link ) {
@@ -891,11 +894,16 @@ const getImageAttributes = (elementAttrs: any, childAttrs: any, extraAttrs: any)
891894
892895const getReferenceAttributes = ( { elementAttrs, newChildren, extraAttrs, sizeAttrs} : any ) => {
893896
894- let { style } = elementAttrs . attrs ;
895-
896897 extraAttrs [ 'asset-caption' ] = extraAttrs [ 'caption' ] ;
898+ if ( newChildren [ 0 ] . attrs . width ) {
899+ delete sizeAttrs . width
900+ }
901+ const style = { }
902+ if ( elementAttrs ?. attrs ?. style ?. [ 'text-align' ] ) {
903+ style [ 'text-align' ] = elementAttrs ?. attrs ?. style ?. [ 'text-align' ]
904+ }
897905
898- const childAttrs = { ...newChildren [ 0 ] . attrs , ...sizeAttrs , style : { 'text-align' : style [ 'text-align' ] } , position : extraAttrs . position }
906+ const childAttrs = { ...newChildren [ 0 ] . attrs , ...sizeAttrs , style , position : extraAttrs . position }
899907 extraAttrs = { ...extraAttrs , ...sizeAttrs }
900908
901909 if ( ! childAttrs . position ) {
@@ -905,7 +913,7 @@ const getReferenceAttributes = ({elementAttrs, newChildren, extraAttrs, sizeAttr
905913 const referenceAttrs = getImageAttributes ( elementAttrs , childAttrs , extraAttrs ) ;
906914
907915 referenceAttrs . type = "reference" ;
908-
916+ delete referenceAttrs ?. attrs ?. [ 'redactor-attributes' ] ?. [ 'anchorlink' ] ;
909917 return referenceAttrs
910918}
911919
0 commit comments