Skip to content

Commit

Permalink
Update pyscript_plugin.js
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelliao authored Apr 26, 2023
1 parent 5189b15 commit 4164c5c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/pyscript_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,31 @@ export default class LearnPython3Plugin {
}

afterPyScriptExec(opt) {
console.log(opt);
let
tag = opt.pyScriptTag,
outputId = tag.getAttribute('output'),
$btn = $('button[outputId=' + outputId + ']'),
$i = $btn.find('i');
$i.removeClass('uk-icon-spinner');
$i.removeClass('uk-icon-spin');
$i.removeClass('uk-icon-spinner');
$i.removeClass('uk-icon-spin');
$btn.removeAttr('disabled');
let err = $(tag).find('pre.py-error').text();
if (err) {
let
$out = $('#' + outputId),
s = $out.text();
if (s) {
s = s + '\n' + err;
} else {
s = err;
}
$out.text(s);
$out.addClass('uk-alert-danger');
}
}

onUserError(err) {
console.log('Error >>>');
console.log('Error >>>');
console.error(err);
}
}

0 comments on commit 4164c5c

Please sign in to comment.