mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Forgot update code demo (#1121)
This commit is contained in:
committed by
GitHub
parent
3840b3804f
commit
10ad450176
@@ -200,14 +200,8 @@ Code.bindClick = function(el, func) {
|
|||||||
* Load the Prettify CSS and JavaScript.
|
* Load the Prettify CSS and JavaScript.
|
||||||
*/
|
*/
|
||||||
Code.importPrettify = function() {
|
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');
|
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);
|
document.head.appendChild(script);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -313,41 +307,41 @@ Code.renderContent = function() {
|
|||||||
} else if (content.id == 'content_javascript') {
|
} else if (content.id == 'content_javascript') {
|
||||||
var code = Blockly.JavaScript.workspaceToCode(Code.workspace);
|
var code = Blockly.JavaScript.workspaceToCode(Code.workspace);
|
||||||
content.textContent = code;
|
content.textContent = code;
|
||||||
if (typeof prettyPrintOne == 'function') {
|
if (typeof PR.prettyPrintOne == 'function') {
|
||||||
code = content.textContent;
|
code = content.textContent;
|
||||||
code = prettyPrintOne(code, 'js');
|
code = PR.prettyPrintOne(code, 'js');
|
||||||
content.innerHTML = code;
|
content.innerHTML = code;
|
||||||
}
|
}
|
||||||
} else if (content.id == 'content_python') {
|
} else if (content.id == 'content_python') {
|
||||||
code = Blockly.Python.workspaceToCode(Code.workspace);
|
code = Blockly.Python.workspaceToCode(Code.workspace);
|
||||||
content.textContent = code;
|
content.textContent = code;
|
||||||
if (typeof prettyPrintOne == 'function') {
|
if (typeof PR.prettyPrintOne == 'function') {
|
||||||
code = content.textContent;
|
code = content.textContent;
|
||||||
code = prettyPrintOne(code, 'py');
|
code = PR.prettyPrintOne(code, 'py');
|
||||||
content.innerHTML = code;
|
content.innerHTML = code;
|
||||||
}
|
}
|
||||||
} else if (content.id == 'content_php') {
|
} else if (content.id == 'content_php') {
|
||||||
code = Blockly.PHP.workspaceToCode(Code.workspace);
|
code = Blockly.PHP.workspaceToCode(Code.workspace);
|
||||||
content.textContent = code;
|
content.textContent = code;
|
||||||
if (typeof prettyPrintOne == 'function') {
|
if (typeof PR.prettyPrintOne == 'function') {
|
||||||
code = content.textContent;
|
code = content.textContent;
|
||||||
code = prettyPrintOne(code, 'php');
|
code = PR.prettyPrintOne(code, 'php');
|
||||||
content.innerHTML = code;
|
content.innerHTML = code;
|
||||||
}
|
}
|
||||||
} else if (content.id == 'content_dart') {
|
} else if (content.id == 'content_dart') {
|
||||||
code = Blockly.Dart.workspaceToCode(Code.workspace);
|
code = Blockly.Dart.workspaceToCode(Code.workspace);
|
||||||
content.textContent = code;
|
content.textContent = code;
|
||||||
if (typeof prettyPrintOne == 'function') {
|
if (typeof PR.prettyPrintOne == 'function') {
|
||||||
code = content.textContent;
|
code = content.textContent;
|
||||||
code = prettyPrintOne(code, 'dart');
|
code = PR.prettyPrintOne(code, 'dart');
|
||||||
content.innerHTML = code;
|
content.innerHTML = code;
|
||||||
}
|
}
|
||||||
} else if (content.id == 'content_lua') {
|
} else if (content.id == 'content_lua') {
|
||||||
code = Blockly.Lua.workspaceToCode(Code.workspace);
|
code = Blockly.Lua.workspaceToCode(Code.workspace);
|
||||||
content.textContent = code;
|
content.textContent = code;
|
||||||
if (typeof prettyPrintOne == 'function') {
|
if (typeof PR.prettyPrintOne == 'function') {
|
||||||
code = content.textContent;
|
code = content.textContent;
|
||||||
code = prettyPrintOne(code, 'lua');
|
code = PR.prettyPrintOne(code, 'lua');
|
||||||
content.innerHTML = code;
|
content.innerHTML = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user