[go: nahoru, domu]

Skip to content

Commit

Permalink
fix: marker outter click error (opensumi#2195)
Browse files Browse the repository at this point in the history
  • Loading branch information
erha19 authored Jan 12, 2023
1 parent 9e93127 commit 4b0e852
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/markers/src/browser/markers-tree.view.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useEffect, useState, useCallback } from 'react';
import React, { FC, useEffect, useState, useCallback, RefObject, createRef } from 'react';

import { IRecycleTreeHandle, RecycleTree } from '@opensumi/ide-components';
import { ViewState, useInjectable } from '@opensumi/ide-core-browser';
Expand Down Expand Up @@ -96,14 +96,14 @@ const Empty: FC = () => {
* marker panel
*/
export const MarkerPanel = ({ viewState }: { viewState: ViewState }) => {
const markerModelService = useInjectable(MarkerModelService);
const wrapperRef: React.RefObject<HTMLDivElement> = React.createRef();
const markerModelService = useInjectable<MarkerModelService>(MarkerModelService);
const wrapperRef: RefObject<HTMLDivElement> = createRef();

const handleOuterClick = useCallback(() => {
// 空白区域点击,取消焦点状态
const { enactiveFileDecoration } = markerModelService;
enactiveFileDecoration();
}, []);
const { enactiveNodeDecoration } = markerModelService;
enactiveNodeDecoration();
}, [markerModelService]);

useEffect(() => {
const handleBlur = () => {
Expand Down
1 change: 1 addition & 0 deletions packages/markers/src/browser/tree/marker-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const MarkerNodeRendered: React.FC<IMarkerNodeRenderedProps> = ({
}: IMarkerNodeRenderedProps) => {
const handleClick = useCallback(
(ev: React.MouseEvent) => {
ev.stopPropagation();
if (itemType === TreeNodeType.TreeNode || itemType === TreeNodeType.CompositeTreeNode) {
onClick(ev, item as MarkerNode, itemType);
}
Expand Down

0 comments on commit 4b0e852

Please sign in to comment.