Darginec05 / Yoopta-Editor

Build Notion-like, Craft-like, Coda-like, Medium-like editors with Yoopta
https://yoopta.dev/
MIT License
784 stars 61 forks source link

[FEATURE] Question about adding custom html to the toggle option #189

Closed BartoszGl closed 1 week ago

BartoszGl commented 1 week ago

Is this a unique feature?

Is your feature request related to a problem/unavailable functionality? Please describe.

Hello, and first of all thanks for providing such a great library!

I have a question regarding the custom toolbar. In documentation there is a fragment like this in the web/next-example/src/components/Toolbars/MediumToolbar/MediumToolbar.tsx

\

<button type="button" className={s.button} onClick={() => editor.formats.bold.toggle()}> <span style={editor.formats.bold.isActive() ? { color: '#b5e5a4' } : { color: '#fff' }} className={s.item}>

      </span>
    </button>

\

I see there is an option to use chosen editor.formats.bold.toggle() and in other examples also some chosen editor.formats options. I would like to add a completely new custom format -> I would like to add a button around highligted text and add a custom id for that button based on some custom logic. Is this possible to extend and write custom formats for my highlighted text?

Proposed Solution

No proposed solution, it is more of a question

Screenshots

No response

Do you want to work on this issue?

No

If "yes" to the above, please explain how you would technically implement this (issue will not be assigned if this is skipped)

No response

Darginec05 commented 1 week ago

Hey @BartoszGl 👋 I prepared example how to create custom mark

Let me know if it helped you

BartoszGl commented 1 week ago

Hello @Darginec05 excellent, thanks a lot!

Darginec05 commented 1 week ago

@BartoszGl with love from open-source 💙