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

How can I render HTML with tailwind classes inside .pasteString()? #175

Open
ukcw opened this issue Mar 7, 2023 · 2 comments
Open

How can I render HTML with tailwind classes inside .pasteString()? #175

ukcw opened this issue Mar 7, 2023 · 2 comments

Comments

@ukcw
Copy link

ukcw commented Mar 7, 2023

<Typewriter
  onInit={(typewriter) => {
    typewriter
      .typeString('Welcome to my site!')
      .pauseFor(100)
      .typeString('<br />')
      .pauseFor(100)
      .typeString("Let's get started...")
      .callFunction((state) => {
        // turn off animation
        state.elements.cursor.style.animation = 'none'
        // hide cursor
        state.elements.cursor.style.display = 'none'
      })
      .pasteString(
        `
      <div className="flex my-6 justify-between">
      <p className="italic">Select a category</p>
      <ul className="space-x-2 items-center">
        <li className="inline-block px-1 py-1 border rounded-md">
          <AiOutlineArrowDown />
        </li>
        <li className="inline-block px-1 py-1 border rounded-md">
          <AiOutlineArrowUp />
        </li>
        <li className="inline-block px-1 py-1 border rounded-md">
          <BsArrowReturnLeft />
        </li>
      </ul>
      </div>
      `,
        null
      )
      .start()
  }}
  options={{
    delay: 60,
  }}
/>

I'm trying to paste an entire div using the .pasteString method but only the div and p are being rendered, the entire ul is being skipped. Is this expected behaviour? As well, the method signature seems to expect a string and a HTMLElement | null as opposed to just a string.

@tomer-tgp
Copy link

tomer-tgp commented Mar 16, 2023

similar issue here, I have a <table> inside the string I am typing and it strips all the <tr> and <td> and leaves only <table>

I think it can't render nested html elements, and leaves just the parent one

@xuhen
Copy link

xuhen commented May 23, 2023

Is there any solution to skip specific tag eg: table? then, it will keep the childern tag ?

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

3 participants