Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-rendering of the mention list #370

Open
krishnaIVP opened this issue Apr 23, 2024 · 0 comments
Open

Re-rendering of the mention list #370

krishnaIVP opened this issue Apr 23, 2024 · 0 comments

Comments

@krishnaIVP
Copy link

krishnaIVP commented Apr 23, 2024

Hey Techies,

Is there, anyone having the same issue of not rendering the mentioned list as when we use a static array to run and check the list... It is working fine but when we are fetching data from APIs and then trying to add it to the mentioned list, it is not working.

My Component file:

import { useState, useMemo, useRef, useEffect } from 'react'
import ReactQuill from 'react-quill'
import Quill from 'quill'
import Toolbar from './Toolbar/Toolbar'
import 'react-quill/dist/quill.snow.css'
import MentionFormat from './Formats/mention'
import MentionModule from './Modules/mention'
import { FORMATS } from './Utils'
import './mention.css'
// import './Modules/floating-label.scss'
import { createPortal } from 'react-dom'
import MentionsList from './MentionList'
import { Typography } from '@mui/material'
Quill.register({ 'formats/mention': MentionFormat })
Quill.register('modules/mention', MentionModule)
const Size = Quill.import('formats/size')
Size.whitelist = ['extra-small', 'small', 'medium', 'large']
Quill.register(Size, true)
let Font = Quill.import('formats/font')
Font.whitelist = ['inconsolata', 'roboto', 'mirza', 'arial']
Quill.register(Font, true)

// Props to fetch data
export type EditorProps = {
  hideImageButton?: boolean
  hideToolBar?: boolean
  defaultVal?: string
  setupMentionValues: IMentionItems[]
  height?: string
  width?: string
  label?: string
  readOnly?: boolean
  getValueString?: (selectedItem: string) => void
  getValue?: (selectedItem: string) => void
  getMentionItem?: (selectedItem: IMentionValue) => void
  getHTMLContent?: (selectedItem: string) => void
}

// Interface for setup mention items
export interface IMentionItems {
  id: string
  value: string
}
// Interface for get mention values
export interface IMentionValue {
  name: string
  id: string
}

const QUILL_FORAMTS = FORMATS.map(({ name }) => name)

