Skip to content

Commit

Permalink
refactored wrapper HTML template by extracting the input into its o…
Browse files Browse the repository at this point in the history
…wn template function
  • Loading branch information
yairEO committed Apr 23, 2024
1 parent e0c6380 commit c52c6e3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/parts/templates.js
Expand Up @@ -13,15 +13,22 @@ export default {
${_s.required ? 'required' : ''}
${_s.mode === 'select' ? "spellcheck='false'" : ''}
tabIndex="-1">
<span ${!_s.readonly && _s.userInput ? 'contenteditable' : ''} tabIndex="0" data-placeholder="${_s.placeholder || ZERO_WIDTH_UNICODE_CHAR}" aria-placeholder="${_s.placeholder || ''}"
class="${_s.classNames.input}"
role="textbox"
aria-autocomplete="both"
aria-multiline="${_s.mode=='mix'?true:false}"></span>
${this.settings.templates.input.call(this)}
${ZERO_WIDTH_UNICODE_CHAR}
</tags>`
},

input() {
var _s = this.settings,
placeholder = _s.placeholder || ZERO_WIDTH_UNICODE_CHAR;

return `<span ${!_s.readonly && _s.userInput ? 'contenteditable' : ''} tabIndex="0" data-placeholder="${placeholder}" aria-placeholder="${_s.placeholder || ''}"
class="${_s.classNames.input}"
role="textbox"
aria-autocomplete="both"
aria-multiline="${_s.mode=='mix'?true:false}"></span>`
},

tag(tagData, {settings: _s}){
return `<tag title="${(tagData.title || tagData.value)}"
contenteditable='false'
Expand Down

0 comments on commit c52c6e3

Please sign in to comment.