[cell | ...
+ if ( this.startContainer.type == CKEDITOR.NODE_ELEMENT && this.startContainer.getName() in nonCells
+ || this.endContainer.type == CKEDITOR.NODE_ELEMENT && this.endContainer.getName() in nonCells )
+ {
+ this.shrink( CKEDITOR.NODE_ELEMENT, true );
+ }
+
+ var bookmark = this.createBookmark();
+
+ // Create marker tags for the start and end boundaries.
+ var startNode = bookmark.startNode;
+
+ var endNode;
+ if ( !collapsed )
+ endNode = bookmark.endNode;
+
+ // Create the main range which will be used for the selection.
+ var ieRange = this.document.$.body.createTextRange();
+
+ // Position the range at the start boundary.
+ ieRange.moveToElementText( startNode.$ );
+ ieRange.moveStart( 'character', 1 );
+
+ if ( endNode )
+ {
+ // Create a tool range for the end.
+ var ieRangeEnd = this.document.$.body.createTextRange();
+
+ // Position the tool range at the end.
+ ieRangeEnd.moveToElementText( endNode.$ );
+
+ // Move the end boundary of the main range to match the tool range.
+ ieRange.setEndPoint( 'EndToEnd', ieRangeEnd );
+ ieRange.moveEnd( 'character', -1 );
+ }
+ else
+ {
+ // The isStartMarkerAlone logic comes from V2. It guarantees that the lines
+ // will expand and that the cursor will be blinking on the right place.
+ // Actually, we are using this flag just to avoid using this hack in all
+ // situations, but just on those needed.
+ var next = startNode.getNext( notWhitespaces );
+ isStartMarkerAlone = ( !( next && next.getText && next.getText().match( fillerTextRegex ) ) // already a filler there?
+ && ( forceExpand || !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) ) ) );
+
+ // Append a temporary before the selection.
+ // This is needed to avoid IE destroying selections inside empty
+ // inline elements, like (#253).
+ // It is also needed when placing the selection right after an inline
+ // element to avoid the selection moving inside of it.
+ dummySpan = this.document.createElement( 'span' );
+ dummySpan.setHtml( '' ); // Zero Width No-Break Space (U+FEFF). See #1359.
+ dummySpan.insertBefore( startNode );
+
+ if ( isStartMarkerAlone )
+ {
+ // To expand empty blocks or line spaces after
, we need
+ // instead to have any char, which will be later deleted using the
+ // selection.
+ // \ufeff = Zero Width No-Break Space (U+FEFF). (#1359)
+ this.document.createText( '\ufeff' ).insertBefore( startNode );
+ }
+ }
+
+ // Remove the markers (reset the position, because of the changes in the DOM tree).
+ this.setStartBefore( startNode );
+ startNode.remove();
+
+ if ( collapsed )
+ {
+ if ( isStartMarkerAlone )
+ {
+ // Move the selection start to include the temporary \ufeff.
+ ieRange.moveStart( 'character', -1 );
+
+ ieRange.select();
+
+ // Remove our temporary stuff.
+ this.document.$.selection.clear();
+ }
+ else
+ ieRange.select();
+
+ this.moveToPosition( dummySpan, CKEDITOR.POSITION_BEFORE_START );
+ dummySpan.remove();
+ }
+ else
+ {
+ this.setEndBefore( endNode );
+ endNode.remove();
ieRange.select();
-
- // Remove our temporary stuff.
- this.document.$.selection.clear();
- }
- else
- ieRange.select();
-
- this.moveToPosition( dummySpan, CKEDITOR.POSITION_BEFORE_START );
- dummySpan.remove();
- }
- else
- {
- this.setEndBefore( endNode );
- endNode.remove();
- ieRange.select();
- }
-
- this.document.fire( 'selectionchange' );
- }
- :
- function()
- {
- var startContainer = this.startContainer;
-
- // If we have a collapsed range, inside an empty element, we must add
- // something to it, otherwise the caret will not be visible.
- if ( this.collapsed && startContainer.type == CKEDITOR.NODE_ELEMENT && !startContainer.getChildCount() )
- startContainer.append( new CKEDITOR.dom.text( '' ) );
-
- var nativeRange = this.document.$.createRange();
- nativeRange.setStart( startContainer.$, this.startOffset );
-
- try
- {
- nativeRange.setEnd( this.endContainer.$, this.endOffset );
- }
- catch ( e )
- {
- // There is a bug in Firefox implementation (it would be too easy
- // otherwise). The new start can't be after the end (W3C says it can).
- // So, let's create a new range and collapse it to the desired point.
- if ( e.toString().indexOf( 'NS_ERROR_ILLEGAL_VALUE' ) >= 0 )
- {
- this.collapse( true );
+ }
+
+ this.document.fire( 'selectionchange' );
+ }
+ :
+ function()
+ {
+ var startContainer = this.startContainer;
+
+ // If we have a collapsed range, inside an empty element, we must add
+ // something to it, otherwise the caret will not be visible.
+ if ( this.collapsed && startContainer.type == CKEDITOR.NODE_ELEMENT && !startContainer.getChildCount() )
+ startContainer.append( new CKEDITOR.dom.text( '' ) );
+
+ var nativeRange = this.document.$.createRange();
+ nativeRange.setStart( startContainer.$, this.startOffset );
+
+ try
+ {
nativeRange.setEnd( this.endContainer.$, this.endOffset );
}
- else
- throw( e );
- }
-
- var selection = this.document.getSelection().getNative();
- selection.removeAllRanges();
- selection.addRange( nativeRange );
- };
+ catch ( e )
+ {
+ // There is a bug in Firefox implementation (it would be too easy
+ // otherwise). The new start can't be after the end (W3C says it can).
+ // So, let's create a new range and collapse it to the desired point.
+ if ( e.toString().indexOf( 'NS_ERROR_ILLEGAL_VALUE' ) >= 0 )
+ {
+ this.collapse( true );
+ nativeRange.setEnd( this.endContainer.$, this.endOffset );
+ }
+ else
+ throw( e );
+ }
+
+ var selection = this.document.getSelection().getNative();
+ selection.removeAllRanges();
+ selection.addRange( nativeRange );
+ };
} )();
Index: /CKEditor/branches/versions/3.4.x/_source/plugins/styles/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.4.x/_source/plugins/styles/plugin.js (revision 5655)
+++ /CKEditor/branches/versions/3.4.x/_source/plugins/styles/plugin.js (revision 5656)
@@ -1,3 +1,3 @@
-/*
+/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -61,5 +61,5 @@
// Save the current state, so it can be compared next
// time.
- callback.state !== currentState;
+ callback.state = currentState;
}
}
@@ -67,5 +67,5 @@
}
- // Save the callback info, so it can be checked on the next occurence of
+ // Save the callback info, so it can be checked on the next occurrence of
// selectionChange.
styleStateChangeCallbacks.push( { style : style, fn : callback } );
@@ -181,4 +181,8 @@
},
+ /**
+ * Whether this style can be applied at the element path.
+ * @param elementPath
+ */
checkApplicable : function( elementPath )
{
@@ -223,4 +227,6 @@
var elementAttr = element.getAttribute( attName ) || '';
+
+ // Special treatment for 'style' attribute is required.
if ( attName == 'style' ?
compareCssText( attribs[ attName ], normalizeCssText( elementAttr, false ) )
@@ -769,4 +775,5 @@
}
+ var nonWhitespaces = CKEDITOR.dom.walker.whitespaces( true );
/**
* Merge a block with a previous sibling if available.
@@ -775,5 +782,5 @@
{
var previousBlock;
- if ( !( ( previousBlock = preBlock.getPreviousSourceNode( true, CKEDITOR.NODE_ELEMENT ) )
+ if ( !( ( previousBlock = preBlock.getPrevious( nonWhitespaces ) )
&& previousBlock.is
&& previousBlock.is( 'pre') ) )
@@ -1199,4 +1206,5 @@
}
+ // Make the comparison of attribute value easier by standardizing it.
function normalizeProperty( name, value, isStyle )
{
@@ -1206,4 +1214,5 @@
}
+ // Make the comparison of style text easier by standardizing it.
function normalizeCssText( unparsedCssText, nativeNormalize )
{
@@ -1241,4 +1250,10 @@
}
+ /**
+ * Compare two bunch of styles, with the speciality that value 'inherit'
+ * is treated as a wildcard which will match any value.
+ * @param {Object|String} source
+ * @param {Object|String} target
+ */
function compareCssText( source, target )
{
@@ -1247,6 +1262,4 @@
for( var name in source )
{
- // Value 'inherit' is treated as a wildcard,
- // which will match any value.
if ( !( name in target &&
( target[ name ] == source[ name ]
Index: /CKEditor/branches/versions/3.4.x/_source/plugins/wsc/dialogs/wsc.css
===================================================================
--- /CKEditor/branches/versions/3.4.x/_source/plugins/wsc/dialogs/wsc.css (revision 5655)
+++ /CKEditor/branches/versions/3.4.x/_source/plugins/wsc/dialogs/wsc.css (revision 5656)
@@ -71,5 +71,4 @@
border-bottom: #d5d59d 1px solid;
cursor: pointer;
- cursor: hand;
}
Index: /CKEditor/branches/versions/3.4.x/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.4.x/_source/plugins/wysiwygarea/plugin.js (revision 5655)
+++ /CKEditor/branches/versions/3.4.x/_source/plugins/wysiwygarea/plugin.js (revision 5656)
@@ -15,5 +15,5 @@
// Matching an empty paragraph at the end of document.
- var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
+ var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center|li)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
function onInsertHtml( evt )
@@ -443,4 +443,24 @@
if ( control.is( 'img', 'hr', 'input', 'textarea', 'select' ) )
editor.getSelection().selectElement( control );
+ } );
+ }
+
+ if ( CKEDITOR.env.gecko )
+ {
+ domDocument.on( 'mouseup', function( ev )
+ {
+ if ( ev.data.$.button == 2 )
+ {
+ var target = ev.data.getTarget();
+
+ // Prevent right click from selecting an empty block even
+ // when selection is anchored inside it. (#5845)
+ if ( !target.getOuterHtml().replace( emptyParagraphRegexp, '' ) )
+ {
+ var range = new CKEDITOR.dom.range( domDocument );
+ range.moveToElementEditStart( target );
+ range.select( true );
+ }
+ }
} );
}
Index: /CKEditor/branches/versions/3.4.x/_source/skins/kama/dialog.css
===================================================================
--- /CKEditor/branches/versions/3.4.x/_source/skins/kama/dialog.css (revision 5655)
+++ /CKEditor/branches/versions/3.4.x/_source/skins/kama/dialog.css (revision 5656)
@@ -677,5 +677,4 @@
border: outset 1px;
cursor: pointer;
- cursor: hand;
}
@@ -742,5 +741,4 @@
{
cursor: pointer;
- cursor: hand;
}
@@ -775,5 +773,4 @@
display: inline;
cursor: pointer;
- cursor: hand;
font-weight: bold;
position: relative;
Index: /CKEditor/branches/versions/3.4.x/_source/skins/office2003/dialog.css
===================================================================
--- /CKEditor/branches/versions/3.4.x/_source/skins/office2003/dialog.css (revision 5655)
+++ /CKEditor/branches/versions/3.4.x/_source/skins/office2003/dialog.css (revision 5656)
@@ -608,5 +608,4 @@
border: outset 1px;
cursor: pointer;
- cursor: hand;
}
@@ -673,5 +672,4 @@
{
cursor: pointer;
- cursor: hand;
}
@@ -705,5 +703,4 @@
display: inline;
cursor: pointer;
- cursor: hand;
font-weight: bold;
position: relative;
Index: /CKEditor/branches/versions/3.4.x/_source/skins/v2/dialog.css
===================================================================
--- /CKEditor/branches/versions/3.4.x/_source/skins/v2/dialog.css (revision 5655)
+++ /CKEditor/branches/versions/3.4.x/_source/skins/v2/dialog.css (revision 5656)
@@ -610,5 +610,4 @@
border: outset 1px;
cursor: pointer;
- cursor: hand;
}
@@ -675,5 +674,4 @@
{
cursor: pointer;
- cursor: hand;
}
@@ -707,5 +705,4 @@
display: inline;
cursor: pointer;
- cursor: hand;
font-weight: bold;
position: relative;