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,
"dev": true
},
"cryptiles": {
"cryptile": {
"version": "2.0.5",
"bundled": true,
"dev": true,

View File

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

View File

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