aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-08 21:36:58 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-05-08 21:36:58 +0900
commit53c3ddab2e0efa656ab04726a85df04bb899f4d8 (patch)
tree76d7651acf48fad555f6b784dcb1498a90b5dcb6
parentd41c7476a6ae10cb906f826d97cef86e9d237151 (diff)
Fix bookmark
-rw-r--r--src/background/actions/command.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/background/actions/command.js b/src/background/actions/command.js
index e46a97e..be742cd 100644
--- a/src/background/actions/command.js
+++ b/src/background/actions/command.js
@@ -1,3 +1,4 @@
+import messages from 'shared/messages';
import actions from '../actions';
import * as tabs from '../shared/tabs';
import * as bookmarks from '../shared/bookmarks';
@@ -45,7 +46,7 @@ const addBookmarkCommand = (tab, args) => {
return Promise.resolve();
}
- return bookmarks.create(args[0], tab.url);
+ return bookmarks.create(args.join(' '), tab.url);
};
const setCommand = (args) => {
@@ -78,7 +79,18 @@ const exec = (tab, line, settings) => {
case 'buffer':
return bufferCommand(args);
case 'addbookmark':
- return addBookmarkCommand(tab, args);
+ return addBookmarkCommand(tab, args).then((item) => {
+ if (!item) {
+ return browser.tabs.sendMessage(tab.id, {
+ type: messages.CONSOLE_SHOW_ERROR,
+ text: 'Could not create a bookmark',
+ });
+ }
+ return browser.tabs.sendMessage(tab.id, {
+ type: messages.CONSOLE_SHOW_INFO,
+ text: 'Saved current page: ' + item.url,
+ });
+ });
case 'set':
return setCommand(args);
case '':