fix: skip auto-formatting JSON inputs
Summary
- Skip auto-formatting for JSON-like textarea content to avoid corrupting structural commas in JSON.
- Add a unit test covering JSON input.
Why
Autocomplete-Plus auto-formatting is designed for comma-separated prompt tags. When users paste JSON into a multiline textarea (e.g. used as structured prompt schema), formatting on blur can remove JSON commas and break the JSON.
Test plan
- npm test
Thank you for the review and the suggestions.
I have applied the changes to use \JSON.parse\ for JSON detection and added the unit tests for the \comfyui-prompt-control\ scheduling syntax.
During testing, the scheduling syntax tests initially failed because the original \wordCommaPattern\ (/\w+\s*,/g) did not match the closing bracket ]. I updated the regex to /[^\s,]+\s*,/g\ to ensure these tokens are correctly captured. All tests are now passing.
Please let me know if anything else is needed.