Compare commits
1 Commits
main
...
feat-right
| Author | SHA1 | Date | |
|---|---|---|---|
| 212a5c4530 |
@@ -81,6 +81,13 @@ function DocumentListItem(
|
|||||||
title: document.titleWithDefault,
|
title: document.titleWithDefault,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
onContextMenu={(e) => {
|
||||||
|
if (menuOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
handleMenuOpen();
|
||||||
|
}}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
<Content>
|
<Content>
|
||||||
@@ -137,6 +144,7 @@ function DocumentListItem(
|
|||||||
<DocumentMenu
|
<DocumentMenu
|
||||||
document={document}
|
document={document}
|
||||||
showPin={showPin}
|
showPin={showPin}
|
||||||
|
visible={menuOpen}
|
||||||
onOpen={handleMenuOpen}
|
onOpen={handleMenuOpen}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
modal={false}
|
modal={false}
|
||||||
|
|||||||
@@ -131,7 +131,16 @@ const CollectionLink: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Relative ref={drop}>
|
<Relative
|
||||||
|
ref={drop}
|
||||||
|
onContextMenu={(e) => {
|
||||||
|
if (menuOpen || isEditing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
handleMenuOpen();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<DropToImport collectionId={collection.id}>
|
<DropToImport collectionId={collection.id}>
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
to={{
|
to={{
|
||||||
@@ -178,6 +187,7 @@ const CollectionLink: React.FC<Props> = ({
|
|||||||
onRename={() =>
|
onRename={() =>
|
||||||
editableTitleRef.current?.setIsEditing(true)
|
editableTitleRef.current?.setIsEditing(true)
|
||||||
}
|
}
|
||||||
|
visible={menuOpen}
|
||||||
onOpen={handleMenuOpen}
|
onOpen={handleMenuOpen}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -310,6 +310,13 @@ function InnerDocumentLink(
|
|||||||
$isDragging={isDragging}
|
$isDragging={isDragging}
|
||||||
$isMoving={isMoving}
|
$isMoving={isMoving}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
onContextMenu={(e) => {
|
||||||
|
if (menuOpen || isEditing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
handleMenuOpen();
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div ref={dropToReparent}>
|
<div ref={dropToReparent}>
|
||||||
<DropToImport documentId={node.id} activeClassName="activeDropZone">
|
<DropToImport documentId={node.id} activeClassName="activeDropZone">
|
||||||
@@ -372,6 +379,7 @@ function InnerDocumentLink(
|
|||||||
onRename={() =>
|
onRename={() =>
|
||||||
editableTitleRef.current?.setIsEditing(true)
|
editableTitleRef.current?.setIsEditing(true)
|
||||||
}
|
}
|
||||||
|
visible={menuOpen}
|
||||||
onOpen={handleMenuOpen}
|
onOpen={handleMenuOpen}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -115,7 +115,18 @@ function StarredLink({ star }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Draggable key={star.id} ref={draggableRef} $isDragging={isDragging}>
|
<Draggable
|
||||||
|
key={star.id}
|
||||||
|
ref={draggableRef}
|
||||||
|
$isDragging={isDragging}
|
||||||
|
onContextMenu={(e) => {
|
||||||
|
if (menuOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
handleMenuOpen();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
depth={0}
|
depth={0}
|
||||||
to={{
|
to={{
|
||||||
@@ -136,6 +147,7 @@ function StarredLink({ star }: Props) {
|
|||||||
<Fade>
|
<Fade>
|
||||||
<DocumentMenu
|
<DocumentMenu
|
||||||
document={document}
|
document={document}
|
||||||
|
visible={menuOpen}
|
||||||
onOpen={handleMenuOpen}
|
onOpen={handleMenuOpen}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ type Props = {
|
|||||||
collection: Collection;
|
collection: Collection;
|
||||||
placement?: Placement;
|
placement?: Placement;
|
||||||
modal?: boolean;
|
modal?: boolean;
|
||||||
|
visible?: boolean;
|
||||||
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
|
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
|
||||||
onRename?: () => void;
|
onRename?: () => void;
|
||||||
onOpen?: () => void;
|
onOpen?: () => void;
|
||||||
@@ -49,6 +50,7 @@ function CollectionMenu({
|
|||||||
collection,
|
collection,
|
||||||
label,
|
label,
|
||||||
modal = true,
|
modal = true,
|
||||||
|
visible,
|
||||||
placement,
|
placement,
|
||||||
onRename,
|
onRename,
|
||||||
onOpen,
|
onOpen,
|
||||||
@@ -64,6 +66,12 @@ function CollectionMenu({
|
|||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const file = React.useRef<HTMLInputElement>(null);
|
const file = React.useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (visible !== undefined && menu.visible !== visible) {
|
||||||
|
menu.setVisible(visible);
|
||||||
|
}
|
||||||
|
}, [visible]);
|
||||||
|
|
||||||
const handleExport = React.useCallback(() => {
|
const handleExport = React.useCallback(() => {
|
||||||
dialogs.openModal({
|
dialogs.openModal({
|
||||||
title: t("Export collection"),
|
title: t("Export collection"),
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ type Props = {
|
|||||||
/** Pass true if the document is currently being displayed */
|
/** Pass true if the document is currently being displayed */
|
||||||
showDisplayOptions?: boolean;
|
showDisplayOptions?: boolean;
|
||||||
modal?: boolean;
|
modal?: boolean;
|
||||||
|
visible?: boolean;
|
||||||
showToggleEmbeds?: boolean;
|
showToggleEmbeds?: boolean;
|
||||||
showPin?: boolean;
|
showPin?: boolean;
|
||||||
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
|
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
|
||||||
@@ -74,6 +75,7 @@ function DocumentMenu({
|
|||||||
document,
|
document,
|
||||||
className,
|
className,
|
||||||
modal = true,
|
modal = true,
|
||||||
|
visible,
|
||||||
showToggleEmbeds,
|
showToggleEmbeds,
|
||||||
showDisplayOptions,
|
showDisplayOptions,
|
||||||
label,
|
label,
|
||||||
@@ -106,6 +108,12 @@ function DocumentMenu({
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (visible !== undefined && menu.visible !== visible) {
|
||||||
|
menu.setVisible(visible);
|
||||||
|
}
|
||||||
|
}, [visible]);
|
||||||
|
|
||||||
const handleOpen = React.useCallback(async () => {
|
const handleOpen = React.useCallback(async () => {
|
||||||
if (!data && !loading) {
|
if (!data && !loading) {
|
||||||
await request();
|
await request();
|
||||||
|
|||||||
Reference in New Issue
Block a user