INNER CODE UNIT · JavaScript
addFile
carvel-dev/ytt · pkg/website/js/app.js:14
function addFile(e, opts) { // opts = {text, name, focus}
var configId = "config-box-"+configBoxesCount;
if (!opts.name) {
opts.name = "config-" + (configBoxesCount+1) + ".yml";
}
if (!opts.text) { opts.text = ""; }
$(".config-boxes", parentEl).append(
'<div id="'+configId+'-box">'+
'<button id="'+configId+'-delete" class="button">x</button>'+
'<input id="'+configId+'-name" value="'+opts.name+'"/>'+
'<textarea id="'+configId+'-data">'+opts.text+'</textarea><br/>'+
'</div>'
);
var editor = CodeMirror.fromTextArea(document.getElementById(configId+"-data"), {