mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 10:49:51 +08:00 
			
		
		
		
	fix(editor): 添加组件默认添加到视窗中间,如果组件初始化height不是数值,则当0处理
This commit is contained in:
		
							parent
							
								
									805339422a
								
							
						
					
					
						commit
						663d7cee9f
					
				@ -142,9 +142,13 @@ export const toRelative = (node: MNode) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const setTop2Middle = (node: MNode, parentNode: MNode, stage: StageCore) => {
 | 
					const setTop2Middle = (node: MNode, parentNode: MNode, stage: StageCore) => {
 | 
				
			||||||
  const style = node.style || {};
 | 
					  const style = node.style || {};
 | 
				
			||||||
  const height = style.height || 0;
 | 
					  let height = style.height || 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!stage || typeof style.top !== 'undefined' || !parentNode.style || !isNumber(height)) return style;
 | 
					  if (!stage || typeof style.top !== 'undefined' || !parentNode.style) return style;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!isNumber(height)) {
 | 
				
			||||||
 | 
					    height = 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { height: parentHeight } = parentNode.style;
 | 
					  const { height: parentHeight } = parentNode.style;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user