-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inner <p> on the element even if MediumEditor is applied to a text element #829
Comments
@brunomperes is there a reason why you wouldn't want to start with a <div class="editor"><p>Lorem ipsum dolor sit amet consectetur.</p></div> where the |
Actually, yes. There are two unwanted behaviours (not sure if contenteditable's or editor's):
<div class="editor"><p>Lorem ipsum dolor sit amet consectetur.</p><i class="fa fa-gear"></i><i class="fa fa-trash"></div> To: <div class="editor"><p>Lorem ipsum dolor sit amet consectetur.</p></div>
<div class="editor"><h2></h2></div> Click to edit and delete, it changes to: <div class="editor"><p></p></div> So I noticed that when I applied medium-editor activation to the inner tag ( |
1), what are you trying to achieve with the
<div class="editor"><h2><br/></h2></div> That should prevent the editor from converting it to a |
Thanks for the reply @nmielnik
|
On a side note, I've noticed a third behaviour, but it isn't fixed by the initial approach (which started this issue): <div class="editor"><h2>Lorem ipsum</h2></div> Then click at the end of the text, and press return, it creates a <div class="editor"><h2>Lorem ipsum</h2><p>asdfadf</p></div> Is there a way that it uses the same tag on that |
For 1), I would recommend try using absolutely positioned elements, or pseudo-elements to get those icons in there, I think it will be a struggle to have them as actual elements inside the editor element.
If possible, it might be worth trying out some of this stuff with version 5.0 and see if any of these issues might be resolved. I'm not sure if they would, but it could be worth investigating. |
Version: 4.12.11
I am calling MediumEditor to this element:
But after any key press, the element is transformed into:
Same happens to h1 - h6.
The behaviour is probably caused because of this line. Which causes to call formatBlock, if node has no children.
Since I haven't seen any recommendation to only apply the Editor to wrapping divs, my guess is that it is not an expected behaviour.
I'm thinking that a verification before formatting the block to add a
<p>
inside should fix it.Something like:
I'd be happy to send a PR if the solution seems sufficient.
The text was updated successfully, but these errors were encountered: