JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-4.0_full
[ckeditor.git] / _source / plugins / fakeobjects / plugin.js
diff --git a/_source/plugins/fakeobjects/plugin.js b/_source/plugins/fakeobjects/plugin.js
deleted file mode 100644 (file)
index f81bdb6..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*\r
-Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-(function()\r
-{\r
-       var cssStyle = CKEDITOR.htmlParser.cssStyle,\r
-                       cssLength = CKEDITOR.tools.cssLength;\r
-\r
-       var cssLengthRegex = /^((?:\d*(?:\.\d+))|(?:\d+))(.*)?$/i;\r
-\r
-       /*\r
-        * Replacing the former CSS length value with the later one, with\r
-        * adjustment to the length  unit.\r
-        */\r
-       function replaceCssLength( length1, length2 )\r
-       {\r
-               var parts1 = cssLengthRegex.exec( length1 ),\r
-                               parts2 = cssLengthRegex.exec( length2 );\r
-\r
-               // Omit pixel length unit when necessary,\r
-               // e.g. replaceCssLength( 10, '20px' ) -> 20\r
-               if ( parts1 )\r
-               {\r
-                       if ( !parts1[ 2 ] && parts2[ 2 ] == 'px' )\r
-                               return parts2[ 1 ];\r
-                       if ( parts1[ 2 ] == 'px' && !parts2[ 2 ] )\r
-                               return parts2[ 1 ] + 'px';\r
-               }\r
-\r
-               return length2;\r
-       }\r
-\r
-       var htmlFilterRules =\r
-       {\r
-               elements :\r
-               {\r
-                       $ : function( element )\r
-                       {\r
-                               var attributes = element.attributes,\r
-                                       realHtml = attributes && attributes[ 'data-cke-realelement' ],\r
-                                       realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ),\r
-                                       realElement = realFragment && realFragment.children[ 0 ];\r
-\r
-                               // Width/height in the fake object are subjected to clone into the real element.\r
-                               if ( realElement && element.attributes[ 'data-cke-resizable' ] )\r
-                               {\r
-                                       var styles = new cssStyle( element ).rules,\r
-                                               realAttrs = realElement.attributes,\r
-                                               width = styles.width,\r
-                                               height = styles.height;\r
-\r
-                                       width && ( realAttrs.width = replaceCssLength( realAttrs.width, width ) );\r
-                                       height && ( realAttrs.height = replaceCssLength( realAttrs.height, height ) );\r
-                               }\r
-\r
-                               return realElement;\r
-                       }\r
-               }\r
-       };\r
-\r
-       CKEDITOR.plugins.add( 'fakeobjects',\r
-       {\r
-               requires : [ 'htmlwriter' ],\r
-\r
-               afterInit : function( editor )\r
-               {\r
-                       var dataProcessor = editor.dataProcessor,\r
-                               htmlFilter = dataProcessor && dataProcessor.htmlFilter;\r
-\r
-                       if ( htmlFilter )\r
-                               htmlFilter.addRules( htmlFilterRules );\r
-               }\r
-       });\r
-\r
-       CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable )\r
-       {\r
-               var lang = this.lang.fakeobjects,\r
-                       label = lang[ realElementType ] || lang.unknown;\r
-\r
-               var attributes =\r
-               {\r
-                       'class' : className,\r
-                       'data-cke-realelement' : encodeURIComponent( realElement.getOuterHtml() ),\r
-                       'data-cke-real-node-type' : realElement.type,\r
-                       alt : label,\r
-                       title : label,\r
-                       align : realElement.getAttribute( 'align' ) || ''\r
-               };\r
-\r
-               // Do not set "src" on high-contrast so the alt text is displayed. (#8945)\r
-               if ( !CKEDITOR.env.hc )\r
-                       attributes.src = CKEDITOR.getUrl( 'images/spacer.gif' );\r
-\r
-               if ( realElementType )\r
-                       attributes[ 'data-cke-real-element-type' ] = realElementType;\r
-\r
-               if ( isResizable )\r
-               {\r
-                       attributes[ 'data-cke-resizable' ] = isResizable;\r
-\r
-                       var fakeStyle = new cssStyle();\r
-\r
-                       var width = realElement.getAttribute( 'width' ),\r
-                               height = realElement.getAttribute( 'height' );\r
-\r
-                       width && ( fakeStyle.rules.width = cssLength( width ) );\r
-                       height && ( fakeStyle.rules.height = cssLength( height ) );\r
-                       fakeStyle.populate( attributes );\r
-               }\r
-\r
-               return this.document.createElement( 'img', { attributes : attributes } );\r
-       };\r
-\r
-       CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, className, realElementType, isResizable )\r
-       {\r
-               var lang = this.lang.fakeobjects,\r
-                       label = lang[ realElementType ] || lang.unknown,\r
-                       html;\r
-\r
-               var writer = new CKEDITOR.htmlParser.basicWriter();\r
-               realElement.writeHtml( writer );\r
-               html = writer.getHtml();\r
-\r
-               var attributes =\r
-               {\r
-                       'class' : className,\r
-                       'data-cke-realelement' : encodeURIComponent( html ),\r
-                       'data-cke-real-node-type' : realElement.type,\r
-                       alt : label,\r
-                       title : label,\r
-                       align : realElement.attributes.align || ''\r
-               };\r
-\r
-               // Do not set "src" on high-contrast so the alt text is displayed. (#8945)\r
-               if ( !CKEDITOR.env.hc )\r
-                       attributes.src = CKEDITOR.getUrl( 'images/spacer.gif' );\r
-\r
-               if ( realElementType )\r
-                       attributes[ 'data-cke-real-element-type' ] = realElementType;\r
-\r
-               if ( isResizable )\r
-               {\r
-                       attributes[ 'data-cke-resizable' ] = isResizable;\r
-                       var realAttrs = realElement.attributes,\r
-                               fakeStyle = new cssStyle();\r
-\r
-                       var width = realAttrs.width,\r
-                               height = realAttrs.height;\r
-\r
-                       width != undefined && ( fakeStyle.rules.width =  cssLength( width ) );\r
-                       height != undefined && ( fakeStyle.rules.height = cssLength ( height ) );\r
-                       fakeStyle.populate( attributes );\r
-               }\r
-\r
-               return new CKEDITOR.htmlParser.element( 'img', attributes );\r
-       };\r
-\r
-       CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement )\r
-       {\r
-               if ( fakeElement.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT )\r
-                       return null;\r
-\r
-               var element = CKEDITOR.dom.element.createFromHtml(\r
-                       decodeURIComponent( fakeElement.data( 'cke-realelement' ) ),\r
-                       this.document );\r
-\r
-               if ( fakeElement.data( 'cke-resizable') )\r
-               {\r
-                       var width = fakeElement.getStyle( 'width' ),\r
-                               height = fakeElement.getStyle( 'height' );\r
-\r
-                       width && element.setAttribute( 'width', replaceCssLength( element.getAttribute( 'width' ), width ) );\r
-                       height && element.setAttribute( 'height', replaceCssLength( element.getAttribute( 'height' ), height ) );\r
-               }\r
-\r
-               return element;\r
-       };\r
-\r
-})();\r