Opened 15 years ago

Last modified 13 years ago

#2589 confirmed Bug

changing style when typing text works incorrectly

Reported by: Irina Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.0
Keywords: HasPatch Cc: irina.dinarieva@…

Description

Start typing some text in demo. Switch to some style that is actually span (Marker-green for one), type more, switch to Marker-yellow, type more, switch to Marker-green again - type and see that text continue to be yellow. So we can't swith to the first applied style when continue typing.

Change History (6)

comment:1 Changed 15 years ago by Artur Formella

Keywords: Confirmed added
Version: FCKeditor 2.5 Beta

Confirmed in IE7 and FF3

comment:2 Changed 15 years ago by Irina

Want to note that on safari such changing of styles or even swithching to bold/italic while typing doesn't wark at all. But it seems to be another bug

comment:3 Changed 15 years ago by Irina

Cc: irina.dinarieva@… added

comment:4 Changed 15 years ago by Irina

FYI. For myself I did some crude fixes. In my case I only have paragraph and span css styles and bold/itaic and I want span styles not merged but separated so for me works the following code (ff, ie):

_ApplyInlineStyle : function( range, selectIt, updateRange ) {

var doc = range.Window.document ; if ( range.CheckIsCollapsed() ) {

Create the element to be inserted in the DOM. var collapsedElement = this.BuildElement( doc ) ;

/ by Irina D In case we are going to insert a span find out if the range is inside of another span and move it outside if yes. We switch off possible bold/italic in this case but it is not so bad as inner spans for me if (range.StartContainer.parentNode) {

if (collapsedElement.tagName == "SPAN") {

range.StartContainer.nodeName - points to #text node in ff and to its parent element in ie var parentEl; if (range.StartContainer.nodeType == 3) { text node

probably mozilla parentEl = range.StartContainer.parentNode;

} else {

probably ie parentEl = range.StartContainer;

} if (parentEl.tagName != "P" && parentEl.tagName != "BODY") {

probably we are inside of span alert(range.CheckEndOfBlock()); if (range.CheckEndOfBlock()) {

cursor is not inside of text but we are just typing in the end of line for (;;) {

we can be inside of bold/italic and that can be inside of span so find that possible parent span. if (!parentEl) break;

if (parentEl.tagName == "P"
parentEl.tagName == "SPAN"
parentEl.tagName == "BODY") break;

parentEl = parentEl.parentNode;

} if (parentEl) if (parentEl.tagName == "SPAN") {

if we found out that we are inside of span and that new element is span too then we should start our new span outside previous one range.SetStart(parentEl, 4);

}

}

}

}

} / end by Irina D range.InsertNode( collapsedElement ) ;

range.MoveToPosition( collapsedElement, 2 ) ; range.Select() ;

return ;

}

Version 0, edited 15 years ago by Irina (next)

comment:5 Changed 13 years ago by Krzysztof Studnik

Component: GeneralCore : Styles
Version: FCKeditor 2.5 Beta3.0

Confirmed in 3.6.2Trunk
Selecting styles as follows

  • select marker yellow, type "test" (text has yellow background)
  • select marker green, type "test" (text has green background)
  • select marker yellow, type "test" (text still has green background)
  • select marker yellow again, type "test" (background is switched to yellow)

comment:6 Changed 13 years ago by Krzysztof Studnik

Keywords: HasPatch added
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