Fixes issue with saving files and makes empty files and New TLdraw command work (#258)
* Fixes issue with saving files and makes empty files and New TLdraw command work * v0.1.16 * v0.1.18 Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
parent
a95b581e07
commit
913b4dc5d2
2 changed files with 6 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
|||
"name": "tldraw-vscode",
|
||||
"displayName": "TLDraw",
|
||||
"description": "The TLDraw Extension for VS Code.",
|
||||
"version": "0.1.15",
|
||||
"version": "0.1.18",
|
||||
"license": "MIT",
|
||||
"publisher": "tldraw-org",
|
||||
"repository": {
|
||||
|
|
|
@ -160,10 +160,13 @@ export class TLDrawEditorProvider implements vscode.CustomTextEditorProvider {
|
|||
case UI_EVENT.TLDRAW_UPDATED: {
|
||||
// Synchronize the TextDocument with the tldraw components document state
|
||||
|
||||
const prevFile = JSON.parse(document.getText()) as TLDrawFile
|
||||
const nextFile = JSON.parse(e.text) as TLDrawFile
|
||||
|
||||
nextFile.document = sanitizeDocument(prevFile.document, nextFile.document)
|
||||
// There's no reason to sanitize if the file contents are still an empty file.
|
||||
if( document.getText() !== "" ){
|
||||
const prevFile = JSON.parse(document.getText()) as TLDrawFile
|
||||
nextFile.document = sanitizeDocument(prevFile.document, nextFile.document)
|
||||
}
|
||||
|
||||
this.synchronizeTextDocument(document, nextFile)
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue