josdejong / josdejong/jsoneditor

Use JSON Schema default value as placeholder for the value input field

Open
#931 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.