Commas inserted into values with '>' attribute selector
Issue Overview
When you declare custom block attributes, if you include '>' in the selector, commas get inserted between every character of the value.
Steps to Reproduce (for bugs)
- Create a custom block, with '>' in the selector, such as:
email: { type: 'array', source: 'attribute', selector: '.email > a', attribute: 'mailto' },for a complete code example, see https://gist.github.com/wpalchemist/2bf2fee33d5d31c43c61cf053c9d2f78 - Create a post with that block and save it. The first time you save, it will be fine.
- Edit the post, and save it again - now commas will be inserted between every character of that attribute
- Every time you save the post, more commas will be inserted
Expected Behavior
Data should be saved exactly as it is entered.
Current Behavior
Commas are inserted between every character every time the data is saved.
Removing '>' fixes the problem, but there are situations where developers will need it there.
Possible Solution
Screenshots / Video
Related Issues and/or PRs
Todos
- [ ] Tests
- [ ] Documentation
I suspect you're having the issue because you're using "Editable" for your different inputs (The value of the Editable is not a simple a string, it's an array). "Editable" is only meant to be used for "formatted" text. For email, phones and stuff like that, it might be better to just use simple inputs or textareas
I'm closing this. Please feel free to reopen if my comment above doesn't address your issue.