Skip to content

Commit 721055c

Browse files
committed
Merge branch 't/11297' into major
2 parents 1cb18c5 + b82ce65 commit 721055c

File tree

15 files changed

+1056
-193
lines changed

15 files changed

+1056
-193
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CKEditor 4 Changelog
99
* Default class of captioned image has changed to _"image"_ (was: _"caption"_). Please note that once edited in CKEditor 4.4+, all existing images of the _"caption"_ class (`<figure class="caption">`) will be [filtered out](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) unless [`config.image2_captionedClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-image2_captionedClass) option is set to _"caption"_. For backward compatibility (i.e. when upgrading), it is highly recommended to do so, to also prevent CSS conflicts, etc.. This does not apply to new CKEditor integrations.
1010
* Widgets without defined buttons are not registered automatically to the ACF any more. Before CKEditor 4.4 widgets were registered to the ACF what was an incorrect behavior ([#11567](http://dev.ckeditor.com/ticket/11567)). This change should not have any impact on standard scenarios, but if your button does not execute widget command you have to set [`allowedContent`](http://docs.ckeditor.com/#!/api/CKEDITOR.feature-property-allowedContent) and [`requiredContent`](http://docs.ckeditor.com/#!/api/CKEDITOR.feature-property-requiredContent) properties on it manually, because editor will not be able to find them.
1111
* [Showborders](http://ckeditor.com/addon/showborders) plugin was added to the Standard package in order to ensure that unstyled tables are still visible for user ([#11665](http://dev.ckeditor.com/ticket/11665)).
12+
* Since CKEditor 4.4 the editor instance should be passed to [`CKEDITOR.style`](http://docs.ckeditor.com/#!/api/CKEDITOR.style) methods to ensure full compatibility (e.g. applying styles to widgets requires that). We ensured backward compatibility though, so the [`CKEDITOR.style`](http://docs.ckeditor.com/#!/api/CKEDITOR.style) will work even when editor instance is not provided.
1213

1314
New Features:
1415

@@ -30,6 +31,11 @@ New Features:
3031
If defined, the editor produces classes instead of inline styles for aligned images.
3132
* Default caption of the image can be translated (customized) with `editor.lang.image2.captionPlaceholder`.
3233
* [#11341](http://dev.ckeditor.com/ticket/11341): [Enhanced Image](http://ckeditor.com/addon/image2) plugin: it's now possible to link any kind of an image.
34+
* [#11297](http://dev.ckeditor.com/ticket/11297): Styles can now be applied to widgets. Definition of a style which can be applied to specific widget must contain two additional properties &ndash; `type` and `widget`. Read more in the **TODO**. Note that by default widgets support only classes and no other attributes or styles. Related changes and features:
35+
* Introduced [`CKEDITOR.style.addCustomHandler`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-static-method-addCustomHandler) method for registering custom style handlers.
36+
* The [`CKEDITOR.style.apply`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-method-apply) and [`CKEDITOR.style.remove`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-method-remove) methods are now called with editor instance instead of document so they can be reused by [`CKEDITOR.editor.applyStyle`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-applyStyle) and [`CKEDITOR.editor.removeStyle`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-removeStyle) methods. Backward compatibility was preserved, but from CKEditor 4.4 it is highly recommended to pass editor instead of document to these methods.
37+
* Many new methods and properties were introduced in the [Widget API](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget) to make the way how styles are handled by widgets fully customizable. See: [`widget.definition.styleableElements`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.definition-property-styleableElements), [`widget.definition.styleToAllowedContentRule`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.definition-property-styleToAllowedContentRules), [`widget.addClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-addClass), [`widget.removeClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-removeClass) [`widget.getClasses`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-getClasses), [`widget.hasClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-hasClass), [`widget.applyStyle`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-applyStyle), [`widget.removeStyle`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-removeStyle), [`widget.checkStyleActive`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-checkStyleActive).
38+
* Integration with the [Allowed Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) required a [CKEDITOR.style.toAllowedContent](http://docs.ckeditor.com/#!/api/CKEDITOR.style-method-toAllowedContentRules) method which can be implemented by custom style handler and if exists is used by the [`CKEDITOR.filter`](http://docs.ckeditor.com/#!/api/CKEDITOR.filter) to translate a style to [allowed content rules](http://docs.ckeditor.com/#!/api/CKEDITOR.filter.allowedContentRules).
3339

3440
Fixed Issues:
3541

core/filter.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,13 @@
228228

229229
if ( typeof newRules == 'string' )
230230
newRules = parseRulesString( newRules );
231-
else if ( newRules instanceof CKEDITOR.style )
231+
else if ( newRules instanceof CKEDITOR.style ) {
232+
// If style has the cast method defined, use it and abort.
233+
if ( newRules.toAllowedContentRules )
234+
return this.allow( newRules.toAllowedContentRules( this.editor ), featureName, overrideCustom );
235+
232236
newRules = convertStyleToRules( newRules );
233-
else if ( CKEDITOR.tools.isArray( newRules ) ) {
237+
} else if ( CKEDITOR.tools.isArray( newRules ) ) {
234238
for ( i = 0; i < newRules.length; ++i )
235239
ret = this.allow( newRules[ i ], featureName, overrideCustom );
236240
return ret; // Return last status.

0 commit comments

Comments
 (0)