Index: _source/core/config.js =================================================================== --- _source/core/config.js (revision 3025) +++ _source/core/config.js (working copy) @@ -146,7 +146,7 @@ * @example * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea'; */ - plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,removeformat,smiley,sourcearea,specialchar,tab,toolbar,wysiwygarea', + plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,removeformat,smiley,sourcearea,specialchar,tab,toolbar,wysiwygarea', /** * The theme to be used to build the UI. Index: _source/core/dom/element.js =================================================================== --- _source/core/dom/element.js (revision 3025) +++ _source/core/dom/element.js (working copy) @@ -259,6 +259,16 @@ return this.$.innerHTML; }, + getOuterHtml : function() + { + if ( this.$.outerHTML ) + return this.$.outerHTML; + + var tmpDiv = this.$.ownerDocument.createElement( 'div' ); + tmpDiv.appendChild( this.$.cloneNode( true ) ); + return tmpDiv.innerHTML; + }, + /** * Sets the inner HTML of this element. * @param {String} html The HTML to be set for this element. @@ -563,6 +573,11 @@ return $ ? new CKEDITOR.dom.node( $ ) : null; }, + getStyle : function( name ) + { + return this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ]; + }, + /** * Checks if the element name matches one or more names. * @param {String} name[,name[,...]] One or more names to be checked. Index: _source/core/dom/node.js =================================================================== --- _source/core/dom/node.js (revision 3025) +++ _source/core/dom/node.js (working copy) @@ -416,6 +416,12 @@ } return this; + }, + + replace : function( nodeToReplace ) + { + this.insertBefore( nodeToReplace ); + nodeToReplace.remove(); } } ); Index: _source/core/editor.js =================================================================== --- _source/core/editor.js (revision 3025) +++ _source/core/editor.js (working copy) @@ -264,6 +264,7 @@ delete this._.instanceConfig; this._.commands = {}; + this._.styles = []; /** * The DOM element that has been replaced by this editor instance. This @@ -348,6 +349,11 @@ this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition ); }, + addCss : function( css ) + { + this._.styles.push( css ); + }, + /** * Destroys the editor instance, releasing all resources used by it. * If the editor replaced an element, the element will be recovered. Index: _source/core/htmlparser/element.js =================================================================== --- _source/core/htmlparser/element.js (revision 3025) +++ _source/core/htmlparser/element.js (working copy) @@ -13,6 +13,12 @@ */ CKEDITOR.htmlParser.element = function( name, attributes ) { + if ( attributes._cke_saved_src ) + attributes.src = attributes._cke_saved_src; + + if ( attributes._cke_saved_href ) + attributes.href = attributes._cke_saved_href; + /** * The element name. * @type String @@ -97,13 +103,36 @@ */ writeHtml : function( writer ) { + var attributes = this.attributes; + + // The "_cke_realelement" attribute indicates that the current + // element is a placeholder for another element. + if ( attributes._cke_realelement ) + { + var realFragment = new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( attributes._cke_realelement ) ); + realFragment.writeHtml( writer ); + return; + } + + // The "_cke_replacedata" indicates that this element is replacing + // a data snippet, which should be outputted as is. + if ( attributes._cke_replacedata ) + { + writer.write( attributes._cke_replacedata ); + return; + } + // Open element tag. writer.openTag( this.name, this.attributes ); // Copy all attributes to an array. var attribsArray = []; - for ( var a in this.attributes ) - attribsArray.push( [ a, this.attributes[ a ] ] ); + for ( var a in attributes ) + { + // Ignore all attributes starting with "_cke". + if ( !/^_cke/.test( a ) ) + attribsArray.push( [ a, this.attributes[ a ] ] ); + } // Sort the attributes by name. attribsArray.sort( sortAttribs ); @@ -112,9 +141,6 @@ for ( var i = 0, len = attribsArray.length ; i < len ; i++ ) { var attrib = attribsArray[ i ]; - // IE's treated expand fields as dom attributes, skip it - if ( CKEDITOR.env.ie && attrib === '_cke_expando' ) - continue; writer.attribute( attrib[0], attrib[1] ); } Index: _source/plugins/fakeobjects/plugin.js =================================================================== --- _source/plugins/fakeobjects/plugin.js (revision 0) +++ _source/plugins/fakeobjects/plugin.js (revision 0) @@ -0,0 +1,19 @@ +/* +Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.plugins.add( 'fakeobjects' ); + +CKEDITOR.editor.prototype.createFakeElement = function( realElement, className ) +{ + return this.document.createElement( 'img', + { + attributes : + { + 'class' : className, + src : CKEDITOR.getUrl( 'images/spacer.gif' ), + _cke_realelement : encodeURIComponent( realElement.getOuterHtml() ) + } + }); +}; Index: _source/plugins/htmlwriter/plugin.js =================================================================== --- _source/plugins/htmlwriter/plugin.js (revision 3025) +++ _source/plugins/htmlwriter/plugin.js (working copy) @@ -225,7 +225,7 @@ /** * Writes the current indentation chars. It uses the * {@link #indentationChars} property, repeating it for the current - * intentation steps. + * indentation steps. * @example * // Writes "\t" (e.g.). * writer.indentation(); @@ -237,6 +237,16 @@ }, /** + * Writes any kind of data to the ouput. + * @example + * writer.write( 'This is an <b>example</b>.' ); + */ + write : function( data ) + { + this._.output.push( data ); + }, + + /** * Empties the current output buffer. * @example * writer.reset(); Index: _source/plugins/pagebreak/images/pagebreak.gif =================================================================== 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 Index: _source/plugins/pagebreak/plugin.js =================================================================== --- _source/plugins/pagebreak/plugin.js (revision 0) +++ _source/plugins/pagebreak/plugin.js (revision 0) @@ -0,0 +1,83 @@ +/* +Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +/** + * @file Horizontal Page Break + */ + +// Register a plugin named "pagebreak". +CKEDITOR.plugins.add( 'pagebreak', +{ + init : function( editor ) + { + // Register the command. + editor.addCommand( 'pagebreak', CKEDITOR.plugins.pagebreakCmd ); + + // Register the toolbar button. + editor.ui.addButton( 'PageBreak', + { + label : editor.lang.pagebreak, + command : 'pagebreak' + }); + + // Add the style that renders our placeholder. + editor.addCss( + 'img.cke_pagebreak' + + '{' + + 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/pagebreak.gif' ) + ');' + + 'background-position: center center;' + + 'background-repeat: no-repeat;' + + 'clear: both;' + + 'display: block;' + + 'float: none;' + + 'width: 100%;' + + 'border-top: #999999 1px dotted;' + + 'border-bottom: #999999 1px dotted;' + + 'height: 5px;' + + + '}' ); + + // Listen for the "contentDom" event, so the document can be fixed to + // display the placeholders. + editor.on( 'contentDom', function() + { + var divs = editor.document.getBody().getElementsByTag( 'div' ); + for ( var div, i = 0, length = divs.count() ; i < length ; i++ ) + { + div = divs.getItem( i ); + if ( div.getStyle( 'page-break-after' ) == 'always' && !/[^\s\u00A0]/.test( div.getText() ) ) + { + editor.createFakeElement( div, 'cke_pagebreak' ).replace( div ); + } + } + }); + }, + requires : [ 'fakeobjects' ] +}); + +CKEDITOR.plugins.pagebreakCmd = +{ + exec : function( editor ) + { + // Create the element that represents a print break. + var breakObject = CKEDITOR.dom.element.createFromHtml( '