export default function IvpSummernote(props: EditorProps) {
  // Properties
  const {
    setupMentionValues,
    defaultVal,
    hideImageButton,
    hideToolBar,
    getValueString,
    getValue,
    getMentionItem,
    getHTMLContent,
    height,
    width,
    label,
    readOnly
  } = props
  const text = `${defaultVal}`
  const [open, setOpen] = useState(false)
  const [mentions, setMentions] = useState([])
  const [isFocused, setIsFocused] = useState(false)
  const [hasContent, setHasContent] = useState(text && text.trim().length > 0)
  const quillContainerRef = useRef(null)

  const ref = useRef<any>()

  // Mention View Open and Close
  /* istanbul ignore next */
  const handleClose = () => {
    setOpen(false)
  }
  /* istanbul ignore next */
  const handleOpen = () => {
    setOpen(true)
  }
  // Mention Item Click
  /* istanbul ignore next */
  const onItemClick = ({ data }) => {
    if (getMentionItem) getMentionItem(data)
    let nm = data.name
    data.name = `{${nm}}`
    ref.current.editor.emitter.emit('mention-clicked', data)
    handleClose()
  }
  // Undo and redo functions for Custom Toolbar
  /* istanbul ignore next */
  function undoChange(this: {
    quill: any
    undo: () => void
    redo: () => void
  }) {
    this.quill.history.undo()
  }
  /* istanbul ignore next */
  function redoChange(this: {
    quill: any
    undo: (this: { quill: any; undo: () => void; redo: () => void }) => void
    redo: () => void
  }) {
    this.quill.history.redo()
  }
  // Handle Changes when user type in text Editor
  /* istanbul ignore next */
  const handleChangeSelection = () => {
    let txt = ref.current.editor.container.innerText
    let justHtml = ref.current.editor.root.innerHTML
    const replacedText = txt?.replace(/@\{([^}]+)\}/g, (match, p1) => {
      const foundItem = setupMentionValues.find((item) => item.value === p1)
      return foundItem ? foundItem.id : match
    })
    setHasContent(txt && txt?.trim().length > 0)
    if (getValueString) getValueString(txt)
    if (getValue) getValue(replacedText)
    if (getHTMLContent) getHTMLContent(justHtml)
  }
  const handleFocus = () => {
    setIsFocused(true)
  }

  const handleBlur = () => {
    setIsFocused(false)
  }
  //   const handleChange = (content) => {
  //     ref.current.onChange(content)
  //     setHasContent(content && content.trim().length > 0)
  //   }
  /* istanbul ignore next */
  const mentionCallBacks = () => {
    const selection = ref.current.editor.getSelection(true)
    ref.current.editor.insertText(selection.index, '@')
    ref.current.editor.blur()
    ref.current.editor.focus()
  }
  // Render Mention List
  /* istanbul ignore next */
  const renderMentionList = ({ quillContainer, searchTerm }) => {
    let matches: any = []
    if (searchTerm.length === 0) {
      matches = setupMentionValues
    } else {
      for (let i = 0; i < setupMentionValues.length; i++) {
        if (
          setupMentionValues[i].value
            .toLowerCase()
            .indexOf(searchTerm.toLowerCase()) >= 0
        )
          matches.push(setupMentionValues[i])
      }
    }
    if (!quillContainerRef.current) {
      quillContainerRef.current = quillContainer
    }
    setMentions(matches)
    setOpen(true)
  }
  // Assuming you have a reference to your text editor element
  // Get the selection object
  const selection = window.getSelection()
  let topValue = 0
  let leftValue = 0
  /* istanbul ignore next */
  if (selection && selection.rangeCount > 0) {
    // Get the first range in the selection
    const range = selection.getRangeAt(0)
    // Get the bounding client rect of the range
    const rect = range.getBoundingClientRect()
    // Calculate the position relative to the text editor
    const top = rect.top + window.scrollY
    const left = rect.left + window.scrollX
    topValue = top
    leftValue = left
  }
  //   const labelStyle: React.CSSProperties = {
  //     // position: 'absolute',
  //     top: '-150px',
  //     left: '80px',
  //     // transform: 'translateY(-50%)',
  //     // transition: 'all 0.3s ease',
  //     // pointerEvents: 'none' as React.CSSProperties['pointerEvents'], // Set the pointerEvents property correctly
  //     color: '#9e9e9e'
  //     // Optional: Add styles for active state
  //     // ...(active && {
  //     //   color: 'blue', // Change color if active
  //     //   fontSize: '12px', // Adjust size if active
  //     // }),
  //   }
  //   const labelStyle2: React.CSSProperties = {
  //     position: 'absolute',
  //     transition: 'all 0.3s ease',
  //     top: isFocused || hasContent ? '-50px' : '',
  //     fontSize: isFocused || hasContent ? '12px' : 'inherit',
  //     color: isFocused || hasContent ? '#3f51b5' : '#9e9e9e'
  //     // transform: isFocused || hasContent ? 'translateY(-50%)' : ''
  //   }
  // UseEffect
  useEffect(() => {
    handleChangeSelection()
  })
  return (
    <>
      {useMemo(
        () => (
          <>
            {/* <Typography sx={{ top: '-140px', width: '6rem' }}>
              {label}
            </Typography> */}
            <ReactQuill
              style={{
                height: height ? height : '15em',
                width: width ? width : '15em',
                borderRadius: '5px',
                border: 'solid 1px red',
                maxHeight: '40em',
                minWidth: '20em',
                maxWidth: '90em'
              }}
              ref={ref}
              id='text-Editor'
              modules={{
                clipboard: {
                  matchVisual: true
                },
                toolbar: hideToolBar
                  ? false
                  : {
                      container: '#toolbar',
                      size: ['12px', '16px', '24px', '36px'],
                      handlers: {
                        undo: undoChange,
                        redo: redoChange,
                        mention: mentionCallBacks
                      }
                    },
                history: {
                  delay: 500,
                  maxStack: 100,
                  userOnly: true
                },
                mention: {
                  allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
                  mentionDenotationChars: ['@'],
                  positioningStrategy: 'inside-quill',
                  hideMentionList: handleClose,
                  showMnetionList: handleOpen,
                  renderMentionList: renderMentionList
                }
              }}
              formats={QUILL_FORAMTS}
              theme='snow'
              defaultValue={text}
              readOnly={readOnly}
              onChangeSelection={handleChangeSelection}
              //   onChange={handleChange}
              onFocus={handleFocus}
              onBlur={handleBlur}
              placeholder='WhereClause'
            />
          </>
        ),
        /* eslint-disable react-hooks/exhaustive-deps */
        []
        /* eslint-enable react-hooks/exhaustive-deps */
      )}
      {hideToolBar ? null : (
        <Toolbar width={width ? width : '20em'} hideImgBtn={hideImageButton} />
      )}
      <p id='counter'></p>
      {quillContainerRef.current &&
        /* istanbul ignore next */
        createPortal(
          <MentionsList
            open={open}
            items={mentions}
            top={topValue}
            left={leftValue}
            oneClose={handleClose}
            onItemClick={onItemClick}
          />,
          quillContainerRef.current
        )}
    </>
  )
}

My Rendering Component file:

import { useEffect, useState } from 'react'
import IvpSummernote, {
  IMentionItems,
  IMentionValue
} from '../Component/IvpSummernote/IvpSummernote'

