Skip to content
Merged

Fix #464

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Public/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@
font-size: 90%;
font-weight: 600;
}

#debugger-button:hover {
background-color: #2222221a;
}
#debugger-button:disabled {
background-color: #e9ecef;
color: #6c757d;
cursor: not-allowed;
}

#debugger-regex {
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
Expand Down
3 changes: 2 additions & 1 deletion Public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ <h1 class="h5 my-2">
</div>
<div class="col align-self-center">
<div class="text-end mt-2">
<button id="debugger-button" class="px-3" data-bs-toggle="modal" data-bs-target="#debugger-modal">
<button id="debugger-button" class="px-3" data-bs-toggle="modal" data-bs-target="#debugger-modal"
disabled>
<div data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-container="#debugger-button"
title="Debugger" aria-label="Debugger" style="display: inline-block;">
<span class="fa-solid fa-stethoscope"></span>
Expand Down
8 changes: 8 additions & 0 deletions Public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,23 @@ export class App {
}
break;
case "match":
const debuggerButton = document.getElementById("debugger-button");

if (response.result) {
const matches = JSON.parse(response.result);
this.patternTestEditor.matches = matches;
this.updateMatchCount(matches.length, "match-count");

debuggerButton.disabled = response.result.length === "";
} else {
this.patternTestEditor.matches = [];
this.updateMatchCount(0, "match-count");

debuggerButton.disabled = true;
}

this.patternTestEditor.error = response.error;

break;
case "debug":
if (response.result) {
Expand Down
2 changes: 1 addition & 1 deletion Public/js/views/dsl_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class DSLView extends EventDispatcher {
if (!error) {
return;
}
if (typeof error === "string" && error instanceof String) {
if (typeof error === "string" || error instanceof String) {
widgets.push(
editor.addLineWidget(0, ErrorMessage.create(error), {
coverGutter: false,
Expand Down
2 changes: 1 addition & 1 deletion Public/js/views/expression_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ExpressionField extends EventDispatcher {
set error(error) {
if (error) {
let message = "";
if (typeof error === "string" && error instanceof String) {
if (typeof error === "string" || error instanceof String) {
const errorMessage = Utils.htmlSafe(error);
message = `<span class="fw-bolder text-danger">Parse Error:</span> ${errorMessage}`;
} else {
Expand Down