]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blobdiff - sources/core/filter.js
Update to 4.7.3
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / core / filter.js
index db68530edf3cdfca21f8c5c3498f498527a2aac9..3e64fc5b0dbb4f6d164c089708d44c49f34eff11 100644 (file)
                        },
                        // Object: element name => array of transformations groups.
                        transformations: {},
-                       cachedTests: {}
+                       cachedTests: {},
+                       cachedChecks: {}
                };
 
                // Register filter instance.
                                        if ( el.attributes[ 'data-cke-filter' ] == 'off' )
                                                return false;
 
-                                       // (#10260) Don't touch elements like spans with data-cke-* attribute since they're
+                                       // (http://dev.ckeditor.com/ticket/10260) Don't touch elements like spans with data-cke-* attribute since they're
                                        // responsible e.g. for placing markers, bookmarks, odds and stuff.
                                        // We love 'em and we don't wanna lose anything during the filtering.
                                        // '|' is to avoid tricky joints like data-="foo" + cke-="bar". Yes, they're possible.
                                if ( !element.parent )
                                        continue;
 
-                               // Handle custom elements as inline elements (#12683).
+                               // Handle custom elements as inline elements (http://dev.ckeditor.com/ticket/12683).
                                parentDtd = DTD[ element.parent.name ] || DTD.span;
 
                                switch ( check.check ) {
                        };
                } )(),
 
+               /**
+                * Returns a clone of this filter instance.
+                *
+                * @since 4.7.3
+                * @returns {CKEDITOR.filter}
+                */
+               clone: function() {
+                       var ret = new CKEDITOR.filter(),
+                               clone = CKEDITOR.tools.clone;
+
+                       // Cloning allowed content related things.
+                       ret.allowedContent = clone( this.allowedContent );
+                       ret._.allowedRules = clone( this._.allowedRules );
+
+                       // Disallowed content rules.
+                       ret.disallowedContent = clone( this.disallowedContent );
+                       ret._.disallowedRules = clone( this._.disallowedRules );
+
+                       ret._.transformations = clone( this._.transformations );
+
+                       ret.disabled = this.disabled;
+                       ret.editor = this.editor;
+
+                       return ret;
+               },
+
                /**
                 * Destroys the filter instance and removes it from the global {@link CKEDITOR.filter#instances} object.
                 *
                        var widths = element.styles.margin.match( /(\-?[\.\d]+\w+)/g ) || [ '0px' ];
                        switch ( widths.length ) {
                                case 1:
-                                       element.styles.margin = widths[0];
+                                       mapStyles( [ 0, 0, 0, 0 ] );
                                        break;
                                case 2:
                                        mapStyles( [ 0, 1, 0, 1 ] );
  *     * {@link CKEDITOR.filter.allowedContentRules} – defined rules will be added
  *     to the {@link CKEDITOR.editor#filter}.
  *     * `true` – will disable the filter (data will not be filtered,
- *     all features will be activated).
+ *     all features will be activated). Reading [security best practices](#!/guide/dev_best_practices) before setting `true` is recommended.
  *     * default – the filter will be configured by loaded features
  *     (toolbar items, commands, etc.).
  *