Show info on yanked

This commit is contained in:
Shin'ya Ueoka 2017-10-08 19:08:51 +09:00
parent b0d2b53281
commit 7ac00fce6f
12 changed files with 84 additions and 31 deletions

View file

@ -4,6 +4,7 @@ import * as scrolls from 'content/scrolls';
import * as navigates from 'content/navigates';
import * as urls from 'content/urls';
import * as followActions from 'content/actions/follow';
import * as consoleFrames from 'content/console-frames';
const exec = (operation) => {
switch (operation.type) {
@ -34,7 +35,11 @@ const exec = (operation) => {
case operations.NAVIGATE_ROOT:
return navigates.root(window);
case operations.URLS_YANK:
return urls.yank(window);
urls.yank(window);
return consoleFrames.postMessage(window.document, {
type: messages.CONSOLE_SHOW_INFO,
text: 'Current url yanked',
});
default:
browser.runtime.sendMessage({
type: messages.BACKGROUND_OPERATION,

View file

@ -15,4 +15,9 @@ const blur = (doc) => {
iframe.blur();
};
export { initialize, blur };
const postMessage = (doc, message) => {
let iframe = doc.getElementById('vimvixen-console-frame');
iframe.contentWindow.postMessage(JSON.stringify(message), '*');
};
export { initialize, blur, postMessage };