|
|
@@ -26,6 +26,7 @@ type BookmarkFolderItemProps = {
|
|
|
isReadOnlyUser: boolean
|
|
|
bookmarkFolder: BookmarkFolderItems
|
|
|
isOpen?: boolean
|
|
|
+ isOperable: boolean,
|
|
|
level: number
|
|
|
root: string
|
|
|
isUserHomePage?: boolean
|
|
|
@@ -37,7 +38,7 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
|
|
|
const BASE_FOLDER_PADDING = 15;
|
|
|
const acceptedTypes: DragItemType[] = [DRAG_ITEM_TYPE.FOLDER, DRAG_ITEM_TYPE.BOOKMARK];
|
|
|
const {
|
|
|
- isReadOnlyUser, bookmarkFolder, isOpen: _isOpen = false, level, root, isUserHomePage,
|
|
|
+ isReadOnlyUser, bookmarkFolder, isOpen: _isOpen = false, isOperable, level, root, isUserHomePage,
|
|
|
onClickDeleteBookmarkHandler, bookmarkFolderTreeMutation,
|
|
|
} = props;
|
|
|
|
|
|
@@ -148,6 +149,7 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
|
|
|
<BookmarkFolderItem
|
|
|
key={childFolder._id}
|
|
|
isReadOnlyUser={isReadOnlyUser}
|
|
|
+ isOperable={props.isOperable}
|
|
|
bookmarkFolder={childFolder}
|
|
|
level={level + 1}
|
|
|
root={root}
|
|
|
@@ -166,6 +168,7 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
|
|
|
<BookmarkItem
|
|
|
key={bookmark._id}
|
|
|
isReadOnlyUser={isReadOnlyUser}
|
|
|
+ isOperable={props.isOperable}
|
|
|
bookmarkedPage={bookmark.page}
|
|
|
level={level + 1}
|
|
|
parentFolder={bookmarkFolder}
|
|
|
@@ -211,8 +214,8 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
|
|
|
key={folderId}
|
|
|
type={acceptedTypes}
|
|
|
item={props}
|
|
|
- useDragMode={true}
|
|
|
- useDropMode={true}
|
|
|
+ useDragMode={isOperable}
|
|
|
+ useDropMode={isOperable}
|
|
|
onDropItem={itemDropHandler}
|
|
|
isDropable={isDropable}
|
|
|
>
|
|
|
@@ -252,33 +255,35 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
|
|
|
</div>
|
|
|
</>
|
|
|
)}
|
|
|
- <div className="grw-foldertree-control d-flex">
|
|
|
- <BookmarkFolderItemControl
|
|
|
- onClickRename={onClickRenameHandler}
|
|
|
- onClickDelete={onClickDeleteHandler}
|
|
|
- onClickMoveToRoot={bookmarkFolder.parent != null
|
|
|
- ? onClickMoveToRootHandlerForBookmarkFolderItemControl
|
|
|
- : undefined
|
|
|
- }
|
|
|
- >
|
|
|
- <div onClick={e => e.stopPropagation()}>
|
|
|
- <DropdownToggle color="transparent" className="border-0 rounded btn-page-item-control p-0 grw-visible-on-hover mr-1">
|
|
|
- <i className="icon-options fa fa-rotate-90 p-1"></i>
|
|
|
- </DropdownToggle>
|
|
|
- </div>
|
|
|
- </BookmarkFolderItemControl>
|
|
|
- {/* Maximum folder hierarchy of 2 levels */}
|
|
|
- {!(bookmarkFolder.parent != null) && (
|
|
|
- <button
|
|
|
- id='create-bookmark-folder-button'
|
|
|
- type="button"
|
|
|
- className="border-0 rounded btn btn-page-item-control p-0 grw-visible-on-hover"
|
|
|
- onClick={onClickPlusButton}
|
|
|
+ { isOperable && (
|
|
|
+ <div className="grw-foldertree-control d-flex">
|
|
|
+ <BookmarkFolderItemControl
|
|
|
+ onClickRename={onClickRenameHandler}
|
|
|
+ onClickDelete={onClickDeleteHandler}
|
|
|
+ onClickMoveToRoot={bookmarkFolder.parent != null
|
|
|
+ ? onClickMoveToRootHandlerForBookmarkFolderItemControl
|
|
|
+ : undefined
|
|
|
+ }
|
|
|
>
|
|
|
- <i className="icon-plus d-block p-0" />
|
|
|
- </button>
|
|
|
- )}
|
|
|
- </div>
|
|
|
+ <div onClick={e => e.stopPropagation()}>
|
|
|
+ <DropdownToggle color="transparent" className="border-0 rounded btn-page-item-control p-0 grw-visible-on-hover mr-1">
|
|
|
+ <i className="icon-options fa fa-rotate-90 p-1"></i>
|
|
|
+ </DropdownToggle>
|
|
|
+ </div>
|
|
|
+ </BookmarkFolderItemControl>
|
|
|
+ {/* Maximum folder hierarchy of 2 levels */}
|
|
|
+ {!(bookmarkFolder.parent != null) && (
|
|
|
+ <button
|
|
|
+ id='create-bookmark-folder-button'
|
|
|
+ type="button"
|
|
|
+ className="border-0 rounded btn btn-page-item-control p-0 grw-visible-on-hover"
|
|
|
+ onClick={onClickPlusButton}
|
|
|
+ >
|
|
|
+ <i className="icon-plus d-block p-0" />
|
|
|
+ </button>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</li>
|
|
|
</DragAndDropWrapper>
|
|
|
{isCreateAction && (
|