Skip to content

Commit eab2d44

Browse files
committed
Implement write/read buffers in electron fill
This makes cutting and copy files from the file tree work.
1 parent e61ea79 commit eab2d44

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/ide/src/fill/electron.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT
171171
document.createElement = newCreateElement;
172172

173173
class Clipboard {
174-
public has(): boolean {
175-
return false;
174+
private readonly buffers = new Map<string, Buffer>();
175+
176+
public has(format: string): boolean {
177+
return this.buffers.has(format);
176178
}
177179

178180
public readFindText(): string {
@@ -190,6 +192,14 @@ class Clipboard {
190192
public readText(): Promise<string> {
191193
return clipboard.readText();
192194
}
195+
196+
public writeBuffer(format: string, buffer: Buffer): void {
197+
this.buffers.set(format, buffer);
198+
}
199+
200+
public readBuffer(format: string): Buffer | undefined {
201+
return this.buffers.get(format);
202+
}
193203
}
194204

195205
class Shell {

0 commit comments

Comments
 (0)