Support editing properties of type selector and selectorAll#1573
Conversation
Move the "stringify a non-string value (e.g. event-set object)" branch
from PropertyRow into InputWidget so the widget owns its (de)serialization
(mirroring SelectWidget's pattern).
Also replace the array parse from a plain value.split(',') to
schema.parse(value), which additionally trims whitespace around each
entry — "foo, bar" now yields ["foo", "bar"] instead of ["foo", " bar"].
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ng a property Previously stringify(null) was called, which would fail or return "" depending on the property type. Pass null straight to updateEntity so it can route to removeAttribute and reset the property to its default. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For selector and selectorAll types, read the value from getDOMAttribute (the raw selector string) rather than props.data (the parsed Element/NodeList), and commit on blur instead of on every keystroke — querying the DOM on each character is wasteful and a partial selector is rarely valid. Omit the schema when rendering InputWidget so the typed string is passed through as-is, and in EntityUpdateCommand skip the schema.stringify pass for selector types so A-Frame preserves the selector verbatim in attrValue, even if it doesn't resolve. Add onBlur and Enter-to-blur support to InputWidget so this flow works. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…, this can happen if we reset a property and copy to clipboard
Code Review: Support editing properties of type selector and selectorAllThanks for this PR, @vincentfretin! The backport from c-frame/aframe-editor is well-scoped and the commit messages are excellent. Overall the approach is sound — here are my observations: What this PR does
Strengths
Issues / Suggestions1. Deprecated
|
|
@claude about the e.stopPropagation() in onKeyDown, I did it similar to NumberWidget without thinking too much, you're right that it prevents the event to emit on the document and that's on purpose, but actually we also have the shouldCaptureKeyEvent in shortcuts.js that return false if we're in an input, so even without the e.stopPropagation(), the event will be discarded and won't trigger the delete confirmation of the selected entity if we press Delete inside the input. I'd say we keep it, that's fine, and ctrl+z and arrows actually works correctly with it. Esc doesn't work as you describe with or without it. |
|
Claude finished @vincentfretin's task in 1m 22s —— View job Code Review: Support editing properties of type selector and selectorAllThanks for this PR, @vincentfretin! The backport from c-frame/aframe-editor is well-scoped and the commit messages are excellent. Overall the approach is sound — here are my observations: What this PR does
Strengths
Issues / Suggestions1. Deprecated
|
Add support for editing a property of type selector and selectorAll types.
Also refactor the previous fix 2162f9e that added support for type array without oneOf.
That backports changes from