diff options
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/actions/operation.js | 4 | ||||
-rw-r--r-- | src/content/urls.js | 17 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js index c1bd1c8..89d7fec 100644 --- a/src/content/actions/operation.js +++ b/src/content/actions/operation.js @@ -83,7 +83,9 @@ const exec = (operation, repeat, settings, addonEnabled) => { consoleFrames.postInfo(window.document, 'Current url yanked'); break; case operations.URLS_PASTE: - urls.paste(window, operation.newTab ? operation.newTab : false); + urls.paste( + window, operation.newTab ? operation.newTab : false, settings.search + ); break; default: browser.runtime.sendMessage({ diff --git a/src/content/urls.js b/src/content/urls.js index 9b7b284..1c5b7e5 100644 --- a/src/content/urls.js +++ b/src/content/urls.js @@ -1,4 +1,5 @@ import messages from 'shared/messages'; +import * as urls from '../shared/urls'; const yank = (win) => { let input = win.document.createElement('input'); @@ -14,7 +15,7 @@ const yank = (win) => { input.remove(); }; -const paste = (win, newTab) => { +const paste = (win, newTab, searchSettings) => { let textarea = win.document.createElement('textarea'); win.document.body.append(textarea); @@ -24,13 +25,13 @@ const paste = (win, newTab) => { textarea.focus(); if (win.document.execCommand('paste')) { - if (/^(https?|ftp):\/\//.test(textarea.textContent)) { - browser.runtime.sendMessage({ - type: messages.OPEN_URL, - url: textarea.textContent, - newTab: newTab ? newTab : false, - }); - } + let value = textarea.textContent; + let url = urls.normalizeUrl(value, searchSettings); + browser.runtime.sendMessage({ + type: messages.OPEN_URL, + url, + newTab, + }); } textarea.remove(); |