mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-07 00:12:21 +01:00
make ctrl-shift-v work in the terminal (paste text)
This commit is contained in:
parent
bf03ff2591
commit
e15558690f
@ -762,6 +762,15 @@ class Screen {
|
||||
navigator.clipboard.writeText(sel);
|
||||
return false;
|
||||
}
|
||||
if (e.type == "keypress" && e.code == "KeyV" && e.shiftKey && e.ctrlKey) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let p = navigator.clipboard.readText();
|
||||
p.then((text) => {
|
||||
termWrap.dataHandler?.(text);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (termWrap.isRunning) {
|
||||
return true;
|
||||
}
|
||||
@ -3630,11 +3639,15 @@ class Model {
|
||||
}
|
||||
|
||||
getCmd(line: LineType): Cmd {
|
||||
let slines = this.getScreenLinesById(line.screenid);
|
||||
return this.getCmdByScreenLine(line.screenid, line.lineid);
|
||||
}
|
||||
|
||||
getCmdByScreenLine(screenId: string, lineId: string): Cmd {
|
||||
let slines = this.getScreenLinesById(screenId);
|
||||
if (slines == null) {
|
||||
return null;
|
||||
}
|
||||
return slines.getCmd(line.lineid);
|
||||
return slines.getCmd(lineId);
|
||||
}
|
||||
|
||||
getActiveLine(screenId: string, lineid: string): SWLinePtr {
|
||||
|
@ -61,6 +61,7 @@ class TermWrap {
|
||||
onUpdateContentHeight: (termContext: RendererContext, height: number) => void;
|
||||
ptyDataSource: (termContext: TermContextUnion) => Promise<PtyDataType>;
|
||||
initializing: boolean;
|
||||
dataHandler?: (data: string, termWrap: TermWrap) => void;
|
||||
|
||||
constructor(elem: Element, opts: TermWrapOpts) {
|
||||
opts = opts ?? ({} as any);
|
||||
@ -104,6 +105,7 @@ class TermWrap {
|
||||
this.terminal.onKey((e) => opts.keyHandler(e, this));
|
||||
}
|
||||
if (opts.dataHandler != null) {
|
||||
this.dataHandler = opts.dataHandler;
|
||||
this.terminal.onData((e) => opts.dataHandler(e, this));
|
||||
}
|
||||
this.terminal.textarea.addEventListener("focus", () => {
|
||||
|
Loading…
Reference in New Issue
Block a user