| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 /* 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 (function() 7 { 8 var htmlFilterRules = 9 { 10 elements : 11 { 12 $ : function( element ) 13 { 14 var attributes = element.attributes, 15 realHtml = attributes && attributes._cke_realelement, 16 realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ), 17 realElement = realFragment && realFragment.children[ 0 ]; 18 19 // If we have width/height in the element, we must move it into 20 // the real element. 21 if ( realElement && element.attributes._cke_resizable ) 22 { 23 var style = element.attributes.style; 24 25 if ( style ) 26 { 27 // Get the width from the style. 28 var match = /(?:^|\s)width\s*:\s*(\d+)/i.exec( style ), 29 width = match && match[1]; 30 31 // Get the height from the style. 32 match = /(?:^|\s)height\s*:\s*(\d+)/i.exec( style ); 33 var height = match && match[1]; 34 35 if ( width ) 36 realElement.attributes.width = width; 37 38 if ( height ) 39 realElement.attributes.height = height; 40 } 41 } 42 43 return realElement; 44 } 45 } 46 }; 47 48 CKEDITOR.plugins.add( 'fakeobjects', 49 { 50 requires : [ 'htmlwriter' ], 51 52 afterInit : function( editor ) 53 { 54 var dataProcessor = editor.dataProcessor, 55 htmlFilter = dataProcessor && dataProcessor.htmlFilter; 56 57 if ( htmlFilter ) 58 htmlFilter.addRules( htmlFilterRules ); 59 } 60 }); 61 })(); 62 63 CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable ) 64 { 65 var lang = this.lang.fakeobjects; 66 67 var attributes = 68 { 69 'class' : className, 70 src : CKEDITOR.getUrl( 'images/spacer.gif' ), 71 _cke_realelement : encodeURIComponent( realElement.getOuterHtml() ), 72 _cke_real_node_type : realElement.type, 73 alt : lang[ realElementType ] || lang.unknown, 74 align : realElement.getAttribute( 'align' ) || '' 75 }; 76 77 if ( realElementType ) 78 attributes._cke_real_element_type = realElementType; 79 80 if ( isResizable ) 81 attributes._cke_resizable = isResizable; 82 83 return this.document.createElement( 'img', { attributes : attributes } ); 84 }; 85 86 CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, className, realElementType, isResizable ) 87 { 88 var lang = this.lang.fakeobjects, 89 html; 90 91 var writer = new CKEDITOR.htmlParser.basicWriter(); 92 realElement.writeHtml( writer ); 93 html = writer.getHtml(); 94 95 var attributes = 96 { 97 'class' : className, 98 src : CKEDITOR.getUrl( 'images/spacer.gif' ), 99 _cke_realelement : encodeURIComponent( html ), 100 _cke_real_node_type : realElement.type, 101 alt : lang[ realElementType ] || lang.unknown, 102 align : realElement.attributes.align || '' 103 }; 104 105 if ( realElementType ) 106 attributes._cke_real_element_type = realElementType; 107 108 if ( isResizable ) 109 attributes._cke_resizable = isResizable; 110 111 return new CKEDITOR.htmlParser.element( 'img', attributes ); 112 }; 113 114 CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement ) 115 { 116 if ( fakeElement.getAttribute( '_cke_real_node_type' ) != CKEDITOR.NODE_ELEMENT ) 117 return null; 118 119 return CKEDITOR.dom.element.createFromHtml( 120 decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ), 121 this.document ); 122 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |