Skip to content
Snippets Groups Projects
Commit 0a35acc6 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Rename function

parent 54ff1df6
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ import { declarations } from './' ...@@ -15,7 +15,7 @@ import { declarations } from './'
import issueTypes from './issues-types' import issueTypes from './issues-types'
import manuscriptTypes from './manuscript-types' import manuscriptTypes from './manuscript-types'
import { requiredBasedOnType } from './wizard-validators' import { requiredBasedOnType, parseEmptyHtml } from './wizard-validators'
const min3Chars = minChars(3) const min3Chars = minChars(3)
const declarationsMinSize = minSize(declarations.options.length) const declarationsMinSize = minSize(declarations.options.length)
...@@ -103,6 +103,7 @@ export default { ...@@ -103,6 +103,7 @@ export default {
renderComponent: TitleEditor, renderComponent: TitleEditor,
placeholder: 'Manuscript title', placeholder: 'Manuscript title',
title: 'Manuscript title', title: 'Manuscript title',
validate: [parseEmptyHtml],
}, },
{ {
fieldId: 'spacing-title', fieldId: 'spacing-title',
......
...@@ -6,7 +6,7 @@ const requiredTypes = manuscriptTypes ...@@ -6,7 +6,7 @@ const requiredTypes = manuscriptTypes
.filter(t => t.abstractRequired) .filter(t => t.abstractRequired)
.map(t => t.value) .map(t => t.value)
const parseAbstract = value => { export const parseEmptyHtml = value => {
if (value && value.replace('<p></p>', '').replace('<h1></h1>', '')) { if (value && value.replace('<p></p>', '').replace('<h1></h1>', '')) {
return undefined return undefined
} }
...@@ -16,7 +16,7 @@ const parseAbstract = value => { ...@@ -16,7 +16,7 @@ const parseAbstract = value => {
export const requiredBasedOnType = (value, formValues) => { export const requiredBasedOnType = (value, formValues) => {
if ( if (
requiredTypes.includes(get(formValues, 'metadata.type')) && requiredTypes.includes(get(formValues, 'metadata.type')) &&
(isEmpty(get(formValues, 'metadata.abstract')) || parseAbstract(value)) (isEmpty(get(formValues, 'metadata.abstract')) || parseEmptyHtml(value))
) { ) {
return 'Required' return 'Required'
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment