Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Bookmark manager style update #4658

Merged
merged 6 commits into from
Oct 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/common/lib/faviconUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const { isSourceAboutUrl } = require('../../../js/lib/appUrlUtil')
const {isSourceAboutUrl} = require('../../../js/lib/appUrlUtil')
const UrlUtil = require('../../../js/lib/urlutil')

module.exports.iconSize = 16
Expand Down
4 changes: 2 additions & 2 deletions app/extensions/brave/about-bookmarks.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<meta charset="utf-8">
<meta name="availableLanguages" content="">
<meta name="defaultLanguage" content="en-US">
<meta name='theme-color' content='#035500'>
<meta name='theme-color' content='#ff5000'>
<link rel="shortcut icon"type="image/x-icon" href="data:image/x-icon;,">
<title data-l10n-id="bookmarks"></title>
<title data-l10n-id="bookmarkManager"></title>
<script src='js/about.js'></script>
<script src="ext/l20n.min.js" async></script>
<link rel="localization" href="locales/{locale}/bookmarks.properties">
Expand Down
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/bookmarks.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bookmarks=Bookmarks
bookmarkManager=Bookmark Manager
folders=Folders
partitionNumber=Session {{partitionNumber}}
bookmarksToolbar=Bookmarks Toolbar
otherBookmarks=Other Bookmarks
bookmarkSearch.placeholder=Search bookmarks
importBrowserData=Import browser data
2 changes: 1 addition & 1 deletion app/extensions/brave/locales/en-US/history.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ historyTitle=History
history=History
clearBrowsingDataNow=Clear browsing data
removeSelectedItems=Remove selected items
historySearch=Search history
time=Time
title=Title
domain=Domain
historySearch.placeholder=Search history
35 changes: 17 additions & 18 deletions app/renderer/components/bookmarksToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,19 @@ class BookmarkToolbarButton extends ImmutableComponent {
this.onDragOver = this.onDragOver.bind(this)
this.onContextMenu = this.onContextMenu.bind(this)
}

showBookmarkFolderMenu (e) {
e.target = ReactDOM.findDOMNode(this)

if (e && e.stopPropagation) {
e.stopPropagation()
}

const xPos = (e.target.getBoundingClientRect().left | 0) - 2
const yPos = (e.target.parentNode.getBoundingClientRect().bottom | 0) - 1

windowActions.onMouseOverBookmarkFolder(this.props.bookmark.get('folderId'), this.props.sites, this.props.bookmark, xPos, yPos)
get activeFrame () {
return windowStore.getFrame(this.props.activeFrameKey)
}

onClick (e) {
if (!this.props.clickBookmarkItem(this.props.bookmark, e) &&
this.props.bookmark.get('tags').includes(siteTags.BOOKMARK_FOLDER)) {
if (this.props.contextMenuDetail) {
windowActions.setContextMenuDetail()
return
}
this.showBookmarkFolderMenu(e)
e.target = ReactDOM.findDOMNode(this)
this.props.showBookmarkFolderMenu(this.props.bookmark, e)
return
}
}

Expand All @@ -62,10 +53,12 @@ class BookmarkToolbarButton extends ImmutableComponent {
if (this.props.selectedFolderId) {
if (this.isFolder && this.props.selectedFolderId !== this.props.bookmark.get('folderId')) {
// Auto-expand the menu if user mouses over another folder
this.showBookmarkFolderMenu(e)
e.target = ReactDOM.findDOMNode(this)
this.props.showBookmarkFolderMenu(this.props.bookmark, e)
} else if (!this.isFolder && this.props.selectedFolderId !== -1) {
// Hide the currently expanded menu if user mouses over a non-folder
windowActions.onMouseOverBookmarkFolder(-1)
windowActions.setBookmarksToolbarSelectedFolderId(-1)
windowActions.setContextMenuDetail()
}
}
}
Expand All @@ -84,7 +77,7 @@ class BookmarkToolbarButton extends ImmutableComponent {
e.target = ReactDOM.findDOMNode(this)
if (dnd.isMiddle(e.target, e.clientX)) {
e.target.getBoundingClientRect
this.showBookmarkFolderMenu(e)
this.props.showBookmarkFolderMenu(this.props.bookmark, e)
windowActions.setIsBeingDraggedOverDetail(dragTypes.BOOKMARK, this.props.bookmark, {
expanded: true
})
Expand Down Expand Up @@ -238,6 +231,7 @@ class BookmarksToolbar extends ImmutableComponent {
this.onMoreBookmarksMenu = this.onMoreBookmarksMenu.bind(this)
this.openContextMenu = this.openContextMenu.bind(this)
this.clickBookmarkItem = this.clickBookmarkItem.bind(this)
this.showBookmarkFolderMenu = this.showBookmarkFolderMenu.bind(this)
}
get activeFrame () {
return windowStore.getFrame(this.props.activeFrameKey)
Expand Down Expand Up @@ -293,6 +287,10 @@ class BookmarksToolbar extends ImmutableComponent {
clickBookmarkItem (bookmark, e) {
return bookmarkActions.clickBookmarkItem(this.bookmarks, bookmark, this.activeFrame, e)
}
showBookmarkFolderMenu (bookmark, e) {
windowActions.setBookmarksToolbarSelectedFolderId(bookmark.get('folderId'))
contextMenus.onShowBookmarkFolderMenu(this.bookmarks, bookmark, this.activeFrame, e)
}
updateBookmarkData (props) {
this.bookmarks = siteUtil.getBookmarks(props.sites)

Expand Down Expand Up @@ -407,11 +405,12 @@ class BookmarksToolbar extends ImmutableComponent {
ref={(node) => this.bookmarkRefs.push(node)}
key={i}
contextMenuDetail={this.props.contextMenuDetail}
activeFrameKey={this.props.activeFrameKey}
draggingOverData={this.props.draggingOverData}
openContextMenu={this.openContextMenu}
clickBookmarkItem={this.clickBookmarkItem}
showBookmarkFolderMenu={this.showBookmarkFolderMenu}
bookmark={bookmark}
sites={this.bookmarks}
showFavicon={this.props.showFavicon}
showOnlyFavicon={this.props.showOnlyFavicon}
selectedFolderId={this.props.selectedFolderId} />)
Expand Down
10 changes: 1 addition & 9 deletions docs/windowActions.md
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ See `eventStore.js` for an example use-case



### onMouseOverBookmarkFolder(folderId, bookmarks, bookmark, xPos, yPos)
### setBookmarksToolbarSelectedFolderId(folderId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting I think we're trying to move away from setter actions


Fired when the mouse clicks or hovers over a bookmark folder in the bookmarks toolbar

Expand All @@ -900,14 +900,6 @@ Fired when the mouse clicks or hovers over a bookmark folder in the bookmarks to
**folderId**: `number`, from the siteDetail for the bookmark folder
If set to null, no menu is open. If set to -1, mouse is over a bookmark, not a folder

**bookmarks**: `Object`, all of the users bookmarks

**bookmark**: `Object`, the object representing the selected folder

**xPos**: `number`, x position of the left corner of the context mennu

**yPos**: `number`, y position of the top corner of the context menu




Expand Down
Loading