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
{{ message }}
Repository navigation
Add built-in support for converting "->" to "→" #915
There's not a good way to do this directly from the BlockNote API atm unfortunately, but should be quite easy with a TipTap extension. You can then pass your extension to the _tiptapOptions editor option:
import { Extension } from '@tiptap/core'
const ArrowConversion = Extension.create({
name: 'arrowConversion',
addInputRules() {
return [
{
find: /->/g,
handler: ({ state, range }) => {
const { from, to } = range
const tr = state.tr.replaceWith(from, to, state.schema.text('→'))
return tr
},
},
]
},
})
export default ArrowConversion
I noticed that you used this code in the pull request. However, I encountered some editing errors when using it, specifically when adding spaces between words or inserting special characters. If you could create a pull request with an example of how to use the Tiptap extension, please ensure that the logic is thoroughly checked.
I used the code snippet above in _tiptapOptions and encountered an error when adding a space to a word, or when modifying a character. It gets replaced by an arrow. When I tested it, there was no issue, but the tester reported this error when it was moved to production.
Activity
matthewlipski commentedon Jul 16, 2024
There's not a good way to do this directly from the BlockNote API atm unfortunately, but should be quite easy with a TipTap extension. You can then pass your extension to the
_tiptapOptionseditor option:lamtuanamc commentedon Jul 25, 2024
ok thanks, i got it
YousefED commentedon Jul 29, 2024
I think this would be a great example on how to use tiptap extensions with blocknote.
/bounty 10
algora-pbc commentedon Jul 29, 2024
## 💎 $10 bounty • BlockNote💎 $10 bounty • divyasingh0803
Steps to solve:
/attempt #915with your implementation plan/claim #915in the PR body to claim the bountyThank you for contributing to TypeCellOS/BlockNote!
Add a bounty • Share on socials
k0msenapati commentedon Jul 30, 2024
/attempt #915
Options
algora-pbc commentedon Jul 30, 2024
💡 @kom-senapati submitted a pull request that claims the bounty. You can visit your bounty board to reward.
lamtuanamc commentedon Jul 30, 2024
I noticed that you used this code in the pull request. However, I encountered some editing errors when using it, specifically when adding spaces between words or inserting special characters. If you could create a pull request with an example of how to use the Tiptap extension, please ensure that the logic is thoroughly checked.
@kom-senapati
k0msenapati commentedon Jul 30, 2024
Can you tell me what editing errors you got?
k0msenapati commentedon Jul 30, 2024
The extension is added to Blocknote, it works in playground.
lamtuanamc commentedon Jul 30, 2024
I used the code snippet above in _tiptapOptions and encountered an error when adding a space to a word, or when modifying a character. It gets replaced by an arrow. When I tested it, there was no issue, but the tester reported this error when it was moved to production.
cl1.mov
cl2.mov
k0msenapati commentedon Jul 30, 2024
No such issues for me I just tried out
30_7_2024.6_51_21.pm.-.Screen.-.Untitled.video.webm
docs: added example custom tiptap extension (arrow conversion) (#971)
algora-pbc commentedon Jul 31, 2024
🎉🎈 @kom-senapati has been awarded $10! 🎈🎊