Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/extensionsIntegrated/Terminal/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,10 +846,12 @@ define(function (require, exports, module) {
const active = _getActiveTerminal();
if (active && active.isAlive) {
active.focus();
navigator.clipboard.readText().then(function (text) {
Phoenix.app.clipboardReadText().then(function (text) {
if (text) {
nodeConnector.execPeer("writeTerminal", {id: active.id, data: text});
}
}).catch(function (err) {
console.error("Terminal paste failed:", err);
});
}
});
Expand Down
14 changes: 7 additions & 7 deletions test/spec/Terminal-integ-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,14 @@ define(function (require, exports, module) {
await openTerminal();
await waitForShellReady();

// Mock clipboard.readText to return a known string,
// since the test iframe may not have clipboard
// permission (no window focus).
// Mock Phoenix.app.clipboardReadText to return a
// known string, since the test iframe may not have
// clipboard permission (no window focus).
const pasteText = "PASTEMARKER456";
const clipboard = testWindow.navigator.clipboard;
spyOn(clipboard, "readText").and.returnValue(
testWindow.Promise.resolve(pasteText)
);
spyOn(testWindow.Phoenix.app, "clipboardReadText")
.and.returnValue(
testWindow.Promise.resolve(pasteText)
);

// Execute the paste command
await CommandManager.execute("terminal.paste");
Expand Down
Loading