You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm relatively new to Re-mirror, but I've went through the docs several times now.
I want to have a "Insert Link" button, where the user might write some text, highlight it, then clicks on this "Insert Link" button, & I'll open a modal with 2 text fields, URL & Text.
Ideally, I want to pre-fill these 2 inputs with whatever the user was highlighting when he clicked the button.
In my "Insert Link" component, here is the code I have currently, which works fine except for the part I mentioned above.
constcommands=useCommands();constonModalSubmit=useCallback(({ href, text })=>{commands.insertMarkdown(`[${text}](${href})`)},[commands])constonClick=()=>{openInsertLinkModal({prefillText: ????})}
So is there some hook or helper function that I can call in the onClick handler before opening the modal to get the currently highlighted text (if any)???
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
I'm relatively new to Re-mirror, but I've went through the docs several times now.
I want to have a "Insert Link" button, where the user might write some text, highlight it, then clicks on this "Insert Link" button, & I'll open a modal with 2 text fields, URL & Text.
Ideally, I want to pre-fill these 2 inputs with whatever the user was highlighting when he clicked the button.
In my "Insert Link" component, here is the code I have currently, which works fine except for the part I mentioned above.
So is there some hook or helper function that I can call in the
onClick
handler before opening the modal to get the currently highlighted text (if any)???Thanks.
Beta Was this translation helpful? Give feedback.
All reactions