Excerpt form error fix (#20730)
fixes https://linear.app/tryghost/issue/DES-435/excerpt-in-post-settings-has-an-inconsistent-error-state The excerpt form field seemed to not be properly handling errors. However, it was a case of the error styling being overruled by the regular styling, causing the red border to only show upon `:focus` when there is an error in the excerpt. I've rewritten the logic to be slightly less obfuscated and added some CSS to circumvent the issue.
This commit is contained in:
parent
85aed302c1
commit
0412decaec
@ -225,7 +225,7 @@ select {
|
|||||||
.gh-select.error,
|
.gh-select.error,
|
||||||
.error .gh-input-append,
|
.error .gh-input-append,
|
||||||
select.error {
|
select.error {
|
||||||
border-color: var(--red);
|
border-color: var(--red)!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gh-input:focus,
|
.gh-input:focus,
|
||||||
|
@ -62,12 +62,11 @@ export default BaseValidator.create({
|
|||||||
|
|
||||||
customExcerpt(model) {
|
customExcerpt(model) {
|
||||||
if (!validator.isLength(model.customExcerpt || '', 0, 300)) {
|
if (!validator.isLength(model.customExcerpt || '', 0, 300)) {
|
||||||
if (model.feature.editorExcerpt) {
|
const errorMessage = 'Excerpt cannot be longer than 300 characters.';
|
||||||
model.errors.add('customExcerpt', 'Excerpt cannot be longer than 300 characters.');
|
model.errors.add('customExcerpt', errorMessage);
|
||||||
} else {
|
|
||||||
model.errors.add('customExcerpt', 'Excerpt cannot be longer than 300 characters.');
|
|
||||||
}
|
|
||||||
this.invalidate();
|
this.invalidate();
|
||||||
|
} else {
|
||||||
|
model.errors.remove('customExcerpt');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user