workaround for codemirror bug on chrome - click "show answer" does codemirror.refresh()

This commit is contained in:
ichuang
2012-06-02 20:48:07 -04:00
parent 4ff3a8735c
commit 652aaff78e
4 changed files with 15 additions and 6 deletions

View File

@@ -105,6 +105,10 @@
## image input: for clicking on images (see imageinput.html)
<script type="text/javascript" src="/static/js/imageinput.js"></script>
<script type="text/javascript" >
var codemirror_set= {}; // associative array of codemirror objects
</script>
<%block name="js_extra"/>
</body>

View File

@@ -131,6 +131,10 @@
<script type="text/javascript" src="${static.url('js/schematic.js')}"></script>
<script type="text/javascript" src="${static.url('js/cktsim.js')}"></script>
<script type="text/javascript" >
var codemirror_set= {}; // associative array of codemirror objects
</script>
<%block name="js_extra"/>
</body>
</html>

View File

@@ -15,10 +15,6 @@ function ${ id }_content_updated() {
};
});
// for (var key in codemirror_set) {
// codemirror_set[key].refresh();
// }
$('#check_${ id }').unbind('click').click(function() {
$("input.schematic").each(function(index,element){ element.schematic.update_value(); });
$(".CodeMirror").each(function(index,element){ if (element.CodeMirror.save) element.CodeMirror.save(); });
@@ -67,7 +63,8 @@ function ${ id }_content_updated() {
break;
default:
alert(json.success);
}}
}
}
);
log_event('problem_check', submit_data);
});
@@ -100,6 +97,10 @@ function ${ id }_content_updated() {
}
});
for (var key in codemirror_set) {
codemirror_set[key].refresh();
}
log_event('problem_show', {'problem':'${ id }'});
});

View File

@@ -30,7 +30,7 @@ $(function(){
% endif
});
cm.refresh();
// codemirror_set["${id}"] = cm; // track it for refreshes
codemirror_set["${id}"] = cm; // track it for refreshes
});
</script>
<style type="text/css">