Open yuvalkarmi opened 4 weeks ago
Chiming in here to answer my own question (@amirhhashemi it may still be worth it to add to the documentation):
The plugin works fine in the sense that it adds the dir
attribute to the node.
However, the actual custom component implementation must utilize this (duh, in retrospect 🤦♀️):
So in my AlertComponent, I added direction: node.attrs.dir
to the element styles (I use material UI, so for me I use sx
, like this, but obviously set styles as you would for your UI library):
<Box sx={{
direction: node.attrs.dir
}}
<NodeViewContent />
</Box>
Hey @amirhhashemi thanks so much for making this.
For some reason, this isn't working on my custom components. For instance, I have this
Alert
node:My actual alert component uses
<NodeViewContent />
for the rendering.I also made sure to include
alert
it when initializing the plugin:Despite this, the text direction does not apply. I'm sure I'm missing something in the implementation.
Could you please shed a bit of light on how to implement the plugin in custom components?
Thanks! Yuval