Skip to content

Commit 4164c5c

Browse files
authored
Update pyscript_plugin.js
1 parent 5189b15 commit 4164c5c

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

docs/pyscript_plugin.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,31 @@ export default class LearnPython3Plugin {
55
}
66

77
afterPyScriptExec(opt) {
8-
console.log(opt);
98
let
109
tag = opt.pyScriptTag,
1110
outputId = tag.getAttribute('output'),
1211
$btn = $('button[outputId=' + outputId + ']'),
1312
$i = $btn.find('i');
14-
$i.removeClass('uk-icon-spinner');
15-
$i.removeClass('uk-icon-spin');
13+
$i.removeClass('uk-icon-spinner');
14+
$i.removeClass('uk-icon-spin');
1615
$btn.removeAttr('disabled');
16+
let err = $(tag).find('pre.py-error').text();
17+
if (err) {
18+
let
19+
$out = $('#' + outputId),
20+
s = $out.text();
21+
if (s) {
22+
s = s + '\n' + err;
23+
} else {
24+
s = err;
25+
}
26+
$out.text(s);
27+
$out.addClass('uk-alert-danger');
28+
}
1729
}
1830

1931
onUserError(err) {
20-
console.log('Error >>>');
32+
console.log('Error >>>');
2133
console.error(err);
2234
}
2335
}

0 commit comments

Comments
 (0)