Skip to content

Commit

Permalink
check null on index
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaznv committed Jul 5, 2023
1 parent fde3727 commit 10ff3ee
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions resources/js/components/editor-index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ export default {
props: ['resourceName', 'field'],
computed: {
value() {
let value = this.field.value
.replace(/<[^>]*(>|$)|&nbsp;|&zwnj;|&raquo;|&laquo;|&gt;/g, ' ')
.replace(/(<([^>]+)>)/gi, '')
if (this.field.value) {
let value = this.field.value
.replace(/<[^>]*(>|$)|&nbsp;|&zwnj;|&raquo;|&laquo;|&gt;/g, ' ')
.replace(/(<([^>]+)>)/gi, '')
if (value.length <= this.field.indexLimit) {
return value
if (value.length <= this.field.indexLimit) {
return value
}
return value.substring(0, this.field.indexLimit) + '...'
}
return value.substring(0, this.field.indexLimit) + '...'
return ''
}
}
}
Expand Down

0 comments on commit 10ff3ee

Please sign in to comment.