Skip to content

Commit

Permalink
Merge pull request #273 from wonknu/2.16.X
Browse files Browse the repository at this point in the history
fix: max-lenght properties is broken
  • Loading branch information
gregorybesson committed Dec 14, 2017
2 parents ca1d9c6 + 53a5c84 commit 51d06a5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/server/public/abecms/scripts/modules/EditorAutocomplete.js
Expand Up @@ -100,18 +100,6 @@ export default class EditorAutocomplete {
var nodeComments = IframeCommentNode('#page-template', id.replace(/\./g, '-'))
var maxLength = this._currentInput.getAttribute('data-maxlength')

if(typeof maxLength !== 'undefined' && maxLength !== null && maxLength !== '') {
maxLength = parseInt(maxLength)
var countLength = [].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result')).length
if(countLength === maxLength) {
this._currentInput.value = ''
this._divWrapper.parentNode.removeChild(this._divWrapper)
this._currentInput.setAttribute('disabled', 'disabled')
}else {
this._currentInput.removeAttribute('disabled')
}
}

var results = this._currentInput && [].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result')) || []
var json = this._json.data

Expand Down Expand Up @@ -155,6 +143,18 @@ export default class EditorAutocomplete {
}
}

if(typeof maxLength !== 'undefined' && maxLength !== null && maxLength !== '') {
maxLength = parseInt(maxLength)
var countLength = [].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result')).length
if(countLength === maxLength) {
this._currentInput.value = ''
this._divWrapper.parentNode.removeChild(this._divWrapper)
this._currentInput.setAttribute('disabled', 'disabled')
}else {
this._currentInput.removeAttribute('disabled')
}
}

this.onReload._fire()
}

Expand Down

0 comments on commit 51d06a5

Please sign in to comment.