mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Forgot update code demo (#1121)
This commit is contained in:
parent
3840b3804f
commit
10ad450176
1 changed files with 11 additions and 17 deletions
|
@ -200,14 +200,8 @@ Code.bindClick = function(el, func) {
|
|||
* Load the Prettify CSS and JavaScript.
|
||||
*/
|
||||
Code.importPrettify = function() {
|
||||
//<link rel="stylesheet" href="../prettify.css">
|
||||
//<script src="../prettify.js"></script>
|
||||
var link = document.createElement('link');
|
||||
link.setAttribute('rel', 'stylesheet');
|
||||
link.setAttribute('href', '../prettify.css');
|
||||
document.head.appendChild(link);
|
||||
var script = document.createElement('script');
|
||||
script.setAttribute('src', '../prettify.js');
|
||||
script.setAttribute('src', 'https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js');
|
||||
document.head.appendChild(script);
|
||||
};
|
||||
|
||||
|
@ -313,41 +307,41 @@ Code.renderContent = function() {
|
|||
} else if (content.id == 'content_javascript') {
|
||||
var code = Blockly.JavaScript.workspaceToCode(Code.workspace);
|
||||
content.textContent = code;
|
||||
if (typeof prettyPrintOne == 'function') {
|
||||
if (typeof PR.prettyPrintOne == 'function') {
|
||||
code = content.textContent;
|
||||
code = prettyPrintOne(code, 'js');
|
||||
code = PR.prettyPrintOne(code, 'js');
|
||||
content.innerHTML = code;
|
||||
}
|
||||
} else if (content.id == 'content_python') {
|
||||
code = Blockly.Python.workspaceToCode(Code.workspace);
|
||||
content.textContent = code;
|
||||
if (typeof prettyPrintOne == 'function') {
|
||||
if (typeof PR.prettyPrintOne == 'function') {
|
||||
code = content.textContent;
|
||||
code = prettyPrintOne(code, 'py');
|
||||
code = PR.prettyPrintOne(code, 'py');
|
||||
content.innerHTML = code;
|
||||
}
|
||||
} else if (content.id == 'content_php') {
|
||||
code = Blockly.PHP.workspaceToCode(Code.workspace);
|
||||
content.textContent = code;
|
||||
if (typeof prettyPrintOne == 'function') {
|
||||
if (typeof PR.prettyPrintOne == 'function') {
|
||||
code = content.textContent;
|
||||
code = prettyPrintOne(code, 'php');
|
||||
code = PR.prettyPrintOne(code, 'php');
|
||||
content.innerHTML = code;
|
||||
}
|
||||
} else if (content.id == 'content_dart') {
|
||||
code = Blockly.Dart.workspaceToCode(Code.workspace);
|
||||
content.textContent = code;
|
||||
if (typeof prettyPrintOne == 'function') {
|
||||
if (typeof PR.prettyPrintOne == 'function') {
|
||||
code = content.textContent;
|
||||
code = prettyPrintOne(code, 'dart');
|
||||
code = PR.prettyPrintOne(code, 'dart');
|
||||
content.innerHTML = code;
|
||||
}
|
||||
} else if (content.id == 'content_lua') {
|
||||
code = Blockly.Lua.workspaceToCode(Code.workspace);
|
||||
content.textContent = code;
|
||||
if (typeof prettyPrintOne == 'function') {
|
||||
if (typeof PR.prettyPrintOne == 'function') {
|
||||
code = content.textContent;
|
||||
code = prettyPrintOne(code, 'lua');
|
||||
code = PR.prettyPrintOne(code, 'lua');
|
||||
content.innerHTML = code;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue