josdejong / josdejong/jsoneditor
Use JSON Schema default value as placeholder for the value input field
Open
feature
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
Thanks Constantin for this suggestion via email. Should work by:
1. in `Node.js`: add this code to `_updateDomDefault()`:
```js
if (this.schema.default) {
inputElement.setAttribute('data-text', this.schema.default);
}
```
2. in `_editor.scss` for `&.jsoneditor-empty` instead of `content:'value'` have: `content:data(data-text)`
```css
div {
&.jsoneditor-value {
word-break: break-word;
&.jsoneditor-empty {
&::after {
content:attr(data-text)
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.