🐛 Fix text editor wasm playground

This commit is contained in:
Andrey Antukh 2026-01-13 10:08:37 +01:00
parent f0e53d70ae
commit dc44156b53
4 changed files with 10 additions and 10 deletions

View File

@ -7,7 +7,7 @@
To start the development environment run: To start the development environment run:
```sh ```sh
yarn run dev pnpm run dev
``` ```
### Testing ### Testing
@ -15,14 +15,14 @@ yarn run dev
For running unit tests and running coverage: For running unit tests and running coverage:
```sh ```sh
yarn run test pnpm run test
yarn run coverage pnpm run coverage
``` ```
> If you want, you can run the [vitest](https://vitest.dev/) UI by running: > If you want, you can run the [vitest](https://vitest.dev/) UI by running:
```sh ```sh
yarn run test:ui pnpm run test:ui
``` ```
## How to build it ## How to build it
@ -30,7 +30,7 @@ yarn run test:ui
The editor can be built and updated inside Penpot using the following command: The editor can be built and updated inside Penpot using the following command:
```sh ```sh
PENPOT_SOURCE_PATH=/path/to/penpot/repository yarn build:update PENPOT_SOURCE_PATH=/path/to/penpot/repository pnpm build:update
``` ```
This command is going to search for the file located in `frontend/src/app/main/ui/workspace/shapes/text/new_editor/TextEditor.js` and update it. This command is going to search for the file located in `frontend/src/app/main/ui/workspace/shapes/text/new_editor/TextEditor.js` and update it.

View File

@ -7,7 +7,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"coverage": "vitest run --coverage", "coverage": "vitest run --coverage",
"wasm:update": "cp ../resources/public/js/render_wasm.wasm ./src/wasm/render_wasm.wasm && cp ../resources/public/js/render_wasm.js ./src/wasm/render_wasm.js", "wasm:update": "mkdir -p src/wasm && cp ../resources/public/js/render-wasm.wasm ./src/wasm/render-wasm.wasm && cp ../resources/public/js/render-wasm.js ./src/wasm/render-wasm.js",
"test": "vitest --run", "test": "vitest --run",
"fmt:js": "pnpx prettier -c src/**/*.js", "fmt:js": "pnpx prettier -c src/**/*.js",
"test:watch": "vitest", "test:watch": "vitest",

View File

@ -1,7 +1,7 @@
import "./style.css"; import "./style.css";
import "./fonts.css"; import "./fonts.css";
import "./editor/TextEditor.css"; import "./editor/TextEditor.css";
import initWasmModule from "./wasm/render_wasm.js"; import initWasmModule from "./wasm/render-wasm.js";
import { UUID } from "./playground/uuid.js"; import { UUID } from "./playground/uuid.js";
import { Rect, Point } from "./playground/geom.js"; import { Rect, Point } from "./playground/geom.js";
import { WASMModuleWrapper } from "./playground/wasm.js"; import { WASMModuleWrapper } from "./playground/wasm.js";

View File

@ -68,7 +68,7 @@ The Text Editor Playground provides an isolated environment to test the new rend
2. Start the development server: 2. Start the development server:
```sh ```sh
yarn dev pnpm run dev
``` ```
3. Open your browser and go to: 3. Open your browser and go to:
@ -78,14 +78,14 @@ This will launch the playground interface where you can interactively test text
### Updating the WASM Renderer ### Updating the WASM Renderer
To update the `render_wasm.wasm` and `render_wasm.js` files used by the playground: To update the `render-wasm.wasm` and `render-wasm.js` files used by the playground:
1. Make sure you have the latest compiled WASM files in `frontend/resources/public/js/`. 1. Make sure you have the latest compiled WASM files in `frontend/resources/public/js/`.
2. From the `frontend/text-editor` directory, run: 2. From the `frontend/text-editor` directory, run:
```sh ```sh
yarn wasm:update pnpm run wasm:update
``` ```
This script will copy the latest `render_wasm.wasm` and `render_wasm.js` into the playgrounds `src/wasm/` directory, ensuring the playground uses the most recent build. This script will copy the latest `render_wasm.wasm` and `render_wasm.js` into the playgrounds `src/wasm/` directory, ensuring the playground uses the most recent build.