diff --git a/custom-editor-sample/media/pawDraw.js b/custom-editor-sample/media/pawDraw.js index 01bb817c..ebdd5587 100644 --- a/custom-editor-sample/media/pawDraw.js +++ b/custom-editor-sample/media/pawDraw.js @@ -182,9 +182,9 @@ */ async resetUntitled(strokes = []) { const size = 100; - this.initialCanvas.width = size; - this.initialCanvas.height = size; - + this.initialCanvas.width = this.drawingCanvas.width = size; + this.initialCanvas.height = this.drawingCanvas.height = size; + this.initialCtx.save(); { this.initialCtx.fillStyle = 'white'; @@ -245,7 +245,7 @@ { // Get the image data for the canvas and post it back to the extension. editor.getImageData().then(data => { - vscode.postMessage({ type: 'response', requestId, body: data }); + vscode.postMessage({ type: 'response', requestId, body: Array.from(data) }); }); return; } diff --git a/custom-editor-sample/src/pawDrawEditor.ts b/custom-editor-sample/src/pawDrawEditor.ts index 7858e1c8..be4337db 100644 --- a/custom-editor-sample/src/pawDrawEditor.ts +++ b/custom-editor-sample/src/pawDrawEditor.ts @@ -248,8 +248,8 @@ export class PawDrawEditorProvider implements vscode.CustomEditorProvider(panel, 'getFileData', {}); - return new Uint8Array(response.data); + const response = await this.postMessageWithResponse(panel, 'getFileData', {}); + return new Uint8Array(response); } });