#9753 closed Bug (invalid)
The pre button of CKEditor 3.6.2 adds extra new lines
Reported by: | vijendra | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.0 |
Keywords: | Cc: | vijendra.1007@… |
Description
The pre button of CKEditor 3.6.2 ASP.Net, adds extra new lines.
To reproduce this issue type following "test Test Test Test"
Then select the text and click the pre button of ckeditor. The editor adds extra lines. When you hit the Source button to check whats happening inside You will find that, the editor converts each of <p> and </p> with \n. I letter changed the default enterline mode from P to BR. But then hitting the pre button caused the entire text and not just the selected text, to get wrapped inside the PRE tag. I configured the editor by writting writer rule for BR tag to not add new line before and after the beggining and end of BR tag. And also configured the editor to use self eding tag for BR so as to generate <BR/> tag.
Attachments (4)
Change History (25)
comment:1 Changed 12 years ago by
comment:2 follow-up: 3 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Please upgrade to latest CKEditor for ASP.NET as this issue doesn't occur there.
comment:3 Changed 12 years ago by
Version: | 3.6.2 → 4.0 |
---|
No, the issue occur in new version of CKEditor as well Try these steps:
- Go here http://ckeditor.com/demo
- Copy following text and paste it in CKEditor
"test1
Test2
Test3
Test4"
- Then select only 3rd and 4th line and click PRE
- You can see that the entire text gets wrapped inside PRE
Replying to j.swiderski:
Please upgrade to latest CKEditor for ASP.NET as this issue doesn't occur there.
Changed 12 years ago by
Attachment: | ScreenHunter_02 Dec. 03 19.48.gif added |
---|
comment:4 Changed 12 years ago by
- Which Browser are you talking about?
- What do you mean by "entire text gets wrapped inside PRE". Only text in selection gets wrapped in pre but this is correct behaviour.
comment:6 follow-up: 7 Changed 12 years ago by
I have but it doesn't tell me which browser do you use and I don't see whole text getting wrapped to pre. All I see is -
Only text in selection gets wrapped in pre but this is correct behaviour.
Perhaps you might want to give me more detailes?
comment:7 Changed 12 years ago by
It is reproduciable in all browser. Do follwing steps.
- Go to ckeditor demo page.
- Copy below text and paste into ckeditor.
"test1
test2
test3
test4"
- Now select the 3rd and 4th line "test3 and test4" and from the format dropdown select Formatted option. It will not only wrap "test3 and test4" but "test1 and test2" as well inside PRE tag.
If you still didnt understood. Then do following.
- Set the EnterMode to BR or DIV.
- Type Test then press enter, again type test and press enter. Do this few more time. It will create few lines each having only one word Test. Select few lines from it.
- Select the Formatted option from Format dropdown. It will wrap all the lines in PRE .
If you still didnt understood the issue then i will attach video tomorrow please check that.
'Replying to j.swiderski:
I have but it doesn't tell me which browser do you use and I don't see whole text getting wrapped to pre. All I see is -
Only text in selection gets wrapped in pre but this is correct behaviour.
Perhaps you might want to give me more detailes?
comment:8 follow-up: 9 Changed 12 years ago by
I have tried in BR, DIV and P mode and none of this resulted in error.
I'm attaching the screen cast for you to see. Test case seems easy and yet we get different results. What have I missed?
Changed 12 years ago by
Attachment: | 2012-12-03_2235.swf added |
---|
Changed 12 years ago by
Attachment: | PRE wrapping all text.swf added |
---|
Changed 12 years ago by
Attachment: | PRE wrapping all text.2.swf added |
---|
comment:9 Changed 12 years ago by
I have added the video please check. I am using IE10. The behavior is same on Chrome and FF as well. You can reproduce the issue by following below steps:
- Go to CKEditor Demo page.
- Copy below text (don't type, just copy) and paste it into CKEditor
"test1
test2
test3
test4"
- Now select the last line.
- Then select the formatted option from the Format dropdown.
Please see the attached video file. https://dev.ckeditor.com/attachment/ticket/9753/PRE%20wrapping%20all%20text.swf
comment:9 Changed 12 years ago by
I have added the video please check. I am using IE10. The behavior is same on Chrome and FF as well. You can reproduce the issue by following below steps:
- Go to CKEditor Demo page.
- Copy below text (don't type, just copy) and paste it into CKEditor
"test1
test2
test3
test4"
- Now select the last line.
- Then select the formatted option from the Format dropdown.
Please see the attached video file. https://dev.ckeditor.com/attachment/ticket/9753/PRE%20wrapping%20all%20text.swf
comment:9 Changed 12 years ago by
I have added the video please check. I am using IE10. The behavior is same on Chrome and FF as well. You can reproduce the issue by following below steps:
- Go to CKEditor Demo page.
- Copy below text (don't type, just copy) and paste it into CKEditor
"test1
test2
test3
test4"
- Now select the last line.
- Then select the formatted option from the Format dropdown.
Please see the attached video file. https://dev.ckeditor.com/attachment/ticket/9753/PRE%20wrapping%20all%20text.swf
Replying to j.swiderski:
I have tried in BR, DIV and P mode and none of this resulted in error.
I'm attaching the screen cast for you to see. Test case seems easy and yet we get different results. What have I missed?
comment:10 Changed 12 years ago by
Not it is clear but the issue is still invalid.
When you paste text like this from notepad it gets pasted as single p (One enter from notepad gets changed to br. Two enters from notepad get changed to p - this was unified in CKEditor 4). Single P as you probably know is in HTML5 flow element (referred in HTML4 as Block-level element). Element Pre is the same - flow/block.
Editor works like that by design - block/flow element replaces whole block/flow element, not just selection. Replacing selection works with phrasing/inline elements.
comment:11 Changed 12 years ago by
Its an issue for all those normal users who paste text thousands of times directly from email, notepad, Edit++ etc. to the CKeditor and apply the Format option over few of the selected text. We cant expect that the normal user has knowledge of HTML5 flow elements or how the Editor works.
Unbelievable that despite of showing the issue, still its been closed as Not a Bug.
Also, not all editors works this way, please verify the same behavior here http://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx .
comment:12 follow-up: 13 Changed 12 years ago by
You can get the same in CKEditor just go to enter mode BR sample - http://ckeditor.com/demo#enter
Paste contents from notepad, select only last "test" and change it to PRE - it will work the same. All you need to do is change enter mode to BR.
comment:13 Changed 12 years ago by
So does that mean I should use the non recomended setting just because the recomended setting has issues? Why cant we fix the issue rather?
Replying to j.swiderski:
You can get the same in CKEditor just go to enter mode BR sample - http://ckeditor.com/demo#enter
Paste contents from notepad, select only last "test" and change it to PRE - it will work the same. All you need to do is change enter mode to BR.
comment:14 Changed 12 years ago by
Why cant we fix the issue rather?
Because as I have explained this is by design. This is how CKEditor works. One block-level element is replaced with other.
comment:15 Changed 12 years ago by
Ok so can we assume this is a product limitation and can we have it documented somewhere in the ckeditor wiki? For normal user they dont have knowledge about what is an flow element or how the editor works.
So I would like to have this limitation documented in wiki or we should make the BR Enter mode as the standard enter mode.
comment:16 follow-up: 17 Changed 12 years ago by
This is not a product limitation. This is designed this way and this requires from the user just the basic knowledge about text editing in any of the professional well known editors like MS Word or Libre Office.
There are block styles and inline styles. Block styles are always applied to entire blocks, not to the selected lines only. This is how CKEditor, MS Word and Libre Office work.
Keep in mind that in enterMode=P users will create <br>
intentionally, so mostly - in special cases, because it's natural to press enter only. So your case with "a<br>b<br>c..."
is just wrong, because that doesn't happen in "nature".
comment:17 Changed 12 years ago by
Consider this case now. I select few text and hit the B button, this will make the selected text to apear in bold. Now when I do same thing but in this case hit Formatted option from format dropdown it wraps the entire content within PRE tag and not just the selected text. Isnt this sound confusing to the normal user. I have asked few other people and they to thought this as a bug in CKEditor, the reason is simple they expected ONLY the selected text to get wrapped inside PRE not the entire text. If you can fix this then its ok. But for normal users this looks like a bug.
Replying to Reinmar:
This is not a product limitation. This is designed this way and this requires from the user just the basic knowledge about text editing in any of the professional well known editors like MS Word or Libre Office.
There are block styles and inline styles. Block styles are always applied to entire blocks, not to the selected lines only. This is how CKEditor, MS Word and Libre Office work.
Keep in mind that in enterMode=P users will create
<br>
intentionally, so mostly - in special cases, because it's natural to press enter only. So your case with"a<br>b<br>c..."
is just wrong, because that doesn't happen in "nature".
comment:18 Changed 12 years ago by
We've been discussing this issue in the team.
While MS Word makes it possible to have selected words styled like blocks (e.g. headers), we have to take in consideration that it is a desktop application that is not made to deal with HTML and the web. It's made for printing. So, it's environment is much more flexible, giving the possibility for users to mess up their documents that way.
With HTML instead, we can't simply put a block element, like <h1> or <pre> in the middle of the text. The only option we would have is breaking the paragraph in 3 parts (before, selection and after), creating 3 separate blocks. But then this would be also an ugly and unnexpected behavior.
So, considering that no other option is available, the current solution is the most adequate we can provide.
comment:19 Changed 12 years ago by
Component: | Server : ASP.Net → General |
---|
The pre button of CKEditor 3.6.2 ASP.Net, adds extra new lines.
To reproduce this issue type following "test
Test
Test
Test"
Then select the text and click the pre button of ckeditor. The editor adds extra lines. When you hit the Source button to check whats happening inside You will find that, the editor converts each of <p> and </p> with \n. I letter changed the default enterline mode from P to BR. But then hitting the pre button caused the entire text and not just the selected text, to get wrapped inside the PRE tag. I configured the editor by writting writer rule for BR tag to not add new line before and after the beggining and end of BR tag. And also configured the editor to use self eding tag for BR so as to generate <BR/> tag.