Giter Site home page Giter Site logo

Comments (4)

 avatar commented on June 4, 2024 10

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.

Eduser-vivo avatar Eduser-vivo commented on June 4, 2024 1
 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.

a-utkarsh avatar a-utkarsh commented on June 4, 2024

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.

Zayyarhein avatar Zayyarhein commented on June 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.