Skip to content

feat(image-editor): add requireAssetName option and fix invalid name dismissal - #11777

Open
Dmitriy Antipov (THEb0nny) wants to merge 1 commit into
microsoft:masterfrom
THEb0nny:feature/require-asset-name
Open

Dmitriy Antipov (THEb0nny) wants to merge 1 commit into
microsoft:masterfrom
THEb0nny:feature/require-asset-name

Conversation

@THEb0nny

Copy link
Copy Markdown
Contributor

Summary

  1. requireAssetName target option:

    • Adds an optional requireAssetName?: boolean flag to appTheme in target config (pxtarget.json).
    • When enabled, the image editor field blocks closing via the "Done" button if no asset name is provided, focusing the name input and prompting the user.
  2. Fix dismissal on invalid/duplicate asset name:

    • Previously, clicking "Done" while an invalid or already-taken asset name was typed would trigger onBlur first, which cleared the draft name and error state without updating the asset, silently dismissing the modal and losing changes.
    • Now, "Done" validates the name, keeps the error message visible, focuses the input, and prevents closing until the error is resolved.
  3. Clean cancellation on Escape / Close button:

    • Pressing Escape or clicking ✖ in ImageFieldEditor now explicitly cancels the edit session and leaves the underlying block / code unchanged.

…dismissal

- Add requireAssetName appTheme option to require an asset name before saving in the asset field editor
- Prevent Done button from closing and silently discarding changes when an asset name is duplicate or invalid
- Ensure Escape and close button cleanly discard changes without modifying the underlying block or file
- Fix false invalid-character error when asset name input is empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant