Skip to content

Commit dcffbe2

Browse files
committed
When blocks are active:
* Sync editor with start state of blocks. * Add title to editor saying it's read-only when blocks are on.
1 parent a6f96e6 commit dcffbe2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python-main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ function web_editor(config) {
491491
if(blockly.is(':visible')) {
492492
dirty = false;
493493
blockly.hide();
494+
$('#editor').attr('title', '');
494495
editor.ACE.setReadOnly(false);
495496
$("#command-snippet").off('click');
496497
$("#command-snippet").click(function () {
@@ -503,6 +504,7 @@ function web_editor(config) {
503504
}
504505
}
505506
editor.ACE.setReadOnly(true);
507+
$('#editor').attr('title', 'The code editor is read-only when blocks are active.');
506508
$("#command-snippet").off('click');
507509
$("#command-snippet").click(function () {
508510
alert(config.translate.alerts.snippets);
@@ -530,6 +532,8 @@ function web_editor(config) {
530532
}
531533
workspace.addChangeListener(myUpdateFunction);
532534
}
535+
// Set editor to current state of blocks.
536+
EDITOR.setCode(Blockly.Python.workspaceToCode(workspace));
533537
};
534538
}
535539

0 commit comments

Comments
 (0)