Skip to content

Commit

Permalink
Merge branch 't/9994' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Feb 15, 2013
2 parents 3a9b2c5 + 50d3db0 commit 85dfc91
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
4 changes: 3 additions & 1 deletion core/editor.js
Expand Up @@ -557,7 +557,9 @@
* @param {CKEDITOR.commandDefinition} commandDefinition The command definition.
*/
addCommand: function( commandName, commandDefinition ) {
return this.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition );
commandDefinition.name = commandName.toLowerCase();
var cmd = new CKEDITOR.command( this, commandDefinition );
return this.commands[ commandName ] = cmd;
},

/**
Expand Down
19 changes: 12 additions & 7 deletions core/filter.js
Expand Up @@ -72,9 +72,9 @@
this.customConfig = false;

// Add editor's default rules.
this.allow( 'p br', 1 );
this.allow( allowedContent, 1 );
this.allow( editor.config.extraAllowedContent, 1 );
this.allow( 'p br', 'default', 1 );
this.allow( allowedContent, 'config', 1 );
this.allow( editor.config.extraAllowedContent, 'extra', 1 );

//
// Add filter listeners to toHTML and toDataFormat events.
Expand All @@ -97,7 +97,7 @@
// Rules object passed in editorOrRules argument - initialize standalone filter.
else {
this.customConfig = false;
this.allow( editorOrRules, 1 );
this.allow( editorOrRules, 'default', 1 );
}
};

Expand All @@ -106,12 +106,13 @@
* Adds specified rules to the filter.
*
* @param {Object/String/CKEDITOR.style/Object[]/String[]/CKEDITOR.style[]} newRules
* @param {String} [featureName] Name of a feature that allows this content.
* @param {Boolean} [overrideCustom] By default this method will reject any rules
* if default {@link CKEDITOR.config#allowedContent} is defined. Pass `true`
* to force rules addition.
* @returns {Boolean} Whether rules were accepted.
*/
allow: function( newRules, overrideCustom ) {
allow: function( newRules, featureName, overrideCustom ) {
if ( this.disabled )
return false;

Expand All @@ -133,7 +134,7 @@
newRules = convertStyleToRules( newRules );
else if ( CKEDITOR.tools.isArray( newRules ) ) {
for ( i = 0; i < newRules.length; ++i )
ret = this.allow( newRules[ i ], overrideCustom );
ret = this.allow( newRules[ i ], featureName, overrideCustom );
return ret; // Return last status.
}

Expand All @@ -156,6 +157,9 @@
if ( groupName.charAt( 0 ) != '$' )
rule.elements = groupName;

if ( featureName )
rule.featureName = featureName.toLowerCase();

// Save rule and remember to optimize it.
this.allowedContent.push( rule );
rulesToOptimize.push( rule );
Expand Down Expand Up @@ -297,6 +301,7 @@
* @param feature.allowedContent HTML that can be generated by this feature.
* @param feature.requiredContent Minimal HTML that this feature must be allowed to
* generate for it to be able to function at all.
* @param {String} feature.name Name of this feature.
* @returns {Boolean} Whether this feature can be enabled.
*/
addFeature: function( feature ) {
Expand All @@ -313,7 +318,7 @@

// If default configuration (will be checked inside #allow()),
// then add allowed content rules.
this.allow( feature.allowedContent );
this.allow( feature.allowedContent, feature.name );

this.addTransformations( feature.contentTransformations );
this.addContentForms( feature.contentForms );
Expand Down
10 changes: 6 additions & 4 deletions plugins/liststyle/plugin.js
Expand Up @@ -11,19 +11,21 @@
if ( editor.blockless )
return;

var cmd = new CKEDITOR.dialogCommand( 'numberedListStyle', {
var def, cmd;

def = new CKEDITOR.dialogCommand( 'numberedListStyle', {
requiredContent: 'ol',
allowedContent: 'ol{list-style-type}[start]'
} );
editor.addCommand( 'numberedListStyle', cmd );
cmd = editor.addCommand( 'numberedListStyle', def );
editor.addFeature( cmd );
CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );

cmd = new CKEDITOR.dialogCommand( 'bulletedListStyle', {
def = new CKEDITOR.dialogCommand( 'bulletedListStyle', {
requiredContent: 'ul',
allowedContent: 'ul{list-style-type}'
} );
editor.addCommand( 'bulletedListStyle', cmd );
cmd = editor.addCommand( 'bulletedListStyle', def );
editor.addFeature( cmd );
CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );

Expand Down
4 changes: 2 additions & 2 deletions plugins/tabletools/plugin.js
Expand Up @@ -679,8 +679,8 @@
}
});
}
function addCmd( name, cmd ) {
editor.addCommand( name, cmd );
function addCmd( name, def ) {
var cmd = editor.addCommand( name, def );
editor.addFeature( cmd );
}

Expand Down

0 comments on commit 85dfc91

Please sign in to comment.