Change nunjucks preview box to <textarea> (Closes #904)

This commit is contained in:
Gregory Schier 2018-04-26 12:22:08 -04:00
parent bd683a7d1c
commit 4bd9b166cf
3 changed files with 6 additions and 13 deletions

2
package-lock.json generated
View File

@ -1703,7 +1703,7 @@
"bundled": true, "bundled": true,
"dev": true "dev": true
}, },
"cryptiles": { "cryptile": {
"version": "2.0.5", "version": "2.0.5",
"bundled": true, "bundled": true,
"dev": true, "dev": true,

View File

@ -564,22 +564,15 @@ class TagEditor extends React.PureComponent<Props, State> {
let previewElement; let previewElement;
if (error) { if (error) {
previewElement = ( previewElement = (
<pre> <textarea className="danger" value={error || 'Error'} readOnly/>
<code className="block danger selectable">{error || <span>&nbsp;</span>}</code>
</pre>
); );
} else if (rendering) { } else if (rendering) {
previewElement = ( previewElement = (
<pre> <textarea value="rendering..." readOnly/>
<code className="block"><span className="faint italic">rendering...</span></code>
</pre>
); );
} else { } else {
previewElement = ( previewElement = (
<pre> <textarea value={preview || 'error'} readOnly rows={5}/>
<code className="block selectable scrollable force-wrap">{preview ||
<span>&nbsp;</span>}</code>
</pre>
); );
} }

View File

@ -93,8 +93,8 @@ class VariableEditor extends PureComponent {
<div className="form-control form-control--outlined"> <div className="form-control form-control--outlined">
<label>Live Preview <label>Live Preview
{error {error
? <code className="block danger selectable">{error || <span>&nbsp;</span>}</code> ? <textarea className="danger" value={error || 'Error'} readOnly/>
: <code className="block selectable">{preview || <span>&nbsp;</span>}</code> : <textarea value={preview || ''} readOnly/>
} }
</label> </label>
</div> </div>