diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index ea1ee92fa10..905a6555e2e 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -129,9 +129,9 @@ allowFlashPlayer=Allow {{origin}} to run Flash Player? ledgerBackupText=Your ledger keys are {{paymentId}} and {{passphrase}} error=Error caseSensitivity=Match case -nameField=Title: -locationField=Location: -parentFolderField=Folder: +nameField=Title +locationField=Location +parentFolderField=Folder save=Save rememberDecision=Remember this decision bookmarksToolbar=Bookmarks Toolbar diff --git a/app/extensions/brave/locales/en-US/menu.properties b/app/extensions/brave/locales/en-US/menu.properties index a0c2739f543..5a2f1eaa9db 100644 --- a/app/extensions/brave/locales/en-US/menu.properties +++ b/app/extensions/brave/locales/en-US/menu.properties @@ -3,6 +3,8 @@ closeTab=Close closeOtherTabs=Close other Tabs bookmarkPage=Bookmark Page bookmarkLink=Bookmark This Link +bookmarkAdded=Bookmark Added +bookmarkEdit=Edit Bookmark openFile=Open File… openLocation=Open Location… openSearch=Search for "{{selectedVariable}}" @@ -19,7 +21,8 @@ paste=Paste pasteAndGo=Paste and Go pasteAndSearch=Paste and Search pasteWithoutFormatting=Paste without formatting -delete=Delete +done=Done +remove=Remove selectAll=Select All findNext=Find Next findPrevious=Find Previous @@ -50,6 +53,7 @@ clearSiteData=Clear All Cookies and Site Data… recentlyClosed=Recently Closed recentlyVisited=Recently Visited bookmarks=Bookmarks +viewBookmarks=View all bookmarks addToFavoritesBar=Add to Favorites Bar window=Window minimize=Minimize diff --git a/docs/state.md b/docs/state.md index 3a3d6066658..c8844ee51ec 100644 --- a/docs/state.md +++ b/docs/state.md @@ -372,6 +372,7 @@ WindowStore bookmarkDetail: { currentDetail: Object, // Detail of the current bookmark which is in add/edit mode originalDetails: Object // Detail of the original bookmark to edit + shouldShowLocation: Boolean // Whether or not to show the URL input }, braveryPanelDetail: { advancedControls: boolean, // If specified, indicates if advanced controls should be shown diff --git a/docs/windowActions.md b/docs/windowActions.md index 66b50dc58b8..bd7426feca1 100644 --- a/docs/windowActions.md +++ b/docs/windowActions.md @@ -467,7 +467,7 @@ Dispatches a message to set the find-in-page details. -### setBookmarkDetail(currentDetail, originalDetail, destinationDetail) +### setBookmarkDetail(currentDetail, originalDetail, destinationDetail, shouldShowLocation) Dispatches a message to set add/edit bookmark details If set, also indicates that add/edit is shown @@ -480,6 +480,8 @@ If set, also indicates that add/edit is shown **destinationDetail**: `Object`, Will move the added bookmark to the specified position +**shouldShowLocation**: `Object`, Whether or not to show the URL input + ### setContextMenuDetail(detail) diff --git a/js/actions/windowActions.js b/js/actions/windowActions.js index de8b657a409..38494b70104 100644 --- a/js/actions/windowActions.js +++ b/js/actions/windowActions.js @@ -643,13 +643,15 @@ const windowActions = { * @param {Object} currentDetail - Properties of the bookmark to change to * @param {Object} originalDetail - Properties of the bookmark to edit * @param {Object} destinationDetail - Will move the added bookmark to the specified position + * @param {Object} shouldShowLocation - Whether or not to show the URL input */ - setBookmarkDetail: function (currentDetail, originalDetail, destinationDetail) { + setBookmarkDetail: function (currentDetail, originalDetail, destinationDetail, shouldShowLocation) { dispatch({ actionType: WindowConstants.WINDOW_SET_BOOKMARK_DETAIL, currentDetail, originalDetail, - destinationDetail + destinationDetail, + shouldShowLocation }) }, diff --git a/js/components/addEditBookmark.js b/js/components/addEditBookmark.js index 24044bf8a02..fb5e47fdcaf 100644 --- a/js/components/addEditBookmark.js +++ b/js/components/addEditBookmark.js @@ -4,8 +4,8 @@ const React = require('react') const ImmutableComponent = require('./immutableComponent') -const Dialog = require('./dialog') const Button = require('./button') +const cx = require('../lib/classSet') const windowActions = require('../actions/windowActions') const appActions = require('../actions/appActions') const KeyCodes = require('../../app/common/constants/keyCodes') @@ -24,6 +24,7 @@ class AddEditBookmark extends ImmutableComponent { this.onClose = this.onClose.bind(this) this.onClick = this.onClick.bind(this) this.onSave = this.onSave.bind(this) + this.onViewBookmarks = this.onViewBookmarks.bind(this) this.onRemoveBookmark = this.onRemoveBookmark.bind(this) } @@ -51,6 +52,10 @@ class AddEditBookmark extends ImmutableComponent { } } componentDidMount () { + // Automatically save if this is triggered by the url star + if (!this.props.shouldShowLocation) { + this.onSave(false) + } this.bookmarkName.select() this.bookmarkName.focus() } @@ -96,7 +101,7 @@ class AddEditBookmark extends ImmutableComponent { appActions.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, true) } } - onSave () { + onSave (closeDialog = true) { // First check if the title of the currentDetail is set if (!this.bookmarkNameValid) { return false @@ -105,13 +110,19 @@ class AddEditBookmark extends ImmutableComponent { this.showToolbarOnFirstBookmark() const tag = this.isFolder ? siteTags.BOOKMARK_FOLDER : siteTags.BOOKMARK appActions.addSite(this.props.currentDetail, tag, this.props.originalDetail, this.props.destinationDetail) - this.onClose() + if (closeDialog) { + this.onClose() + } } onRemoveBookmark () { const tag = this.isFolder ? siteTags.BOOKMARK_FOLDER : siteTags.BOOKMARK appActions.removeSite(this.props.currentDetail, tag) this.onClose() } + onViewBookmarks () { + this.onClose() + windowActions.newFrame({location: 'about:bookmarks'}, true) + } get displayBookmarkName () { if (this.props.currentDetail.get('customTitle') !== undefined) { return this.props.currentDetail.get('customTitle') @@ -119,42 +130,58 @@ class AddEditBookmark extends ImmutableComponent { return this.props.currentDetail.get('title') || '' } render () { - return -
-
-
-
+ return
+
+
+
{ - !this.isFolder - ?
-
- : null + !this.isFolder && this.props.shouldShowLocation + ?

+ :

} -
-
-

+
+
-
+ } } diff --git a/js/components/main.js b/js/components/main.js index e4364831ec5..3776458ebed 100644 --- a/js/components/main.js +++ b/js/components/main.js @@ -32,7 +32,6 @@ const ClearBrowsingDataPanel = require('./clearBrowsingDataPanel') const ImportBrowserDataPanel = require('../../app/renderer/components/importBrowserDataPanel') const AutofillAddressPanel = require('./autofillAddressPanel') const AutofillCreditCardPanel = require('./autofillCreditCardPanel') -const AddEditBookmark = require('./addEditBookmark') const LoginRequired = require('./loginRequired') const ReleaseNotes = require('./releaseNotes') const BookmarksToolbar = require('../../app/renderer/components/bookmarksToolbar') @@ -667,7 +666,8 @@ class Main extends ImmutableComponent { (node.classList.contains('popupWindow') || node.classList.contains('contextMenu') || node.classList.contains('extensionButton') || - node.classList.contains('menubarItem'))) { + node.classList.contains('menubarItem') || + node.classList.contains('bookmarkForm'))) { // Middle click (on context menu) needs to fire the click event. // We need to prevent the default "Auto-Scrolling" behavior. if (node.classList.contains('contextMenu') && e.button === 1) { @@ -919,6 +919,7 @@ class Main extends ImmutableComponent { startLoadTime={activeFrame && activeFrame.get('startLoadTime') || undefined} endLoadTime={activeFrame && activeFrame.get('endLoadTime') || undefined} loading={activeFrame && activeFrame.get('loading')} + bookmarkDetail={this.props.windowState.get('bookmarkDetail')} mouseInTitlebar={this.props.windowState.getIn(['ui', 'mouseInTitlebar'])} searchDetail={this.props.windowState.get('searchDetail')} enableNoScript={this.enableNoScript(activeSiteSettings)} @@ -1003,14 +1004,6 @@ class Main extends ImmutableComponent { ? : null } - { - this.props.windowState.get('bookmarkDetail') - ? - : null - } { noScriptIsVisible ? + { + this.props.bookmarkDetail + ? + : null + }
{ isSourceAboutUrl(this.props.location) || this.titleMode - ? + ? null : this.loading ?
} -