support zz command
This commit is contained in:
parent
1f15d22643
commit
a5f1e06efc
4 changed files with 14 additions and 4 deletions
|
@ -45,6 +45,9 @@ const doBackgroundAction = (sender, action) => {
|
||||||
case actions.ZOOM_OUT:
|
case actions.ZOOM_OUT:
|
||||||
zooms.zoomOut();
|
zooms.zoomOut();
|
||||||
break;
|
break;
|
||||||
|
case actions.ZOOM_NEUTRAL:
|
||||||
|
zooms.neutral();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ const DEFAULT_KEYMAP = [
|
||||||
{ keys: [{ code: KeyboardEvent.DOM_VK_L }], action: [ actions.TABS_NEXT, 1 ]},
|
{ keys: [{ code: KeyboardEvent.DOM_VK_L }], action: [ actions.TABS_NEXT, 1 ]},
|
||||||
{ keys: [{ code: KeyboardEvent.DOM_VK_Z }, { code: KeyboardEvent.DOM_VK_I }], action: [ actions.ZOOM_IN ]},
|
{ keys: [{ code: KeyboardEvent.DOM_VK_Z }, { code: KeyboardEvent.DOM_VK_I }], action: [ actions.ZOOM_IN ]},
|
||||||
{ keys: [{ code: KeyboardEvent.DOM_VK_Z }, { code: KeyboardEvent.DOM_VK_O }], action: [ actions.ZOOM_OUT ]},
|
{ keys: [{ code: KeyboardEvent.DOM_VK_Z }, { code: KeyboardEvent.DOM_VK_O }], action: [ actions.ZOOM_OUT ]},
|
||||||
|
{ keys: [{ code: KeyboardEvent.DOM_VK_Z }, { code: KeyboardEvent.DOM_VK_Z }], action: [ actions.ZOOM_NEUTRAL]},
|
||||||
{ keys: [{ code: KeyboardEvent.DOM_VK_F }], action: [ actions.FOLLOW_START, false ]},
|
{ keys: [{ code: KeyboardEvent.DOM_VK_F }], action: [ actions.FOLLOW_START, false ]},
|
||||||
{ keys: [{ code: KeyboardEvent.DOM_VK_F, shift: true }], action: [ actions.FOLLOW_START, true ]},
|
{ keys: [{ code: KeyboardEvent.DOM_VK_F, shift: true }], action: [ actions.FOLLOW_START, true ]},
|
||||||
{ keys: [{ code: KeyboardEvent.DOM_VK_H, shift: true }], action: [ actions.HISTORY_PREV ]},
|
{ keys: [{ code: KeyboardEvent.DOM_VK_H, shift: true }], action: [ actions.HISTORY_PREV ]},
|
||||||
|
|
|
@ -18,7 +18,7 @@ const zoomIn = (tabId = undefined) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const zoomOut = (tabId = undefined) => {
|
const zoomOut = (tabId = undefined) => {
|
||||||
browser.tabs.getZoom(tabId).then((factor) => {
|
browser.tabs.getZoom(tabId).then((factor) => {
|
||||||
|
@ -29,6 +29,10 @@ const zoomOut = (tabId = undefined) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export { zoomIn, zoomOut };
|
const neutral = (tabId = undefined) => {
|
||||||
|
browser.tabs.setZoom(tabId, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { zoomIn, zoomOut, neutral };
|
||||||
|
|
|
@ -13,6 +13,7 @@ export const HISTORY_PREV = 'history.prev';
|
||||||
export const HISTORY_NEXT = 'history.next';
|
export const HISTORY_NEXT = 'history.next';
|
||||||
export const ZOOM_IN = 'zoom.in';
|
export const ZOOM_IN = 'zoom.in';
|
||||||
export const ZOOM_OUT = 'zoom.out';
|
export const ZOOM_OUT = 'zoom.out';
|
||||||
|
export const ZOOM_NEUTRAL = 'zoom.neutral';
|
||||||
|
|
||||||
const BACKGROUND_ACTION_SET = new Set([
|
const BACKGROUND_ACTION_SET = new Set([
|
||||||
TABS_CLOSE,
|
TABS_CLOSE,
|
||||||
|
@ -20,7 +21,8 @@ const BACKGROUND_ACTION_SET = new Set([
|
||||||
TABS_PREV,
|
TABS_PREV,
|
||||||
TABS_NEXT,
|
TABS_NEXT,
|
||||||
ZOOM_IN,
|
ZOOM_IN,
|
||||||
ZOOM_OUT
|
ZOOM_OUT,
|
||||||
|
ZOOM_NEUTRAL
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const CONTENT_ACTION_SET = new Set([
|
const CONTENT_ACTION_SET = new Set([
|
||||||
|
|
Reference in a new issue