lekoala / bootstrap5-tags

Replace select[multiple] with nices badges for Bootstrap 5
MIT License
150 stars 35 forks source link

Add support for readonly-tags #72

Closed Istalacar closed 1 year ago

Istalacar commented 1 year ago

Hi, As suggested I created draft for read-only tags. Issues that I believer deserve mentioning: If You try to remove readonly tag by backspace, nothing will happen, even if You have tags earlier, that could be removed. If next tag for removal by backspace is "readonly" tag, then the feature is disabled. Tags before "readonly" one, can still be removed by taping on the "x" button.

I merged my repo with newest master, to add support for disabled tags as well. I noticed it too late.

lekoala commented 1 year ago

@Istalacar could you review what's currently on master? i've given it some thoughts and I'd rather use the officially supported "disabled" attribute. Could you give it a try and see how that fits with your proposal ?

Istalacar commented 1 year ago

I rebased my repo to be up to date with your master. Readonly feature now works, and is behaving the same as disabled tags. Also, this comment is no longer applicable:

If next tag for removal by backspace is "readonly" tag, then the feature is disabled. Tags before "readonly" one, can still be removed by taping on the "x" button. Now, if You try to remove last item, script will just find last matching tag (not disabled / not readonly), and will remove it (even if it is not right next to it).

lekoala commented 1 year ago

@Istalacar ok i see, but then maybe we can just use disabled, and not using readonly? what is the use case for this ?

Istalacar commented 1 year ago

Disable should fulfill my needs. I want to show all tags to everyone, but only allow users to remove some of them. I created POC for my needs, and after suggestion created a PR, but It's up to you whether you want this in master repository.

lekoala commented 1 year ago

@Istalacar if disabled works for you, let's keep it as is, i'd rather not add more features to support later on :-) but thanks for the input, it's your proposal that made me add disabled support it's an interesting one