Sha256: 4414d50c630de02bb9316e85812cb10d81d9963fcdeaa1ba7376f74df3bc929b

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

var ace_edit = function(id, template_type) {
  $('#template_content_editor-'+id).show();
  var editor = ace.edit('template_content_editor-'+id);
  var textarea = $('textarea[id="template_content-'+id+'"]').hide();
  var session = editor.getSession();
  session.setMode("ace/mode/" + template_type);
  session.setValue(textarea.val());
  session.setTabSize(2);
  session.setUseSoftTabs(true);
  session.setUseWrapMode(true);
  session.on('change', function(){
    textarea.val(editor.getSession().getValue());
  });
  editor.commands.addCommand({
    name: 'save',
    bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},
    exec: function(editor) {
      $("#"+editor.container.id).closest('form').submit();
    },
    readOnly: false
  });
  return editor;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smithycms-0.0.2 app/assets/javascripts/smithy/templates.js