Opened 9 years ago
Last modified 9 years ago
#14529 confirmed Bug
Applying Styles can sometimes break existing content (especially widgets)
Reported by: | Chris | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Styles | Version: | |
Keywords: | Cc: |
Description
Note: This is more prevalent when using BR as the enter mode and not using automatic paragraphs, which is our preferred configuration.
Steps to reproduce
- In the config, set enter mode to BR and automatic paragraph off
- In any container's editable portion (I am using a widget that emulates a bootstrap panel.) add some text, maybe even 2 lines
- using the styles dropdown, select 'Heading 2' to convert the text to an H2
Expected result
Selected text would be wrapped with an H2
Actual result
The container div gets converted to an H2 and any attributes are applied. This is what is breaking the widget editable portion.
Other details (browser, OS, CKEditor version, installed plugins)
using widget and some custom plugins that are simple bootstrap grid system and panels.
See attached picture.
Attachments (2)
Change History (8)
Changed 9 years ago by
Attachment: | style changes wiget structure.png added |
---|
comment:1 Changed 9 years ago by
Keywords: | styles added; sytles removed |
---|
comment:2 Changed 9 years ago by
Keywords: | styles enter mode automatic paragraph removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Version: | 4.5.7 |
Hi,
Your sample widget doesn't work at all. It contains only a template so I can't reproduce this problem in anyway based on your attachment.
I have extended allowedContent
of the default simplebox plugin - selector: '.simplebox-content', allowedContent: 'p br ul ol li strong em h2'
but all worked as expected. I was able to enter H2 inside content area and no problem occured, even after setting enterMode : CKEDITOR.ENTER_BR, autoParagraph : false
.
I can see that you have inline widget as well. Please note that in case of inline widget its wrapper will most likely be the inline span. You should not insert H2
(block-content) into such widget (represented by inline element).
I'm closing this issue as invalid for now. Please provide reduced, working sample. We will validate it and consider reopening this ticket.
comment:3 Changed 9 years ago by
I've attached my custom plugin which makes a simple bootstrap panel. You should be able to follow my STR to reproduce. There shouldn't be anything special about my widget. Applying a Heading 2 to selected text in the body breaks the container. Also, once broken, if you go to source and back, that content is gone.
comment:4 Changed 9 years ago by
Thank you for the code. Yes, you are right, the content editable for the widget is not protected and one block element like H2
can replace another block element like div
. This is in fact how CKEditor works by default, one block element replaces another, but the main problem is that this div
is content editable so the behaviour is not desired in such case.
From what I have checked there are two culprits: config.enterMode = CKEDITOR.ENTER_BR;
and config.autoParagraph = false;
Without these config options everything works as expected.
@pitchingchris please note that you are disabling autoParagraph
which is now deprecated and as mentioned in docs it should not used.
I'm not sure if this case with autoparagraph
is valid and if we will be fixing it.
@m.lewandowski could you perhaps comment on this ticket?
comment:5 Changed 9 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
#14508 was marked as duplicate.
comment:6 Changed 9 years ago by
Status: | reopened → confirmed |
---|
Yes, I can confirm that this should not happen. Wrapper should not be touched by this UC. Potential problem could be in the iterator, but it's just a blind guess.
screenshot of style issues