mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 23:56:51 +00:00
* Fix #75 * Declare raw Although it's valid, I don't think we want to use a variable without declaration. Co-authored-by: SPGoding <SPGoding@outlook.com>
This commit is contained in:
@@ -277,10 +277,13 @@ function generateJson(data, struct) {
|
||||
let $el = $('#components').find('[data-type="json"]').clone();
|
||||
$el.attr('data-index', struct.id);
|
||||
$el.find('[data-name]').attr('data-i18n', struct.translate);
|
||||
let raw;
|
||||
if (typeof data !== 'string') {
|
||||
data = JSON.stringify(data);
|
||||
raw = JSON.stringify(data);
|
||||
} else {
|
||||
raw = data;
|
||||
}
|
||||
$el.find('textarea').val(data).keydown(e => preventNewline(e));
|
||||
$el.find('textarea').val(raw).keydown(e => preventNewline(e));
|
||||
if (struct.help) {
|
||||
$el.append(generateTooltip(struct.translate));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user