3 Commits
Author SHA1 Message Date
Oleg Isonen cfba520e6d feat: Open text assets in code editor (#5918)
## What changed

- open every textual asset type from the upload registry in an editable
CodeMirror dialog
- select installed CodeMirror language support by MIME type and use
plain text editing as the fallback
- support `txt`, `csv`, `md`, `js`, `css`, `json`, `html`, `xml`, and
`svg` without adding asset-specific language branches to the shared
editor
- keep the canvas mounted and interactive behind the dialog
- persist edits on blur, `Cmd/Ctrl+S`, or `Cmd/Ctrl+Enter` through the
asset replacement pipeline
- preserve folder and description metadata and repoint supported asset
references
- clean up failed replacement uploads instead of leaving orphan assets

## Impact

Users can open, edit, and persist all text-based upload formats directly
in the builder without replacing or reloading the canvas. New `text/*`
upload types will automatically become editable as plain text; installed
syntax support is selected by MIME type.

## Validation

- `pnpm --filter @webstudio-is/builder test --
app/builder/features/text-file-editor/text-file-utils.test.ts
app/builder/shared/assets/replace-asset.test.ts
app/builder/shared/asset-manager/asset-manager.test.tsx`
- `pnpm --filter @webstudio-is/builder typecheck`
- `pnpm exec oxlint --deny-warnings <changed files>`
- `pnpm exec oxfmt --check <changed files>`
- `git diff --check`
- verified the running dev server applied the changes through Vite HMR

Ref #5824
2026-07-20 13:42:06 +02:00
Oleg Isonen 953ab1eb79 fix: fix bindings crash (#5817) 2026-06-13 12:29:14 +02:00
Oleg Isonen f52545a2e9 fix: Fix expression binding editing (#5811)
## Summary

Fix expression binding editing when changing assignment/comparison
operators in the binding editor.

## Changes

- Fix duplicate variable replacement in assignment expressions like
`system.origin = ...`
- Align assignment target handling across expression linting, identifier
collection, and transpilation
- Prevent executable transpilation from adding optional chaining to
assignment targets, avoiding invalid JS like `a?.b = c`
- Preserve CodeMirror selection when syncing external editor values so
the cursor does not jump to the beginning
- Add regression coverage for:
  - `system.origin = ...` variable roundtrip
  - direct, member, computed, nested, compound, and logical assignments
  - destructuring assignment rejection
  - executable assignment transpilation parse safety
  - editor selection clamping

## Testing

- `pnpm --filter @webstudio-is/sdk exec vitest run
src/expression.test.ts`
- `pnpm --filter @webstudio-is/sdk exec tsc --noEmit`
- `pnpm --filter @webstudio-is/builder exec vitest run
app/shared/code-editor-base.test.ts app/shared/data-variables.test.tsx
app/builder/shared/expression-editor.test.ts
app/builder/shared/binding-popover.test.ts`
- `pnpm --filter @webstudio-is/builder exec tsc --noEmit`
- `git diff --check`
2026-06-11 23:35:11 +02:00