Skip to content

Commit 85dfc91

Browse files
committed
Merge branch 't/9994' into major
2 parents 3a9b2c5 + 50d3db0 commit 85dfc91

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

core/editor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,9 @@
557557
* @param {CKEDITOR.commandDefinition} commandDefinition The command definition.
558558
*/
559559
addCommand: function( commandName, commandDefinition ) {
560-
return this.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition );
560+
commandDefinition.name = commandName.toLowerCase();
561+
var cmd = new CKEDITOR.command( this, commandDefinition );
562+
return this.commands[ commandName ] = cmd;
561563
},
562564

563565
/**

core/filter.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
this.customConfig = false;
7373

7474
// Add editor's default rules.
75-
this.allow( 'p br', 1 );
76-
this.allow( allowedContent, 1 );
77-
this.allow( editor.config.extraAllowedContent, 1 );
75+
this.allow( 'p br', 'default', 1 );
76+
this.allow( allowedContent, 'config', 1 );
77+
this.allow( editor.config.extraAllowedContent, 'extra', 1 );
7878

7979
//
8080
// Add filter listeners to toHTML and toDataFormat events.
@@ -97,7 +97,7 @@
9797
// Rules object passed in editorOrRules argument - initialize standalone filter.
9898
else {
9999
this.customConfig = false;
100-
this.allow( editorOrRules, 1 );
100+
this.allow( editorOrRules, 'default', 1 );
101101
}
102102
};
103103

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

@@ -133,7 +134,7 @@
133134
newRules = convertStyleToRules( newRules );
134135
else if ( CKEDITOR.tools.isArray( newRules ) ) {
135136
for ( i = 0; i < newRules.length; ++i )
136-
ret = this.allow( newRules[ i ], overrideCustom );
137+
ret = this.allow( newRules[ i ], featureName, overrideCustom );
137138
return ret; // Return last status.
138139
}
139140

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

160+
if ( featureName )
161+
rule.featureName = featureName.toLowerCase();
162+
159163
// Save rule and remember to optimize it.
160164
this.allowedContent.push( rule );
161165
rulesToOptimize.push( rule );
@@ -297,6 +301,7 @@
297301
* @param feature.allowedContent HTML that can be generated by this feature.
298302
* @param feature.requiredContent Minimal HTML that this feature must be allowed to
299303
* generate for it to be able to function at all.
304+
* @param {String} feature.name Name of this feature.
300305
* @returns {Boolean} Whether this feature can be enabled.
301306
*/
302307
addFeature: function( feature ) {
@@ -313,7 +318,7 @@
313318

314319
// If default configuration (will be checked inside #allow()),
315320
// then add allowed content rules.
316-
this.allow( feature.allowedContent );
321+
this.allow( feature.allowedContent, feature.name );
317322

318323
this.addTransformations( feature.contentTransformations );
319324
this.addContentForms( feature.contentForms );

plugins/liststyle/plugin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@
1111
if ( editor.blockless )
1212
return;
1313

14-
var cmd = new CKEDITOR.dialogCommand( 'numberedListStyle', {
14+
var def, cmd;
15+
16+
def = new CKEDITOR.dialogCommand( 'numberedListStyle', {
1517
requiredContent: 'ol',
1618
allowedContent: 'ol{list-style-type}[start]'
1719
} );
18-
editor.addCommand( 'numberedListStyle', cmd );
20+
cmd = editor.addCommand( 'numberedListStyle', def );
1921
editor.addFeature( cmd );
2022
CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );
2123

22-
cmd = new CKEDITOR.dialogCommand( 'bulletedListStyle', {
24+
def = new CKEDITOR.dialogCommand( 'bulletedListStyle', {
2325
requiredContent: 'ul',
2426
allowedContent: 'ul{list-style-type}'
2527
} );
26-
editor.addCommand( 'bulletedListStyle', cmd );
28+
cmd = editor.addCommand( 'bulletedListStyle', def );
2729
editor.addFeature( cmd );
2830
CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );
2931

plugins/tabletools/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@
679679
}
680680
});
681681
}
682-
function addCmd( name, cmd ) {
683-
editor.addCommand( name, cmd );
682+
function addCmd( name, def ) {
683+
var cmd = editor.addCommand( name, def );
684684
editor.addFeature( cmd );
685685
}
686686

0 commit comments

Comments
 (0)