Opened 12 years ago
Closed 12 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.
Change History (7)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
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:4 Changed 12 years ago by
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.
comment:5 Changed 12 years ago by
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 12 years ago by
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 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
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.
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.