tags-input icon indicating copy to clipboard operation
tags-input copied to clipboard

make separator configurable

Open pirxpilot opened this issue 9 years ago • 10 comments

it's still comma by default but you can pass { separator: ' ' } or { separator: ':' } as an option argument when creating tags-input

pirxpilot avatar Nov 24 '16 17:11 pirxpilot

Thought: what about having it be an attribute on the input?

<input type="tags" data-separator=":" value="foo:bar:baz">

developit avatar Nov 24 '16 18:11 developit

Yup. Much better. Let me rework it.

pirxpilot avatar Nov 25 '16 04:11 pirxpilot

Some fixes:

  • implemented data-separator
  • fixed char detection - Safari does not actually support neither key nor char on keydown events - we need to parse keyIdentifier to properly detect separator char

pirxpilot avatar Nov 25 '16 23:11 pirxpilot

How can one specify multible seperators? E.g. "," and enter?

luckydonald avatar Dec 15 '16 00:12 luckydonald

@luckydonald by pasting

developit avatar Dec 15 '16 00:12 developit

@luckydonald - enter and tab is always a separator, as for others you can specify a string with multiple charactes - see: https://pirxpilot.github.io/tags-input/ Source for the demo is here: https://github.com/code42day/tags-input/blob/next/index.html

pirxpilot avatar Dec 15 '16 00:12 pirxpilot

Ah now I see what was being asked haha. Nice demo @pirxpilot

developit avatar Dec 15 '16 00:12 developit

Detecting keys is tricky, not all documented properties are set on all events. For example charCode is not set in most browsers on keyDown. see: https://dvcs.w3.org/hg/d4e/raw-file/tip/key-event-test.html

pirxpilot avatar Dec 15 '16 00:12 pirxpilot

🙏

0xc00010ff avatar Jun 05 '17 06:06 0xc00010ff

@0xc00010ff check @pirxpilot 's fork https://github.com/pirxpilot/tags-input

tumpio avatar Jun 05 '17 07:06 tumpio