aboutsummaryrefslogtreecommitdiff
path: root/sources/core/filter.js
diff options
context:
space:
mode:
Diffstat (limited to 'sources/core/filter.js')
-rw-r--r--sources/core/filter.js37
1 files changed, 32 insertions, 5 deletions
diff --git a/sources/core/filter.js b/sources/core/filter.js
index db68530..3e64fc5 100644
--- a/sources/core/filter.js
+++ b/sources/core/filter.js
@@ -158,7 +158,8 @@
158 }, 158 },
159 // Object: element name => array of transformations groups. 159 // Object: element name => array of transformations groups.
160 transformations: {}, 160 transformations: {},
161 cachedTests: {} 161 cachedTests: {},
162 cachedChecks: {}
162 }; 163 };
163 164
164 // Register filter instance. 165 // Register filter instance.
@@ -299,7 +300,7 @@
299 if ( el.attributes[ 'data-cke-filter' ] == 'off' ) 300 if ( el.attributes[ 'data-cke-filter' ] == 'off' )
300 return false; 301 return false;
301 302
302 // (#10260) Don't touch elements like spans with data-cke-* attribute since they're 303 // (http://dev.ckeditor.com/ticket/10260) Don't touch elements like spans with data-cke-* attribute since they're
303 // responsible e.g. for placing markers, bookmarks, odds and stuff. 304 // responsible e.g. for placing markers, bookmarks, odds and stuff.
304 // We love 'em and we don't wanna lose anything during the filtering. 305 // We love 'em and we don't wanna lose anything during the filtering.
305 // '|' is to avoid tricky joints like data-="foo" + cke-="bar". Yes, they're possible. 306 // '|' is to avoid tricky joints like data-="foo" + cke-="bar". Yes, they're possible.
@@ -346,7 +347,7 @@
346 if ( !element.parent ) 347 if ( !element.parent )
347 continue; 348 continue;
348 349
349 // Handle custom elements as inline elements (#12683). 350 // Handle custom elements as inline elements (http://dev.ckeditor.com/ticket/12683).
350 parentDtd = DTD[ element.parent.name ] || DTD.span; 351 parentDtd = DTD[ element.parent.name ] || DTD.span;
351 352
352 switch ( check.check ) { 353 switch ( check.check ) {
@@ -806,6 +807,32 @@
806 } )(), 807 } )(),
807 808
808 /** 809 /**
810 * Returns a clone of this filter instance.
811 *
812 * @since 4.7.3
813 * @returns {CKEDITOR.filter}
814 */
815 clone: function() {
816 var ret = new CKEDITOR.filter(),
817 clone = CKEDITOR.tools.clone;
818
819 // Cloning allowed content related things.
820 ret.allowedContent = clone( this.allowedContent );
821 ret._.allowedRules = clone( this._.allowedRules );
822
823 // Disallowed content rules.
824 ret.disallowedContent = clone( this.disallowedContent );
825 ret._.disallowedRules = clone( this._.disallowedRules );
826
827 ret._.transformations = clone( this._.transformations );
828
829 ret.disabled = this.disabled;
830 ret.editor = this.editor;
831
832 return ret;
833 },
834
835 /**
809 * Destroys the filter instance and removes it from the global {@link CKEDITOR.filter#instances} object. 836 * Destroys the filter instance and removes it from the global {@link CKEDITOR.filter#instances} object.
810 * 837 *
811 * @since 4.4.5 838 * @since 4.4.5
@@ -2201,7 +2228,7 @@
2201 var widths = element.styles.margin.match( /(\-?[\.\d]+\w+)/g ) || [ '0px' ]; 2228 var widths = element.styles.margin.match( /(\-?[\.\d]+\w+)/g ) || [ '0px' ];
2202 switch ( widths.length ) { 2229 switch ( widths.length ) {
2203 case 1: 2230 case 1:
2204 element.styles.margin = widths[0]; 2231 mapStyles( [ 0, 0, 0, 0 ] );
2205 break; 2232 break;
2206 case 2: 2233 case 2:
2207 mapStyles( [ 0, 1, 0, 1 ] ); 2234 mapStyles( [ 0, 1, 0, 1 ] );
@@ -2291,7 +2318,7 @@
2291 * * {@link CKEDITOR.filter.allowedContentRules} – defined rules will be added 2318 * * {@link CKEDITOR.filter.allowedContentRules} – defined rules will be added
2292 * to the {@link CKEDITOR.editor#filter}. 2319 * to the {@link CKEDITOR.editor#filter}.
2293 * * `true` – will disable the filter (data will not be filtered, 2320 * * `true` – will disable the filter (data will not be filtered,
2294 * all features will be activated). 2321 * all features will be activated). Reading [security best practices](#!/guide/dev_best_practices) before setting `true` is recommended.
2295 * * default – the filter will be configured by loaded features 2322 * * default – the filter will be configured by loaded features
2296 * (toolbar items, commands, etc.). 2323 * (toolbar items, commands, etc.).
2297 * 2324 *