Strange behavior of the defaultAlignment setting in the TextAlign extension #3459
Closed
1 of 2 tasks
Labels
Type: Bug
The issue or pullrequest is related to a bug
What’s the bug you are facing?
First off thank you to the development team and community for this great tool. So far it has been just what I needed and I am hopeful that it will be a long-term solution for me!
With the TextAlign extension enabled, I have a Tiptap editor element for which
element.style.textAlign == ""
. However, it inherits atextAlign
value, which can be accessed throughwindow.getComputedStyle(element).textAlign
. On loading, the Tiptap editor uses the inheritedtextAlign
value rather than the default value assigned through the extension using thedefaultAlignment
setting.Then, the editor allows you to change the text alignment as expected, unless you try to change it to the value set in
defaultAlignment
. In that case, it changes the alignment to the inherited/computed value.Which browser was this experienced in? Are any special extensions installed?
How can we reproduce the bug on our side?
The issue seems to also occur when I try using the TextAlign extension in a simple webapp made with React, so as far as I can tell it will occur as long as you install the TextAlign extension. Then, you set
defaultAlignment
usingTextAlign.configure()
so that it does not match whatever the editor element's inherited/computedtextAlign
value is.Can you provide a CodeSandbox?
https://codesandbox.io/p/sandbox/wild-morning-cbyyyh?file=%2Fsrc%2FApp.js
(Not built with Svelte, but the issue persists)
What did you expect to happen?
I expect that when the Tiptap editor first loads, each node's alignment would match the value configured for
defaultAlignment
(regardless of any properties inherited by the editor element). Then, each node's alignment could be changed using buttons, keyboard shortcuts, etc.Anything to add? (optional)
Please don't hesitate to let me know if anything I've said is unclear and I'll be happy to update the post to clarify.
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: