mirror of
https://github.com/chinchang/web-maker.git
synced 2025-05-15 22:59:41 +02:00
add console clear kbd shortcut and minor fixes.
This commit is contained in:
parent
580cfebbab
commit
d7bfe24a0a
@ -106,7 +106,7 @@
|
|||||||
<div class="js-console__header code-wrap__header" title="Double click to toggle console">
|
<div class="js-console__header code-wrap__header" title="Double click to toggle console">
|
||||||
<span class="code-wrap__header-label">Console</span>
|
<span class="code-wrap__header-label">Console</span>
|
||||||
<div class="code-wrap__header-right-options">
|
<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>
|
<svg>
|
||||||
<use xlink:href="#cancel-icon"></use>
|
<use xlink:href="#cancel-icon"></use>
|
||||||
</svg>
|
</svg>
|
||||||
@ -120,7 +120,7 @@
|
|||||||
<svg width="18" height="18" fill="#346fd2">
|
<svg width="18" height="18" fill="#346fd2">
|
||||||
<use xlink:href="#chevron-icon"></use>
|
<use xlink:href="#chevron-icon"></use>
|
||||||
</svg>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -91,7 +91,6 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
;
|
;
|
||||||
|
|
||||||
scope.cm = {};
|
scope.cm = {};
|
||||||
scope.consoleCm;
|
|
||||||
scope.frame = frame;
|
scope.frame = frame;
|
||||||
scope.demoFrameDocument = frame.contentDocument || frame.contentWindow.document;
|
scope.demoFrameDocument = frame.contentDocument || frame.contentWindow.document;
|
||||||
|
|
||||||
@ -1311,7 +1310,10 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
scope.consoleCm.setValue('');
|
scope.consoleCm.setValue('');
|
||||||
};
|
};
|
||||||
scope.evalConsoleExpr = function (e) {
|
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);
|
window.onMessageFromConsole('> ' + e.target.value);
|
||||||
frame.contentWindow._wmEvaluate(e.target.value);
|
frame.contentWindow._wmEvaluate(e.target.value);
|
||||||
e.target.value = '';
|
e.target.value = '';
|
||||||
@ -1322,10 +1324,10 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
if (arg && arg.indexOf && arg.indexOf('filesystem:chrome-extension') !== -1) {
|
if (arg && arg.indexOf && arg.indexOf('filesystem:chrome-extension') !== -1) {
|
||||||
arg = arg.replace(/filesystem:chrome-extension.*\.js:(\d+):(\d+)/g, 'script $1:$2');
|
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);
|
scope.consoleCm.scrollTo(0, Infinity);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
function compileNodes() {
|
function compileNodes() {
|
||||||
function attachListenerForEvent(eventName) {
|
function attachListenerForEvent(eventName) {
|
||||||
@ -1339,7 +1341,7 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
attachListenerForEvent('click');
|
attachListenerForEvent('click');
|
||||||
attachListenerForEvent('change');
|
attachListenerForEvent('change');
|
||||||
attachListenerForEvent('input');
|
attachListenerForEvent('input');
|
||||||
attachListenerForEvent('keypress');
|
attachListenerForEvent('keyup');
|
||||||
}
|
}
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
|
@ -279,9 +279,11 @@ li.CodeMirror-hint-active {
|
|||||||
background-color: rgb(18, 19, 27);
|
background-color: rgb(18, 19, 27);
|
||||||
color: rgba(255, 255, 255, 0.45);
|
color: rgba(255, 255, 255, 0.45);
|
||||||
border-top: 1px solid rgba(255,255,255,0.14);
|
border-top: 1px solid rgba(255,255,255,0.14);
|
||||||
z-index: 1;
|
|
||||||
/*line-height: 20px;*/
|
/*line-height: 20px;*/
|
||||||
}
|
}
|
||||||
|
.footer {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
.main-header {
|
.main-header {
|
||||||
border: 0;
|
border: 0;
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.14);
|
border-bottom: 1px solid rgba(255,255,255,0.14);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user