Skip to content

Commit

Permalink
Push over changes from minimal skulpt to the public example
Browse files Browse the repository at this point in the history
  • Loading branch information
acbart committed Jun 3, 2020
1 parent e7378cc commit 6fc23bc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
21 changes: 12 additions & 9 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 22 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
</label>
</div>

<div class="btn-group" data-toggle="buttons" style="display: inline-block">
<label>
<input type="checkbox" name="blockpy-mode-set" checked
onclick="editor.setImageMode(!editor.configuration.imageMode);">
Image Mode
</label>
</div>


<div id="blockmirror-editor"></div>
</div>
Expand All @@ -59,7 +67,17 @@
<script type="text/javascript">
var editor = new BlockMirror({
'container': document.getElementById('blockmirror-editor'),
blocklyMediaPath: '../lib/blockly/media/'
blocklyMediaPath: '../lib/blockly/media/',
imageMode: true,
imageDownloadHOok: (oldUrl) => {
return oldUrl;
},
imageUploadHook: (blob) => {
return Promise.resolve("Image("+JSON.stringify(URL.createObjectURL(blob))+")");
},
imageLiteralHook: (oldUrl) => {
return `Image("${oldUrl}")`;
},
//'height': '2000px'
});
editor.addChangeListener(function (event) {
Expand Down Expand Up @@ -173,7 +191,7 @@
"while x == 0:\n pass\nwhile y < z:\n a = 0\nelse:\n b = a",
"import x as y, b as c, d\nimport os",
"from . import x\nfrom .os import y\nfrom ..path import z\nfrom dog.house import a\nfrom cat import b, c as d, e",
"import matplotlib.pyplot as plt",
//"import matplotlib.pyplot as plt",
"with open('filename') as outfile:\n pass",
"with open('filename') as outfile, open('file2') as infile, other_context:\n pass",
"#hello world!\n# Another comment\n#: int\n\na",
Expand All @@ -183,8 +201,8 @@
"(lambda x: x)()",
"class Alpha:\n def beta():\n '''\n Hello World!\n Testing.\n '''",
"'test'.replace(1, 2, 3)",
"'\n'",
'"""\ntest"""'
"'\\n'",
"'''\ntest'''"
];

function runTests() {
Expand Down
2 changes: 1 addition & 1 deletion test/minimal_skulpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
var editor = new BlockMirror({
'container': document.getElementById('blockmirror-editor'),
'toolbox': 'normal',
imageMode: "constructor",
imageMode: true,
imageDownloadHOok: (oldUrl) => {
return oldUrl;
},
Expand Down

0 comments on commit 6fc23bc

Please sign in to comment.