Opened 13 years ago

Closed 11 years ago

Last modified 7 years ago

#7961 closed Bug (duplicate)

html5 block-level link

Reported by: Garry Yao Owned by:
Priority: Normal Milestone:
Component: Core : Parser Version:
Keywords: HTML5 Cc:

Description

  1. Load the editor with the following content:
    <a><p>linked paragraph</p></a>
    
  • Actual Result: Link is inlined.
    <p><a></a></p>
    <p><a>linked paragraph</a></p>
    

Change History (13)

comment:1 Changed 13 years ago by Frederico Caldeira Knabben

Keywords: Discussion added

First of all, we must understand whether we want to support transparent elements. It may add some good level of complexity to our code, with no clear benefits (especially considering that such kinds of links can't be created with the editor).

We definitely should not have an empty <p><a></a></p> being appended, but that's another issue.

comment:2 Changed 13 years ago by Wiktor Walc

Recent complaint from user after noticing that CKEditor is destroying the source code. Sample code provided by user:

<a href="page:68994">
<div class="fader">
<img src="/file/XR3tIW8/1.jpg" alt="Accessories" />
<div>
<img src="/file/XR3tIW8/2.jpg" alt="Accessories" />
</div>
<span class="catName">Accessories</span>
</div>
</a>

and the (unexpected) result:

<a href="page:68983"> </a>
<div class="fader">
<a href="page:68983"><img alt="Lighting" src="/file/XR3tIW8/1.jpg" /> </a>
<div>
<a href="page:68983"><img alt="Lighting" src="/file/XR3tIW8/2.jpg" /> </a></div>
<a href="page:68983"><span class="catName">Lighting</span> </a>
</div>

When using custom CSS styles such a modification may totally change the way how page is rendered.

"especially considering that such kinds of links can't be created with the editor"

We have to also keep in mind that certain part of users is looking for a replacement for their current editor. For them editing an existing content coming from other sources is also an important feature.

comment:3 Changed 12 years ago by Jakub Ś

Status: newconfirmed
Version: 3.6.1

As describe here http://dev.w3.org/html5/spec/text-level-semantics.html#the-a-element HTML5 allows for block level links.

Perhaps it's worth considering this in the future.

comment:4 Changed 12 years ago by Jakub Ś

Feature request #8442 is a duplicate of this issue.

comment:5 Changed 12 years ago by Jakub Ś

Keywords: HTML5 added

comment:6 Changed 12 years ago by Jakub Ś

Keywords: Discussion removed

comment:7 Changed 11 years ago by Eric Heydenberk

Has there been any progress on this change? This can be particularly destructive for users editing content that may be styled by selectors that assume the elements are in their original order. Would it be difficult to simply add an option to disable this feature?

comment:8 Changed 11 years ago by Piotrek Koszuliński

Resolution: duplicate
Status: confirmedclosed

Nope, unfortunately no. As I explained in your pull request this thing is complex and requires a lot of changes. It would be similarly time-consuming to extract "fix structure" feature from parser to be able to switch it off.

BTW. There's more general ticket for this issue - #9457. Let's continue this thread there.

comment:9 Changed 8 years ago by Tim Bessie

I also have a need for things like this - block-level elements nested within inline elements, custom attributes, etc. (luckily the custom attributes don't appear to be messed with).

We were using GWT's RichTextEditor for an HTML component, and want to switch to CKEditor. However, CKEditor ALWAYS "corrects" our HTML, whereas RichTextEditor only does it if the browser itself does it. It appears that CKEditor is doing this itself, as when I load these "invalid" HTML snippets into any browser as-is, it is not "corrected".

Why can't CKEditor leave my HTML alone? I'm inserted HTML snippets into a document using the insertHtml() method, and it's appearing rearranged and "fixed", which is not what I want.

comment:10 Changed 8 years ago by Jakub Ś

Block-level links are not possible at the moment. It is also not possible to have span wrapping divs or paragraphs. In that second case, this is invalid HTML and fixing this is implemented into core so there is no way to disable it.

Many of the tags/attributes/styles/classes however depend on ACF. This is a configurable filter which allows you having defined set of tags/attributes/styles/classes used in editor. You could disable it but a much better idea is configure ACF so that it fits your needs. To learn more about ACF, please see:
http://docs.ckeditor.com/#!/guide/dev_acf
http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
http://docs.ckeditor.com/#!/guide/dev_disallowed_content
http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addTransformations
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraAllowedContent

comment:11 Changed 8 years ago by Tim Bessie

Well, I tried the method described elsewhere of modifying the CKEditor DTD to allow it, and that worked, so it IS possible.

comment:12 Changed 7 years ago by joepkes

We are having same issue. Do you have a link to method and what you changed?

comment:13 in reply to:  12 Changed 7 years ago by Tim Bessie

Replying to joepkes:

We are having same issue. Do you have a link to method and what you changed?

Yes - when CKEditor is attached (we're using the inline editor, but it probably should work for the regular version), among other things we have this bit, for the particular non-standard HTML we're using. It says "ul, ol and table elements can exist within span elements":

$wnd.CKEDITOR.dtd.span.ul = 1;
$wnd.CKEDITOR.dtd.span.ol = 1;
$wnd.CKEDITOR.dtd.span.table = 1;
Last edited 7 years ago by Tim Bessie (previous) (diff)
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