Comments (4)
Did you take a look at renderItem
? Should be no problem to render what you want. It should look something like this:
renderItem: (item, searchTerm) => {
return `
<div class="cql-list-item-inner">
<img src="${item.imageUrl}">
${item.value}
</div>`;
}
from quill-mention.
import { renderToString } from 'react-dom/server'
const renderMentionItem = (item) =>{
return (
<ListItem value = {item.id}>
<ListItemAvatar>
<Avatar
src={item.avatar}
alt={item.value}
color={createAvatar(item.value).color}
sx={{ width: 27, height: 27, fontSize: 12 }}
>
{createAvatar(item.value).name}
</Avatar>
</ListItemAvatar>
<ListItemText primary = {item.value} />
</ListItem>
);
}
renderItem : function(item, searchTerm){ return renderToString(renderMentionItem(item)) },
from quill-mention.
can you write full example. I am not able to render custom HTML. I am using MUI Listitem
allowedChars : /^[A-Za-z\sÅÄÖåäö]*$/, mentionDenotationChars : ["@", "#"], isolateCharacter : true, renderItem : function (item, searchTerm) { return ( <ListItem value = {item.id}> <ListItemAvatar> <Avatar> UA </Avatar> </ListItemAvatar> <ListItemText primary = {item.value} /> </ListItem> ); }, source : function (searchTerm, renderItem, mentionChar) { let values; if (mentionChar === "@") { values = atValues; } if (searchTerm.length === 0) { renderItem(values, searchTerm); } else { const matches = []; for (let i = 0; i < values.length; i++) if ( ~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase()) ) matches.push(values[i]); renderItem(matches, searchTerm); } }
from quill-mention.
allowedChars : /^[A-Za-z\sÅÄÖåäö]*$/, mentionDenotationChars : ["@", "#"], isolateCharacter : true, renderItem : function (item, searchTerm) { return ( <ListItem value = {item.id}> <ListItemAvatar> <Avatar> UA </Avatar> </ListItemAvatar> <ListItemText primary = {item.value} /> </ListItem> ); }, source : function (searchTerm, renderItem, mentionChar) { let values; if (mentionChar === "@") { values = atValues; } if (searchTerm.length === 0) { renderItem(values, searchTerm); } else { const matches = []; for (let i = 0; i < values.length; i++) if ( ~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase()) ) matches.push(values[i]); renderItem(matches, searchTerm); } }
How about this problem? Can you show the user image in li list? If you found the any solution, please let me known your solution for this case. @a-utkarsh
from quill-mention.
Related Issues (20)
- Inserting an a mention with insertItem adds an "undefined" before the denotation char HOT 2
- Fixed Quill v2.0.0-dev.4 implementation HOT 5
- Getting error when code is deployed in Dev environment - [Parchment] Unable to create mention blot HOT 1
- Typescript declaration error while importing quill-mention HOT 1
- Links do not work anymore HOT 1
- window.addEventListener("mention-clicked"... not triggering HOT 2
- Release notes / changes HOT 3
- Quill-mention does not consider the searchterm which contains the mentiondenotationchar as a single term.
- Denotation char span in blot is being flattened by setting innerText HOT 1
- How to solve the problem of not supporting Chinese search?
- renderItem and styled pop-up in Angular 14 HOT 1
- quill-mention should support Quill Version 2.0.0-rc.0 HOT 2
- Quill 2 Support HOT 1
- quill Cannot import modules/mention. Are you sure it was registered? HOT 1
- mentionDenotationChars if it is a special symbol regular match is not correct
- what is the problem with my code
- Re-rendering of the mention list
- Add profile image to the mention list
- Bug: Character insertion position/order sometimes wrong HOT 2
- 5.0.0: quill.mention.min.js outdated with the rest of the code HOT 2
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 quill-mention.