tribute
tribute copied to clipboard
Use '@' as selectTemplate case menu position error.
How can we reproduce this bug?
- config as below.
{
values: [
{
key: "Jordan Humphreys",
value: "Jordan Humphreys",
},
{
key: "Sir Walter Riley",
value: "Sir Walter Riley",
}
],
replaceTextSuffix: '',
requireLeadingSpace: false,
selectTemplate(item) {
return '<span contenteditable="false">' + '@' + item.original.value + "</span>";
}
}
- Tap @ and choose one item
- Tap LeftArrow on keyboard
- Tap RightArrow on keyboard
What did you expect to happen? Do not show menu or fix menu position.
What happened instead? Menu show at left-top.
Screenshot:
I think the '@' mark in selectTemplate cause this problem.
Oh interesting, so if you get rid of the @
symbol, the problem goes away?
Oh interesting, so if you get rid of the
@
symbol, the problem goes away?
Yes, if i remove @
symbol in selectTemplate, everything is ok.
How do you keep @ to solve this problem?
How do you keep @ to solve this problem?
We just remove show @.
How can we solve this problem if we keep the @ on display。I need to keep the @ on display
And the trigger is also @
How can we solve this problem if we keep the @ symbol in selectTemplate。what should I do? @mrsweaters @a365344743s
@lhb12345 我在React中是这么解决的
this.refs.input.addEventListener("tribute-active-true", (e) => {
setTimeout(() => {
const tributePanels = document.getElementsByClassName('tribute-container');
const lastPanel = tributePanels[tributePanels.length - 1];
const { left, top } = lastPanel.style;
if (left === '0px' || top === '0px') {
lastPanel.style.display = 'none';
}
}, 10);
});