tmpl/editor/objects.tmpl
{{$rin := RandTen}}
<div class="tabview" id="{{$rin}}" pkg="{{.PKG}}">
<div class="row" style="padding-top:20px;">
<div class="col-sm-3" style="min-height:50px;">
</div>
<div class="col-sm-5" >
<input class="form-control sti" editor="{{$rin}}" type="text" placeholder="Interface name">
</div>
<div class="col-sm-4" style="text-align:right">
<button class="btn btn-primary" onclick="SearchEditor('{{$rin}}')"><i class="fa fa-search"></i></button>
<button class="btn btn-primary" onclick="AddtoEd('object', '{{$rin}}')"><i class="fa fa-plus"></i></button>
<button class="btn btn-warning" onclick="SavePKG('5','{{.PKG}}', '{{$rin}}')"><i class="fa fa-save"></i></button>
</div>
</div>
<div id="editor{{$rin}}" class="defed">{{printf "%s" .Edata}}</div>
<script type="text/javascript">
editors["{{$rin}}"] = ace.edit("editor{{$rin}}");
editors["{{$rin}}"].getSession().setMode("ace/mode/golang");
editors["{{$rin}}"].setTheme("ace/theme/clouds_midnight");
editors["{{$rin}}"].setOptions({enableBasicAutocompletion: true, enableSnippets: true, enableLiveAutocompletion: true});
editors["{{$rin}}"].commands.addCommand({
name: 'myCommand',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
//...
SavePKG('5','{{.PKG}}', '{{$rin}}');
},
readOnly: true // false if this command should not apply in readOnly mode
});
editors["{{$rin}}"].commands.addCommand({
name: 'build',
bindKey: {win: 'Ctrl-B', mac: 'Command-B'},
exec: function(editor) {
//...
SavePKGAndBuild('5','{{.PKG}}', '{{$rin}}');
},
readOnly: true // false if this command should not apply in readOnly mode
});
editors["{{$rin}}"].on('change', function() {
sendMessage({
path : '{{.PKG}} - Interface funcs',
editor : editors["{{$rin}}"].getValue()
});
});
editorPaths['{{.PKG}} - Interface funcs'] = editors["{{$rin}}"];
addTab({{.PKG}} + " - Interface funcs", {{$rin}} );
</script>
</div>