Ticket #2860: 2860_2.patch
File 2860_2.patch, 13.8 KB (added by , 16 years ago) |
---|
-
_source/core/config.js
146 146 * @example 147 147 * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea'; 148 148 */ 149 plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage, removeformat,smiley,sourcearea,specialchar,tab,toolbar,wysiwygarea',149 plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,removeformat,smiley,sourcearea,specialchar,tab,toolbar,wysiwygarea', 150 150 151 151 /** 152 152 * The theme to be used to build the UI. -
_source/core/dom/element.js
259 259 return this.$.innerHTML; 260 260 }, 261 261 262 getOuterHtml : function() 263 { 264 if ( this.$.outerHTML ) 265 return this.$.outerHTML; 266 267 var tmpDiv = this.$.ownerDocument.createElement( 'div' ); 268 tmpDiv.appendChild( this.$.cloneNode( true ) ); 269 return tmpDiv.innerHTML; 270 }, 271 262 272 /** 263 273 * Sets the inner HTML of this element. 264 274 * @param {String} html The HTML to be set for this element. … … 563 573 return $ ? new CKEDITOR.dom.node( $ ) : null; 564 574 }, 565 575 576 getStyle : function( name ) 577 { 578 return this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ]; 579 }, 580 566 581 /** 567 582 * Checks if the element name matches one or more names. 568 583 * @param {String} name[,name[,...]] One or more names to be checked. -
_source/core/dom/node.js
416 416 } 417 417 418 418 return this; 419 }, 420 421 replace : function( nodeToReplace ) 422 { 423 this.insertBefore( nodeToReplace ); 424 nodeToReplace.remove(); 419 425 } 420 426 } 421 427 ); -
_source/core/editor.js
264 264 delete this._.instanceConfig; 265 265 266 266 this._.commands = {}; 267 this._.styles = []; 267 268 268 269 /** 269 270 * The DOM element that has been replaced by this editor instance. This … … 348 349 this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition ); 349 350 }, 350 351 352 addCss : function( css ) 353 { 354 this._.styles.push( css ); 355 }, 356 351 357 /** 352 358 * Destroys the editor instance, releasing all resources used by it. 353 359 * If the editor replaced an element, the element will be recovered. -
_source/core/htmlparser/element.js
13 13 */ 14 14 CKEDITOR.htmlParser.element = function( name, attributes ) 15 15 { 16 if ( attributes._cke_saved_src ) 17 attributes.src = attributes._cke_saved_src; 18 19 if ( attributes._cke_saved_href ) 20 attributes.href = attributes._cke_saved_href; 21 16 22 /** 17 23 * The element name. 18 24 * @type String … … 97 103 */ 98 104 writeHtml : function( writer ) 99 105 { 106 var attributes = this.attributes; 107 108 // The "_cke_realelement" attribute indicates that the current 109 // element is a placeholder for another element. 110 if ( attributes._cke_realelement ) 111 { 112 var realFragment = new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( attributes._cke_realelement ) ); 113 realFragment.writeHtml( writer ); 114 return; 115 } 116 117 // The "_cke_replacedata" indicates that this element is replacing 118 // a data snippet, which should be outputted as is. 119 if ( attributes._cke_replacedata ) 120 { 121 writer.write( attributes._cke_replacedata ); 122 return; 123 } 124 100 125 // Open element tag. 101 126 writer.openTag( this.name, this.attributes ); 102 127 103 128 // Copy all attributes to an array. 104 129 var attribsArray = []; 105 for ( var a in this.attributes ) 106 attribsArray.push( [ a, this.attributes[ a ] ] ); 130 for ( var a in attributes ) 131 { 132 // Ignore all attributes starting with "_cke". 133 if ( !/^_cke/.test( a ) ) 134 attribsArray.push( [ a, this.attributes[ a ] ] ); 135 } 107 136 108 137 // Sort the attributes by name. 109 138 attribsArray.sort( sortAttribs ); … … 112 141 for ( var i = 0, len = attribsArray.length ; i < len ; i++ ) 113 142 { 114 143 var attrib = attribsArray[ i ]; 115 // IE's treated expand fields as dom attributes, skip it116 if ( CKEDITOR.env.ie && attrib === '_cke_expando' )117 continue;118 144 writer.attribute( attrib[0], attrib[1] ); 119 145 } 120 146 -
_source/plugins/fakeobjects/plugin.js
1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 CKEDITOR.plugins.add( 'fakeobjects' ); 7 8 CKEDITOR.editor.prototype.createFakeElement = function( realElement, className ) 9 { 10 return this.document.createElement( 'img', 11 { 12 attributes : 13 { 14 'class' : className, 15 src : CKEDITOR.getUrl( 'images/spacer.gif' ), 16 _cke_realelement : encodeURIComponent( realElement.getOuterHtml() ) 17 } 18 }); 19 }; -
_source/plugins/htmlwriter/plugin.js
225 225 /** 226 226 * Writes the current indentation chars. It uses the 227 227 * {@link #indentationChars} property, repeating it for the current 228 * in tentation steps.228 * indentation steps. 229 229 * @example 230 230 * // Writes "\t" (e.g.). 231 231 * writer.indentation(); … … 237 237 }, 238 238 239 239 /** 240 * Writes any kind of data to the ouput. 241 * @example 242 * writer.write( 'This is an <b>example</b>.' ); 243 */ 244 write : function( data ) 245 { 246 this._.output.push( data ); 247 }, 248 249 /** 240 250 * Empties the current output buffer. 241 251 * @example 242 252 * writer.reset(); -
_source/plugins/pagebreak/plugin.js
Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: _source\plugins\pagebreak\images\pagebreak.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 /** 7 * @file Horizontal Page Break 8 */ 9 10 // Register a plugin named "pagebreak". 11 CKEDITOR.plugins.add( 'pagebreak', 12 { 13 init : function( editor ) 14 { 15 // Register the command. 16 editor.addCommand( 'pagebreak', CKEDITOR.plugins.pagebreakCmd ); 17 18 // Register the toolbar button. 19 editor.ui.addButton( 'PageBreak', 20 { 21 label : editor.lang.pagebreak, 22 command : 'pagebreak' 23 }); 24 25 // Add the style that renders our placeholder. 26 editor.addCss( 27 'img.cke_pagebreak' + 28 '{' + 29 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/pagebreak.gif' ) + ');' + 30 'background-position: center center;' + 31 'background-repeat: no-repeat;' + 32 'clear: both;' + 33 'display: block;' + 34 'float: none;' + 35 'width: 100%;' + 36 'border-top: #999999 1px dotted;' + 37 'border-bottom: #999999 1px dotted;' + 38 'height: 5px;' + 39 40 '}' ); 41 42 // Listen for the "contentDom" event, so the document can be fixed to 43 // display the placeholders. 44 editor.on( 'contentDom', function() 45 { 46 var divs = editor.document.getBody().getElementsByTag( 'div' ); 47 for ( var div, i = 0, length = divs.count() ; i < length ; i++ ) 48 { 49 div = divs.getItem( i ); 50 if ( div.getStyle( 'page-break-after' ) == 'always' && !/[^\s\u00A0]/.test( div.getText() ) ) 51 { 52 editor.createFakeElement( div, 'cke_pagebreak' ).replace( div ); 53 } 54 } 55 }); 56 }, 57 requires : [ 'fakeobjects' ] 58 }); 59 60 CKEDITOR.plugins.pagebreakCmd = 61 { 62 exec : function( editor ) 63 { 64 // Create the element that represents a print break. 65 var breakObject = CKEDITOR.dom.element.createFromHtml( '<div style="page-break-after: always;"><span style="display: none;"> </span></div>' ); 66 67 // Creates the fake image used for this element. 68 breakObject = editor.createFakeElement( breakObject, 'cke_pagebreak' ); 69 70 var ranges = editor.getSelection().getRanges(); 71 72 for ( var range, i = 0 ; i < ranges.length ; i++ ) 73 { 74 range = ranges[ i ]; 75 76 if ( i > 0 ) 77 breakObject = breakObject.clone( true ); 78 79 range.splitBlock( 'p' ); 80 range.insertNode( breakObject ); 81 } 82 } 83 }; -
_source/plugins/toolbar/plugin.js
211 211 'Bold', 'Italic', 'Underline', 'Strike', '-', 212 212 'Subscript', 'Superscript', '-', 213 213 'SelectAll', 'RemoveFormat', '-', 214 'Smiley', 'HorizontalRule', 'SpecialChar' 214 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak' 215 215 ] 216 216 ]; -
_source/plugins/wysiwygarea/plugin.js
44 44 // #### protectEvents - END 45 45 46 46 // #### protectAttributes - START 47 48 // TODO: Clean and simplify these regexes. 47 49 var protectUrlTagRegex = /<(?:a|area|img)(?=\s).*?\s(?:href|src)=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi, 48 protectUrlAttributeRegex = /\s(href|src)(\s*=\s*?('|")[\s\S]*?\3)/gi, 49 protectedUrlTagRegex = /<(?:a|area|img)(?=\s)(?:"[^"]*"|'[^']*'|[^<])*>/gi, 50 protectedAttributeRegex = /_cke_saved_/gi, 51 protectUrls = function( html ) 52 { 53 return html.replace( protectUrlTagRegex, protectUrls_ReplaceTags ); 54 }, 55 protectUrls_ReplaceTags = function( tagMatch ) 56 { 57 return tagMatch.replace( protectUrlAttributeRegex, '$& _cke_saved_$1$2'); 58 }, 59 protectUrlsRestore = function( html ) 60 { 61 return html.replace( protectedUrlTagRegex, protectUrlsRestore_ReplaceTags ); 62 }, 63 protectUrlsRestore_ReplaceTags = function( tagMatch ) 64 { 65 return tagMatch.replace( protectUrlAttributeRegex, '' ).replace( protectedAttributeRegex, '' ); 66 }; 50 protectUrlAttributeRegex = /\s(href|src)(\s*=\s*?('|")[\s\S]*?\3)/gi; 51 52 var protectUrls = function( html ) 53 { 54 return html.replace( protectUrlTagRegex, protectUrls_ReplaceTags ); 55 }; 56 57 var protectUrls_ReplaceTags = function( tagMatch ) 58 { 59 return tagMatch.replace( protectUrlAttributeRegex, '$& _cke_saved_$1$2'); 60 }; 61 67 62 // #### protectAttributes - END 68 63 69 64 var onInsertHtml = function( evt ) … … 300 295 // Protect src or href attributes. 301 296 data = protectUrls( data ); 302 297 303 // Replace tags with fake elements.304 if ( editor.fakeobjects )305 data = editor.fakeobjects.protectHtml( data );306 307 298 data = 308 299 editor.config.docType + 309 300 '<html dir="' + editor.config.contentsLangDirection + '">' + 310 301 '<head>' + 311 302 '<link href="' + editor.config.contentsCss + '" type="text/css" rel="stylesheet" _fcktemp="true"/>' + 303 '<style type="text/css" _fcktemp="true">' + 304 editor._.styles.join( '\n' ) + 305 '</style>'+ 312 306 '</head>' + 313 307 '<body>' + 314 308 data + … … 356 350 // Restore protected attributes. 357 351 data = protectEventsRestore( data ); 358 352 359 // Restore protected URLs.360 data = protectUrlsRestore( data );361 362 // Restore fake elements.363 if ( editor.fakeobjects )364 data = editor.fakeobjects.restoreHtml( data );365 366 353 return data; 367 354 }, 368 355 -
contents.css
12 12 /* Remove the background color to make it transparent */ 13 13 background-color: #fff; 14 14 } 15 16 /* The following declarations are to be removed from this file (#2786) */17 18 img.cke_fakeobject19 {20 background-position: center center;21 background-repeat: no-repeat;22 border: 1px solid #a9a9a9;23 width: 80px;24 height: 80px;25 }26 27 img.cke_fakeobject.flash28 {29 background-image: url(images/flashlogo.gif);30 }31 32 img.cke_fakeobject.object33 {34 background-image: url(images/plugin.gif);35 }36 37 img.cke_fakeobject.anchor38 {39 background-image: url(images/anchor.gif);40 width: 18px;41 height: 18px;42 }43 44 img.cke_fakeobject.pagebreak45 {46 background-image: url(images/pagebreak.gif);47 width: 100%;48 height: 7px;49 }