Skip to content
Permalink
Browse files

Merge branch 't/9507'

  • Loading branch information...
oleq committed Feb 19, 2013
2 parents db1bfe8 + aaeb6ab commit d904beb99e1ea2119f2d114ca0ebbb507964498b
Showing with 28 additions and 14 deletions.
  1. +1 −0 CHANGES.md
  2. +26 −13 core/selection.js
  3. +1 −1 plugins/dialog/plugin.js
@@ -17,6 +17,7 @@ CKEditor 4 Changelog
* [#9883](http://dev.ckeditor.com/ticket/9883): Maximizing was making the entire page editable with divarea based editors.
* [#9940](http://dev.ckeditor.com/ticket/9940): With Firefox, navigating back to a page with the editor was making the entire page editable.
* [#9966](http://dev.ckeditor.com/ticket/9966): Fixed: Unable to type square brackets with French keyboard layout. Changed magicline keystrokes.
* [#9507](http://dev.ckeditor.com/ticket/9507): [Firefox] Selection is moved before editable position when editor focused for the first time.

## CKEditor 4.0.1

@@ -196,18 +196,36 @@

var isInline = editable.isInline();

var restoreSel;

// Give the editable an initial selection on first focus,
// put selection at a consistent position at the start
// of the contents. (#5156)
editable.attachListener( editable, 'focus', function( evt ) {
evt.removeListener();

if ( restoreSel !== 0 ) {
var rng = editor.createRange();
rng.moveToElementEditStart( editable );
rng.select();
}
}, null, null, -2 );

// Plays the magic here to restore/save dom selection on editable focus/blur.
editable.attachListener( editable, 'focus', function() {
editor.unlockSelection( restoreSel );
restoreSel = 0;
}, null, null, -1 );

// Disable selection restoring when clicking in.
editable.attachListener( editable, 'mousedown', function() {
restoreSel = 0;
});

// Browsers could loose the selection once the editable lost focus,
// in such case we need to reproduce it by saving a locked selection
// and restoring it upon focus gain.
if ( CKEDITOR.env.ie || CKEDITOR.env.opera || isInline ) {
var restoreSel;

// Plays the magic here to restore/save dom selection on editable focus/blur.
editable.attachListener( editable, 'focus', function() {
editor.unlockSelection( restoreSel );
restoreSel = 0;
}, null, null, -1 );

var lastSel;
// Save a fresh copy of the selection.
function saveSel() {
@@ -226,11 +244,6 @@
editor.lockSelection( lastSel );
restoreSel = 1;
}, null, null, -1 );

// Disable selection restoring when clicking in.
editable.attachListener( editable, 'mousedown', function() {
restoreSel = 0;
});
}

// The following selection related fixes applies to only framed editable.
@@ -2813,7 +2813,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
// undo support should dedicate to specific dialog implementation.
canUndo: false,

editorFocus: CKEDITOR.env.ie || CKEDITOR.env.webkit
editorFocus: 1
};

(function() {

0 comments on commit d904beb

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.