Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
ckeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vanilla ckeditor-3.6.6
[ckeditor.git]
/
_source
/
plugins
/
stylescombo
/
plugin.js
diff --git
a/_source/plugins/stylescombo/plugin.js
b/_source/plugins/stylescombo/plugin.js
index
8ed7f9b
..
b693ada
100644
(file)
--- a/
_source/plugins/stylescombo/plugin.js
+++ b/
_source/plugins/stylescombo/plugin.js
@@
-1,5
+1,5
@@
/*
\r
/*
\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
\r
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
*/
\r
\r
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
*/
\r
\r
@@
-14,7
+14,8
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
var config = editor.config,
\r
lang = editor.lang.stylesCombo,
\r
styles = {},
\r
var config = editor.config,
\r
lang = editor.lang.stylesCombo,
\r
styles = {},
\r
- stylesList = [];
\r
+ stylesList = [],
\r
+ combo;
\r
\r
function loadStylesSet( callback )
\r
{
\r
\r
function loadStylesSet( callback )
\r
{
\r
@@
-26,7
+27,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
styleName;
\r
\r
// Put all styles into an Array.
\r
styleName;
\r
\r
// Put all styles into an Array.
\r
- for ( var i = 0 ; i < stylesDefinitions.length ; i++ )
\r
+ for ( var i = 0, count = stylesDefinitions.length ; i < count ; i++ )
\r
{
\r
var styleDefinition = stylesDefinitions[ i ];
\r
\r
{
\r
var styleDefinition = stylesDefinitions[ i ];
\r
\r
@@
-34,6
+35,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
style = styles[ styleName ] = new CKEDITOR.style( styleDefinition );
\r
style._name = styleName;
\r
\r
style = styles[ styleName ] = new CKEDITOR.style( styleDefinition );
\r
style._name = styleName;
\r
+ style._.enterMode = config.enterMode;
\r
\r
stylesList.push( style );
\r
}
\r
\r
stylesList.push( style );
\r
}
\r
@@
-61,21
+63,24
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
init : function()
\r
{
\r
\r
init : function()
\r
{
\r
- var combo = this;
\r
+ combo = this;
\r
\r
loadStylesSet( function()
\r
{
\r
\r
loadStylesSet( function()
\r
{
\r
- var style, styleName;
\r
+ var style,
\r
+ styleName,
\r
+ lastType,
\r
+ type,
\r
+ i,
\r
+ count;
\r
\r
// Loop over the Array, adding all items to the
\r
// combo.
\r
\r
// Loop over the Array, adding all items to the
\r
// combo.
\r
- var lastType;
\r
- for ( var i = 0 ; i < stylesList.length ; i++ )
\r
+ for ( i = 0, count = stylesList.length ; i < count ; i++ )
\r
{
\r
style = stylesList[ i ];
\r
styleName = style._name;
\r
{
\r
style = stylesList[ i ];
\r
styleName = style._name;
\r
-
\r
- var type = style.type;
\r
+ type = style.type;
\r
\r
if ( type != lastType )
\r
{
\r
\r
if ( type != lastType )
\r
{
\r
@@
-91,7
+96,6
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
combo.commit();
\r
\r
\r
combo.commit();
\r
\r
- combo.onOpen();
\r
});
\r
},
\r
\r
});
\r
},
\r
\r
@@
-101,14
+105,10
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
editor.fire( 'saveSnapshot' );
\r
\r
var style = styles[ value ],
\r
editor.fire( 'saveSnapshot' );
\r
\r
var style = styles[ value ],
\r
- selection = editor.getSelection();
\r
-
\r
- var elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() );
\r
+ selection = editor.getSelection(),
\r
+ elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() );
\r
\r
\r
- if ( style.type == CKEDITOR.STYLE_INLINE && style.checkActive( elementPath ) )
\r
- style.remove( editor.document );
\r
- else
\r
- style.apply( editor.document );
\r
+ style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document );
\r
\r
editor.fire( 'saveSnapshot' );
\r
},
\r
\r
editor.fire( 'saveSnapshot' );
\r
},
\r
@@
-117,13
+117,12
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
{
\r
editor.on( 'selectionChange', function( ev )
\r
{
\r
{
\r
editor.on( 'selectionChange', function( ev )
\r
{
\r
- var currentValue = this.getValue();
\r
-
\r
- var elementPath = ev.data.path,
\r
+ var currentValue = this.getValue(),
\r
+ elementPath = ev.data.path,
\r
elements = elementPath.elements;
\r
\r
// For each element into the elements path.
\r
elements = elementPath.elements;
\r
\r
// For each element into the elements path.
\r
- for ( var i = 0, element ; i < elements.length ; i++ )
\r
+ for ( var i = 0, count = elements.length, element ; i < count ; i++ )
\r
{
\r
element = elements[i];
\r
\r
{
\r
element = elements[i];
\r
\r
@@
-151,12
+150,11
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
if ( CKEDITOR.env.ie || CKEDITOR.env.webkit )
\r
editor.focus();
\r
\r
if ( CKEDITOR.env.ie || CKEDITOR.env.webkit )
\r
editor.focus();
\r
\r
- var selection = editor.getSelection();
\r
+ var selection = editor.getSelection(),
\r
+ element = selection.getSelectedElement(),
\r
+ elementPath = new CKEDITOR.dom.elementPath( element || selection.getStartElement() ),
\r
+ counter = [ 0, 0, 0, 0 ];
\r
\r
\r
- var element = selection.getSelectedElement(),
\r
- elementPath = new CKEDITOR.dom.elementPath( element || selection.getStartElement() );
\r
-
\r
- var counter = [ 0, 0, 0, 0 ];
\r
this.showAll();
\r
this.unmarkAll();
\r
for ( var name in styles )
\r
this.showAll();
\r
this.unmarkAll();
\r
for ( var name in styles )
\r
@@
-183,6
+181,22
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
if ( !counter[ CKEDITOR.STYLE_OBJECT ] )
\r
this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_OBJECT ) ] );
\r
\r
if ( !counter[ CKEDITOR.STYLE_OBJECT ] )
\r
this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_OBJECT ) ] );
\r
+ },
\r
+
\r
+ // Force a reload of the data
\r
+ reset: function()
\r
+ {
\r
+ if ( combo )
\r
+ {
\r
+ delete combo._.panel;
\r
+ delete combo._.list;
\r
+ combo._.committed = 0;
\r
+ combo._.items = {};
\r
+ combo._.state = CKEDITOR.TRISTATE_OFF;
\r
+ }
\r
+ styles = {};
\r
+ stylesList = [];
\r
+ loadStylesSet();
\r
}
\r
});
\r
\r
}
\r
});
\r
\r