Opened 7 years ago

Closed 7 years ago

#6687 closed Bug (fixed)

empty tag should be removed on inline-style format

Reported by: yiminghe Owned by: Garry Yao
Priority: Low Milestone: CKEditor 3.5.1
Component: Core : Styles Version: 3.4.2
Keywords: Cc:

Description

example:

<span style='font-size:28px;'>^测试$</span>

indicates start selection position and $ indicates end selection position.

when apply inline-style format such as change to 48px , now the code generated is (use firebug pls)

{{{
<span style='font-size:48px;'>测试</span>
<span style='font-size:28px;'></span>
}}}

it should be : (no empty style tag)

<span style='font-size:48px;'>测试</span>

i fix it :

in 3.4.2/_source/plugins/styles/plugin.js line 449 ,add following code :

 var validNextSilbing = includedNode.getNext(function(node) {
                                return !node.getAttribute || !node.getAttribute("_cke_bookmark");
                            });
                            while ( !validNextSilbing
                                && ( parentNode = includedNode.getParent(), dtd[ parentNode.getName() ] )
                                && ( parentNode.getPosition( firstNode ) | CKEDITOR.POSITION_FOLLOWING | CKEDITOR.POSITION_IDENTICAL | CKEDITOR.POSITION_IS_CONTAINED ) == ( CKEDITOR.POSITION_FOLLOWING + CKEDITOR.POSITION_IDENTICAL + CKEDITOR.POSITION_IS_CONTAINED )
                                && ( !def.childRule || def.childRule( parentNode ) ) )
                            {
                                includedNode = parentNode;
                            }

in summary ,we should ignore bookmark and include parent node in style range.

Attachments (2)

inline-style.png (4.1 KB) - added by yiminghe 7 years ago.
incorrect code generated
6687.patch (1.6 KB) - added by Garry Yao 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by yiminghe

Attachment: inline-style.png added

incorrect code generated

comment:1 Changed 7 years ago by yiminghe

'' indicates start selection position and '$' indicates end selection position.

comment:2 Changed 7 years ago by Garry Yao

Keywords: inline style format removed
Milestone: CKEditor 3.5.1
Priority: NormalLow
Status: newconfirmed

Yet another bookmark sucker, having no impacts on WYSYWIG, mark as low-pri, though requires a fix, thanks yiminghe.

Changed 7 years ago by Garry Yao

Attachment: 6687.patch added

comment:3 Changed 7 years ago by Garry Yao

Owner: set to Garry Yao
Status: confirmedreview

comment:4 Changed 7 years ago by Tobiasz Cudnik

Status: reviewreview_passed

comment:5 Changed 7 years ago by Garry Yao

Resolution: fixed
Status: review_passedclosed

Fixed with [6275].

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