Skip to content

Commit

Permalink
Merge branch 't/11297' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Apr 8, 2014
2 parents 1cb18c5 + b82ce65 commit 721055c
Show file tree
Hide file tree
Showing 15 changed files with 1,056 additions and 193 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Expand Up @@ -9,6 +9,7 @@ CKEditor 4 Changelog
* 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.
* 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.
* [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)).
* 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.

New Features:

Expand All @@ -30,6 +31,11 @@ New Features:
If defined, the editor produces classes instead of inline styles for aligned images.
* Default caption of the image can be translated (customized) with `editor.lang.image2.captionPlaceholder`.
* [#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.
* [#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:
* Introduced [`CKEDITOR.style.addCustomHandler`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-static-method-addCustomHandler) method for registering custom style handlers.
* 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.
* 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).
* 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).

Fixed Issues:

Expand Down
8 changes: 6 additions & 2 deletions core/filter.js
Expand Up @@ -228,9 +228,13 @@

if ( typeof newRules == 'string' )
newRules = parseRulesString( newRules );
else if ( newRules instanceof CKEDITOR.style )
else if ( newRules instanceof CKEDITOR.style ) {
// If style has the cast method defined, use it and abort.
if ( newRules.toAllowedContentRules )
return this.allow( newRules.toAllowedContentRules( this.editor ), featureName, overrideCustom );

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

0 comments on commit 721055c

Please sign in to comment.