refboard: restore clipboard copy and native paste flows

This commit is contained in:
Hiren Kangad
2026-03-13 15:30:23 +05:30
parent e9e0c25491
commit 3dd110f491
4 changed files with 7 additions and 5 deletions
+2 -4
View File
@@ -61,8 +61,7 @@ export async function writeCanvasToClipboard(
outputCanvas.width = sw;
outputCanvas.height = sh;
const ctx2d = outputCanvas.getContext('2d')!;
ctx2d.fillStyle = '#1e1e1e';
ctx2d.fillRect(0, 0, outputCanvas.width, outputCanvas.height);
ctx2d.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
ctx2d.drawImage(sourceCanvas, sx, sy, sw, sh, 0, 0, sw, sh);
} else {
// Full current view copy.
@@ -70,8 +69,7 @@ export async function writeCanvasToClipboard(
outputCanvas.width = sourceCanvas.width;
outputCanvas.height = sourceCanvas.height;
const ctx2d = outputCanvas.getContext('2d')!;
ctx2d.fillStyle = '#1e1e1e';
ctx2d.fillRect(0, 0, outputCanvas.width, outputCanvas.height);
ctx2d.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
ctx2d.drawImage(sourceCanvas, 0, 0);
}
@@ -492,6 +492,7 @@ export const shortcuts: ShortcutDef[] = [
{
id: 'paste', keys: { key: 'v', ctrl: true },
category: 'editing', description: 'Paste',
preventDefault: false,
handler: async (ctx) => {
// Only handle recent internal copies here.
// For external clipboard content (images, text, HTML), do NOT call
+1
View File
@@ -24,6 +24,7 @@ export interface ShortcutDef {
category: 'alignment' | 'arrangement' | 'normalize' | 'navigation' | 'editing' | 'view' | 'tools' | 'image';
needsSelection?: boolean; // skip if no objects selected
minSelection?: number; // minimum selected objects (default 1 if needsSelection)
preventDefault?: boolean; // defaults to true
}
export interface ShortcutContext {