Skip to content

Commit 41ca2f4

Browse files
authored
Dev Tools: Allow overlay hint to be customized by ReActionView (#1420)
Enables marcoroth/reactionview#88 Related marcoroth/reactionview#47 Related marcoroth/reactionview#81
1 parent d6b1025 commit 41ca2f4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

javascript/packages/dev-tools/src/error-overlay.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,22 @@ export class ErrorOverlay {
577577
<div class="herb-dismiss-hint" style="padding-left: 24px; padding-right: 24px; padding-bottom: 12px;">
578578
Click outside, press <kbd style="display: inline-block; padding: 2px 6px; font-family: monospace; font-size: 0.9em; color: #333; background: #f7f7f7; border: 1px solid #ccc; border-radius: 4px; box-shadow: 0 2px 0 #ccc, 0 2px 3px rgba(0,0,0,0.2) inset;">Esc</kbd> key, or fix the code to dismiss.<br>
579579
580-
You can also disable this overlay by passing <code style="color: #ffeb3b; font-family: monospace; font-size: 12pt;">validation_mode: :none</code> to <code style="color: #ffeb3b; font-family: monospace; font-size: 12pt;">Herb::Engine</code>.
580+
${this.getDismissHint()}
581581
</div>
582582
</div>
583583
`;
584584
}
585585

586+
private getDismissHint(): string {
587+
const template = document.querySelector('template[data-herb-dismiss-hint]') as HTMLTemplateElement | null;
588+
589+
if (template) {
590+
return template.innerHTML.trim();
591+
}
592+
593+
return `You can also disable this overlay by passing <code style="color: #ffeb3b; font-family: monospace; font-size: 12pt;">validation_mode: :none</code> to <code style="color: #ffeb3b; font-family: monospace; font-size: 12pt;">Herb::Engine</code>.`;
594+
}
595+
586596
private getValidationOverlayStyles(): string {
587597
return `
588598
.herb-validation-overlay {

0 commit comments

Comments
 (0)