Skip to content

Commit

Permalink
some minor adjustments to the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Glen committed Feb 18, 2015
1 parent b5b6639 commit 5cc1c91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
var ace_edit = function(id, template_type, name) {
if (!name) { name = 'template_content' }
var editor_name = name + '_editor-' + id
$('#'+editor_name).show();
var editor = ace.edit(editor_name);
var textarea = $('textarea[id="' + name + '-'+id+'"]').hide();
var textarea_id = name + '-' + id
var editor_id = name + '_editor-' + id
$('#'+editor_id).show();
var editor = ace.edit(editor_id);
var $textarea = $('#'+textarea_id);
$textarea.hide()
var session = editor.getSession();
session.setMode("ace/mode/" + template_type);
session.setValue(textarea.val());
session.setValue($textarea.val());
session.setTabSize(2);
session.setUseSoftTabs(true);
session.setUseWrapMode(true);
session.on('change', function(){
textarea.val(editor.getSession().getValue());
$textarea.val(editor.getSession().getValue());
});
editor.commands.addCommand({
name: 'save',
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/smithy/templates.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ textarea[name="content[content]"],
min-height:40em;
width:97%;
position:relative;
&.short {
min-height:10em;
}
}

0 comments on commit 5cc1c91

Please sign in to comment.