1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-14 22:35:33 +02:00

add console clear kbd shortcut and minor fixes.

This commit is contained in:
Kushagra Gour 2017-05-08 02:21:22 +05:30
parent 580cfebbab
commit d7bfe24a0a
3 changed files with 12 additions and 8 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>
<div class="code-wrap__header-right-options">
<a class="code-wrap__header-btn" title="Clear console" d-click="clearConsole">
<a class="code-wrap__header-btn" title="Clear console (CTRL + L)" d-click="clearConsole">
<svg>
<use xlink:href="#cancel-icon"></use>
</svg>
@ -120,7 +120,7 @@
<svg width="18" height="18" fill="#346fd2">
<use xlink:href="#chevron-icon"></use>
</svg>
<input d-keypress="evalConsoleExpr" style="padding:3px;font-size:inherit;width:calc(100% - 30px); background: black; color: white; border:0;">
<input d-keyup="evalConsoleExpr" style="padding:3px;font-size:inherit;width:calc(100% - 30px); background: black; color: white; border:0;">
</div>
</div>
</div>

View File

@ -91,7 +91,6 @@ runBtn, searchInput, consoleEl, consoleLogEl
;
scope.cm = {};
scope.consoleCm;
scope.frame = frame;
scope.demoFrameDocument = frame.contentDocument || frame.contentWindow.document;
@ -1311,7 +1310,10 @@ runBtn, searchInput, consoleEl, consoleLogEl
scope.consoleCm.setValue('');
};
scope.evalConsoleExpr = function (e) {
if (e.which === 13) {
// Clear console on CTRL + L
if (((e.which === 76 || e.which === 12) && e.ctrlKey)) {
scope.clearConsole();
} else if (e.which === 13) {
window.onMessageFromConsole('> ' + e.target.value);
frame.contentWindow._wmEvaluate(e.target.value);
e.target.value = '';
@ -1322,10 +1324,10 @@ runBtn, searchInput, consoleEl, consoleLogEl
if (arg && arg.indexOf && arg.indexOf('filesystem:chrome-extension') !== -1) {
arg = arg.replace(/filesystem:chrome-extension.*\.js:(\d+):(\d+)/g, 'script $1:$2');
}
scope.consoleCm.replaceRange('\n' + arg + ((arg + '').match(/\[object \w+\]/) ? JSON.stringify(arg) : '') + ' ', {line: Infinity});
scope.consoleCm.replaceRange('\n' + arg + ' ' + ((arg + '').match(/\[object \w+]/) ? JSON.stringify(arg) : ''), { line: Infinity });
scope.consoleCm.scrollTo(0, Infinity);
});
}
};
function compileNodes() {
function attachListenerForEvent(eventName) {
@ -1339,7 +1341,7 @@ runBtn, searchInput, consoleEl, consoleLogEl
attachListenerForEvent('click');
attachListenerForEvent('change');
attachListenerForEvent('input');
attachListenerForEvent('keypress');
attachListenerForEvent('keyup');
}
function init () {

View File

@ -279,9 +279,11 @@ li.CodeMirror-hint-active {
background-color: rgb(18, 19, 27);
color: rgba(255, 255, 255, 0.45);
border-top: 1px solid rgba(255,255,255,0.14);
z-index: 1;
/*line-height: 20px;*/
}
.footer {
z-index: 1;
}
.main-header {
border: 0;
border-bottom: 1px solid rgba(255,255,255,0.14);