Prepare for Publishing VS Code Extension (#227)
* Changed Wardlt use back to Tldraw. Added some VS Code marketplace categories * Missed removing one Wardlt mention * Initial support for esbuild based vscode extension workflow. * Hacky start of vs code extension build script * Fixed categories of extension * Added script for generating VS Code extension installer * Temp fix for file format change affecting VS Code extension * Temp fix for file format change issue * Cleanup, prevent changes from saving pagestates * Remove logic around saving pageState * standardize capitalization * v0.1.8 * Edit readme, scripts * Update .eslintignore * v0.1.9 * v0.1.10 * cleans up build scripts, adds publishing notes * Added VS Code extension implementation references links. start:vscode now auto opens the extension folder in VS Code * Removed step from VS Code README to manually open the extensions folder * Removed file * v0.1.11 * v0.1.12 * Fix empty file * v0.1.13 * README cleanup * v0.1.14 * Update TLDrawEditorProvider.ts * v0.1.15 * Fix types for file extension (sort of) build script for extension Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
parent
c1288363cd
commit
a95b581e07
42 changed files with 2506 additions and 1479 deletions
21
vscode/extension/src/utils.ts
Normal file
21
vscode/extension/src/utils.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import type { TLDrawDocument } from '@tldraw/tldraw'
|
||||
|
||||
export function getNonce() {
|
||||
let text = ''
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||
for (let i = 0; i < 32; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length))
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
export function sanitizeDocument(prev: TLDrawDocument, next: TLDrawDocument): TLDrawDocument {
|
||||
Object.values(prev.pageStates).forEach((pageState) => {
|
||||
// Ensure that the previous page state is preserved, if possible
|
||||
if (next.pages[pageState.id] !== undefined) {
|
||||
next.pageStates[pageState.id] = pageState
|
||||
}
|
||||
})
|
||||
|
||||
return next
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue