From 0b0df69b9bbf5096d161cdb2501d4f1f6d008304 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 28 Jul 2020 15:49:07 -0700 Subject: [PATCH] Fixing untitled saving --- custom-editor-sample/media/pawDraw.js | 8 ++++---- custom-editor-sample/src/pawDrawEditor.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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); } });