fix: issue #20 cmd-J panel tab strip visibility and output panel parity
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
} from "../utils/shortcuts.js";
|
||||
import { syncTitlebarOverlayInsets } from "../bridges/titlebar_overlay.js";
|
||||
import { runMenuRuntimeCommand } from "../bridges/menu_runtime.js";
|
||||
import { copyTextToClipboard } from "../utils/clipboard.js";
|
||||
|
||||
export const AppShell = {
|
||||
mounted() {
|
||||
@@ -179,6 +180,10 @@ export const AppShell = {
|
||||
}
|
||||
});
|
||||
|
||||
this.handleEvent("clipboard", ({ text }) => {
|
||||
copyTextToClipboard(text || "");
|
||||
});
|
||||
|
||||
window.addEventListener("bds:native-menu-action", this.handleNativeMenuAction);
|
||||
window.addEventListener("keydown", this.handleShortcutKeyDown, true);
|
||||
this.el.addEventListener("load", this.handleThumbnailLoad, true);
|
||||
|
||||
27
assets/js/utils/clipboard.js
Normal file
27
assets/js/utils/clipboard.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copies text to the system clipboard, mirroring the old app's behavior:
|
||||
// navigator.clipboard when available, with a hidden-textarea fallback for
|
||||
// webviews that lack the async clipboard API.
|
||||
export const copyTextToClipboard = async (text) => {
|
||||
if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof document === "undefined" || typeof document.createElement !== "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
const textArea = document.createElement("textarea");
|
||||
textArea.value = text;
|
||||
textArea.setAttribute("readonly", "");
|
||||
textArea.style.position = "absolute";
|
||||
textArea.style.left = "-9999px";
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
|
||||
if (typeof document.execCommand === "function") {
|
||||
document.execCommand("copy");
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
};
|
||||
Reference in New Issue
Block a user