Comments (11)
from tribute.
Ah interesting, one quick workaround for this while I look into some potential solutions is to set contenteditable="false"
on your element.
{
selectTemplate: function (item) {
return '<span class="handle" contenteditable="false">' + item.original.username + '</span>';
},
values: [
{ name: 'Allen Iverson', username: 'alleniverson' },
{ name: 'Basketball HOF', username: 'Hoophall' }
]
}
The side effect is that the entire node gets deleted, but there is no way to corrupt the markup. Let me know if this works for you.
from tribute.
@achambers The landscape was pretty bleak when I was looking for a solution. We are using this in production but under a very restricted use case; we match IDs similar to Github issue references. We have no plans of abandoning this project.
I have been looking for someone to help maintain the library as the needs of the project currently outweigh my available time. If you are interested in contributing, that would be great.
from tribute.
You can preview the problem here: https://plnkr.co/edit/AV1ru1uYDbttp5mx62SF?p=preview
Just open file script.js
and:
- Uncomment line 13.
- Comment line 14.
from tribute.
This is not a solution for me since it introduces a bed UX pattern for users. Sorry... :)
from tribute.
@mrsweaters What’s the status of this bug? I’ve come across it also. You can end up with an fully nested element if you keep editing the mention which is totally undesirable.
Is there any love being given to this issue?
Where might one start to look in order to patch this? Il happy to do so myself if you could give me a steer
from tribute.
@achambers This is still an issue unfortunately. This will involve making delete more aware of the selection context on backspace/delete and tribute aware of whether or not your selection is part of a matched node.
https://github.com/zurb/tribute/blob/master/src/TributeEvents.js#L220
- We need to know if we are in an already matched node so that we don't accidentally nest matches.
- When you backspace and start typing again and then select a match, it should fill in the match and then jump out of the current element and insert the caret after.
- If there is no match and you continue typing, and you are in the context of a
selectTemplate
node, we should move you out of the node.
I think that covers most of the edge cases.
from tribute.
@mrsweaters Yep, that pretty much sums up my take on it. So, my question to you now is in what capacity are you using this lib? This seems like a pretty fundamental bug where you can’t edit a mention without considerable unwanted DOM.
I’m only asking as I’m building mention capabilities in to my app and have started out with at.js which doesn’t fill me with confidence. I came across Tribute and started spiking it out to see if it will fit our needs. It definitely fills me with more confidence than at.js does and fixes a few of the bugs I’ve seen with it but also feels potentially like it is missing a couple of fundamental concepts like this one.
Is it fair to say Tribute is early stage and not yet used in Production in anger?
Please don’t get me wrong, I’ve got a much better feeling about Tribute than at.js but am trying to weigh up perusing with Tribute and potentially putting my time in to helping get it where I need it to be, or rolling my own.
Could you give me some context?
from tribute.
@achambers Just checking in. Were you able to take a look at improving the backspace functionality? Let me know if you hit any roadblocks or where I could help!
from tribute.
Mate, I never had the chance to further explore Tribute due to time constraints unfortunately.
from tribute.
Closing as this is pretty old. Thank you for your help!
from tribute.
Related Issues (20)
- tributejs npm package version 5.1.3 is lastest, but not have loadingItemTemplate in options HOT 1
- Hi, why I can't use arrow key on my mention tooltip HOT 1
- Menu is offset incorrectly
- Cannot set cursor in front of the mention tag
- DOM-based XSS due to un-escaped special characters HOT 1
- Is it possible to add dropdown with heading?
- Removing items with backspace is not working when added by showMenuForCollection menu HOT 3
- Removing characters one by one with backspace then auto suggesting is not working HOT 1
- Instead of characters matches, is there words can match
- latest Typescript complile error
- Option to use DOM elements instead of HTML strings as templates
- Typescript 4.8.2 (Required by Angular 15) TributeOptions Type issue
- Update to stimulus-use debounce broke remote data load
- Error while clicking on scroll bar - chrome on mac
- Replacing words that contains space
- Performance issue and freezes
- When we can have a new version with the latest changes from master? HOT 2
- Tribute doesnot seem to work inside bootstrap modal.
- Disable the need a symbol to starts the lookup
- Issue with Deleting Mention via Programmatic Trigger in Tribute.js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tribute.