mirror of https://github.com/laurent22/joplin.git
pull/7844/head
parent
da11476fd7
commit
9c080ec631
|
@ -8,6 +8,7 @@ interface Props {
|
|||
onKeyDown?: Function;
|
||||
itemRenderer: Function;
|
||||
className?: string;
|
||||
onNoteDrop?: Function;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -29,6 +30,7 @@ class ItemList extends React.Component<Props, State> {
|
|||
|
||||
this.onScroll = this.onScroll.bind(this);
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
this.onDrop = this.onDrop.bind(this);
|
||||
}
|
||||
|
||||
visibleItemCount(props: Props = undefined) {
|
||||
|
@ -76,6 +78,10 @@ class ItemList extends React.Component<Props, State> {
|
|||
if (this.props.onKeyDown) this.props.onKeyDown(event);
|
||||
}
|
||||
|
||||
onDrop(event: any) {
|
||||
if (this.props.onNoteDrop) this.props.onNoteDrop(event);
|
||||
}
|
||||
|
||||
makeItemIndexVisible(itemIndex: number) {
|
||||
const top = Math.min(this.props.items.length - 1, this.state.topItemIndex);
|
||||
const bottom = Math.max(0, this.state.bottomItemIndex);
|
||||
|
@ -141,7 +147,7 @@ class ItemList extends React.Component<Props, State> {
|
|||
if (this.props.className) classes.push(this.props.className);
|
||||
|
||||
return (
|
||||
<div ref={this.listRef} className={classes.join(' ')} style={style} onScroll={this.onScroll} onKeyDown={this.onKeyDown}>
|
||||
<div ref={this.listRef} className={classes.join(' ')} style={style} onScroll={this.onScroll} onKeyDown={this.onKeyDown} onDrop={this.onDrop}>
|
||||
{itemComps}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -275,7 +275,6 @@ const NoteListComponent = (props: Props) => {
|
|||
onCheckboxClick={noteItem_checkboxClick}
|
||||
onDragStart={noteItem_dragStart}
|
||||
onNoteDragOver={noteItem_noteDragOver}
|
||||
onNoteDrop={noteItem_noteDrop}
|
||||
onTitleClick={noteItem_titleClick}
|
||||
onContextMenu={itemContextMenu}
|
||||
/>;
|
||||
|
@ -526,6 +525,7 @@ const NoteListComponent = (props: Props) => {
|
|||
style={props.size}
|
||||
itemRenderer={renderItem}
|
||||
onKeyDown={onKeyDown}
|
||||
onNoteDrop={noteItem_noteDrop}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -56,7 +56,6 @@ interface NoteListItemProps {
|
|||
onCheckboxClick: any;
|
||||
onDragStart: any;
|
||||
onNoteDragOver: any;
|
||||
onNoteDrop: any;
|
||||
onTitleClick: any;
|
||||
onContextMenu(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>): void;
|
||||
}
|
||||
|
@ -175,7 +174,6 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
|
|||
<StyledRoot
|
||||
className={classNames}
|
||||
onDragOver={props.onNoteDragOver}
|
||||
onDrop={props.onNoteDrop}
|
||||
width={props.width}
|
||||
height={props.height}
|
||||
isProvisional={props.isProvisional}
|
||||
|
|
Loading…
Reference in New Issue