File tree Expand file tree Collapse file tree
packages/core/src/view/node Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { createElement as h , Component } from 'preact/compat'
22import { reaction , IReactionDisposer } from 'mobx'
3- import { map } from 'lodash-es'
3+ import { map , isNil , isFunction } from 'lodash-es'
44import Anchor from '../Anchor'
55import { BaseText } from '../text'
66import LogicFlow from '../../LogicFlow'
@@ -403,6 +403,15 @@ export abstract class BaseNode<P extends IProps = IProps> extends Component<
403403 } else {
404404 graphModel . eventCenter . emit ( EventType . ELEMENT_CLICK , eventOptions )
405405 graphModel . eventCenter . emit ( EventType . NODE_CLICK , eventOptions )
406+ // 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
407+ const el = e . currentTarget as HTMLElement
408+ const rAF =
409+ ! isNil ( window ) && isFunction ( window . requestAnimationFrame )
410+ ? window . requestAnimationFrame . bind ( window )
411+ : ( fn : ( ) => void ) => setTimeout ( fn , 0 )
412+ rAF ( ( ) => {
413+ el . focus ( )
414+ } )
406415 }
407416 }
408417
You can’t perform that action at this time.
0 commit comments