Javascript 羽毛笔-提及未在羽毛笔JS编辑器内容中插入提及值(使用React羽毛笔)
我正在使用实现,但在单击列表中的项目时无法更新编辑器内容 我可以在单击右符号时正确地呈现列表,并相应地显示数据。但是,当我单击它时,它会消失,并且项目值不会添加到编辑器内容中 下面是我测试它的方法:Javascript 羽毛笔-提及未在羽毛笔JS编辑器内容中插入提及值(使用React羽毛笔),javascript,reactjs,quill,react-quill,Javascript,Reactjs,Quill,React Quill,我正在使用实现,但在单击列表中的项目时无法更新编辑器内容 我可以在单击右符号时正确地呈现列表,并相应地显示数据。但是,当我单击它时,它会消失,并且项目值不会添加到编辑器内容中 下面是我测试它的方法: const suggestPeople = searchTerm => { const allPeople = [ { id: 1, value: "Fredrik Sundqvist" }, { id: 2
const suggestPeople = searchTerm => {
const allPeople = [
{
id: 1,
value: "Fredrik Sundqvist"
},
{
id: 2,
value: "Patrik Sjölin"
}
];
return allPeople.filter(person => person.value.includes(searchTerm));
};
/* Mention module config
====================== */
const mentionModule = {
allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
mentionDenotationChars: ["·"],
source: async function(searchTerm, renderList) {
const matchedPeople = await suggestPeople(searchTerm);
renderList(matchedPeople);
}
};
Quill.register("modules/mentions", QuillMention);
const modules = {
syntax: true,
clipboard: {
matchVisual: false
},
toolbar: {
container: "#toolbar",
},
mention: mentionModule
};
谢谢大家! 我解决了
我需要在config对象中添加onSelect方法,并添加“提及”作为formats数组的元素
不管怎样谢谢你:)