Index: /CKEditor/branches/prototype/_source/plugins/fakeobjects/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/fakeobjects/plugin.js	(revision 2904)
+++ /CKEditor/branches/prototype/_source/plugins/fakeobjects/plugin.js	(revision 2905)
@@ -27,387 +27,396 @@
 (function()
 {
+	var flashExtensionRegex = /\.swf($|#|\?)/i,
+		emptyElements = { base:1,col:1,meta:1,link:1,hr:1,br:1,param:1,img:1,area:1,input:1 },
+		makeTagOpenerHtml = function( tagName, attributes, selfClosing )
+		{
+			var attribStr = [], html = [ '<' + tagName ];
+			for ( var i in attributes )
+				attribStr.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '"');
+			if ( attribStr.length > 0 )
+				html.push( ' ', attribStr.join( ' ' ) );
+			if ( emptyElements[ tagName ] || selfClosing )
+				html.push( ' /' );
+			html.push( '>' );
+			return html.join( '' );
+		},
+		cssWidthRegex = /width\s*:\s*([0-9]+)\s*(?:[\w%]+)?\s*;?/i,
+		cssHeightRegex = /height\s*:\s*([0-9]+)\s*(?:[\w%]+)?\s*;?/i;
+
+	var copyParser = function()
+	{
+		this._ = { html : null };
+		this.output = [];
+
+		CKEDITOR.htmlParser.call( this );
+	};
+	copyParser.prototype = {
+		onTagOpen : function( tagName, attributes, selfClosing )
+		{
+			this.output.push( makeTagOpenerHtml( tagName, attributes, selfClosing ) );
+		},
+
+		onTagClose : function( tagName )
+		{
+			if ( !emptyElements[ tagName] )
+				this.output.push( '</' + tagName + '>' );
+		},
+
+		onText : function( text )
+		{
+			this.output.push( text );
+		},
+
+		onComment : function( comment )
+		{
+			this.output.push( '<!--' + comment + '-->' );
+		},
+
+		parse : function( html )
+		{
+			this._.html = html;
+			return CKEDITOR.htmlParser.prototype.parse.apply( this, arguments );
+		}
+	};
+
+	/**
+	 * Manages element placeholders in WYSIWYG area.
+	 * @constructor
+	 * @example
+	 */
+	CKEDITOR.plugins.fakeobjects = function()
+	{
+		this._ =
+		{
+			objectTypes : [
+				{
+					match : function( nodeName, attributes )
+					{
+						return nodeName == 'embed' &&
+							( attributes.type == 'application/x-shockwave-flash' || flashExtensionRegex.test( attributes.src || '' ) );
+					},
+					cssClass : 'flash',
+					priority : 10
+				},
+				{
+					match : function( nodeName, attributes )
+					{
+						return ( nodeName == 'a' && attributes.name != null && attributes.name != '' );
+					},
+					cssClass : 'anchor',
+					priority : 10
+				},
+				{
+					match : function( nodeName, attributes )
+					{
+						if ( nodeName == 'div' && attributes.style && attributes.style.pageBreakAfter == 'always' )
+							if ( attributes.firstChild )
+							{
+								var element = new CKEDITOR.dom.element( attributes.firstChild );
+								return ( element && element.getName() == 'span');
+							}
+						return false;
+					},
+					cssClass : 'pagebreak',
+					priority : 10
+				},
+				{
+					match : function( nodeName, attributes )
+					{
+						return nodeName == 'embed' || nodeName == 'object';
+					},
+					cssClass : 'object',
+					priority : 0x100000000
+				}
+			]
+		};
+	};
+	CKEDITOR.plugins.fakeobjects.prototype =
+	{
+		/**
+		 * Converts an element into a placeholder &lt;img&gt; element, for adding
+		 * into the WYSIWYG area.
+		 * @param {CKEDITOR.dom.element} element Input DOM element.
+		 * @returns {CKEDITOR.dom.element} The placeholder &lt;img&gt; element.
+		 * @example
+		 */
+		protectElement : function( element )
+		{
+			var $ = element.$.cloneNode( true ),
+				doc = $.ownerDocument,
+				temp = doc.createElement( 'div' ),
+				html;
+
+			// Get the object's HTML code.
+			temp.appendChild( $ );
+			html = temp.innerHTML;
+
+			// Get the fake element's CSS class.
+			var cssClass = 'unknown';
+			var realElementType = element.getName();
+			for ( var i = 0 ; i < this._.objectTypes.length ; i++ )
+			{
+				if ( this._.objectTypes[i].match( element.getName(), element.$ ) )
+				{
+					cssClass = 'cke_fakeobject' + ' ' + this._.objectTypes[i].cssClass;
+					realElementType = this._.objectTypes[i].cssClass;
+					break;
+				}
+			}
+
+			// Make the fake element.
+			var fakeRawElement = doc.createElement( 'img' ),
+				cssText = $.style.cssText,
+				widthMatch = cssText.match( cssWidthRegex ),
+				heightMatch = cssText.match( cssHeightRegex );
+			fakeRawElement.className = cssClass;
+			fakeRawElement.src = CKEDITOR.getUrl( 'images/spacer.gif' ); 
+			if ( widthMatch)
+				fakeRawElement.style.width = widthMatch[1] + 'px';
+			if ( heightMatch )
+				fakeRawElement.style.height = heightMatch[1] + 'px';
+			fakeRawElement.setAttribute( '_cke_protected_html', encodeURIComponent( html ) );
+			fakeRawElement.setAttribute( '_cke_real_element_type', realElementType );
+			return new CKEDITOR.dom.element( fakeRawElement );
+		},
+
+		/**
+		 * Converts a placeholder &lt;img&gt; element back to the real element.
+		 * @param {CKEDITOR.dom.element} fakeImgElement The placeholder &lt;img&gt;.
+		 * @returns {CKEDITOR.dom.element} The real element.
+		 * @example
+		 */
+		restoreElement : function( fakeImgElement )
+		{
+			var html = decodeURIComponent( fakeImgElement.getAttribute( '_cke_protected_html' ) ),
+				realElement = CKEDITOR.dom.element.createFromHtml( html, editor.document );
+
+			if ( fakeImgElement.$.style.width )
+				realElement.setStyle( 'width', fakeImgElement.$.style.width );
+			if ( fakeImgElement.$.style.height )
+				realElement.setStyle( 'height', fakeImgElement.$.style.height );
+
+			return realElement;
+		},
+
+		/**
+		 * Converts protectable elements in an HTML string to placeholders.
+		 * @param {String} html HTML with protectable elements.
+		 * @returns {String} HTML with placeholders.
+		 * @example
+		 */
+		protectHtml : function( html )
+		{
+			var parser = new CKEDITOR.htmlParser(),
+				tagDepth = 0, processedHtml = [],
+				protectedHtml = [], inProtection = false,
+				objectTypes = this._.objectTypes;
+
+			parser.onTagOpen = function( tagName, attributes, selfClosing )
+			{
+				if ( inProtection )
+				{
+					protectedHtml.push( makeTagOpenerHtml( tagName, attributes, selfClosing ) );
+					if ( !( emptyElements[ tagName ] || selfClosing ) )
+						tagDepth++;
+					if ( tagDepth < 1 )
+					{
+						inProtection = false;
+						processedHtml.push( encodeURIComponent( protectedHtml.join( '' ) ), '" />' );
+						protectedHtml = [];
+					}
+					return;
+				}
+
+				for ( var i = 0 ; i < objectTypes.length ; i++ )
+				{
+					if ( objectTypes[i].match( tagName, attributes ) )
+					{
+						inProtection = true;
+						tagDepth = 0;
+
+						// Get the original object's width and height.
+						var styles = attributes.style || '',
+							widthMatch = styles.match( cssWidthRegex ),
+							heightMatch = styles.match( cssHeightRegex );
+
+						// Create the fake <img> tag.
+						processedHtml.push( '<img src="',
+							CKEDITOR.getUrl( 'images/spacer.gif' ),
+							'" ',
+							'class="cke_fakeobject ' + objectTypes[i].cssClass + '" ',
+							'_cke_real_element_type="' + objectTypes[i].cssClass + '"' );
+
+						if ( widthMatch || heightMatch )
+						{
+							processedHtml.push( 'style="',
+								widthMatch ? 'width:' + widthMatch[1] + 'px;' : '',
+								heightMatch ? 'height:' + heightMatch[1] + 'px;' : '',
+								'" ' );
+						}
+
+						processedHtml.push( '_cke_protected_html="' );
+						arguments.callee.call( this, tagName, attributes, selfClosing );
+						return;
+					}
+				}
+
+				processedHtml.push( makeTagOpenerHtml( tagName, attributes ) );
+			};
+
+			parser.onText = function( text )
+			{
+				inProtection ? protectedHtml.push( text ) : processedHtml.push( text );
+			};
+
+			parser.onComment = function( comment )
+			{
+				inProtection ? protectedHtml.push( '<!--' + comment + '-->' ) : processedHtml.push( '<!--' + comment + '-->' );
+			};
+
+			parser.onTagClose = function( tagName )
+			{
+				if ( inProtection )
+				{
+					if ( !emptyElements[ tagName ] )
+						tagDepth--;
+					protectedHtml.push( '</' + tagName + '>' );
+					if ( tagDepth < 1 )
+					{
+						inProtection = false;
+						processedHtml.push( encodeURIComponent( protectedHtml.join( '' ) ), '" />' );
+						protectedHtml = [];
+					}
+				}
+				else
+					processedHtml.push( '</' + tagName + '>' );
+			};
+
+			parser.parse( html );
+			return processedHtml.join( '' );
+		},
+		/**
+		 * Updates HTML into a placeholder
+		 * @param {CKEDITOR.dom.element} fakeImgElement The placeholder &lt;img&gt;.
+		 * @param {CKEDITOR.dom.element} element Input DOM element.
+		 * @returns {String} encoded HTML.
+		 * @example
+		 */
+		updateFakeElement : function( fakeElement, realElement )
+		{
+			var $ = realElement.$.cloneNode( true ),
+				doc = $.ownerDocument,
+				temp = doc.createElement( 'div' ),
+				html;
+
+			// Get the object's HTML code.
+			temp.appendChild( $ );
+			html = temp.innerHTML;
+			fakeElement.setAttribute( '_cke_protected_html', encodeURIComponent( html ) );
+			return html;
+		},
+		
+		/**
+		 * Restores placeholders in an HTML string back to their original elements.
+		 * @param {String} html HTML with placeholders.
+		 * @returns {String} Restored HTML.
+		 * @example
+		 */
+		restoreHtml : function( html )
+		{
+			var parser = new copyParser(),
+				innerParser = new copyParser();
+			
+			innerParser.onTagOpen = function( tagName, attributes, selfClosing )
+			{
+				if ( !this.done )
+				{
+					var styles = attributes.style || '';
+
+					styles = styles.replace( cssWidthRegex, '' ).replace( cssHeightRegex, '' );
+					if ( this.width )
+						styles += 'width:' + this.width + ';';
+					if ( this.height )
+						styles += 'height:' + this.height + ';';
+					attributes.style = styles;
+
+					this.done = true;
+				}
+
+				return copyParser.prototype.onTagOpen.apply( this, arguments );
+			};
+
+			parser.onTagOpen = function( tagName, attributes, selfClosing )
+			{
+				if ( tagName == 'img' && attributes._cke_protected_html !== undefined )
+				{
+					var styles = attributes.style || '',
+						protectedHtml = decodeURIComponent( attributes._cke_protected_html ),
+						widthMatch = styles.match( cssWidthRegex ),
+						heightMatch = styles.match( cssHeightRegex );
+
+					if ( widthMatch || heightMatch )
+					{
+						innerParser.width = widthMatch[1] + 'px';
+						innerParser.height = heightMatch[1] + 'px';
+						innerParser.parse( protectedHtml );
+						protectedHtml = innerParser.output.join( '' );
+					}
+
+					this.output.push( protectedHtml );
+					return;
+				}
+				return copyParser.prototype.onTagOpen.apply( this, arguments );
+			};
+
+			parser.parse( html );
+			return parser.output.join( '' );
+		},
+
+		/**
+		 * Adds an object type to be displayed by placeholders.
+		 * @param {Function} matchFunc A predicate function to determine whether
+		 * an object needs to be replaced by placeholders or not. The function
+		 * should have the following signature:
+		 * <blockquote>function( tagName, attributes )</blockquote>
+		 * In which tagName is the object's tag name, and attributes is an object
+		 * storing all the object's attributes.
+		 * @param {String} cssClass The CSS class that should be added to the
+		 * placeholder &lt;img&gt; for representing this type of object.
+		 * @param {Number} priority (Optional) An integer representing the
+		 * priority of this type of object. If an element matches the descriptions
+		 * of two object types, the object type of <strong>lower</strong> priority
+		 * takes precedance.
+		 * @example
+		 */
+		addObjectType : function( matchFunc, cssClass, priority )
+		{
+			if ( priority === undefined )
+				priority = 10;
+
+			var obj = {
+				match : matchFunc,
+				cssClass : cssClass,
+				priority : priority
+			};
+
+			for ( var i = this._.objectTypes.length - 1 ; i >= 0 ; i-- )
+			{
+				if ( this._.objectTypes[i].priority < priority )
+				{
+					this._.objectTypes.splice( i + 1, 0, obj );
+					return;
+				}
+			}
+
+			this._.objectTypes.unshift( obj );
+		}
+	};
+
 	CKEDITOR.plugins.add( 'fakeobjects',
 		{
 			init : function( editor, pluginPath )
 			{
-				var flashExtensionRegex = /\.swf($|#|\?)/i,
-					emptyElements = { base:1,col:1,meta:1,link:1,hr:1,br:1,param:1,img:1,area:1,input:1 },
-					objectTypes =
-					[
-						{
-							match : function( nodeName, attributes )
-							{
-								return nodeName == 'embed' && ( attributes.type == 'application/x-shockwave-flash' || flashExtensionRegex.test( attributes.src || '' ) );
-							},
-							cssClass : 'flash',
-							priority : 10
-						},
-						{
-							match : function( nodeName, attributes )
-							{
-								return ( nodeName == 'a' && attributes.name != null && attributes.name != '' );
-							},
-							cssClass : 'anchor',
-							priority : 10
-						},
-						{
-							match : function( nodeName, attributes )
-							{
-								if ( nodeName == 'div' && attributes.style && attributes.style.pageBreakAfter == 'always' )
-									if ( attributes.firstChild )
-									{
-										var element = new CKEDITOR.dom.element( attributes.firstChild );
-										return ( element && element.getName() == 'span');
-									}
-								return false;
-							},
-							cssClass : 'pagebreak',
-							priority : 10
-						},
-						{
-							match : function( nodeName, attributes )
-							{
-								return nodeName == 'embed' || nodeName == 'object';
-							},
-							cssClass : 'object',
-							priority : 0x100000000
-						}
-					],
-					makeTagOpenerHtml = function( tagName, attributes, selfClosing )
-					{
-						var attribStr = [], html = [ '<' + tagName ];
-						for ( var i in attributes )
-							attribStr.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '"');
-						if ( attribStr.length > 0 )
-							html.push( ' ', attribStr.join( ' ' ) );
-						if ( emptyElements[ tagName ] || selfClosing )
-							html.push( ' /' );
-						html.push( '>' );
-						return html.join( '' );
-					},
-					cssWidthRegex = /width\s*:\s*([0-9]+)\s*(?:[\w%]+)?\s*;?/i,
-					cssHeightRegex = /height\s*:\s*([0-9]+)\s*(?:[\w%]+)?\s*;?/i;
-
-				var copyParser = function()
-				{
-					this._ = { html : null };
-					this.output = [];
-
-					CKEDITOR.htmlParser.call( this );
-				};
-				copyParser.prototype = {
-					onTagOpen : function( tagName, attributes, selfClosing )
-					{
-						this.output.push( makeTagOpenerHtml( tagName, attributes, selfClosing ) );
-					},
-
-					onTagClose : function( tagName )
-					{
-						if ( !emptyElements[ tagName] )
-							this.output.push( '</' + tagName + '>' );
-					},
-
-					onText : function( text )
-					{
-						this.output.push( text );
-					},
-
-					onComment : function( comment )
-					{
-						this.output.push( '<!--' + comment + '-->' );
-					},
-
-					parse : function( html )
-					{
-						this._.html = html;
-						return CKEDITOR.htmlParser.prototype.parse.apply( this, arguments );
-					}
-				};
-				
-				/**
-				 * Manages element placeholders in WYSIWYG area.
-				 * @namespace
-				 * @example
-				 */
-				CKEDITOR.plugins.fakeobjects =
-				{
-					/**
-					 * Converts an element into a placeholder &lt;img&gt; element, for adding
-					 * into the WYSIWYG area.
-					 * @param {CKEDITOR.dom.element} element Input DOM element.
-					 * @returns {CKEDITOR.dom.element} The placeholder &lt;img&gt; element.
-					 * @example
-					 */
-					protectElement : function( element )
-					{
-						var $ = element.$.cloneNode( true ),
-							doc = $.ownerDocument,
-							temp = doc.createElement( 'div' ),
-							html;
-
-						// Get the object's HTML code.
-						temp.appendChild( $ );
-						html = temp.innerHTML;
-
-						// Get the fake element's CSS class.
-						var cssClass = 'unknown';
-						var realElementType = element.getName();
-						for ( var i = 0 ; i < objectTypes.length ; i++ )
-						{
-							if ( objectTypes[i].match( element.getName(), element.$ ) )
-							{
-								cssClass = 'cke_fakeobject' + ' ' + objectTypes[i].cssClass;
-								realElementType = objectTypes[i].cssClass;
-								break;
-							}
-						}
-
-						// Make the fake element.
-						var fakeRawElement = doc.createElement( 'img' ),
-							cssText = $.style.cssText,
-							widthMatch = cssText.match( cssWidthRegex ),
-							heightMatch = cssText.match( cssHeightRegex );
-						fakeRawElement.className = cssClass;
-						fakeRawElement.src = CKEDITOR.getUrl( 'images/spacer.gif' ); 
-						if ( widthMatch)
-							fakeRawElement.style.width = widthMatch[1] + 'px';
-						if ( heightMatch )
-							fakeRawElement.style.height = heightMatch[1] + 'px';
-						fakeRawElement.setAttribute( '_cke_protected_html', encodeURIComponent( html ) );
-						fakeRawElement.setAttribute( '_cke_real_element_type', realElementType );
-						return new CKEDITOR.dom.element( fakeRawElement );
-					},
-
-					/**
-					 * Converts a placeholder &lt;img&gt; element back to the real element.
-					 * @param {CKEDITOR.dom.element} fakeImgElement The placeholder &lt;img&gt;.
-					 * @returns {CKEDITOR.dom.element} The real element.
-					 * @example
-					 */
-					restoreElement : function( fakeImgElement )
-					{
-						var html = decodeURIComponent( fakeImgElement.getAttribute( '_cke_protected_html' ) ),
-							realElement = CKEDITOR.dom.element.createFromHtml( html, editor.document );
-
-						if ( fakeImgElement.$.style.width )
-							realElement.setStyle( 'width', fakeImgElement.$.style.width );
-						if ( fakeImgElement.$.style.height )
-							realElement.setStyle( 'height', fakeImgElement.$.style.height );
-
-						return realElement;
-					},
-
-					/**
-					 * Converts protectable elements in an HTML string to placeholders.
-					 * @param {String} html HTML with protectable elements.
-					 * @returns {String} HTML with placeholders.
-					 * @example
-					 */
-					protectHtml : function( html )
-					{
-						var parser = new CKEDITOR.htmlParser(),
-							tagDepth = 0, processedHtml = [],
-							protectedHtml = [], inProtection = false;
-
-						parser.onTagOpen = function( tagName, attributes, selfClosing )
-						{
-							if ( inProtection )
-							{
-								protectedHtml.push( makeTagOpenerHtml( tagName, attributes, selfClosing ) );
-								if ( !( emptyElements[ tagName ] || selfClosing ) )
-									tagDepth++;
-								if ( tagDepth < 1 )
-								{
-									inProtection = false;
-									processedHtml.push( encodeURIComponent( protectedHtml.join( '' ) ), '" />' );
-									protectedHtml = [];
-								}
-								return;
-							}
-
-							for ( var i = 0 ; i < objectTypes.length ; i++ )
-							{
-								if ( objectTypes[i].match( tagName, attributes ) )
-								{
-									inProtection = true;
-									tagDepth = 0;
-
-									// Get the original object's width and height.
-									var styles = attributes.style || '',
-										widthMatch = styles.match( cssWidthRegex ),
-										heightMatch = styles.match( cssHeightRegex );
-
-									// Create the fake <img> tag.
-									processedHtml.push( '<img src="',
-										CKEDITOR.getUrl( 'images/spacer.gif' ),
-										'" ',
-										'class="cke_fakeobject ' + objectTypes[i].cssClass + '" ',
-										'_cke_real_element_type="' + objectTypes[i].cssClass + '"' );
-
-									if ( widthMatch || heightMatch )
-									{
-										processedHtml.push( 'style="',
-											widthMatch ? 'width:' + widthMatch[1] + 'px;' : '',
-											heightMatch ? 'height:' + heightMatch[1] + 'px;' : '',
-											'" ' );
-									}
-
-									processedHtml.push( '_cke_protected_html="' );
-									arguments.callee.call( this, tagName, attributes, selfClosing );
-									return;
-								}
-							}
-
-							processedHtml.push( makeTagOpenerHtml( tagName, attributes ) );
-						};
-
-						parser.onText = function( text )
-						{
-							inProtection ? protectedHtml.push( text ) : processedHtml.push( text );
-						};
-
-						parser.onComment = function( comment )
-						{
-							inProtection ? protectedHtml.push( '<!--' + comment + '-->' ) : processedHtml.push( '<!--' + comment + '-->' );
-						};
-
-						parser.onTagClose = function( tagName )
-						{
-							if ( inProtection )
-							{
-								if ( !emptyElements[ tagName ] )
-									tagDepth--;
-								protectedHtml.push( '</' + tagName + '>' );
-								if ( tagDepth < 1 )
-								{
-									inProtection = false;
-									processedHtml.push( encodeURIComponent( protectedHtml.join( '' ) ), '" />' );
-									protectedHtml = [];
-								}
-							}
-							else
-								processedHtml.push( '</' + tagName + '>' );
-						};
-
-						parser.parse( html );
-						return processedHtml.join( '' );
-					},
-					/**
-					 * Updates HTML into a placeholder
-					 * @param {CKEDITOR.dom.element} fakeImgElement The placeholder &lt;img&gt;.
-					 * @param {CKEDITOR.dom.element} element Input DOM element.
-					 * @returns {String} encoded HTML.
-					 * @example
-					 */
-					updateFakeElement : function( fakeElement, realElement )
-					{
-						var $ = realElement.$.cloneNode( true ),
-							doc = $.ownerDocument,
-							temp = doc.createElement( 'div' ),
-							html;
-
-						// Get the object's HTML code.
-						temp.appendChild( $ );
-						html = temp.innerHTML;
-						fakeElement.setAttribute( '_cke_protected_html', encodeURIComponent( html ) );
-						return html;
-					},
-					
-					/**
-					 * Restores placeholders in an HTML string back to their original elements.
-					 * @param {String} html HTML with placeholders.
-					 * @returns {String} Restored HTML.
-					 * @example
-					 */
-					restoreHtml : function( html )
-					{
-						var parser = new copyParser(),
-							innerParser = new copyParser();
-						
-						innerParser.onTagOpen = function( tagName, attributes, selfClosing )
-						{
-							if ( !this.done )
-							{
-								var styles = attributes.style || '';
-
-								styles = styles.replace( cssWidthRegex, '' ).replace( cssHeightRegex, '' );
-								if ( this.width )
-									styles += 'width:' + this.width + ';';
-								if ( this.height )
-									styles += 'height:' + this.height + ';';
-								attributes.style = styles;
-
-								this.done = true;
-							}
-
-							return copyParser.prototype.onTagOpen.apply( this, arguments );
-						};
-
-						parser.onTagOpen = function( tagName, attributes, selfClosing )
-						{
-							if ( tagName == 'img' && attributes._cke_protected_html !== undefined )
-							{
-								var styles = attributes.style || '',
-									protectedHtml = decodeURIComponent( attributes._cke_protected_html ),
-									widthMatch = styles.match( cssWidthRegex ),
-									heightMatch = styles.match( cssHeightRegex );
-
-								if ( widthMatch || heightMatch )
-								{
-									innerParser.width = widthMatch[1] + 'px';
-									innerParser.height = heightMatch[1] + 'px';
-									innerParser.parse( protectedHtml );
-									protectedHtml = innerParser.output.join( '' );
-								}
-
-								this.output.push( protectedHtml );
-								return;
-							}
-							return copyParser.prototype.onTagOpen.apply( this, arguments );
-						};
-
-						parser.parse( html );
-						return parser.output.join( '' );
-					},
-
-					/**
-					 * Adds an object type to be displayed by placeholders.
-					 * @param {Function} matchFunc A predicate function to determine whether
-					 * an object needs to be replaced by placeholders or not. The function
-					 * should have the following signature:
-					 * <blockquote>function( tagName, attributes )</blockquote>
-					 * In which tagName is the object's tag name, and attributes is an object
-					 * storing all the object's attributes.
-					 * @param {String} cssClass The CSS class that should be added to the
-					 * placeholder &lt;img&gt; for representing this type of object.
-					 * @param {Number} priority (Optional) An integer representing the
-					 * priority of this type of object. If an element matches the descriptions
-					 * of two object types, the object type of <strong>lower</strong> priority
-					 * takes precedance.
-					 * @example
-					 */
-					addObjectType : function( matchFunc, cssClass, priority )
-					{
-						if ( priority === undefined )
-							priority = 10;
-
-						var obj = {
-							match : matchFunc,
-							cssClass : cssClass,
-							priority : priority
-						};
-
-						for ( var i = objectTypes.length - 1 ; i >= 0 ; i-- )
-						{
-							if ( objectTypes[i].priority < priority )
-							{
-								objectTypes.splice( i + 1, 0, obj );
-								return;
-							}
-						}
-
-						objectTypes.unshift( obj );
-					}
-				};
+				editor.fakeobjects = new CKEDITOR.plugins.fakeobjects();
 			}
 		} );
Index: /CKEditor/branches/prototype/_source/plugins/link/dialogs/anchor.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/dialogs/anchor.js	(revision 2904)
+++ /CKEditor/branches/prototype/_source/plugins/link/dialogs/anchor.js	(revision 2905)
@@ -20,5 +20,5 @@
  */
 
-CKEDITOR.dialog.add( 'anchor', function( editor ){
+CKEDITOR.dialog.add( 'anchor', function( editor )
 {
 	// Function called in onShow to load selected element.
@@ -57,9 +57,9 @@
 				this.clearSavedSelection();
 
-				var fakeElement = CKEDITOR.plugins.fakeobjects.protectElement( this.editObj );
+				var fakeElement = editor.fakeobjects.protectElement( this.editObj );
 				editor.insertElement( fakeElement );
 			}
 			else
-				CKEDITOR.plugins.fakeobjects.updateFakeElement( this.fakeObj, this.editObj );
+				editor.fakeobjects.updateFakeElement( this.fakeObj, this.editObj );
 			return true;
 		},
@@ -85,5 +85,5 @@
 				{
 					this.fakeObj = element;
-					element = CKEDITOR.plugins.fakeobjects.restoreElement( this.fakeObj );
+					element = editor.fakeobjects.restoreElement( this.fakeObj );
 					loadElements.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( this.fakeObj );
@@ -124,5 +124,3 @@
 		]
 	};
-};
-
-});
+} );
Index: /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js	(revision 2904)
+++ /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js	(revision 2905)
@@ -671,5 +671,5 @@
 				{
 					var domElement = new CKEDITOR.dom.element( element );
-					domElement = CKEDITOR.plugins.fakeobjects.restoreElement( domElement );
+					domElement = editor.fakeobjects.restoreElement( domElement );
 					anchors.push( domElement );
 				}
