Skip to content

Commit 596517e

Browse files
committed
Add palceholder for custom field value.
1 parent 86318d4 commit 596517e

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/article/manuscript/ManuscriptPackage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ export default {
359359
config.addLabel('add-action', 'Add')
360360
config.addLabel('enter-url-placeholder', 'Enter url')
361361
config.addLabel('enter-keyword', 'Enter keyword')
362+
config.addLabel('enter-keywords', 'Click to add keywords')
362363

363364
// Icons
364365
config.addIcon('create-unordered-list', { 'fontawesome': 'fa-list-ul' })

src/article/metadata/MetadataPackage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ export default {
380380
config.addLabel('empty-figure-metadata', 'No fields specified')
381381
config.addLabel('open-link', 'Open Link')
382382
config.addLabel('enter-keyword', 'Enter keyword')
383+
config.addLabel('enter-keywords', 'Click to add keywords')
384+
383385
// Icons
384386
config.addIcon('input-error', { 'fontawesome': 'fa-exclamation-circle' })
385387
config.addIcon('input-loading', { 'fontawesome': 'fa-spinner fa-spin' })

src/article/shared/CustomMetadataFieldComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class CustomMetadataFieldComponent extends NodeComponent {
1717
this._renderValue($$, 'name', { placeholder: this.getLabel('enter-custom-field-name') }).addClass('se-field-name'),
1818
$$(KeywordInput, {
1919
model: valuesModel,
20-
placeholder: this.getLabel('enter-keyword'),
20+
placeholder: this.getLabel('enter-keywords'),
2121
overlayId: valuesModel.id
2222
}).addClass('se-field-values')
2323
)

src/kit/ui/KeywordInput.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ export default class KeywordInput extends OverlayMixin(Component) {
1717
const values = model.getValue()
1818
const isEmpty = values.length === 0
1919
const isExpanded = this.state.isExpanded
20+
const label = isEmpty ? this.props.placeholder : values.join(', ')
2021

2122
const el = $$('div').addClass('sc-keyword-input')
2223
if (isEmpty) el.addClass('sm-empty')
2324
el.addClass(isExpanded ? 'sm-expanded' : 'sm-collapsed')
2425
el.append(
25-
$$('div').addClass('se-label').text(values.join(', '))
26+
$$('div').addClass('se-label').text(label)
2627
.on('click', this._onClick)
2728
)
2829
if (isExpanded) {
@@ -38,8 +39,9 @@ export default class KeywordInput extends OverlayMixin(Component) {
3839
}
3940

4041
_renderEditor ($$) {
41-
const { model, placeholder } = this.props
42+
const model = this.props.model
4243
const values = model.getValue()
44+
const placeholder = this.getLabel('enter-keyword')
4345

4446
const Button = this.getComponent('button')
4547
const Input = this.getComponent('input')

0 commit comments

Comments
 (0)