Opened 14 years ago

Closed 11 years ago

#5309 closed New Feature (fixed)

Context sensitive insertHtml

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

Description (last modified by Garry Yao)

We've seen various paste problems caused by our current implementation of CKEDITOR.editor::insertHtml, now rely on browsers' native API, which is buggy and inconsistent.
While we do have other options here: The idea is to implement an DTD aware, context sensitive insertion based on CKEDITOR.htmlParser' and 'CKEDITOR.editor::insertElement', this should be able to extinguish all weird bugs around.

Related tickets are:

#5696
IE : Cursor moves to the start of paragraph in the Pasted Text

#5367
Implement editor.insertText and use it in the special chars dialog

#5536
Problems with pasting (executing insertHtml) and formatted text

#5170
Problems with pasting (executing insertHtml) and formatted text

#5033
Invalid behavior when inserting nested divs with insertHtml()

#4898
Paste: After pasting a table from word it is not possible to navigate outside the table

#4746
insertHtml left trim text

#3105
insertHtml and insertElement should agree on the result

#2781
FckEditor InsertHtml inserts extra <p> tags

#2749
InsertHtml() is inconsistent between IE 7 and Firefox 2

#2526
InsertHTML Problem

#503
Unordered list paste: doesn't work correctly in IE

Attachments (6)

5309.patch (15.4 KB) - added by Garry Yao 14 years ago.
5309_2.patch (15.9 KB) - added by Garry Yao 14 years ago.
5309_3.patch (16.5 KB) - added by Sa'ar Zac Elias 14 years ago.
Align the outdated patch
5309_4.patch (16.4 KB) - added by Garry Yao 14 years ago.
5309_5.patch (20.6 KB) - added by Garry Yao 13 years ago.
5309_6.patch (20.4 KB) - added by Garry Yao 13 years ago.

Download all attachments as: .zip

Change History (25)

comment:1 Changed 14 years ago by Garry Yao

Component: GeneralCore : Pasting
Description: modified (diff)

comment:2 Changed 14 years ago by Garry Yao

Description: modified (diff)

Minor adjustments.

comment:3 Changed 14 years ago by Garry Yao

Description: modified (diff)

comment:4 Changed 14 years ago by Garry Yao

By checking the insertHtml API in latest HTML5 draft, it also doesn't require a context sensitive insertion:

4. Invoke the HTML fragment parsing algorithm with an arbitrary orphan 'body' element owned by the same Document as the context element and with the value argument as input.

comment:5 Changed 14 years ago by Garry Yao

Milestone: CKEditor 3.3CKEditor 3.4

We're over burdened now so this feature will be deferred to next milestone.

Changed 14 years ago by Garry Yao

Attachment: 5309.patch added

comment:6 Changed 14 years ago by Garry Yao

Description: modified (diff)
Keywords: Confirmed Review? added; Umbrella removed
Owner: set to Garry Yao
Status: newassigned
Type: TaskNew Feature

Ported a simplified version of Firefox's nsHTMLEditor::InsertHTMLWithContext while it supposed to be browser neutral paste implementation.

comment:7 Changed 14 years ago by Garry Yao

Description: modified (diff)

Changed 14 years ago by Garry Yao

Attachment: 5309_2.patch added

comment:8 Changed 14 years ago by Garry Yao

Align the outdated patch.

comment:9 Changed 14 years ago by Wiktor Walc

Might be a duplicate of one of the tickets, but I'm adding it just to have one more test case: #5873

comment:10 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.4CKEditor 3.5

comment:11 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.4.1CKEditor 3.5

Changed 14 years ago by Sa'ar Zac Elias

Attachment: 5309_3.patch added

Align the outdated patch

Changed 14 years ago by Garry Yao

Attachment: 5309_4.patch added

comment:12 Changed 14 years ago by Garry Yao

Align outdated patch

Changed 13 years ago by Garry Yao

Attachment: 5309_5.patch added

comment:13 Changed 13 years ago by Garry Yao

New patch with some updates:

  1. Instead of using "range::extractContent" which is currently buggy when dealing with list and table selection, we now play a browser trick (insertHtml called with an empty content) to achieve the same result;
  2. Introduce a HTML parser param (clipboard) to handle the case when parsing context of the fragment is unknown, where we should not touch the white-spaces children of the fragment.

comment:14 Changed 13 years ago by Garry Yao

It looks like a huge task to make a reviewing here, so let me also propose some orders here:

  1. First we check there's no exception thrown in any case when pasting, this must be guaranteed;
  2. Then we should check paste in any case should not result in malformed structure (DTD valid);
  3. Finally it come to a case by case test with different combination of clipboard content and selection type to check the rationality of the result, in case it's amphibolous, we should allow it to be handled out of this ticket.

Changed 13 years ago by Garry Yao

Attachment: 5309_6.patch added

comment:15 Changed 13 years ago by Garry Yao

Trunk alignment.

comment:16 Changed 13 years ago by Sa'ar Zac Elias

Keywords: Confirmed removed
Status: reviewreview_failed

Please align the patch with the latest updates (data-cke attributes).

comment:17 Changed 13 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.5CKEditor 3.6

This one, other than introducing a good amount of code into core (justifiable), touches import part of it. We need a lot of attention on it and we'll not be able to safely land this on the SVN for the 3.5.

comment:18 Changed 13 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.6

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

Resolution: fixed
Status: review_failedclosed

Fixed in 4.0.

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