CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/plugins/pagebreak/plugin.js



/*
Copyright (c) 2003-2010, 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.getUrlthis.path 'images/pagebreak.gif' ) + ');
			' +
			                'background-position: center center;
			' +
			                'background-repeat: no-repeat;
			' +
			                'clear: both;
			' +
			                'display: block;
			' +
			                'float: none;
			' +
			                'width:100% !important;
			 _width:99.9% !important;
			' +
			                'border-top: #999999 1px dotted;
			' +
			                'border-bottom: #999999 1px dotted;
			' +
			                'height: 5px !important;
			' +
			                'page-break-after: always;
			' +
			            '}' );
		    },
	    afterInit : function( editor )
	    {
		        // Register a filter to displaying placeholders after mode change.
		        var dataProcessor editor.dataProcessor,
		            dataFilter dataProcessor && dataProcessor.dataFilter;
		        if ( dataFilter )
		        {
			            dataFilter.addRules(
			                {
				                    elements :
				                    {
					                        div : function( element )
					                        {
						                            var attributes element.attributes,
						                                style attributes && attributes.style,
						                                child style && element.children.length == && element.children],
						                                childStyle child && ( child.name == 'span' ) && child.attributes.style;
						                            if ( childStyle && ( /page-break-after\s*:\s*always/).teststyle ) && ( /display\s*:\s*none/).testchildStyle ) )
						                            {
							                                var fakeImg editor.createFakeParserElementelement'cke_pagebreak''div' );
							                                var label editor.lang.pagebreakAlt;
							                                fakeImg.attributes'alt' ] = label;
							                                fakeImg.attributes'aria-label' ] = label;
							                                return fakeImg;
							                            }
						                        }
					                    }
				                });
			        }
		    },
	    requires : [ 'fakeobjects' ]
	});
CKEDITOR.plugins.pagebreakCmd =
{
	    exec : function( editor )
	    {
		        // Create the element that represents a print break.
		        var label editor.lang.pagebreakAlt;
		        var breakObject CKEDITOR.dom.element.createFromHtml'<div style="page-break-after: always;
		"><span style="display: none;
		">&nbsp;
		</span></div>' );
		        // Creates the fake image used for this element.
		        breakObject editor.createFakeElementbreakObject'cke_pagebreak''div' );
		        breakObject.setAttribute'alt'label );
		        breakObject.setAttribute'aria-label'label );
		        var ranges editor.getSelection().getRangestrue );
		        editor.fire'saveSnapshot' );
		        for ( var rangeranges.length ;
		 >= 0;
		 i-- )
		        {
			            range ranges];
			            if ( ranges.length -)
			                breakObject breakObject.clone( true );
			            range.splitBlock'p' );
			            range.insertNodebreakObject );
			            if ( == ranges.length )
			            {
				                range.moveToPositionbreakObjectCKEDITOR.POSITION_AFTER_END );
				                range.select();
				            }
			            var previous breakObject.getPrevious();
			            if ( previous && CKEDITOR.dtdprevious.getName() ].div )
			                breakObject.moveprevious );
			        }
		        editor.fire'saveSnapshot' );
		    }
	};





PHP Demo Source Code Index