@@ -90,9 +90,8 @@ function cloneCSSStyle<T extends HTMLElement>(nativeNode: T, clonedNode: T, styl
9090 return ;
9191 }
9292 const sourceStyle = window . getComputedStyle ( nativeNode ) ;
93- // Only clone a subset of styles related to font color and size
94- const ALLOWLIST = [ ...( styleNames || [ ] ) ] ;
95- ALLOWLIST . forEach ( ( prop ) => {
93+ // Only clone a subset of styles
94+ ( styleNames || [ ] ) . forEach ( ( prop ) => {
9695 const value = sourceStyle . getPropertyValue ( prop ) ;
9796 const priority = sourceStyle . getPropertyPriority ( prop ) ;
9897 if ( value ) {
@@ -108,10 +107,11 @@ function cloneCSSStyle<T extends HTMLElement>(nativeNode: T, clonedNode: T, styl
108107 * @param inlineStyleClassNames
109108 */
110109function batchCloneCSSStyle ( sourceNode : SVGGElement , cloneNode : SVGGElement , inlineStyleClassNames ?: string , styleNames ?: string [ ] ) {
111- // text
110+ // handle text style, Hardcoded to slate editor framework
111+ const textSelector = '[data-slate-node="text"]' ;
112112 const textStyle = [ 'font-size' , 'font-family' , 'line-height' , 'text-decoration' , 'font-weight' , 'font-style' , 'word-break' ] ;
113- const sourceTextNodes = Array . from ( sourceNode . querySelectorAll ( '[data-slate-node="text"]' ) ) ;
114- const cloneTextNodes = Array . from ( cloneNode . querySelectorAll ( '[data-slate-node="text"]' ) ) ;
113+ const sourceTextNodes = Array . from ( sourceNode . querySelectorAll ( textSelector ) ) ;
114+ const cloneTextNodes = Array . from ( cloneNode . querySelectorAll ( textSelector ) ) ;
115115 sourceTextNodes . map ( ( node , index ) => {
116116 cloneCSSStyle ( node as HTMLElement , cloneTextNodes [ index ] as HTMLElement , textStyle ) ;
117117 } ) ;
0 commit comments