Block elements can't contain child block elements
|Reported by:||FredCK||Owned by:|
|Priority:||Normal||Milestone:||FCKeditor 2.5 Beta|
We must completely avoid creating block elements inside block elements. Other than being non standards compliant, it causes the code to be broken on both IE and Firefox.
The most obvious case is the <form> creation. Just try these steps in IE:
- Open sample01.html
- Hit [Enter] At the end of the fisrt line.
- Insert a form with the relative toolbar button.
- Place the cursor inside the form.
- Type some text and hit enter.
- Type more text.
- Switch to source view... the second <p> was moved to the end of the HTML.
- Switch back to WYSIWYG, and back to Source... everything has been moved out of the form.
Similar problems happen with the <hr>. So we must provide a way to break the current block when inserting new block elements. This code has been developed for the FCKEnterKey, so we could use that.
Maybe it is a good idea to change FCK.InsertElement to automatically do that job based on the input element type (block / inline).
It is important to leave to the user to move out from the new created block. For example, if we are inserting a form, we must be sure the user will be able to move after the form (another element must be there to get the cursor focus). This is most difficult when EnterMode=br... maybe a is enough in that case.