mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
Added a "copy current url" shortcut
This commit is contained in:
2
l10n
2
l10n
Submodule l10n updated: f0ed268683...d5d4b0f128
@@ -53,3 +53,27 @@ class ZenPreloadedFeature {
|
||||
document.addEventListener('MozBeforeInitialXULLayout', initBound, { once: true });
|
||||
}
|
||||
}
|
||||
|
||||
var gZenCommonActions = {
|
||||
copyCurrentURLToClipboard() {
|
||||
const currentUrl = gBrowser.currentURI.spec;
|
||||
if (currentUrl) {
|
||||
let str = Cc["@mozilla.org/supports-string;1"].createInstance(
|
||||
Ci.nsISupportsString
|
||||
);
|
||||
str.data = currentUrl;
|
||||
let transferable = Cc[
|
||||
"@mozilla.org/widget/transferable;1"
|
||||
].createInstance(Ci.nsITransferable);
|
||||
transferable.init(getLoadContext());
|
||||
transferable.addDataFlavor("text/plain");
|
||||
transferable.setTransferData("text/plain", str);
|
||||
Services.clipboard.setData(
|
||||
transferable,
|
||||
null,
|
||||
Ci.nsIClipboard.kGlobalClipboard
|
||||
);
|
||||
ConfirmationHint.show(document.getElementById("PanelUI-menu-button"), "zen-copy-current-url-confirmation");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -152,7 +152,7 @@ var gZenCompactModeManager = {
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(() => {
|
||||
this.sidebar.style.transition = "margin .3s ease, transform .3s ease, opacity .3s ease";
|
||||
this.sidebar.style.transition = "margin .3s ease, transform .275s ease, opacity .3s ease";
|
||||
// we are in compact mode and we are exiting it
|
||||
if (!this.sidebarIsOnRight) {
|
||||
this.sidebar.style.marginLeft = "0";
|
||||
|
@@ -66,6 +66,7 @@ const defaultKeyboardGroups = {
|
||||
'zen-search-find-again-shortcut-prev',
|
||||
],
|
||||
pageOperations: [
|
||||
'zen-text-action-copy-url-shortcut',
|
||||
'zen-location-open-shortcut',
|
||||
'zen-location-open-shortcut-alt',
|
||||
'zen-save-page-shortcut',
|
||||
@@ -702,7 +703,7 @@ function zenGetDefaultShortcuts() {
|
||||
}
|
||||
|
||||
class ZenKeyboardShortcutsVersioner {
|
||||
static LATEST_KBS_VERSION = 5;
|
||||
static LATEST_KBS_VERSION = 6;
|
||||
|
||||
constructor() {}
|
||||
|
||||
@@ -822,6 +823,21 @@ class ZenKeyboardShortcutsVersioner {
|
||||
)
|
||||
);
|
||||
}
|
||||
if (version < 6) {
|
||||
// Migrate from 5 to 6
|
||||
// In this new version, we add the "Copy URL" shortcut to the default shortcuts
|
||||
data.push(
|
||||
new KeyShortcut(
|
||||
'zen-copy-url',
|
||||
'C',
|
||||
'',
|
||||
ZEN_OTHER_SHORTCUTS_GROUP,
|
||||
KeyShortcutModifiers.fromObject({ accel: true, shift: true }),
|
||||
'code:gZenCommonActions.copyCurrentURLToClipboard()',
|
||||
'zen-text-action-copy-url-shortcut'
|
||||
)
|
||||
);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user