@@ -720,5 +720,5 @@
 				{
 					this.fakeObj = element;
-					element = CKEDITOR.plugins.fakeobjects.restoreElement( this.fakeObj );
+					element = editor.fakeobjects.restoreElement( this.fakeObj );
 					loadLink.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( this.fakeObj );
@@ -857,5 +857,5 @@
 				this._.selectedElement.setAttributes( attributes );
 				if ( this.fakeObj )
-					CKEDITOR.plugins.fakeobjects.updateFakeElement( this.fakeObj, this._.selectedElement );
+					editor.fakeobjects.updateFakeElement( this.fakeObj, this._.selectedElement );
 
 				delete this._.selectedElement;
Index: /CKEditor/branches/prototype/_source/plugins/link/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/plugin.js	(revision 2904)
+++ /CKEditor/branches/prototype/_source/plugins/link/plugin.js	(revision 2905)
@@ -61,4 +61,5 @@
 			} );
 	},
+
 	requires : [ 'fakeobjects' ]
 } );
Index: /CKEditor/branches/prototype/_source/plugins/pagebreak/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/pagebreak/plugin.js	(revision 2904)
+++ /CKEditor/branches/prototype/_source/plugins/pagebreak/plugin.js	(revision 2905)
@@ -46,5 +46,5 @@
 
 		if ( getProtected )
-			return CKEDITOR.plugins.fakeobjects.protectElement( breakObject );
+			return editor.fakeobjects.protectElement( breakObject );
 		else
 			return breakObject;
Index: /CKEditor/branches/prototype/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/wysiwygarea/plugin.js	(revision 2904)
+++ /CKEditor/branches/prototype/_source/plugins/wysiwygarea/plugin.js	(revision 2905)
@@ -248,5 +248,5 @@
 
 								// Replace tags with fake elements.
-								data = CKEDITOR.plugins.fakeobjects.protectHtml( data );
+								data = editor.fakeobjects.protectHtml( data );
 
 								data =
@@ -301,5 +301,5 @@
 
 								// Restore fake elements.
-								data = CKEDITOR.plugins.fakeobjects.restoreHtml( data );
+								data = editor.fakeobjects.restoreHtml( data );
 
 								return data;
