Opened 10 years ago

Closed 10 years ago

#3585 closed Bug (fixed)

Inconsistent formatting of source code

Reported by: Alfonso Martínez de Lizarrondo Owned by: Garry Yao
Priority: Normal Milestone: CKEditor 3.0
Component: Core : Output Data Version: SVN (CKEditor) - OLD
Keywords: Confirmed Review+ Cc:

Description

  1. Load the Ajax example in Firefox.
  2. Switch to source mode. it shows
    <p>
    	<br />
    </p>
    
  3. Switch to design and back to source. The formatting has changed
    <p>
    	<br />
    	</p>
    

(the closing </p> now is indented)

Attachments (3)

3585.patch (2.2 KB) - added by Garry Yao 10 years ago.
3585_2.patch (2.4 KB) - added by Garry Yao 10 years ago.
3585_3.patch (1.8 KB) - added by Garry Yao 10 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 10 years ago by Garry Yao

Keywords: Confirmed added
Milestone: CKEditor 3.0
Owner: set to Garry Yao
Status: newassigned

Changed 10 years ago by Garry Yao

Attachment: 3585.patch added

comment:2 Changed 10 years ago by Garry Yao

Keywords: Review? added

The current parser already has a way of removing head spaces,now the proposed patch make the parser awareness of the tail spaces by pending each text node, both of them could guarantee that the writer won't confuse these formatting spaces with user spaces, to correctly indent the output of a element, one example: If input as:

<p>
<br />
	<p>

Basic writer normalize it into:

<p><br /><p>

Html writer format it as :

<p>
	<br />
</p>

Changed 10 years ago by Garry Yao

Attachment: 3585_2.patch added

comment:3 Changed 10 years ago by Garry Yao

Fixing a bug when there's a single text node within body.

comment:4 Changed 10 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed

We could try a simpler approach here. When closing a tag, we could simply check if its an block(like) tag, and them check if the last child of it is a text node. In that case, we simply rtrim it, and eventually remove it if it becomes empty after trimming.

This check is supposed to happen after line 249 on fragment.js (at revision 3564).

Changed 10 years ago by Garry Yao

Attachment: 3585_3.patch added

comment:5 Changed 10 years ago by Garry Yao

Keywords: Review? added; Review- removed

The new patch used an simplified way to right trim the block tail spaces, the check is happened inside addElement function to make sure it works even for the wrapper paragraph introduced by fix body.

comment:6 Changed 10 years ago by Artur Formella

Keywords: Review+ added; Review? removed

comment:7 Changed 10 years ago by Garry Yao

Resolution: fixed
Status: assignedclosed

Fixed with [3606].

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy