Skip to content

Commit f92df32

Browse files
authored
Merge pull request #145 from adobe/remove-error-hover
chore: remove error hover and disable save when JSON is invalid
2 parents a295481 + fa1d147 commit f92df32

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

tools/admin-edit/admin-edit.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
height: 66vmin;
3232
}
3333

34+
.admin-edit textarea#body.error {
35+
border-color: var(--red-900);
36+
}
37+
3438
/**
3539
* "Creating an Editable Textarea That Supports Syntax Highlighted Code" by Oliver Geer
3640
* Published on CSS-Tricks: https://css-tricks.com/creating-an-editable-textarea-that-supports-syntax-highlighted-code/

tools/admin-edit/admin-edit.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ function validateJSON(code) {
6767
const json = JSON.parse(code);
6868
previewWrapper.removeAttribute('data-line');
6969
previewWrapper.removeAttribute('data-error');
70+
document.getElementById('save').disabled = false;
71+
document.getElementById('body').classList.remove('error');
7072
} catch (error) {
73+
document.getElementById('save').disabled = true;
74+
document.getElementById('body').classList.add('error');
7175
// json is INVALID
7276
const { message } = error;
7377
// extract line of error (if it exists)

tools/admin-edit/line-highlight.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
// add data attributes
6060
const { error } = element.dataset;
6161
if (error) {
62-
highlight.dataset.error = error;
63-
highlight.classList.add('error-hover');
62+
// highlight.dataset.error = error;
63+
// highlight.classList.add('error-hover');
6464
}
6565
if (!hasClass(element, 'line-numbers')) {
6666
highlight.dataset.start = startLine;

tools/page-status/orphaned-pages-popover.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function displayJobDetails() {
103103
}
104104

105105
async function unpublishOrphanedPages(paths) {
106+
// eslint-disable-next-line no-console
106107
console.log('Unpublishing', paths);
107108
const options = {
108109
body: JSON.stringify({

0 commit comments

Comments
 (0)