Merge pull request #166 from zhaouv/editor-mobile-ui

fix getCategory
This commit is contained in:
Zhang Chen 2018-07-05 20:53:38 +08:00 committed by GitHub
commit 4c4bf20dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View File

@ -5,9 +5,13 @@ editor_blockly = function () {
initscript = String.raw` initscript = String.raw`
(function(){ (function(){
var getCategory = function(name){ var getCategory = function(name){
for(var node of document.getElementById('toolbox').children) { for(var node of document.getElementById('toolbox').children) {
if(node.getAttribute('name')==name) return node; if(node.getAttribute('name')==name) return node;
} }
var node = document.createElement('category');
node.setAttribute('name',name);
document.getElementById('toolbox').appendChild(node);
return node;
} }
var toolboxObj = { var toolboxObj = {

View File

@ -165,10 +165,6 @@
<button onclick="editor_blockly.parse()">解析</button> <button onclick="editor_blockly.parse()">解析</button>
<button onclick="editor_blockly.cancel()">取消</button> <button onclick="editor_blockly.cancel()">取消</button>
<xml id="toolbox" style="display:none"> <xml id="toolbox" style="display:none">
<category name="入口方块"></category>
<category name="语句块"></category>
<category name="值块"></category>
<category name="常见事件模板"></category>
</xml> </xml>
</h3> </h3>
<div style="position: relative;height: 100%"> <div style="position: relative;height: 100%">

View File

@ -164,10 +164,6 @@
<button onclick="editor_blockly.parse()">解析</button> <button onclick="editor_blockly.parse()">解析</button>
<button onclick="editor_blockly.cancel()">取消</button> <button onclick="editor_blockly.cancel()">取消</button>
<xml id="toolbox" style="display:none"> <xml id="toolbox" style="display:none">
<category name="入口方块"></category>
<category name="语句块"></category>
<category name="值块"></category>
<category name="常见事件模板"></category>
</xml> </xml>
</h3> </h3>
<div style="position: relative;height: 100%"> <div style="position: relative;height: 100%">