1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-14 02:26:20 +02:00

add events n fix minimize height of console

This commit is contained in:
Kushagra Gour
2017-05-12 02:18:37 +05:30
parent b79af0883c
commit 5ee6564c87
3 changed files with 11 additions and 2 deletions

View File

@ -106,7 +106,7 @@
<div class="js-console__header code-wrap__header" title="Double click to toggle console">
<span class="code-wrap__header-label">Console (<span id="logCountEl">0</span>)</span>
<div class="code-wrap__header-right-options">
<a class="code-wrap__header-btn" title="Clear console (CTRL + L)" d-click="clearConsole">
<a class="code-wrap__header-btn" title="Clear console (CTRL + L)" d-click="onClearConsoleBtnClick">
<svg>
<use xlink:href="#cancel-icon"></use>
</svg>

View File

@ -1318,16 +1318,22 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl
scope.toggleConsole = function () {
consoleEl.classList.toggle('is-minimized');
trackEvent('ui', 'consoleToggle');
};
scope.clearConsole = function () {
scope.consoleCm.setValue('');
logCount = 0;
logCountEl.textContent = logCount;
};
scope.onClearConsoleBtnClick = function () {
scope.clearConsole();
trackEvent('ui', 'consoleClearBtnClick');
};
scope.evalConsoleExpr = function (e) {
// Clear console on CTRL + L
if (((e.which === 76 || e.which === 12) && e.ctrlKey)) {
scope.clearConsole();
trackEvent('ui', 'consoleClearKeyboardShortcut');
} else if (e.which === 13) {
window.onMessageFromConsole('> ' + e.target.value);
@ -1337,6 +1343,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl
/* eslint-enable no-underscore-dangle */
e.target.value = '';
trackEvent('fn', 'evalConsoleExpr');
}
};
window.onMessageFromConsole = function() {
@ -1574,6 +1581,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl
var target = e.target;
if (target.classList.contains('js-console__header')) {
scope.toggleConsole();
trackEvent('ui', 'consoleToggleDblClick');
}
if (target.classList.contains('js-code-wrap__header')) {
var codeWrapParent = target.parentElement;

View File

@ -828,7 +828,8 @@ li.CodeMirror-hint-active {
z-index: 1; /* bring above iframe */
position: absolute;
bottom: 0;
height: 30vh;
min-height: 80px;
height: 35vh;
left: 0;
right: 0;
transform: translateY(0);