mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add buttons for choosing the keyboard handler thing (Ace, Vim, Emacs, Sublime)
This commit is contained in:
parent
6b2ef2c451
commit
bf200480ce
@ -183,6 +183,12 @@
|
||||
<div class="col-md-6 col-sm-12">
|
||||
Editing file <span id="editingFile"></span>
|
||||
<div id="editor" style="resize: both;">file_contents</div>
|
||||
<div class="btn-group" role="group">
|
||||
<button onclick="setKeyboard(event.target)" class="btn btn-primary" data-handler-name="null">Ace</button>
|
||||
<button onclick="setKeyboard(event.target)" class="btn btn-secondary" data-handler-name="ace/keyboard/vim">Vim</button>
|
||||
<button onclick="setKeyboard(event.target)" class="btn btn-secondary" data-handler-name="ace/keyboard/emacs">Emacs</button>
|
||||
<button onclick="setKeyboard(event.target)" class="btn btn-secondary" data-handler-name="ace/keyboard/sublime">Sublime</button>
|
||||
</div>
|
||||
<h3 id="file_warn"></h3>
|
||||
<button class="btn btn-success" onclick="save()">Save</button>
|
||||
</div>
|
||||
@ -657,6 +663,21 @@
|
||||
getTreeView();
|
||||
setTreeViewContext();
|
||||
|
||||
function setKeyboard(target) {
|
||||
var handlerName = target.getAttribute('data-handler-name');
|
||||
if (handlerName == 'null') handlerName = null;
|
||||
editor.setKeyboardHandler(handlerName);
|
||||
|
||||
var nodes = target.parentNode.querySelectorAll("[data-handler-name]");
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
nodes[i].classList.remove('btn-primary');
|
||||
nodes[i].classList.add('btn-secondary');
|
||||
}
|
||||
|
||||
target.classList.remove('btn-secondary');
|
||||
target.classList.add('btn-primary');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% end %}
|
Loading…
Reference in New Issue
Block a user