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

Docs doesn't make it clear how to use TextStyle #29

Open
zoltanszogyenyi opened this issue Sep 17, 2024 · 0 comments
Open

Docs doesn't make it clear how to use TextStyle #29

zoltanszogyenyi opened this issue Sep 17, 2024 · 0 comments

Comments

@zoltanszogyenyi
Copy link

zoltanszogyenyi commented Sep 17, 2024

Hey guys,

Awesome library!

I can't get to understand how to apply a simple font-size style to the <span> tag from the TextStyle docs.

My code is:

// Loop through all elements with the data-text-size attribute
  document.querySelectorAll('[data-text-size]').forEach((button) => {
          button.addEventListener('click', () => {
              const fontSize = button.getAttribute('data-text-size');

              console.log({ style: 'font-size: ' + fontSize + ';' })

              // Apply the selected font size via Tailwind classes using the TipTap editor chain
              editor.chain().focus().setMark('textStyle', { style: 'font-size: ' + fontSize + ';' }).run();

              // Hide the dropdown after selection
              textSizeDropdown.hide();
          });
      });
  }

TextStyle is being imported correctly, the <span> tag is being added but for the love of God the style attribute just doesn't appear. And the docs doesn't have a clear example on how to use it in this case.

I'm using this to create a WYSIWYG wrapper for the Flowbite Library.

Help would be appreciated!

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