Ticket #1033 (closed Bug: fixed)

Opened 16 months ago

Last modified 16 months ago

Unable to apply formatting to selection

Reported by: jonhg Owned by: martinkou
Priority: High Milestone: FCKeditor 2.5 Beta
Component: General Version: SVN
Keywords: Confirmed IE Cc:

Description

Whenever I have selected a text and tries to apply a formatting (bold/italic/font etc) the selection is collapsed and the formatting is not applied to the selected text.

Verfied with IE7 in nightly build.

Change History

Changed 16 months ago by jonhg

Sorry about the missing word in the heading, should be: Unable to apply formatting to selection.

Also I noticed that if you have no selection and the cursor is inside a word the current word is formatted.

Changed 16 months ago by fredck

  • owner set to martinkou
  • summary changed from Unable to formatting to selection to Unable to apply formatting to selection
  • version set to SVN
  • milestone set to FCKeditor 2.5

I have the impression that the selection is being lost when saving the undo snapshot, resulting in a collapsed selection.

Changed 16 months ago by fredck

  • keywords Confirmed IE added

Changed 16 months ago by martinkou

I've tried disabling the save snapshot logic and the bug still occurred. A lot of strange bugs have been discovered regarding selections in IE recently.

This bug could be related to #1034, and perhaps #1026 and #1005 as well.

Changed 16 months ago by jonhg

I've found the problem, we introduced the bug with the "kludge" in #141 with [608], we need to make sure that the range/position is only set at startup.

Changed 16 months ago by fredck

Confirmed. I had the same findings here. The buggy point is FCK.Focus() as it make changes to the selection.

Most probably, the code added with [608] should move outside the Focus() function, to the point where the StartupFocus is executed.

Changed 16 months ago by jonhg

Yes, it seems to working ok, both correct position after startup and no more collapsing selections if

var range = FCK.EditorDocument.selection.createRange() ; range.moveEnd( "character", 1 ) ; range.select() ; range.collapse( true ) ; range.select() ;

is moved to FCK.SetStaus

Changed 16 months ago by martinkou

  • status changed from new to closed
  • resolution set to fixed

It works wonderfully, thanks a lot.

I've committed the suggested fix as [620].

Changed 16 months ago by martinkou

  • status changed from closed to reopened
  • resolution fixed deleted

Oh, no, it's not fixed yet. There's still one more problem in IE:

  1. Open sample01.html.
  2. Copy some text from notepad or whatever source you like.
  3. Press the "Source" button twice.
  4. The cursor should be inside the editing area.
  5. Press Ctrl-V.
  6. Nothing is pasted.
  7. Click on the editing area.
  8. Paste operation successful.

So the bug from #141 is back with this fix.

Changed 16 months ago by jonhg

I guess that means we have to reopen #141 and close this one :)

Changed 16 months ago by martinkou

  • status changed from reopened to closed
  • resolution set to fixed

Fixed with [621].

I've moved the kludge code into FCKEditingArea.prototype.MakeEditable(), and now it works fine for all test cases that I have.

Changed 16 months ago by fredck

After further analysis, we found out that the kludge must be inside Focus() to make it work on all cases. I've made a small change to it with [623] which seams to be ok with this ticket too, so it should be the definitive solution for #141 and this one.

Note: See TracTickets for help on using tickets.