Opened 11 years ago

Closed 11 years ago

#9993 closed Bug (duplicate)

enterMode BR + Google Chrome doesn't close tags after linebreaks

Reported by: Max Joshua Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I found this bug using the latest version of Google Chrome on the latest build, here (enterMode = br): http://nightly.ckeditor.com/13-01-27-08-51/standard/samples/plugins/enterkey/enterkey.html

Start writing a normal phrase, than select the last word before linebreak and enable bold (or link, em, u) and press enter. Insted of closing the bold, the editor keeps it activated. The problem remains also adding other linebreaks.

http://i45.tinypic.com/11j6hef.png

Change History (7)

comment:1 Changed 11 years ago by tema

You can patch a link plugin with catching enter key, inserting span with some invisible text and then deleting it after new <br> gets created. This way link is not continued on the new line. But I suggest you to stop using BR mode because it is buggy as hell. Check DIV mode.

comment:2 Changed 11 years ago by Steffen

agentcooper, have you actually implemented your suggested fix? We have the same issue and cannot switch to "DIV mode" because that would break vBulletin.

comment:3 Changed 11 years ago by tema

I did, will post a code for you some time later today.

comment:4 Changed 11 years ago by tema

Btw, for almost transparent switching to DIV mode from BR mode you can write a rule for unwrapping every DIV, something like

'div': function(element) { delete element.name; element.append(new CKEDITOR.dom.element('br')); return element; }

Also needs a proper config with the newlines for DIVs.

If you have some user-generated divs you want to save, you can add an additional step when loading content in CKEditor, which involves adding "class='userDiv'" to every div (can be done with jQuery). Then, unwrap only div without any attributes. I hope I'm explaining correctly. I implemented this, but the code is really tied now.

Last edited 11 years ago by tema (previous) (diff)

comment:5 Changed 11 years ago by tema

Here is the direct copy from our code of the fix I wrote http://pastebin.com/XK5i2ZB2 I hope you'll manage to fit it in your code. Keep in mind that this code is used with version 3.6.2.

comment:6 Changed 11 years ago by Steffen

Thank you for the fix. However, it did not work for me in CKEditor 3.6.6. Besides the lack of a function "isInside" (which is easily solvable), calling "editor.insertHtml()" fails in my tests (it inserts the HTML code as plain text, not sure why).

But I think I have found another fix for this bug. Here is my patch for CKEditor 3.6.6:

Index: _source/plugins/enterkey/plugin.js
===================================================================
--- _source/plugins/enterkey/plugin.js
+++ _source/plugins/enterkey/plugin.js
@@ -312,6 +312,15 @@
 			else
 			{
 				var lineBreak;
+				
+				// Fix for bug #9993
+				if (isEndOfBlock && range.endContainer.getParent().is('a'))
+				{
+					var anchorNode = range.endContainer.getParent();
+					range.setStartAfter( anchorNode );
+					range.setEndAfter( anchorNode );
+					range.select();
+				}
 
 				isPre = ( startBlockTag == 'pre' );

comment:7 Changed 11 years ago by Jakub Ś

Resolution: duplicate
Status: newclosed
Version: 4.0.2 (GitHub - master)

bold (or link, em, u)

As for bold, em and u. You can toggle these buttons in CKEditor 4 which means that when you don't need bold stle anymore you disable it by clicking button on toolbar. It works like this with every inline style (like font size) with every mode. This part of ticket is invalid.

About links only. Yes, you are right this is a bug. In fact we have this already reported here: #8146. User @fbingha has applied fix to that ticket. Perhaps it will work for you. This part of ticket is a duplicate.

Duplicate of #8146.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy