Ticket #4548: 4548_2.patch
File 4548_2.patch, 5.0 KB (added by , 13 years ago) |
---|
-
_source/core/dom/elementpath.js
1 /* 1 /* 2 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ 5 5 6 6 (function() 7 7 { 8 // Elements that may be considered the "Block boundary" in an element path.9 var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,de:1 };10 8 11 9 // Elements that may be considered the "Block limit" in an element path. 12 10 var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1 }; … … 48 46 49 47 if ( !blockLimit ) 50 48 { 51 if ( !block && pathBlockElements[ elementName ])49 if ( !block && e.isBlockBoundary() ) 52 50 block = e; 53 51 54 52 if ( pathBlockLimitElements[ elementName ] ) -
_source/core/htmlparser/fragment.js
107 107 // body (if fixForBody). 108 108 if ( fixForBody && !target.type ) 109 109 { 110 var elementName, realElement Name;110 var elementName, realElement, isKnown; 111 111 if ( element.attributes 112 && ( realElementName = 113 element.attributes[ '_cke_real_element_type' ] ) ) 114 elementName = realElementName; 115 else 116 elementName = element.name; 117 if ( !( elementName in CKEDITOR.dtd.$body ) ) 112 && element.attributes[ '_cke_real_element_type' ] ) 113 realElement = CKEDITOR.editor.restoreParserElement( element ); 114 115 elementName = realElement ? 116 ( realElement.isUnknown ? // Don't fix for unknown elements. 117 '' : realElement.name ) : element.name; 118 119 if ( elementName && !( elementName in CKEDITOR.dtd.$body ) ) 118 120 { 119 121 var savedCurrent = currentNode; 120 122 -
_source/plugins/fakeobjects/plugin.js
5 5 6 6 (function() 7 7 { 8 var htmlFilterRules =9 {10 elements :11 {12 $ : function( element )13 {14 var realHtml = element.attributes._cke_realelement,15 realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ),16 realElement = realFragment && realFragment.children[ 0 ];17 18 if ( realElement )19 {20 // If we have width/height in the element, we must move it into21 // the real element.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+)/.exec( style ),29 width = match && match[1];30 31 // Get the height from the style.32 match = /(?:^|\s)height\s*:\s*(\d+)/.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 8 CKEDITOR.plugins.add( 'fakeobjects', 49 9 { 50 10 requires : [ 'htmlwriter' ], … … 55 15 htmlFilter = dataProcessor && dataProcessor.htmlFilter; 56 16 57 17 if ( htmlFilter ) 58 htmlFilter.addRules( htmlFilterRules ); 59 } 60 }); 18 htmlFilter.addRules( 19 { 20 elements : 21 { 22 $ : CKEDITOR.editor.restoreParserElement 23 } 24 } ); 25 } 26 }); 61 27 })(); 62 28 63 29 CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable ) … … 109 75 var html = decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ); 110 76 return CKEDITOR.dom.element.createFromHtml( html, this.document ); 111 77 }; 78 79 CKEDITOR.editor.restoreParserElement = function( fakeElement ) 80 { 81 var realHtml = fakeElement.attributes._cke_realelement, 82 realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ), 83 realElement = realFragment && realFragment.children[ 0 ]; 84 85 if ( realElement ) 86 { 87 // If we have width/height in the fakeElement, we must move it into 88 // the real fakeElement. 89 90 var style = fakeElement.attributes.style; 91 92 if ( style ) 93 { 94 // Get the width from the style. 95 var match = /(?:^|\s)width\s*:\s*(\d+)/.exec( style ), 96 width = match && match[1]; 97 98 // Get the height from the style. 99 match = /(?:^|\s)height\s*:\s*(\d+)/.exec( style ); 100 var height = match && match[1]; 101 102 if ( width ) 103 realElement.attributes.width = width; 104 105 if ( height ) 106 realElement.attributes.height = height; 107 } 108 } 109 110 return realElement; 111 }