Skip to content

Commit

Permalink
Add some content to iframe.css to work around LockerProject/Locker#882.…
Browse files Browse the repository at this point in the history
… Only instantiate the function editor if it hasn't been already.
  • Loading branch information
beaugunderson committed Feb 29, 2012
1 parent 2c3c771 commit d8c374b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions css/iframe.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* This file will contain styles that only show up on singly.com in the iframe view */
12 changes: 8 additions & 4 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var jsonThrobber;
var functionEditor;

var RE_NUMERIC_FIELD = /\.\d+(\.|$)/g;

Expand Down Expand Up @@ -154,19 +155,21 @@ function updateFields() {
}

$('.add-on a').click(function() {
var editor = CodeMirror.fromTextArea(document.getElementById('function-definition'),
{
if (functionEditor === undefined) {
functionEditor = CodeMirror.fromTextArea(document.getElementById('function-definition'), {
mode: 'javascript',
indentUnit: 3,
tabSize: 3,
lineWrapping: true,
lineNumbers: true,
matchBrackets: true,
extraKeys: {
"Ctrl-Enter": function(cm) { CodeMirror.simpleHint(cm, CodeMirror.javascriptHint); }
"Ctrl-Enter": function(cm) {
CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);
}
},
onChange: function() {
var content = editor.getValue();
var content = functionEditor.getValue();

var f;

Expand All @@ -189,6 +192,7 @@ function updateFields() {
}
}
});
}

$('#function-modal').modal('show');

Expand Down

0 comments on commit d8c374b

Please sign in to comment.