Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
fix: stopPropagation to prevent invoke Mindmap's event
Browse files Browse the repository at this point in the history
  • Loading branch information
rick-yo committed Jul 26, 2020
1 parent e44cd0b commit 5299f90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { css, jsx } from '@emotion/core';
import { EDITOR_ID } from '../constant';
import editorStore from '../store/editor';
import { memo } from 'react';

const Toolbar = () => {
const scale = editorStore.useSelector(s => s.scale);
Expand Down Expand Up @@ -44,4 +45,4 @@ const Toolbar = () => {
);
};

export default Toolbar;
export default memo(Toolbar);
3 changes: 3 additions & 0 deletions src/components/Topic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ const Topic = (props: HierachyNode<TopicData>) => {
onDragLeave={handleDragLeave}
onDrop={handleDrop}
onDragOver={handleDragOver}
// stopPropagation to prevent invoke Mindmap's event
onMouseDown={e => e.stopPropagation()}
onTouchStart={e => e.stopPropagation()}
css={css`
display: inline-block;
border-radius: ${TOPIC_RADIUS}px;
Expand Down

0 comments on commit 5299f90

Please sign in to comment.