const SummernoteRender = () => {
  // Properties
  const mentionValues: IMentionItems[] = [
    { id: '10', value: 'delhi' },
    { id: '20', value: 'mumbai' },
    { id: '30', value: 'noida' },
    { id: '40', value: 'lucknow' },
    { id: '50', value: 'raipur' },
    { id: '60', value: 'nagpur' }
  ]
  const [editorStringValue, setEditorStringValue] = useState('')
  const [editorValue, setEditorValue] = useState('')
  const [editorHTMLValue, setEditorHTMLValue] = useState('')
  const [mentionData, setMentionData] = useState<IMentionItems[]>([])
  const [mentionItem, setMentionItems] = useState<IMentionValue>()
  const [data, setData] = useState<any>(null)
  const [loading, setLoading] = useState<boolean>(true)
  const [error, setError] = useState<Error | null>(null)

  fetch('https://jsonplaceholder.typicode.com/todos/1')
    .then((response) => response.json())
    .then((json) => console.log(json))
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch(
          'https://jsonplaceholder.typicode.com/users'
        )
        if (!response.ok) {
          throw new Error('Failed to fetch data')
        }
        const jsonData = await response.json()
        console.log(jsonData)
        const transformedData: IMentionItems[] = jsonData.map((item: any) => ({
          id: item.id.toString(),
          value: item.name
        }))
        console.log('Mention Data Values are: ', transformedData)
        setMentionData(transformedData)
        setData(jsonData)
      } catch (error) {
        setError(error as Error)
      } finally {
        setLoading(false)
      }
    }

    fetchData()
  }, [])
  return (
    <div style={{ background: '', borderRadius: '5px' }}>
      <h1>Quill Editor with Mention in React</h1>
      {/* {loading ? (
        <div>Loading...</div>
      ) : ( */}
      <IvpSummernote
        setupMentionValues={mentionData}
        defaultVal=''
        //   initialText={
        //     '<p>Hi, check this editor </p><p><br></p><p><img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBUWFRgSEhUYGBgZGBgSGBgaGBgYGRgYGBgZGRgYGBgcIS4lHB4rIRgYJjgmKy8xNTU1GiQ7QDs0Py40NTEBDAwMEA8QHhISHzQrJSs0NDQ2NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDE0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NP/AABEIAOAA4QMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAACAwABBAUGB//EADgQAAEDAgQEBQMCBQMFAAAAAAEAAhEDIQQSMUEFUWFxEy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WbFDV0yZKzY2qHSYBHLQg8wlOdmdmNgbdhosrH3+E8DaVEk2i4pWrDe2ZPKBI6WuUsBoIbEbpWctloMA3KHxpdJKUYvyVyYusTQ4E77E/4SAYIGu87qNxQzcgEJeDJ9leJA/PMQLzftsgNXeSIPwgHP3S31ASjEVmk+bzGD8eyMPbYagAx0KxB1oP4FTnwnQ06NdTEloc88/gbQjw+IEAzOYH56LC6rMNhSm4tdMQli1sakvRsewAzcd9TzIQNsSDz1CwV4c/PJlaKWKIIduDyQ16FKPodUccxi9gHW1Oko3VCDyIAy9t0mpiQTIEc+qWKsmHd/Tkn0xNWi4f/wBytX44URbJ16BZH0lacwAjfmsdA+aU2o+UFWPdUERzsqbSDbTrdKyZohMcbIb2qE27AYII5TdasU1obbVY2U73TnvvdFg3sCkzcqCm6dQGylYx748qx0aDyLuKaots6xYwCS8SsrsU1plwkbELEOFAyXEz3Ke3DQA3ZO4jUl6GtfNxZG07omsBACKph4uFDkgp10Kq1N4UOIkJj6MhKbTOiV3slMqmZtKKu1oEIgxU+hmTtD/2IoHmtLmWlDQoxK6dFrIuFHJNRVmnHxPkdROadISy2TZduth2Ob5dVx6jHMOiXHzKb0HJwyh2gXC6A0yTbRPbzU1dA0WtmNeRLaZmWpjTrPutQYIgIHULTMBO7Go12c+ZJgISw7BawwASiaTEwkOmYWuAILrBSo/MfIOiZiaWfW0IKFItB5pU+zoT41HF9+wfDKtTzqIuRGEPZ//Z"> </p><strong>eerrr</strong> <em> rrrrrrrff</em>'
        //   }
        hideToolBar={true}
        hideImageButton={false}
        label='WhereClause'
        width='60em'
        height='2rem'
        getMentionItem={setMentionItems}
        getValueString={setEditorStringValue}
        getValue={setEditorValue}
        getHTMLContent={setEditorHTMLValue}
      />
      <div style={{ marginTop: '5rem' }}>
        Editor mention Value are name: {mentionItem?.name} & id:{' '}
        {mentionItem?.id}
      </div>
      <div style={{ marginTop: '2rem', width: '25rem' }}>
        Editor Values are: {editorValue}
      </div>
      <div style={{ marginTop: '2rem', width: '25rem' }}>
        Editor String Values are: {editorStringValue}
      </div>
      <div style={{ marginTop: '2rem', width: '22rem' }}>
        Editor HTML Content are: {editorHTMLValue}
      </div>
    </div>
  )
}
export default SummernoteRender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant