Skip to content

Commit b2fbd9c

Browse files
Merge pull request #464 from SwiftFiddle/fix
Fix
2 parents 57f5c19 + 360b356 commit b2fbd9c

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

Public/css/common.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@
8585
font-size: 90%;
8686
font-weight: 600;
8787
}
88-
8988
#debugger-button:hover {
9089
background-color: #2222221a;
9190
}
91+
#debugger-button:disabled {
92+
background-color: #e9ecef;
93+
color: #6c757d;
94+
cursor: not-allowed;
95+
}
9296

9397
#debugger-regex {
9498
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;

Public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ <h1 class="h5 my-2">
145145
</div>
146146
<div class="col align-self-center">
147147
<div class="text-end mt-2">
148-
<button id="debugger-button" class="px-3" data-bs-toggle="modal" data-bs-target="#debugger-modal">
148+
<button id="debugger-button" class="px-3" data-bs-toggle="modal" data-bs-target="#debugger-modal"
149+
disabled>
149150
<div data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-container="#debugger-button"
150151
title="Debugger" aria-label="Debugger" style="display: inline-block;">
151152
<span class="fa-solid fa-stethoscope"></span>

Public/js/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,23 @@ export class App {
384384
}
385385
break;
386386
case "match":
387+
const debuggerButton = document.getElementById("debugger-button");
388+
387389
if (response.result) {
388390
const matches = JSON.parse(response.result);
389391
this.patternTestEditor.matches = matches;
390392
this.updateMatchCount(matches.length, "match-count");
393+
394+
debuggerButton.disabled = response.result.length === "";
391395
} else {
392396
this.patternTestEditor.matches = [];
393397
this.updateMatchCount(0, "match-count");
398+
399+
debuggerButton.disabled = true;
394400
}
401+
395402
this.patternTestEditor.error = response.error;
403+
396404
break;
397405
case "debug":
398406
if (response.result) {

Public/js/views/dsl_view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class DSLView extends EventDispatcher {
3232
if (!error) {
3333
return;
3434
}
35-
if (typeof error === "string" && error instanceof String) {
35+
if (typeof error === "string" || error instanceof String) {
3636
widgets.push(
3737
editor.addLineWidget(0, ErrorMessage.create(error), {
3838
coverGutter: false,

Public/js/views/expression_field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ExpressionField extends EventDispatcher {
3131
set error(error) {
3232
if (error) {
3333
let message = "";
34-
if (typeof error === "string" && error instanceof String) {
34+
if (typeof error === "string" || error instanceof String) {
3535
const errorMessage = Utils.htmlSafe(error);
3636
message = `<span class="fw-bolder text-danger">Parse Error:</span> ${errorMessage}`;
3737
} else {

0 commit comments

Comments
 (0)