From 53c3ddab2e0efa656ab04726a85df04bb899f4d8 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 8 May 2018 21:36:58 +0900 Subject: [PATCH] Fix bookmark --- src/background/actions/command.js | 16 ++++++++++++++-- 1 file 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 '':