tom-select icon indicating copy to clipboard operation
tom-select copied to clipboard

add limit_display plugin

Open craigh opened this issue 2 years ago • 2 comments

craigh avatar Aug 19 '22 15:08 craigh

Screen Shot 2022-08-19 at 11 25 03 AM

craigh avatar Aug 19 '22 15:08 craigh

@craigh Thanks for this; I'm in the process of investigating a move away from another solution, and this helps greatly with integration into the existing design, which tends to look odd if the select input can grow to infinite height. A few hopefully helpful suggestions:

  1. Consider adding an items option, defaulting to the word 'items', in addition to the existing limit option, whereby one could less vague as to what the items were, e.g., items: 'woozles' would result in 8 woozles selected being displayed.
  2. While the normal style of a plugin is to assign and use self, you're 100% arrow functions here; you always know what this is, so I think you can just skip the self bit and always use this. I'm new here, not sure if this is just a preferred style, but, well, arrow functions mean never being confused about what this is. Best thing ever, IMO.
  3. The 4 separate calls to addEvent could be handled by a for...of loop, and then you don't need addEvent.
for (const type of ['input', 'keyup', 'blur', 'update']) {
    this.control_input.addEventListener(type, updateDisplay);
}

bazineta avatar Sep 05 '22 22:09 bazineta

This pull request has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Nov 19 '23 02:11 github-actions[bot]