Sha256: 679df58a260013e620be3373555971e3204e91f82e366ad4fb98dea9f65f9162

Contents?: true

Size: 1.12 KB

Versions: 288

Compression:

Stored size: 1.12 KB

Contents

export function tagTemplate(tagData) {
  const suggestions = this.settings.whitelist || []

  const possibleSuggestion = suggestions.find(
    // eslint-disable-next-line eqeqeq
    (item) => item.value == tagData.value,
  )
  const possibleLabel = possibleSuggestion
    ? possibleSuggestion.label
    : tagData.value

  return `
<tag title="${tagData.value}"
  contenteditable='false'
  spellcheck='false'
  tabIndex="-1"
  class="tagify__tag ${tagData.class ? tagData.class : ''}"
  ${this.getAttributes(tagData)}
>
  <x title='' class='tagify__tag__removeBtn' role='button' aria-label='remove tag'></x>
  <div>
      <span class='tagify__tag-text'>${possibleLabel}</span>
  </div>
</tag>
`
}

export function suggestionItemTemplate(tagData) {
  return `
<div ${this.getAttributes(tagData)}
  class='tagify__dropdown__item flex items-center ${
  tagData.class ? tagData.class : ''
}'
  tabindex="0"
  role="option">
  ${
  tagData.avatar
    ? `
  <div class='rounded w-8 h-8 block mr-2'>
      <img onerror="this.style.visibility='hidden'" class="w-full" src="${tagData.avatar}">
  </div>`
    : ''
}
  <span>${tagData.label}</span>
</div>
`
}

Version data entries

288 entries across 288 versions & 1 rubygems

Version Path
avo-3.13.7 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.6 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.5 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.4 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.3 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.2 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.1 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.13.0 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-2.53.0 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.12.0 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.10 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.9 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.8 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.7 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.6 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.5 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.4 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.3 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.2 app/javascript/js/controllers/fields/tags_field_helpers.js
avo-3.11.1 app/javascript/js/controllers/fields/tags_field_helpers.js