code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var imageDialog = function( editor, dialogType ) { // Load image preview. var IMAGE = 1, LINK = 2, PREVIEW = 4, CLEANUP = 8, regexGetSize = /^\s*(\d+)((px)|\%)?\s*$/i, regexGetSizeOrEmpty = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i, pxLengthRegex = /^\d+px$/; var onSizeChange = function() { var value = this.getValue(), // This = input element. dialog = this.getDialog(), aMatch = value.match( regexGetSize ); // Check value if ( aMatch ) { if ( aMatch[2] == '%' ) // % is allowed - > unlock ratio. switchLockRatio( dialog, false ); // Unlock. value = aMatch[1]; } // Only if ratio is locked if ( dialog.lockRatio ) { var oImageOriginal = dialog.originalElement; if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { if ( this.id == 'txtHeight' ) { if ( value && value != '0' ) value = Math.round( oImageOriginal.$.width * ( value / oImageOriginal.$.height ) ); if ( !isNaN( value ) ) dialog.setValueOf( 'info', 'txtWidth', value ); } else //this.id = txtWidth. { if ( value && value != '0' ) value = Math.round( oImageOriginal.$.height * ( value / oImageOriginal.$.width ) ); if ( !isNaN( value ) ) dialog.setValueOf( 'info', 'txtHeight', value ); } } } updatePreview( dialog ); }; var updatePreview = function( dialog ) { //Don't load before onShow. if ( !dialog.originalElement || !dialog.preview ) return 1; // Read attributes and update imagePreview; dialog.commitContent( PREVIEW, dialog.preview ); return 0; }; // Custom commit dialog logic, where we're intended to give inline style // field (txtdlgGenStyle) higher priority to avoid overwriting styles contribute // by other fields. function commitContent() { var args = arguments; var inlineStyleField = this.getContentElement( 'advanced', 'txtdlgGenStyle' ); inlineStyleField && inlineStyleField.commit.apply( inlineStyleField, args ); this.foreach( function( widget ) { if ( widget.commit && widget.id != 'txtdlgGenStyle' ) widget.commit.apply( widget, args ); }); } // Avoid recursions. var incommit; // Synchronous field values to other impacted fields is required, e.g. border // size change should alter inline-style text as well. function commitInternally( targetFields ) { if ( incommit ) return; incommit = 1; var dialog = this.getDialog(), element = dialog.imageElement; if ( element ) { // Commit this field and broadcast to target fields. this.commit( IMAGE, element ); targetFields = [].concat( targetFields ); var length = targetFields.length, field; for ( var i = 0; i < length; i++ ) { field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) ); // May cause recursion. field && field.setup( IMAGE, element ); } } incommit = 0; } var switchLockRatio = function( dialog, value ) { if ( !dialog.getContentElement( 'info', 'ratioLock' ) ) return null; var oImageOriginal = dialog.originalElement; // Dialog may already closed. (#5505) if( !oImageOriginal ) return null; // Check image ratio and original image ratio, but respecting user's preference. if ( value == 'check' ) { if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { var width = dialog.getValueOf( 'info', 'txtWidth' ), height = dialog.getValueOf( 'info', 'txtHeight' ), originalRatio = oImageOriginal.$.width * 1000 / oImageOriginal.$.height, thisRatio = width * 1000 / height; dialog.lockRatio = false; // Default: unlock ratio if ( !width && !height ) dialog.lockRatio = true; else if ( !isNaN( originalRatio ) && !isNaN( thisRatio ) ) { if ( Math.round( originalRatio ) == Math.round( thisRatio ) ) dialog.lockRatio = true; } } } else if ( value != undefined ) dialog.lockRatio = value; else { dialog.userlockRatio = 1; dialog.lockRatio = !dialog.lockRatio; } var ratioButton = CKEDITOR.document.getById( btnLockSizesId ); if ( dialog.lockRatio ) ratioButton.removeClass( 'cke_btn_unlocked' ); else ratioButton.addClass( 'cke_btn_unlocked' ); ratioButton.setAttribute( 'aria-checked', dialog.lockRatio ); // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE if ( CKEDITOR.env.hc ) { var icon = ratioButton.getChild( 0 ); icon.setHtml( dialog.lockRatio ? CKEDITOR.env.ie ? '\u25A0': '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' ); } return dialog.lockRatio; }; var resetSize = function( dialog ) { var oImageOriginal = dialog.originalElement; if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { var widthField = dialog.getContentElement( 'info', 'txtWidth' ), heightField = dialog.getContentElement( 'info', 'txtHeight' ); widthField && widthField.setValue( oImageOriginal.$.width ); heightField && heightField.setValue( oImageOriginal.$.height ); } updatePreview( dialog ); }; var setupDimension = function( type, element ) { if ( type != IMAGE ) return; function checkDimension( size, defaultValue ) { var aMatch = size.match( regexGetSize ); if ( aMatch ) { if ( aMatch[2] == '%' ) // % is allowed. { aMatch[1] += '%'; switchLockRatio( dialog, false ); // Unlock ratio } return aMatch[1]; } return defaultValue; } var dialog = this.getDialog(), value = '', dimension = this.id == 'txtWidth' ? 'width' : 'height', size = element.getAttribute( dimension ); if ( size ) value = checkDimension( size, value ); value = checkDimension( element.getStyle( dimension ), value ); this.setValue( value ); }; var previewPreloader; var onImgLoadEvent = function() { // Image is ready. var original = this.originalElement; original.setCustomData( 'isReady', 'true' ); original.removeListener( 'load', onImgLoadEvent ); original.removeListener( 'error', onImgLoadErrorEvent ); original.removeListener( 'abort', onImgLoadErrorEvent ); // Hide loader CKEDITOR.document.getById( imagePreviewLoaderId ).setStyle( 'display', 'none' ); // New image -> new domensions if ( !this.dontResetSize ) resetSize( this ); if ( this.firstLoad ) CKEDITOR.tools.setTimeout( function(){ switchLockRatio( this, 'check' ); }, 0, this ); this.firstLoad = false; this.dontResetSize = false; }; var onImgLoadErrorEvent = function() { // Error. Image is not loaded. var original = this.originalElement; original.removeListener( 'load', onImgLoadEvent ); original.removeListener( 'error', onImgLoadErrorEvent ); original.removeListener( 'abort', onImgLoadErrorEvent ); // Set Error image. var noimage = CKEDITOR.getUrl( editor.skinPath + 'images/noimage.png' ); if ( this.preview ) this.preview.setAttribute( 'src', noimage ); // Hide loader CKEDITOR.document.getById( imagePreviewLoaderId ).setStyle( 'display', 'none' ); switchLockRatio( this, false ); // Unlock. }; var numbering = function( id ) { return CKEDITOR.tools.getNextId() + '_' + id; }, btnLockSizesId = numbering( 'btnLockSizes' ), btnResetSizeId = numbering( 'btnResetSize' ), imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ), imagePreviewBoxId = numbering( 'ImagePreviewBox' ), previewLinkId = numbering( 'previewLink' ), previewImageId = numbering( 'previewImage' ); return { title : editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ], minWidth : 420, minHeight : 360, onShow : function() { this.imageElement = false; this.linkElement = false; // Default: create a new element. this.imageEditMode = false; this.linkEditMode = false; this.lockRatio = true; this.userlockRatio = 0; this.dontResetSize = false; this.firstLoad = true; this.addLink = false; var editor = this.getParentEditor(), sel = this.getParentEditor().getSelection(), element = sel.getSelectedElement(), link = element && element.getAscendant( 'a' ); //Hide loader. CKEDITOR.document.getById( imagePreviewLoaderId ).setStyle( 'display', 'none' ); // Create the preview before setup the dialog contents. previewPreloader = new CKEDITOR.dom.element( 'img', editor.document ); this.preview = CKEDITOR.document.getById( previewImageId ); // Copy of the image this.originalElement = editor.document.createElement( 'img' ); this.originalElement.setAttribute( 'alt', '' ); this.originalElement.setCustomData( 'isReady', 'false' ); if ( link ) { this.linkElement = link; this.linkEditMode = true; // Look for Image element. var linkChildren = link.getChildren(); if ( linkChildren.count() == 1 ) // 1 child. { var childTagName = linkChildren.getItem( 0 ).getName(); if ( childTagName == 'img' || childTagName == 'input' ) { this.imageElement = linkChildren.getItem( 0 ); if ( this.imageElement.getName() == 'img' ) this.imageEditMode = 'img'; else if ( this.imageElement.getName() == 'input' ) this.imageEditMode = 'input'; } } // Fill out all fields. if ( dialogType == 'image' ) this.setupContent( LINK, link ); } if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' ) || element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' ) { this.imageEditMode = element.getName(); this.imageElement = element; } if ( this.imageEditMode ) { // Use the original element as a buffer from since we don't want // temporary changes to be committed, e.g. if the dialog is canceled. this.cleanImageElement = this.imageElement; this.imageElement = this.cleanImageElement.clone( true, true ); // Fill out all fields. this.setupContent( IMAGE, this.imageElement ); } else this.imageElement = editor.document.createElement( 'img' ); // Refresh LockRatio button switchLockRatio ( this, true ); // Dont show preview if no URL given. if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) ) { this.preview.removeAttribute( 'src' ); this.preview.setStyle( 'display', 'none' ); } }, onOk : function() { // Edit existing Image. if ( this.imageEditMode ) { var imgTagName = this.imageEditMode; // Image dialog and Input element. if ( dialogType == 'image' && imgTagName == 'input' && confirm( editor.lang.image.button2Img ) ) { // Replace INPUT-> IMG imgTagName = 'img'; this.imageElement = editor.document.createElement( 'img' ); this.imageElement.setAttribute( 'alt', '' ); editor.insertElement( this.imageElement ); } // ImageButton dialog and Image element. else if ( dialogType != 'image' && imgTagName == 'img' && confirm( editor.lang.image.img2Button )) { // Replace IMG -> INPUT imgTagName = 'input'; this.imageElement = editor.document.createElement( 'input' ); this.imageElement.setAttributes( { type : 'image', alt : '' } ); editor.insertElement( this.imageElement ); } else { // Restore the original element before all commits. this.imageElement = this.cleanImageElement; delete this.cleanImageElement; } } else // Create a new image. { // Image dialog -> create IMG element. if ( dialogType == 'image' ) this.imageElement = editor.document.createElement( 'img' ); else { this.imageElement = editor.document.createElement( 'input' ); this.imageElement.setAttribute ( 'type' ,'image' ); } this.imageElement.setAttribute( 'alt', '' ); } // Create a new link. if ( !this.linkEditMode ) this.linkElement = editor.document.createElement( 'a' ); // Set attributes. this.commitContent( IMAGE, this.imageElement ); this.commitContent( LINK, this.linkElement ); // Remove empty style attribute. if ( !this.imageElement.getAttribute( 'style' ) ) this.imageElement.removeAttribute( 'style' ); // Insert a new Image. if ( !this.imageEditMode ) { if ( this.addLink ) { //Insert a new Link. if ( !this.linkEditMode ) { editor.insertElement( this.linkElement ); this.linkElement.append( this.imageElement, false ); } else //Link already exists, image not. editor.insertElement( this.imageElement ); } else editor.insertElement( this.imageElement ); } else // Image already exists. { //Add a new link element. if ( !this.linkEditMode && this.addLink ) { editor.insertElement( this.linkElement ); this.imageElement.appendTo( this.linkElement ); } //Remove Link, Image exists. else if ( this.linkEditMode && !this.addLink ) { editor.getSelection().selectElement( this.linkElement ); editor.insertElement( this.imageElement ); } } }, onLoad : function() { if ( dialogType != 'image' ) this.hidePage( 'Link' ); //Hide Link tab. var doc = this._.element.getDocument(); if ( this.getContentElement( 'info', 'ratioLock' ) ) { this.addFocusable( doc.getById( btnResetSizeId ), 5 ); this.addFocusable( doc.getById( btnLockSizesId ), 5 ); } this.commitContent = commitContent; }, onHide : function() { if ( this.preview ) this.commitContent( CLEANUP, this.preview ); if ( this.originalElement ) { this.originalElement.removeListener( 'load', onImgLoadEvent ); this.originalElement.removeListener( 'error', onImgLoadErrorEvent ); this.originalElement.removeListener( 'abort', onImgLoadErrorEvent ); this.originalElement.remove(); this.originalElement = false; // Dialog is closed. } delete this.imageElement; }, contents : [ { id : 'info', label : editor.lang.image.infoTab, accessKey : 'I', elements : [ { type : 'vbox', padding : 0, children : [ { type : 'hbox', widths : [ '280px', '110px' ], align : 'right', children : [ { id : 'txtUrl', type : 'text', label : editor.lang.common.url, required: true, onChange : function() { var dialog = this.getDialog(), newUrl = this.getValue(); //Update original image if ( newUrl.length > 0 ) //Prevent from load before onShow { dialog = this.getDialog(); var original = dialog.originalElement; dialog.preview.removeStyle( 'display' ); original.setCustomData( 'isReady', 'false' ); // Show loader var loader = CKEDITOR.document.getById( imagePreviewLoaderId ); if ( loader ) loader.setStyle( 'display', '' ); original.on( 'load', onImgLoadEvent, dialog ); original.on( 'error', onImgLoadErrorEvent, dialog ); original.on( 'abort', onImgLoadErrorEvent, dialog ); original.setAttribute( 'src', newUrl ); // Query the preloader to figure out the url impacted by based href. previewPreloader.setAttribute( 'src', newUrl ); dialog.preview.setAttribute( 'src', previewPreloader.$.src ); updatePreview( dialog ); } // Dont show preview if no URL given. else if ( dialog.preview ) { dialog.preview.removeAttribute( 'src' ); dialog.preview.setStyle( 'display', 'none' ); } }, setup : function( type, element ) { if ( type == IMAGE ) { var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' ); var field = this; this.getDialog().dontResetSize = true; field.setValue( url ); // And call this.onChange() // Manually set the initial value.(#4191) field.setInitValue(); } }, commit : function( type, element ) { if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) { element.data( 'cke-saved-src', this.getValue() ); element.setAttribute( 'src', this.getValue() ); } else if ( type == CLEANUP ) { element.setAttribute( 'src', '' ); // If removeAttribute doesn't work. element.removeAttribute( 'src' ); } }, validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing ) }, { type : 'button', id : 'browse', // v-align with the 'txtUrl' field. // TODO: We need something better than a fixed size here. style : 'display:inline-block;margin-top:10px;', align : 'center', label : editor.lang.common.browseServer, hidden : true, filebrowser : 'info:txtUrl' } ] } ] }, { id : 'txtAlt', type : 'text', label : editor.lang.image.alt, accessKey : 'T', 'default' : '', onChange : function() { updatePreview( this.getDialog() ); }, setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'alt' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'alt', this.getValue() ); } else if ( type == PREVIEW ) { element.setAttribute( 'alt', this.getValue() ); } else if ( type == CLEANUP ) { element.removeAttribute( 'alt' ); } } }, { type : 'hbox', children : [ { id : 'basic', type : 'vbox', children : [ { type : 'hbox', widths : [ '50%', '50%' ], children : [ { type : 'vbox', padding : 1, children : [ { type : 'text', width: '40px', id : 'txtWidth', label : editor.lang.common.width, onKeyUp : onSizeChange, onChange : function() { commitInternally.call( this, 'advanced:txtdlgGenStyle' ); }, validate : function() { var aMatch = this.getValue().match( regexGetSizeOrEmpty ), isValid = !!( aMatch && parseInt( aMatch[1], 10 ) !== 0 ); if ( !isValid ) alert( editor.lang.common.invalidWidth ); return isValid; }, setup : setupDimension, commit : function( type, element, internalCommit ) { var value = this.getValue(); if ( type == IMAGE ) { if ( value ) element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) ); else element.removeStyle( 'width' ); !internalCommit && element.removeAttribute( 'width' ); } else if ( type == PREVIEW ) { var aMatch = value.match( regexGetSize ); if ( !aMatch ) { var oImageOriginal = this.getDialog().originalElement; if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) element.setStyle( 'width', oImageOriginal.$.width + 'px'); } else element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) ); } else if ( type == CLEANUP ) { element.removeAttribute( 'width' ); element.removeStyle( 'width' ); } } }, { type : 'text', id : 'txtHeight', width: '40px', label : editor.lang.common.height, onKeyUp : onSizeChange, onChange : function() { commitInternally.call( this, 'advanced:txtdlgGenStyle' ); }, validate : function() { var aMatch = this.getValue().match( regexGetSizeOrEmpty ), isValid = !!( aMatch && parseInt( aMatch[1], 10 ) !== 0 ); if ( !isValid ) alert( editor.lang.common.invalidHeight ); return isValid; }, setup : setupDimension, commit : function( type, element, internalCommit ) { var value = this.getValue(); if ( type == IMAGE ) { if ( value ) element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) ); else element.removeStyle( 'height' ); !internalCommit && element.removeAttribute( 'height' ); } else if ( type == PREVIEW ) { var aMatch = value.match( regexGetSize ); if ( !aMatch ) { var oImageOriginal = this.getDialog().originalElement; if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) element.setStyle( 'height', oImageOriginal.$.height + 'px' ); } else element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) ); } else if ( type == CLEANUP ) { element.removeAttribute( 'height' ); element.removeStyle( 'height' ); } } } ] }, { id : 'ratioLock', type : 'html', style : 'margin-top:30px;width:40px;height:40px;', onLoad : function() { // Activate Reset button var resetButton = CKEDITOR.document.getById( btnResetSizeId ), ratioButton = CKEDITOR.document.getById( btnLockSizesId ); if ( resetButton ) { resetButton.on( 'click', function( evt ) { resetSize( this ); evt.data && evt.data.preventDefault(); }, this.getDialog() ); resetButton.on( 'mouseover', function() { this.addClass( 'cke_btn_over' ); }, resetButton ); resetButton.on( 'mouseout', function() { this.removeClass( 'cke_btn_over' ); }, resetButton ); } // Activate (Un)LockRatio button if ( ratioButton ) { ratioButton.on( 'click', function(evt) { var locked = switchLockRatio( this ), oImageOriginal = this.originalElement, width = this.getValueOf( 'info', 'txtWidth' ); if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' && width ) { var height = oImageOriginal.$.height / oImageOriginal.$.width * width; if ( !isNaN( height ) ) { this.setValueOf( 'info', 'txtHeight', Math.round( height ) ); updatePreview( this ); } } evt.data && evt.data.preventDefault(); }, this.getDialog() ); ratioButton.on( 'mouseover', function() { this.addClass( 'cke_btn_over' ); }, ratioButton ); ratioButton.on( 'mouseout', function() { this.removeClass( 'cke_btn_over' ); }, ratioButton ); } }, html : '<div>'+ '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.lockRatio + '" class="cke_btn_locked" id="' + btnLockSizesId + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + editor.lang.image.lockRatio + '</span></a>' + '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.resetSize + '" class="cke_btn_reset" id="' + btnResetSizeId + '" role="button"><span class="cke_label">' + editor.lang.image.resetSize + '</span></a>'+ '</div>' } ] }, { type : 'vbox', padding : 1, children : [ { type : 'text', id : 'txtBorder', width: '60px', label : editor.lang.image.border, 'default' : '', onKeyUp : function() { updatePreview( this.getDialog() ); }, onChange : function() { commitInternally.call( this, 'advanced:txtdlgGenStyle' ); }, validate : CKEDITOR.dialog.validate.integer( editor.lang.image.validateBorder ), setup : function( type, element ) { if ( type == IMAGE ) { var value, borderStyle = element.getStyle( 'border-width' ); borderStyle = borderStyle && borderStyle.match( /^(\d+px)(?: \1 \1 \1)?$/ ); value = borderStyle && parseInt( borderStyle[ 1 ], 10 ); isNaN ( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'border' ) ); this.setValue( value ); } }, commit : function( type, element, internalCommit ) { var value = parseInt( this.getValue(), 10 ); if ( type == IMAGE || type == PREVIEW ) { if ( !isNaN( value ) ) { element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) ); element.setStyle( 'border-style', 'solid' ); } else if ( !value && this.isChanged() ) { element.removeStyle( 'border-width' ); element.removeStyle( 'border-style' ); element.removeStyle( 'border-color' ); } if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'border' ); } else if ( type == CLEANUP ) { element.removeAttribute( 'border' ); element.removeStyle( 'border-width' ); element.removeStyle( 'border-style' ); element.removeStyle( 'border-color' ); } } }, { type : 'text', id : 'txtHSpace', width: '60px', label : editor.lang.image.hSpace, 'default' : '', onKeyUp : function() { updatePreview( this.getDialog() ); }, onChange : function() { commitInternally.call( this, 'advanced:txtdlgGenStyle' ); }, validate : CKEDITOR.dialog.validate.integer( editor.lang.image.validateHSpace ), setup : function( type, element ) { if ( type == IMAGE ) { var value, marginLeftPx, marginRightPx, marginLeftStyle = element.getStyle( 'margin-left' ), marginRightStyle = element.getStyle( 'margin-right' ); marginLeftStyle = marginLeftStyle && marginLeftStyle.match( pxLengthRegex ); marginRightStyle = marginRightStyle && marginRightStyle.match( pxLengthRegex ); marginLeftPx = parseInt( marginLeftStyle, 10 ); marginRightPx = parseInt( marginRightStyle, 10 ); value = ( marginLeftPx == marginRightPx ) && marginLeftPx; isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'hspace' ) ); this.setValue( value ); } }, commit : function( type, element, internalCommit ) { var value = parseInt( this.getValue(), 10 ); if ( type == IMAGE || type == PREVIEW ) { if ( !isNaN( value ) ) { element.setStyle( 'margin-left', CKEDITOR.tools.cssLength( value ) ); element.setStyle( 'margin-right', CKEDITOR.tools.cssLength( value ) ); } else if ( !value && this.isChanged( ) ) { element.removeStyle( 'margin-left' ); element.removeStyle( 'margin-right' ); } if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'hspace' ); } else if ( type == CLEANUP ) { element.removeAttribute( 'hspace' ); element.removeStyle( 'margin-left' ); element.removeStyle( 'margin-right' ); } } }, { type : 'text', id : 'txtVSpace', width : '60px', label : editor.lang.image.vSpace, 'default' : '', onKeyUp : function() { updatePreview( this.getDialog() ); }, onChange : function() { commitInternally.call( this, 'advanced:txtdlgGenStyle' ); }, validate : CKEDITOR.dialog.validate.integer( editor.lang.image.validateVSpace ), setup : function( type, element ) { if ( type == IMAGE ) { var value, marginTopPx, marginBottomPx, marginTopStyle = element.getStyle( 'margin-top' ), marginBottomStyle = element.getStyle( 'margin-bottom' ); marginTopStyle = marginTopStyle && marginTopStyle.match( pxLengthRegex ); marginBottomStyle = marginBottomStyle && marginBottomStyle.match( pxLengthRegex ); marginTopPx = parseInt( marginTopStyle, 10 ); marginBottomPx = parseInt( marginBottomStyle, 10 ); value = ( marginTopPx == marginBottomPx ) && marginTopPx; isNaN ( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'vspace' ) ); this.setValue( value ); } }, commit : function( type, element, internalCommit ) { var value = parseInt( this.getValue(), 10 ); if ( type == IMAGE || type == PREVIEW ) { if ( !isNaN( value ) ) { element.setStyle( 'margin-top', CKEDITOR.tools.cssLength( value ) ); element.setStyle( 'margin-bottom', CKEDITOR.tools.cssLength( value ) ); } else if ( !value && this.isChanged( ) ) { element.removeStyle( 'margin-top' ); element.removeStyle( 'margin-bottom' ); } if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'vspace' ); } else if ( type == CLEANUP ) { element.removeAttribute( 'vspace' ); element.removeStyle( 'margin-top' ); element.removeStyle( 'margin-bottom' ); } } }, { id : 'cmbAlign', type : 'select', widths : [ '35%','65%' ], style : 'width:90px', label : editor.lang.common.align, 'default' : '', items : [ [ editor.lang.common.notSet , ''], [ editor.lang.common.alignLeft , 'left'], [ editor.lang.common.alignRight , 'right'] // Backward compatible with v2 on setup when specified as attribute value, // while these values are no more available as select options. // [ editor.lang.image.alignAbsBottom , 'absBottom'], // [ editor.lang.image.alignAbsMiddle , 'absMiddle'], // [ editor.lang.image.alignBaseline , 'baseline'], // [ editor.lang.image.alignTextTop , 'text-top'], // [ editor.lang.image.alignBottom , 'bottom'], // [ editor.lang.image.alignMiddle , 'middle'], // [ editor.lang.image.alignTop , 'top'] ], onChange : function() { updatePreview( this.getDialog() ); commitInternally.call( this, 'advanced:txtdlgGenStyle' ); }, setup : function( type, element ) { if ( type == IMAGE ) { var value = element.getStyle( 'float' ); switch( value ) { // Ignore those unrelated values. case 'inherit': case 'none': value = ''; } !value && ( value = ( element.getAttribute( 'align' ) || '' ).toLowerCase() ); this.setValue( value ); } }, commit : function( type, element, internalCommit ) { var value = this.getValue(); if ( type == IMAGE || type == PREVIEW ) { if ( value ) element.setStyle( 'float', value ); else element.removeStyle( 'float' ); if ( !internalCommit && type == IMAGE ) { value = ( element.getAttribute( 'align' ) || '' ).toLowerCase(); switch( value ) { // we should remove it only if it matches "left" or "right", // otherwise leave it intact. case 'left': case 'right': element.removeAttribute( 'align' ); } } } else if ( type == CLEANUP ) element.removeStyle( 'float' ); } } ] } ] }, { type : 'vbox', height : '250px', children : [ { type : 'html', id : 'htmlPreview', style : 'width:95%;', html : '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) +'<br>'+ '<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading">&nbsp;</div></div>'+ '<div id="' + imagePreviewBoxId + '" class="ImagePreviewBox"><table><tr><td>'+ '<a href="javascript:void(0)" target="_blank" onclick="return false;" id="' + previewLinkId + '">'+ '<img id="' + previewImageId + '" alt="" /></a>' + ( editor.config.image_previewText || 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. '+ 'Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, '+ 'nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.' ) + '</td></tr></table></div></div>' } ] } ] } ] }, { id : 'Link', label : editor.lang.link.title, padding : 0, elements : [ { id : 'txtUrl', type : 'text', label : editor.lang.common.url, style : 'width: 100%', 'default' : '', setup : function( type, element ) { if ( type == LINK ) { var href = element.data( 'cke-saved-href' ); if ( !href ) href = element.getAttribute( 'href' ); this.setValue( href ); } }, commit : function( type, element ) { if ( type == LINK ) { if ( this.getValue() || this.isChanged() ) { var url = decodeURI( this.getValue() ); element.data( 'cke-saved-href', url ); element.setAttribute( 'href', url ); if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL ) this.getDialog().addLink = true; } } } }, { type : 'button', id : 'browse', filebrowser : { action : 'Browse', target: 'Link:txtUrl', url: editor.config.filebrowserImageBrowseLinkUrl }, style : 'float:right', hidden : true, label : editor.lang.common.browseServer }, { id : 'cmbTarget', type : 'select', label : editor.lang.common.target, 'default' : '', items : [ [ editor.lang.common.notSet , ''], [ editor.lang.common.targetNew , '_blank'], [ editor.lang.common.targetTop , '_top'], [ editor.lang.common.targetSelf , '_self'], [ editor.lang.common.targetParent , '_parent'] ], setup : function( type, element ) { if ( type == LINK ) this.setValue( element.getAttribute( 'target' ) || '' ); }, commit : function( type, element ) { if ( type == LINK ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'target', this.getValue() ); } } } ] }, { id : 'Upload', hidden : true, filebrowser : 'uploadButton', label : editor.lang.image.upload, elements : [ { type : 'file', id : 'upload', label : editor.lang.image.btnUpload, style: 'height:40px', size : 38 }, { type : 'fileButton', id : 'uploadButton', filebrowser : 'info:txtUrl', label : editor.lang.image.btnUpload, 'for' : [ 'Upload', 'upload' ] } ] }, { id : 'advanced', label : editor.lang.common.advancedTab, elements : [ { type : 'hbox', widths : [ '50%', '25%', '25%' ], children : [ { type : 'text', id : 'linkId', label : editor.lang.common.id, setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'id' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'id', this.getValue() ); } } }, { id : 'cmbLangDir', type : 'select', style : 'width : 100px;', label : editor.lang.common.langDir, 'default' : '', items : [ [ editor.lang.common.notSet, '' ], [ editor.lang.common.langDirLtr, 'ltr' ], [ editor.lang.common.langDirRtl, 'rtl' ] ], setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'dir' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'dir', this.getValue() ); } } }, { type : 'text', id : 'txtLangCode', label : editor.lang.common.langCode, 'default' : '', setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'lang' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'lang', this.getValue() ); } } } ] }, { type : 'text', id : 'txtGenLongDescr', label : editor.lang.common.longDescr, setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'longDesc' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'longDesc', this.getValue() ); } } }, { type : 'hbox', widths : [ '50%', '50%' ], children : [ { type : 'text', id : 'txtGenClass', label : editor.lang.common.cssClass, 'default' : '', setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'class' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'class', this.getValue() ); } } }, { type : 'text', id : 'txtGenTitle', label : editor.lang.common.advisoryTitle, 'default' : '', onChange : function() { updatePreview( this.getDialog() ); }, setup : function( type, element ) { if ( type == IMAGE ) this.setValue( element.getAttribute( 'title' ) ); }, commit : function( type, element ) { if ( type == IMAGE ) { if ( this.getValue() || this.isChanged() ) element.setAttribute( 'title', this.getValue() ); } else if ( type == PREVIEW ) { element.setAttribute( 'title', this.getValue() ); } else if ( type == CLEANUP ) { element.removeAttribute( 'title' ); } } } ] }, { type : 'text', id : 'txtdlgGenStyle', label : editor.lang.common.cssStyle, validate : CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ), 'default' : '', setup : function( type, element ) { if ( type == IMAGE ) { var genStyle = element.getAttribute( 'style' ); if ( !genStyle && element.$.style.cssText ) genStyle = element.$.style.cssText; this.setValue( genStyle ); var height = element.$.style.height, width = element.$.style.width, aMatchH = ( height ? height : '' ).match( regexGetSize ), aMatchW = ( width ? width : '').match( regexGetSize ); this.attributesInStyle = { height : !!aMatchH, width : !!aMatchW }; } }, onChange : function () { commitInternally.call( this, [ 'info:cmbFloat', 'info:cmbAlign', 'info:txtVSpace', 'info:txtHSpace', 'info:txtBorder', 'info:txtWidth', 'info:txtHeight' ] ); updatePreview( this ); }, commit : function( type, element ) { if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) { element.setAttribute( 'style', this.getValue() ); } } } ] } ] }; }; CKEDITOR.dialog.add( 'image', function( editor ) { return imageDialog( editor, 'image' ); }); CKEDITOR.dialog.add( 'imagebutton', function( editor ) { return imageDialog( editor, 'imagebutton' ); }); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/image/dialogs/image.js
JavaScript
asf20
47,241
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Insert and remove numbered and bulleted lists. */ (function() { var listNodeNames = { ol : 1, ul : 1 }, emptyTextRegex = /^[\n\r\t ]*$/; var whitespaces = CKEDITOR.dom.walker.whitespaces(), bookmarks = CKEDITOR.dom.walker.bookmark(), nonEmpty = function( node ){ return !( whitespaces( node ) || bookmarks( node ) ); }; function cleanUpDirection( element ) { var dir, parent, parentDir; if ( ( dir = element.getDirection() ) ) { parent = element.getParent(); while ( parent && !( parentDir = parent.getDirection() ) ) parent = parent.getParent(); if ( dir == parentDir ) element.removeAttribute( 'dir' ); } } CKEDITOR.plugins.list = { /* * Convert a DOM list tree into a data structure that is easier to * manipulate. This operation should be non-intrusive in the sense that it * does not change the DOM tree, with the exception that it may add some * markers to the list item nodes when database is specified. */ listToArray : function( listNode, database, baseArray, baseIndentLevel, grandparentNode ) { if ( !listNodeNames[ listNode.getName() ] ) return []; if ( !baseIndentLevel ) baseIndentLevel = 0; if ( !baseArray ) baseArray = []; // Iterate over all list items to and look for inner lists. for ( var i = 0, count = listNode.getChildCount() ; i < count ; i++ ) { var listItem = listNode.getChild( i ); // Fixing malformed nested lists by moving it into a previous list item. (#6236) if( listItem.type == CKEDITOR.NODE_ELEMENT && listItem.getName() in CKEDITOR.dtd.$list ) CKEDITOR.plugins.list.listToArray( listItem, database, baseArray, baseIndentLevel + 1 ); // It may be a text node or some funny stuff. if ( listItem.$.nodeName.toLowerCase() != 'li' ) continue; var itemObj = { 'parent' : listNode, indent : baseIndentLevel, element : listItem, contents : [] }; if ( !grandparentNode ) { itemObj.grandparent = listNode.getParent(); if ( itemObj.grandparent && itemObj.grandparent.$.nodeName.toLowerCase() == 'li' ) itemObj.grandparent = itemObj.grandparent.getParent(); } else itemObj.grandparent = grandparentNode; if ( database ) CKEDITOR.dom.element.setMarker( database, listItem, 'listarray_index', baseArray.length ); baseArray.push( itemObj ); for ( var j = 0, itemChildCount = listItem.getChildCount(), child; j < itemChildCount ; j++ ) { child = listItem.getChild( j ); if ( child.type == CKEDITOR.NODE_ELEMENT && listNodeNames[ child.getName() ] ) // Note the recursion here, it pushes inner list items with // +1 indentation in the correct order. CKEDITOR.plugins.list.listToArray( child, database, baseArray, baseIndentLevel + 1, itemObj.grandparent ); else itemObj.contents.push( child ); } } return baseArray; }, // Convert our internal representation of a list back to a DOM forest. arrayToList : function( listArray, database, baseIndex, paragraphMode, dir ) { if ( !baseIndex ) baseIndex = 0; if ( !listArray || listArray.length < baseIndex + 1 ) return null; var doc = listArray[ baseIndex ].parent.getDocument(), retval = new CKEDITOR.dom.documentFragment( doc ), rootNode = null, currentIndex = baseIndex, indentLevel = Math.max( listArray[ baseIndex ].indent, 0 ), currentListItem = null, orgDir, paragraphName = ( paragraphMode == CKEDITOR.ENTER_P ? 'p' : 'div' ); while ( 1 ) { var item = listArray[ currentIndex ]; orgDir = item.element.getDirection( 1 ); if ( item.indent == indentLevel ) { if ( !rootNode || listArray[ currentIndex ].parent.getName() != rootNode.getName() ) { rootNode = listArray[ currentIndex ].parent.clone( false, 1 ); dir && rootNode.setAttribute( 'dir', dir ); retval.append( rootNode ); } currentListItem = rootNode.append( item.element.clone( 0, 1 ) ); if ( orgDir != rootNode.getDirection( 1 ) ) currentListItem.setAttribute( 'dir', orgDir ); for ( var i = 0 ; i < item.contents.length ; i++ ) currentListItem.append( item.contents[i].clone( 1, 1 ) ); currentIndex++; } else if ( item.indent == Math.max( indentLevel, 0 ) + 1 ) { // Maintain original direction (#6861). var currDir = listArray[ currentIndex - 1 ].element.getDirection( 1 ), listData = CKEDITOR.plugins.list.arrayToList( listArray, null, currentIndex, paragraphMode, currDir != orgDir ? orgDir: null ); // If the next block is an <li> with another list tree as the first // child, we'll need to append a filler (<br>/NBSP) or the list item // wouldn't be editable. (#6724) if ( !currentListItem.getChildCount() && CKEDITOR.env.ie && !( doc.$.documentMode > 7 )) currentListItem.append( doc.createText( '\xa0' ) ); currentListItem.append( listData.listNode ); currentIndex = listData.nextIndex; } else if ( item.indent == -1 && !baseIndex && item.grandparent ) { if ( listNodeNames[ item.grandparent.getName() ] ) currentListItem = item.element.clone( false, true ); else { // Create completely new blocks here. if ( dir || item.element.hasAttributes() || paragraphMode != CKEDITOR.ENTER_BR ) { currentListItem = doc.createElement( paragraphName ); item.element.copyAttributes( currentListItem, { type:1, value:1 } ); // There might be a case where there are no attributes in the element after all // (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR, // the current item should be a fragment. if ( !dir && paragraphMode == CKEDITOR.ENTER_BR && !currentListItem.hasAttributes() ) currentListItem = new CKEDITOR.dom.documentFragment( doc ); } else currentListItem = new CKEDITOR.dom.documentFragment( doc ); } if ( currentListItem.type == CKEDITOR.NODE_ELEMENT ) { if ( item.grandparent.getDirection( 1 ) != orgDir ) currentListItem.setAttribute( 'dir', orgDir ); } for ( i = 0 ; i < item.contents.length ; i++ ) currentListItem.append( item.contents[i].clone( 1, 1 ) ); if ( currentListItem.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT && currentIndex != listArray.length - 1 ) { var last = currentListItem.getLast(); if ( last && last.type == CKEDITOR.NODE_ELEMENT && last.getAttribute( 'type' ) == '_moz' ) { last.remove(); } if ( !( last = currentListItem.getLast( nonEmpty ) && last.type == CKEDITOR.NODE_ELEMENT && last.getName() in CKEDITOR.dtd.$block ) ) { currentListItem.append( doc.createElement( 'br' ) ); } } if ( currentListItem.type == CKEDITOR.NODE_ELEMENT && currentListItem.getName() == paragraphName && currentListItem.$.firstChild ) { currentListItem.trim(); var firstChild = currentListItem.getFirst(); if ( firstChild.type == CKEDITOR.NODE_ELEMENT && firstChild.isBlockBoundary() ) { var tmp = new CKEDITOR.dom.documentFragment( doc ); currentListItem.moveChildren( tmp ); currentListItem = tmp; } } var currentListItemName = currentListItem.$.nodeName.toLowerCase(); if ( !CKEDITOR.env.ie && ( currentListItemName == 'div' || currentListItemName == 'p' ) ) currentListItem.appendBogus(); retval.append( currentListItem ); rootNode = null; currentIndex++; } else return null; if ( listArray.length <= currentIndex || Math.max( listArray[ currentIndex ].indent, 0 ) < indentLevel ) break; } if ( database ) { var currentNode = retval.getFirst(), listRoot = listArray[ 0 ].parent; while ( currentNode ) { if ( currentNode.type == CKEDITOR.NODE_ELEMENT ) { // Clear marker attributes for the new list tree made of cloned nodes, if any. CKEDITOR.dom.element.clearMarkers( database, currentNode ); // Clear redundant direction attribute specified on list items. if ( currentNode.getName() in CKEDITOR.dtd.$listItem ) cleanUpDirection( currentNode ); } currentNode = currentNode.getNextSourceNode(); } } return { listNode : retval, nextIndex : currentIndex }; } }; function onSelectionChange( evt ) { if ( evt.editor.readOnly ) return null; var path = evt.data.path, blockLimit = path.blockLimit, elements = path.elements, element, i; // Grouping should only happen under blockLimit.(#3940). for ( i = 0 ; i < elements.length && ( element = elements[ i ] ) && !element.equals( blockLimit ); i++ ) { if ( listNodeNames[ elements[ i ].getName() ] ) return this.setState( this.type == elements[ i ].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); } return this.setState( CKEDITOR.TRISTATE_OFF ); } function changeListType( editor, groupObj, database, listsCreated ) { // This case is easy... // 1. Convert the whole list into a one-dimensional array. // 2. Change the list type by modifying the array. // 3. Recreate the whole list by converting the array to a list. // 4. Replace the original list with the recreated list. var listArray = CKEDITOR.plugins.list.listToArray( groupObj.root, database ), selectedListItems = []; for ( var i = 0 ; i < groupObj.contents.length ; i++ ) { var itemNode = groupObj.contents[i]; itemNode = itemNode.getAscendant( 'li', true ); if ( !itemNode || itemNode.getCustomData( 'list_item_processed' ) ) continue; selectedListItems.push( itemNode ); CKEDITOR.dom.element.setMarker( database, itemNode, 'list_item_processed', true ); } var root = groupObj.root, fakeParent = root.getDocument().createElement( this.type ); // Copy all attributes, except from 'start' and 'type'. root.copyAttributes( fakeParent, { start : 1, type : 1 } ); // The list-style-type property should be ignored. fakeParent.removeStyle( 'list-style-type' ); for ( i = 0 ; i < selectedListItems.length ; i++ ) { var listIndex = selectedListItems[i].getCustomData( 'listarray_index' ); listArray[listIndex].parent = fakeParent; } var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode ); var child, length = newList.listNode.getChildCount(); for ( i = 0 ; i < length && ( child = newList.listNode.getChild( i ) ) ; i++ ) { if ( child.getName() == this.type ) listsCreated.push( child ); } newList.listNode.replace( groupObj.root ); } var headerTagRegex = /^h[1-6]$/; function createList( editor, groupObj, listsCreated ) { var contents = groupObj.contents, doc = groupObj.root.getDocument(), listContents = []; // It is possible to have the contents returned by DomRangeIterator to be the same as the root. // e.g. when we're running into table cells. // In such a case, enclose the childNodes of contents[0] into a <div>. if ( contents.length == 1 && contents[0].equals( groupObj.root ) ) { var divBlock = doc.createElement( 'div' ); contents[0].moveChildren && contents[0].moveChildren( divBlock ); contents[0].append( divBlock ); contents[0] = divBlock; } // Calculate the common parent node of all content blocks. var commonParent = groupObj.contents[0].getParent(); for ( var i = 0 ; i < contents.length ; i++ ) commonParent = commonParent.getCommonAncestor( contents[i].getParent() ); var useComputedState = editor.config.useComputedState, listDir, explicitDirection; useComputedState = useComputedState === undefined || useComputedState; // We want to insert things that are in the same tree level only, so calculate the contents again // by expanding the selected blocks to the same tree level. for ( i = 0 ; i < contents.length ; i++ ) { var contentNode = contents[i], parentNode; while ( ( parentNode = contentNode.getParent() ) ) { if ( parentNode.equals( commonParent ) ) { listContents.push( contentNode ); // Determine the lists's direction. if ( !explicitDirection && contentNode.getDirection() ) explicitDirection = 1; var itemDir = contentNode.getDirection( useComputedState ); if ( listDir !== null ) { // If at least one LI have a different direction than current listDir, we can't have listDir. if ( listDir && listDir != itemDir ) listDir = null; else listDir = itemDir; } break; } contentNode = parentNode; } } if ( listContents.length < 1 ) return; // Insert the list to the DOM tree. var insertAnchor = listContents[ listContents.length - 1 ].getNext(), listNode = doc.createElement( this.type ); listsCreated.push( listNode ); var contentBlock, listItem; while ( listContents.length ) { contentBlock = listContents.shift(); listItem = doc.createElement( 'li' ); // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271) if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) ) contentBlock.appendTo( listItem ); else { contentBlock.copyAttributes( listItem ); // Remove direction attribute after it was merged into list root. (#7657) if ( listDir && contentBlock.getDirection() ) { listItem.removeStyle( 'direction' ); listItem.removeAttribute( 'dir' ); } contentBlock.moveChildren( listItem ); contentBlock.remove(); } listItem.appendTo( listNode ); } // Apply list root dir only if it has been explicitly declared. if ( listDir && explicitDirection ) listNode.setAttribute( 'dir', listDir ); if ( insertAnchor ) listNode.insertBefore( insertAnchor ); else listNode.appendTo( commonParent ); } function removeList( editor, groupObj, database ) { // This is very much like the change list type operation. // Except that we're changing the selected items' indent to -1 in the list array. var listArray = CKEDITOR.plugins.list.listToArray( groupObj.root, database ), selectedListItems = []; for ( var i = 0 ; i < groupObj.contents.length ; i++ ) { var itemNode = groupObj.contents[i]; itemNode = itemNode.getAscendant( 'li', true ); if ( !itemNode || itemNode.getCustomData( 'list_item_processed' ) ) continue; selectedListItems.push( itemNode ); CKEDITOR.dom.element.setMarker( database, itemNode, 'list_item_processed', true ); } var lastListIndex = null; for ( i = 0 ; i < selectedListItems.length ; i++ ) { var listIndex = selectedListItems[i].getCustomData( 'listarray_index' ); listArray[listIndex].indent = -1; lastListIndex = listIndex; } // After cutting parts of the list out with indent=-1, we still have to maintain the array list // model's nextItem.indent <= currentItem.indent + 1 invariant. Otherwise the array model of the // list cannot be converted back to a real DOM list. for ( i = lastListIndex + 1 ; i < listArray.length ; i++ ) { if ( listArray[i].indent > listArray[i-1].indent + 1 ) { var indentOffset = listArray[i-1].indent + 1 - listArray[i].indent; var oldIndent = listArray[i].indent; while ( listArray[i] && listArray[i].indent >= oldIndent ) { listArray[i].indent += indentOffset; i++; } i--; } } var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode, groupObj.root.getAttribute( 'dir' ) ); // Compensate <br> before/after the list node if the surrounds are non-blocks.(#3836) var docFragment = newList.listNode, boundaryNode, siblingNode; function compensateBrs( isStart ) { if ( ( boundaryNode = docFragment[ isStart ? 'getFirst' : 'getLast' ]() ) && !( boundaryNode.is && boundaryNode.isBlockBoundary() ) && ( siblingNode = groupObj.root[ isStart ? 'getPrevious' : 'getNext' ] ( CKEDITOR.dom.walker.whitespaces( true ) ) ) && !( siblingNode.is && siblingNode.isBlockBoundary( { br : 1 } ) ) ) editor.document.createElement( 'br' )[ isStart ? 'insertBefore' : 'insertAfter' ]( boundaryNode ); } compensateBrs( true ); compensateBrs(); docFragment.replace( groupObj.root ); } function listCommand( name, type ) { this.name = name; this.type = type; } // Move direction attribute from root to list items. function dirToListItems( list ) { var dir = list.getDirection(); if ( dir ) { for ( var i = 0, children = list.getChildren(), child; child = children.getItem( i ), i < children.count(); i++ ) { if ( child.type == CKEDITOR.NODE_ELEMENT && child.is( 'li' ) && !child.getDirection() ) child.setAttribute( 'dir', dir ); } list.removeAttribute( 'dir' ); } } listCommand.prototype = { exec : function( editor ) { var doc = editor.document, config = editor.config, selection = editor.getSelection(), ranges = selection && selection.getRanges( true ); // There should be at least one selected range. if ( !ranges || ranges.length < 1 ) return; // Midas lists rule #1 says we can create a list even in an empty document. // But DOM iterator wouldn't run if the document is really empty. // So create a paragraph if the document is empty and we're going to create a list. if ( this.state == CKEDITOR.TRISTATE_OFF ) { var body = doc.getBody(); if ( !body.getFirst( nonEmpty ) ) { config.enterMode == CKEDITOR.ENTER_BR ? body.appendBogus() : ranges[ 0 ].fixBlock( 1, config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ); selection.selectRanges( ranges ); } // Maybe a single range there enclosing the whole list, // turn on the list state manually(#4129). else { var range = ranges.length == 1 && ranges[ 0 ], enclosedNode = range && range.getEnclosedNode(); if ( enclosedNode && enclosedNode.is && this.type == enclosedNode.getName() ) this.setState( CKEDITOR.TRISTATE_ON ); } } var bookmarks = selection.createBookmarks( true ); // Group the blocks up because there are many cases where multiple lists have to be created, // or multiple lists have to be cancelled. var listGroups = [], database = {}, rangeIterator = ranges.createIterator(), index = 0; while ( ( range = rangeIterator.getNextRange() ) && ++index ) { var boundaryNodes = range.getBoundaryNodes(), startNode = boundaryNodes.startNode, endNode = boundaryNodes.endNode; if ( startNode.type == CKEDITOR.NODE_ELEMENT && startNode.getName() == 'td' ) range.setStartAt( boundaryNodes.startNode, CKEDITOR.POSITION_AFTER_START ); if ( endNode.type == CKEDITOR.NODE_ELEMENT && endNode.getName() == 'td' ) range.setEndAt( boundaryNodes.endNode, CKEDITOR.POSITION_BEFORE_END ); var iterator = range.createIterator(), block; iterator.forceBrBreak = ( this.state == CKEDITOR.TRISTATE_OFF ); while ( ( block = iterator.getNextParagraph() ) ) { // Avoid duplicate blocks get processed across ranges. if( block.getCustomData( 'list_block' ) ) continue; else CKEDITOR.dom.element.setMarker( database, block, 'list_block', 1 ); var path = new CKEDITOR.dom.elementPath( block ), pathElements = path.elements, pathElementsCount = pathElements.length, listNode = null, processedFlag = 0, blockLimit = path.blockLimit, element; // First, try to group by a list ancestor. for ( var i = pathElementsCount - 1; i >= 0 && ( element = pathElements[ i ] ); i-- ) { if ( listNodeNames[ element.getName() ] && blockLimit.contains( element ) ) // Don't leak outside block limit (#3940). { // If we've encountered a list inside a block limit // The last group object of the block limit element should // no longer be valid. Since paragraphs after the list // should belong to a different group of paragraphs before // the list. (Bug #1309) blockLimit.removeCustomData( 'list_group_object_' + index ); var groupObj = element.getCustomData( 'list_group_object' ); if ( groupObj ) groupObj.contents.push( block ); else { groupObj = { root : element, contents : [ block ] }; listGroups.push( groupObj ); CKEDITOR.dom.element.setMarker( database, element, 'list_group_object', groupObj ); } processedFlag = 1; break; } } if ( processedFlag ) continue; // No list ancestor? Group by block limit, but don't mix contents from different ranges. var root = blockLimit; if ( root.getCustomData( 'list_group_object_' + index ) ) root.getCustomData( 'list_group_object_' + index ).contents.push( block ); else { groupObj = { root : root, contents : [ block ] }; CKEDITOR.dom.element.setMarker( database, root, 'list_group_object_' + index, groupObj ); listGroups.push( groupObj ); } } } // Now we have two kinds of list groups, groups rooted at a list, and groups rooted at a block limit element. // We either have to build lists or remove lists, for removing a list does not makes sense when we are looking // at the group that's not rooted at lists. So we have three cases to handle. var listsCreated = []; while ( listGroups.length > 0 ) { groupObj = listGroups.shift(); if ( this.state == CKEDITOR.TRISTATE_OFF ) { if ( listNodeNames[ groupObj.root.getName() ] ) changeListType.call( this, editor, groupObj, database, listsCreated ); else createList.call( this, editor, groupObj, listsCreated ); } else if ( this.state == CKEDITOR.TRISTATE_ON && listNodeNames[ groupObj.root.getName() ] ) removeList.call( this, editor, groupObj, database ); } // For all new lists created, merge adjacent, same type lists. for ( i = 0 ; i < listsCreated.length ; i++ ) { listNode = listsCreated[i]; var mergeSibling, listCommand = this; ( mergeSibling = function( rtl ){ var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ]( CKEDITOR.dom.walker.whitespaces( true ) ); if ( sibling && sibling.getName && sibling.getName() == listCommand.type ) { // In case to be merged lists have difference directions. (#7448) if ( sibling.getDirection( 1 ) != listNode.getDirection( 1 ) ) dirToListItems( listNode.getDirection() ? listNode : sibling ); sibling.remove(); // Move children order by merge direction.(#3820) sibling.moveChildren( listNode, rtl ); } } )(); mergeSibling( 1 ); } // Clean up, restore selection and update toolbar button states. CKEDITOR.dom.element.clearAllMarkers( database ); selection.selectBookmarks( bookmarks ); editor.focus(); } }; var dtd = CKEDITOR.dtd; var tailNbspRegex = /[\t\r\n ]*(?:&nbsp;|\xa0)$/; function indexOfFirstChildElement( element, tagNameList ) { var child, children = element.children, length = children.length; for ( var i = 0 ; i < length ; i++ ) { child = children[ i ]; if ( child.name && ( child.name in tagNameList ) ) return i; } return length; } function getExtendNestedListFilter( isHtmlFilter ) { // An element filter function that corrects nested list start in an empty // list item for better displaying/outputting. (#3165) return function( listItem ) { var children = listItem.children, firstNestedListIndex = indexOfFirstChildElement( listItem, dtd.$list ), firstNestedList = children[ firstNestedListIndex ], nodeBefore = firstNestedList && firstNestedList.previous, tailNbspmatch; if ( nodeBefore && ( nodeBefore.name && nodeBefore.name == 'br' || nodeBefore.value && ( tailNbspmatch = nodeBefore.value.match( tailNbspRegex ) ) ) ) { var fillerNode = nodeBefore; // Always use 'nbsp' as filler node if we found a nested list appear // in front of a list item. if ( !( tailNbspmatch && tailNbspmatch.index ) && fillerNode == children[ 0 ] ) children[ 0 ] = ( isHtmlFilter || CKEDITOR.env.ie ) ? new CKEDITOR.htmlParser.text( '\xa0' ) : new CKEDITOR.htmlParser.element( 'br', {} ); // Otherwise the filler is not needed anymore. else if ( fillerNode.name == 'br' ) children.splice( firstNestedListIndex - 1, 1 ); else fillerNode.value = fillerNode.value.replace( tailNbspRegex, '' ); } }; } var defaultListDataFilterRules = { elements : {} }; for ( var i in dtd.$listItem ) defaultListDataFilterRules.elements[ i ] = getExtendNestedListFilter(); var defaultListHtmlFilterRules = { elements : {} }; for ( i in dtd.$listItem ) defaultListHtmlFilterRules.elements[ i ] = getExtendNestedListFilter( true ); CKEDITOR.plugins.add( 'list', { init : function( editor ) { // Register commands. var numberedListCommand = editor.addCommand( 'numberedlist', new listCommand( 'numberedlist', 'ol' ) ), bulletedListCommand = editor.addCommand( 'bulletedlist', new listCommand( 'bulletedlist', 'ul' ) ); // Register the toolbar button. editor.ui.addButton( 'NumberedList', { label : editor.lang.numberedlist, command : 'numberedlist' } ); editor.ui.addButton( 'BulletedList', { label : editor.lang.bulletedlist, command : 'bulletedlist' } ); // Register the state changing handlers. editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, numberedListCommand ) ); editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, bulletedListCommand ) ); }, afterInit : function ( editor ) { var dataProcessor = editor.dataProcessor; if ( dataProcessor ) { dataProcessor.dataFilter.addRules( defaultListDataFilterRules ); dataProcessor.htmlFilter.addRules( defaultListHtmlFilterRules ); } }, requires : [ 'domiterator' ] } ); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/list/plugin.js
JavaScript
asf20
27,061
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The default editing block plugin, which holds the editing area * and source view. */ (function() { // This is a semaphore used to avoid recursive calls between // the following data handling functions. var isHandlingData; CKEDITOR.plugins.add( 'editingblock', { init : function( editor ) { if ( !editor.config.editingBlock ) return; editor.on( 'themeSpace', function( event ) { if ( event.data.space == 'contents' ) event.data.html += '<br>'; }); editor.on( 'themeLoaded', function() { editor.fireOnce( 'editingBlockReady' ); }); editor.on( 'uiReady', function() { editor.setMode( editor.config.startupMode ); }); editor.on( 'afterSetData', function() { if ( !isHandlingData ) { function setData() { isHandlingData = true; editor.getMode().loadData( editor.getData() ); isHandlingData = false; } if ( editor.mode ) setData(); else { editor.on( 'mode', function() { if ( editor.mode ) { setData(); editor.removeListener( 'mode', arguments.callee ); } }); } } }); editor.on( 'beforeGetData', function() { if ( !isHandlingData && editor.mode ) { isHandlingData = true; editor.setData( editor.getMode().getData(), null, 1 ); isHandlingData = false; } }); editor.on( 'getSnapshot', function( event ) { if ( editor.mode ) event.data = editor.getMode().getSnapshotData(); }); editor.on( 'loadSnapshot', function( event ) { if ( editor.mode ) editor.getMode().loadSnapshotData( event.data ); }); // For the first "mode" call, we'll also fire the "instanceReady" // event. editor.on( 'mode', function( event ) { // Do that once only. event.removeListener(); // Redirect the focus into editor for webkit. (#5713) CKEDITOR.env.webkit && editor.container.on( 'focus', function() { editor.focus(); }); if ( editor.config.startupFocus ) editor.focus(); // Fire instanceReady for both the editor and CKEDITOR, but // defer this until the whole execution has completed // to guarantee the editor is fully responsible. setTimeout( function(){ editor.fireOnce( 'instanceReady' ); CKEDITOR.fire( 'instanceReady', null, editor ); }, 0 ); }); editor.on( 'destroy', function () { // -> currentMode.unload( holderElement ); if ( this.mode ) this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) ); }); } }); /** * The current editing mode. An editing mode is basically a viewport for * editing or content viewing. By default the possible values for this * property are "wysiwyg" and "source". * @type String * @example * alert( CKEDITOR.instances.editor1.mode ); // "wysiwyg" (e.g.) */ CKEDITOR.editor.prototype.mode = ''; /** * Registers an editing mode. This function is to be used mainly by plugins. * @param {String} mode The mode name. * @param {Object} modeEditor The mode editor definition. * @example */ CKEDITOR.editor.prototype.addMode = function( mode, modeEditor ) { modeEditor.name = mode; ( this._.modes || ( this._.modes = {} ) )[ mode ] = modeEditor; }; /** * Sets the current editing mode in this editor instance. * @param {String} mode A registered mode name. * @example * // Switch to "source" view. * CKEDITOR.instances.editor1.setMode( 'source' ); */ CKEDITOR.editor.prototype.setMode = function( mode ) { this.fire( 'beforeSetMode', { newMode : mode } ); var data, holderElement = this.getThemeSpace( 'contents' ), isDirty = this.checkDirty(); // Unload the previous mode. if ( this.mode ) { if ( mode == this.mode ) return; this._.previousMode = this.mode; this.fire( 'beforeModeUnload' ); var currentMode = this.getMode(); data = currentMode.getData(); currentMode.unload( holderElement ); this.mode = ''; } holderElement.setHtml( '' ); // Load required mode. var modeEditor = this.getMode( mode ); if ( !modeEditor ) throw '[CKEDITOR.editor.setMode] Unknown mode "' + mode + '".'; if ( !isDirty ) { this.on( 'mode', function() { this.resetDirty(); this.removeListener( 'mode', arguments.callee ); }); } modeEditor.load( holderElement, ( typeof data ) != 'string' ? this.getData() : data ); }; /** * Gets the current or any of the objects that represent the editing * area modes. The two most common editing modes are "wysiwyg" and "source". * @param {String} [mode] The mode to be retrieved. If not specified, the * current one is returned. */ CKEDITOR.editor.prototype.getMode = function( mode ) { return this._.modes && this._.modes[ mode || this.mode ]; }; /** * Moves the selection focus to the editing are space in the editor. */ CKEDITOR.editor.prototype.focus = function() { this.forceNextSelectionCheck(); var mode = this.getMode(); if ( mode ) mode.focus(); }; })(); /** * The mode to load at the editor startup. It depends on the plugins * loaded. By default, the "wysiwyg" and "source" modes are available. * @type String * @default 'wysiwyg' * @example * config.startupMode = 'source'; */ CKEDITOR.config.startupMode = 'wysiwyg'; /** * Sets whether the editor should have the focus when the page loads. * @name CKEDITOR.config.startupFocus * @type Boolean * @default false * @example * config.startupFocus = true; */ /** * Whether to render or not the editing block area in the editor interface. * @type Boolean * @default true * @example * config.editingBlock = false; */ CKEDITOR.config.editingBlock = true; /** * Fired when a CKEDITOR instance is created, fully initialized and ready for interaction. * @name CKEDITOR#instanceReady * @event * @param {CKEDITOR.editor} editor The editor instance that has been created. */ /** * Fired when the CKEDITOR instance is created, fully initialized and ready for interaction. * @name CKEDITOR.editor#instanceReady * @event */ /** * Fired before changing the editing mode. See also CKEDITOR.editor#beforeSetMode and CKEDITOR.editor#mode * @name CKEDITOR.editor#beforeModeUnload * @event */ /** * Fired before the editor mode is set. See also CKEDITOR.editor#mode and CKEDITOR.editor#beforeModeUnload * @name CKEDITOR.editor#beforeSetMode * @event * @since 3.5.3 * @param {String} newMode The name of the mode which is about to be set. */ /** * Fired after setting the editing mode. See also CKEDITOR.editor#beforeSetMode and CKEDITOR.editor#beforeModeUnload * @name CKEDITOR.editor#mode * @event * @param {String} previousMode The previous mode of the editor. */
zysms
trunk/zysms/include/ckeditor/_source/plugins/editingblock/plugin.js
JavaScript
asf20
7,289
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview Defines the "virtual" dialog, dialog content and dialog button * definition classes. */ /** * The definition of a dialog window. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create dialogs. * </div> * @name CKEDITOR.dialog.definition * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * CKEDITOR.dialog.add( 'testOnly', function( editor ) * { * return { * title : 'Test Dialog', * resizable : CKEDITOR.DIALOG_RESIZE_BOTH, * minWidth : 500, * minHeight : 400, * contents : [ * { * id : 'tab1', * label : 'First Tab', * title : 'First Tab Title', * accessKey : 'Q', * elements : [ * { * type : 'text', * label : 'Test Text 1', * id : 'testText1', * 'default' : 'hello world!' * } * ] * } * ] * }; * }); */ /** * The dialog title, displayed in the dialog's header. Required. * @name CKEDITOR.dialog.definition.prototype.title * @field * @type String * @example */ /** * How the dialog can be resized, must be one of the four contents defined below. * <br /><br /> * <strong>CKEDITOR.DIALOG_RESIZE_NONE</strong><br /> * <strong>CKEDITOR.DIALOG_RESIZE_WIDTH</strong><br /> * <strong>CKEDITOR.DIALOG_RESIZE_HEIGHT</strong><br /> * <strong>CKEDITOR.DIALOG_RESIZE_BOTH</strong><br /> * @name CKEDITOR.dialog.definition.prototype.resizable * @field * @type Number * @default CKEDITOR.DIALOG_RESIZE_NONE * @example */ /** * The minimum width of the dialog, in pixels. * @name CKEDITOR.dialog.definition.prototype.minWidth * @field * @type Number * @default 600 * @example */ /** * The minimum height of the dialog, in pixels. * @name CKEDITOR.dialog.definition.prototype.minHeight * @field * @type Number * @default 400 * @example */ /** * The initial width of the dialog, in pixels. * @name CKEDITOR.dialog.definition.prototype.width * @field * @type Number * @default @CKEDITOR.dialog.definition.prototype.minWidth * @since 3.5.3 * @example */ /** * The initial height of the dialog, in pixels. * @name CKEDITOR.dialog.definition.prototype.height * @field * @type Number * @default @CKEDITOR.dialog.definition.prototype.minHeight * @since 3.5.3 * @example */ /** * The buttons in the dialog, defined as an array of * {@link CKEDITOR.dialog.definition.button} objects. * @name CKEDITOR.dialog.definition.prototype.buttons * @field * @type Array * @default [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] * @example */ /** * The contents in the dialog, defined as an array of * {@link CKEDITOR.dialog.definition.content} objects. Required. * @name CKEDITOR.dialog.definition.prototype.contents * @field * @type Array * @example */ /** * The function to execute when OK is pressed. * @name CKEDITOR.dialog.definition.prototype.onOk * @field * @type Function * @example */ /** * The function to execute when Cancel is pressed. * @name CKEDITOR.dialog.definition.prototype.onCancel * @field * @type Function * @example */ /** * The function to execute when the dialog is displayed for the first time. * @name CKEDITOR.dialog.definition.prototype.onLoad * @field * @type Function * @example */ /** * The function to execute when the dialog is loaded (executed every time the dialog is opened). * @name CKEDITOR.dialog.definition.prototype.onShow * @field * @type Function * @example */ /** * <div class="notapi">This class is not really part of the API. It just illustrates the properties * that developers can use to define and create dialog content pages.</div> * @name CKEDITOR.dialog.definition.content * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. */ /** * The id of the content page. * @name CKEDITOR.dialog.definition.content.prototype.id * @field * @type String * @example */ /** * The tab label of the content page. * @name CKEDITOR.dialog.definition.content.prototype.label * @field * @type String * @example */ /** * The popup message of the tab label. * @name CKEDITOR.dialog.definition.content.prototype.title * @field * @type String * @example */ /** * The CTRL hotkey for switching to the tab. * @name CKEDITOR.dialog.definition.content.prototype.accessKey * @field * @type String * @example * contentDefinition.accessKey = 'Q'; // Switch to this page when CTRL-Q is pressed. */ /** * The UI elements contained in this content page, defined as an array of * {@link CKEDITOR.dialog.definition.uiElement} objects. * @name CKEDITOR.dialog.definition.content.prototype.elements * @field * @type Array * @example */ /** * The definition of user interface element (textarea, radio etc). * <div class="notapi">This class is not really part of the API. It just illustrates the properties * that developers can use to define and create dialog UI elements.</div> * @name CKEDITOR.dialog.definition.uiElement * @constructor * @see CKEDITOR.ui.dialog.uiElement * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. */ /** * The id of the UI element. * @name CKEDITOR.dialog.definition.uiElement.prototype.id * @field * @type String * @example */ /** * The type of the UI element. Required. * @name CKEDITOR.dialog.definition.uiElement.prototype.type * @field * @type String * @example */ /** * The popup label of the UI element. * @name CKEDITOR.dialog.definition.uiElement.prototype.title * @field * @type String * @example */ /** * CSS class names to append to the UI element. * @name CKEDITOR.dialog.definition.uiElement.prototype.className * @field * @type String * @example */ /** * Inline CSS classes to append to the UI element. * @name CKEDITOR.dialog.definition.uiElement.prototype.style * @field * @type String * @example */ /** * Horizontal alignment (in container) of the UI element. * @name CKEDITOR.dialog.definition.uiElement.prototype.align * @field * @type String * @example */ /** * Function to execute the first time the UI element is displayed. * @name CKEDITOR.dialog.definition.uiElement.prototype.onLoad * @field * @type Function * @example */ /** * Function to execute whenever the UI element's parent dialog is displayed. * @name CKEDITOR.dialog.definition.uiElement.prototype.onShow * @field * @type Function * @example */ /** * Function to execute whenever the UI element's parent dialog is closed. * @name CKEDITOR.dialog.definition.uiElement.prototype.onHide * @field * @type Function * @example */ /** * Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.setupContent} method is executed. * It usually takes care of the respective UI element as a standalone element. * @name CKEDITOR.dialog.definition.uiElement.prototype.setup * @field * @type Function * @example */ /** * Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.commitContent} method is executed. * It usually takes care of the respective UI element as a standalone element. * @name CKEDITOR.dialog.definition.uiElement.prototype.commit * @field * @type Function * @example */ // ----- hbox ----- /** * Horizontal layout box for dialog UI elements, auto-expends to available width of container. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create horizontal layouts. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.hbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * @name CKEDITOR.dialog.definition.hbox * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'hbox',</b> * widths : [ '25%', '25%', '50%' ], * children : * [ * { * type : 'text', * id : 'id1', * width : '40px', * }, * { * type : 'text', * id : 'id2', * width : '40px', * }, * { * type : 'text', * id : 'id3' * } * ] * } */ /** * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container. * @name CKEDITOR.dialog.definition.hbox.prototype.children * @field * @type Array * @example */ /** * (Optional) The widths of child cells. * @name CKEDITOR.dialog.definition.hbox.prototype.widths * @field * @type Array * @example */ /** * (Optional) The height of the layout. * @name CKEDITOR.dialog.definition.hbox.prototype.height * @field * @type Number * @example */ /** * The CSS styles to apply to this element. * @name CKEDITOR.dialog.definition.hbox.prototype.styles * @field * @type String * @example */ /** * (Optional) The padding width inside child cells. Example: 0, 1. * @name CKEDITOR.dialog.definition.hbox.prototype.padding * @field * @type Number * @example */ /** * (Optional) The alignment of the whole layout. Example: center, top. * @name CKEDITOR.dialog.definition.hbox.prototype.align * @field * @type String * @example */ // ----- vbox ----- /** * Vertical layout box for dialog UI elements. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create vertical layouts. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.vbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * <style type="text/css">.details .detailList {display:none;} </style> * @name CKEDITOR.dialog.definition.vbox * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'vbox',</b> * align : 'right', * width : '200px', * children : * [ * { * type : 'text', * id : 'age', * label : 'Age' * }, * { * type : 'text', * id : 'sex', * label : 'Sex' * }, * { * type : 'text', * id : 'nationality', * label : 'Nationality' * } * ] * } */ /** * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container. * @name CKEDITOR.dialog.definition.vbox.prototype.children * @field * @type Array * @example */ /** * (Optional) The width of the layout. * @name CKEDITOR.dialog.definition.vbox.prototype.width * @field * @type Array * @example */ /** * (Optional) The heights of individual cells. * @name CKEDITOR.dialog.definition.vbox.prototype.heights * @field * @type Number * @example */ /** * The CSS styles to apply to this element. * @name CKEDITOR.dialog.definition.vbox.prototype.styles * @field * @type String * @example */ /** * (Optional) The padding width inside child cells. Example: 0, 1. * @name CKEDITOR.dialog.definition.vbox.prototype.padding * @field * @type Number * @example */ /** * (Optional) The alignment of the whole layout. Example: center, top. * @name CKEDITOR.dialog.definition.vbox.prototype.align * @field * @type String * @example */ /** * (Optional) Whether the layout should expand vertically to fill its container. * @name CKEDITOR.dialog.definition.vbox.prototype.expand * @field * @type Boolean * @example */ // ----- labeled element ------ /** * The definition of labeled user interface element (textarea, textInput etc). * <div class="notapi">This class is not really part of the API. It just illustrates the properties * that developers can use to define and create dialog UI elements.</div> * @name CKEDITOR.dialog.definition.labeledElement * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @see CKEDITOR.ui.dialog.labeledElement * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. */ /** * The label of the UI element. * @name CKEDITOR.dialog.definition.labeledElement.prototype.label * @type String * @field * @example * { * type : 'text', * label : 'My Label ' * } */ /** * (Optional) Specify the layout of the label. Set to 'horizontal' for horizontal layout. * The default layout is vertical. * @name CKEDITOR.dialog.definition.labeledElement.prototype.labelLayout * @type String * @field * @example * { * type : 'text', * label : 'My Label ', * <strong> labelLayout : 'horizontal',</strong> * } */ /** * (Optional) Applies only to horizontal layouts: a two elements array of lengths to specify the widths of the * label and the content element. See also {@link CKEDITOR.dialog.definition.labeledElement#labelLayout}. * @name CKEDITOR.dialog.definition.labeledElement.prototype.widths * @type Array * @field * @example * { * type : 'text', * label : 'My Label ', * labelLayout : 'horizontal', * <strong> widths : [100, 200],</strong> * } */ /** * Specify the inline style of the uiElement label. * @name CKEDITOR.dialog.definition.labeledElement.prototype.labelStyle * @type String * @field * @example * { * type : 'text', * label : 'My Label ', * <strong> labelStyle : 'color: red',</strong> * } */ /** * Specify the inline style of the input element. * @name CKEDITOR.dialog.definition.labeledElement.prototype.inputStyle * @type String * @since 3.6.1 * @field * @example * { * type : 'text', * label : 'My Label ', * <strong> inputStyle : 'text-align:center',</strong> * } */ /** * Specify the inline style of the input element container . * @name CKEDITOR.dialog.definition.labeledElement.prototype.controlStyle * @type String * @since 3.6.1 * @field * @example * { * type : 'text', * label : 'My Label ', * <strong> controlStyle : 'width:3em',</strong> * } */ // ----- button ------ /** * The definition of a button. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create buttons. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.button} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.button * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'button',</b> * id : 'buttonId', * label : 'Click me', * title : 'My title', * onClick : function() { * // this = CKEDITOR.ui.dialog.button * alert( 'Clicked: ' + this.id ); * } * } */ /** * Whether the button is disabled. * @name CKEDITOR.dialog.definition.button.prototype.disabled * @type Boolean * @field * @example */ /** * The label of the UI element. * @name CKEDITOR.dialog.definition.button.prototype.label * @type String * @field * @example */ // ----- checkbox ------ /** * The definition of a checkbox element. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create groups of checkbox buttons. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.checkbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.checkbox * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'checkbox',</b> * id : 'agree', * label : 'I agree', * 'default' : 'checked', * onClick : function() { * // this = CKEDITOR.ui.dialog.checkbox * alert( 'Checked: ' + this.getValue() ); * } * } */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.checkbox.prototype.validate * @field * @type Function * @example */ /** * The label of the UI element. * @name CKEDITOR.dialog.definition.checkbox.prototype.label * @type String * @field * @example */ /** * The default state. * @name CKEDITOR.dialog.definition.checkbox.prototype.default * @type String * @field * @default * '' (unchecked) * @example */ // ----- file ----- /** * The definition of a file upload input. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create file upload elements. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.file} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.file * @extends CKEDITOR.dialog.definition.labeledElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'file'</b>, * id : 'upload', * label : 'Select file from your computer', * size : 38 * }, * { * type : 'fileButton', * id : 'fileId', * label : 'Upload file', * 'for' : [ 'tab1', 'upload' ] * filebrowser : { * onSelect : function( fileUrl, data ) { * alert( 'Successfully uploaded: ' + fileUrl ); * } * } * } */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.file.prototype.validate * @field * @type Function * @example */ /** * (Optional) The action attribute of the form element associated with this file upload input. * If empty, CKEditor will use path to server connector for currently opened folder. * @name CKEDITOR.dialog.definition.file.prototype.action * @type String * @field * @example */ /** * The size of the UI element. * @name CKEDITOR.dialog.definition.file.prototype.size * @type Number * @field * @example */ // ----- fileButton ----- /** * The definition of a button for submitting the file in a file upload input. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create a button for submitting the file in a file upload input. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.fileButton} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.fileButton * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * type : 'file', * id : 'upload', * label : 'Select file from your computer', * size : 38 * }, * { * <b>type : 'fileButton'</b>, * id : 'fileId', * label : 'Upload file', * 'for' : [ 'tab1', 'upload' ] * filebrowser : { * onSelect : function( fileUrl, data ) { * alert( 'Successfully uploaded: ' + fileUrl ); * } * } * } */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.fileButton.prototype.validate * @field * @type Function * @example */ /** * The label of the UI element. * @name CKEDITOR.dialog.definition.fileButton.prototype.label * @type String * @field * @example */ /** * The instruction for CKEditor how to deal with file upload. * By default, the file and fileButton elements will not work "as expected" if this attribute is not set. * @name CKEDITOR.dialog.definition.fileButton.prototype.filebrowser * @type String|Object * @field * @example * // Update field with id 'txtUrl' in the 'tab1' tab when file is uploaded. * filebrowser : 'tab1:txtUrl' * * // Call custom onSelect function when file is successfully uploaded. * filebrowser : { * onSelect : function( fileUrl, data ) { * alert( 'Successfully uploaded: ' + fileUrl ); * } * } */ /** * An array that contains pageId and elementId of the file upload input element for which this button is created. * @name CKEDITOR.dialog.definition.fileButton.prototype.for * @type String * @field * @example * [ pageId, elementId ] */ // ----- html ----- /** * The definition of a raw HTML element. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create elements made from raw HTML code. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.html} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}.<br /> * To access HTML elements use {@link CKEDITOR.dom.document#getById} * @name CKEDITOR.dialog.definition.html * @extends CKEDITOR.dialog.definition.uiElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example 1: * { * <b>type : 'html',</b> * html : '&lt;h3>This is some sample HTML content.&lt;/h3>' * } * @example * // Example 2: * // Complete sample with document.getById() call when the "Ok" button is clicked. * var dialogDefinition = * { * title : 'Sample dialog', * minWidth : 300, * minHeight : 200, * onOk : function() { * // "this" is now a CKEDITOR.dialog object. * var document = this.getElement().getDocument(); * // document = CKEDITOR.dom.document * var element = <b>document.getById( 'myDiv' );</b> * if ( element ) * alert( element.getHtml() ); * }, * contents : [ * { * id : 'tab1', * label : '', * title : '', * elements : * [ * { * <b>type : 'html',</b> * html : '<b>&lt;div id="myDiv">Sample &lt;b>text&lt;/b>.&lt;/div></b>&lt;div id="otherId">Another div.&lt;/div>' * }, * ] * } * ], * buttons : [ CKEDITOR.dialog.cancelButton, CKEDITOR.dialog.okButton ] * }; */ /** * (Required) HTML code of this element. * @name CKEDITOR.dialog.definition.html.prototype.html * @type String * @field * @example */ // ----- radio ------ /** * The definition of a radio group. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create groups of radio buttons. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.radio} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.radio * @extends CKEDITOR.dialog.definition.labeledElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'radio',</b> * id : 'country', * label : 'Which country is bigger', * items : [ [ 'France', 'FR' ], [ 'Germany', 'DE' ] ] , * style : 'color:green', * 'default' : 'DE', * onClick : function() { * // this = CKEDITOR.ui.dialog.radio * alert( 'Current value: ' + this.getValue() ); * } * } */ /** * The default value. * @name CKEDITOR.dialog.definition.radio.prototype.default * @type String * @field * @example */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.radio.prototype.validate * @field * @type Function * @example */ /** * An array of options. Each option is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' is missing, then the value would be assumed to be the same as the description. * @name CKEDITOR.dialog.definition.radio.prototype.items * @field * @type Array * @example */ // ----- selectElement ------ /** * The definition of a select element. * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create select elements. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.select} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.select * @extends CKEDITOR.dialog.definition.labeledElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'select',</b> * id : 'sport', * label : 'Select your favourite sport', * items : [ [ 'Basketball' ], [ 'Baseball' ], [ 'Hockey' ], [ 'Football' ] ], * 'default' : 'Football', * onChange : function( api ) { * // this = CKEDITOR.ui.dialog.select * alert( 'Current value: ' + this.getValue() ); * } * } */ /** * The default value. * @name CKEDITOR.dialog.definition.select.prototype.default * @type String * @field * @example */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.select.prototype.validate * @field * @type Function * @example */ /** * An array of options. Each option is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' is missing, then the value would be assumed to be the same as the description. * @name CKEDITOR.dialog.definition.select.prototype.items * @field * @type Array * @example */ /** * (Optional) Set this to true if you'd like to have a multiple-choice select box. * @name CKEDITOR.dialog.definition.select.prototype.multiple * @type Boolean * @field * @example * @default false */ /** * (Optional) The number of items to display in the select box. * @name CKEDITOR.dialog.definition.select.prototype.size * @type Number * @field * @example */ // ----- textInput ----- /** * The definition of a text field (single line). * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create text fields. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.textInput} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.textInput * @extends CKEDITOR.dialog.definition.labeledElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * { * <b>type : 'text',</b> * id : 'name', * label : 'Your name', * 'default' : '', * validate : function() { * if ( !this.getValue() ) * { * api.openMsgDialog( '', 'Name cannot be empty.' ); * return false; * } * } * } */ /** * The default value. * @name CKEDITOR.dialog.definition.textInput.prototype.default * @type String * @field * @example */ /** * (Optional) The maximum length. * @name CKEDITOR.dialog.definition.textInput.prototype.maxLength * @type Number * @field * @example */ /** * (Optional) The size of the input field. * @name CKEDITOR.dialog.definition.textInput.prototype.size * @type Number * @field * @example */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.textInput.prototype.validate * @field * @type Function * @example */ // ----- textarea ------ /** * The definition of a text field (multiple lines). * <div class="notapi"> * This class is not really part of the API. It just illustrates the properties * that developers can use to define and create textarea. * <br /><br />Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.textarea} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}. * </div> * For a complete example of dialog definition, please check {@link CKEDITOR.dialog.add}. * @name CKEDITOR.dialog.definition.textarea * @extends CKEDITOR.dialog.definition.labeledElement * @constructor * @example * // There is no constructor for this class, the user just has to define an * // object with the appropriate properties. * * // Example: * { * <b>type : 'textarea',</b> * id : 'message', * label : 'Your comment', * 'default' : '', * validate : function() { * if ( this.getValue().length < 5 ) * { * api.openMsgDialog( 'The comment is too short.' ); * return false; * } * } * } */ /** * The number of rows. * @name CKEDITOR.dialog.definition.textarea.prototype.rows * @type Number * @field * @example */ /** * The number of columns. * @name CKEDITOR.dialog.definition.textarea.prototype.cols * @type Number * @field * @example */ /** * (Optional) The validation function. * @name CKEDITOR.dialog.definition.textarea.prototype.validate * @field * @type Function * @example */ /** * The default value. * @name CKEDITOR.dialog.definition.textarea.prototype.default * @type String * @field * @example */
zysms
trunk/zysms/include/ckeditor/_source/plugins/dialog/dialogDefinition.js
JavaScript
asf20
31,825
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The floating dialog plugin. */ /** * No resize for this dialog. * @constant */ CKEDITOR.DIALOG_RESIZE_NONE = 0; /** * Only allow horizontal resizing for this dialog, disable vertical resizing. * @constant */ CKEDITOR.DIALOG_RESIZE_WIDTH = 1; /** * Only allow vertical resizing for this dialog, disable horizontal resizing. * @constant */ CKEDITOR.DIALOG_RESIZE_HEIGHT = 2; /* * Allow the dialog to be resized in both directions. * @constant */ CKEDITOR.DIALOG_RESIZE_BOTH = 3; (function() { var cssLength = CKEDITOR.tools.cssLength; function isTabVisible( tabId ) { return !!this._.tabs[ tabId ][ 0 ].$.offsetHeight; } function getPreviousVisibleTab() { var tabId = this._.currentTabId, length = this._.tabIdList.length, tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ) + length; for ( var i = tabIndex - 1 ; i > tabIndex - length ; i-- ) { if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) ) return this._.tabIdList[ i % length ]; } return null; } function getNextVisibleTab() { var tabId = this._.currentTabId, length = this._.tabIdList.length, tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ); for ( var i = tabIndex + 1 ; i < tabIndex + length ; i++ ) { if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) ) return this._.tabIdList[ i % length ]; } return null; } function clearOrRecoverTextInputValue( container, isRecover ) { var inputs = container.$.getElementsByTagName( 'input' ); for ( var i = 0, length = inputs.length; i < length ; i++ ) { var item = new CKEDITOR.dom.element( inputs[ i ] ); if ( item.getAttribute( 'type' ).toLowerCase() == 'text' ) { if ( isRecover ) { item.setAttribute( 'value', item.getCustomData( 'fake_value' ) || '' ); item.removeCustomData( 'fake_value' ); } else { item.setCustomData( 'fake_value', item.getAttribute( 'value' ) ); item.setAttribute( 'value', '' ); } } } } // Handle dialog element validation state UI changes. function handleFieldValidated( isValid, msg ) { var input = this.getInputElement(); if ( input ) { isValid ? input.removeAttribute( 'aria-invalid' ) : input.setAttribute( 'aria-invalid', true ); } if ( !isValid ) { if ( this.select ) this.select(); else this.focus(); } msg && alert( msg ); this.fire( 'validated', { valid : isValid, msg : msg } ); } function resetField() { var input = this.getInputElement(); input && input.removeAttribute( 'aria-invalid' ); } /** * This is the base class for runtime dialog objects. An instance of this * class represents a single named dialog for a single editor instance. * @param {Object} editor The editor which created the dialog. * @param {String} dialogName The dialog's registered name. * @constructor * @example * var dialogObj = new CKEDITOR.dialog( editor, 'smiley' ); */ CKEDITOR.dialog = function( editor, dialogName ) { // Load the dialog definition. var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], defaultDefinition = CKEDITOR.tools.clone( defaultDialogDefinition ), buttonsOrder = editor.config.dialog_buttonsOrder || 'OS', dir = editor.lang.dir; if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (#4750) ( buttonsOrder == 'rtl' && dir == 'ltr' ) || ( buttonsOrder == 'ltr' && dir == 'rtl' ) ) defaultDefinition.buttons.reverse(); // Completes the definition with the default values. definition = CKEDITOR.tools.extend( definition( editor ), defaultDefinition ); // Clone a functionally independent copy for this dialog. definition = CKEDITOR.tools.clone( definition ); // Create a complex definition object, extending it with the API // functions. definition = new definitionObject( this, definition ); var doc = CKEDITOR.document; var themeBuilt = editor.theme.buildDialog( editor ); // Initialize some basic parameters. this._ = { editor : editor, element : themeBuilt.element, name : dialogName, contentSize : { width : 0, height : 0 }, size : { width : 0, height : 0 }, contents : {}, buttons : {}, accessKeyMap : {}, // Initialize the tab and page map. tabs : {}, tabIdList : [], currentTabId : null, currentTabIndex : null, pageCount : 0, lastTab : null, tabBarMode : false, // Initialize the tab order array for input widgets. focusList : [], currentFocusIndex : 0, hasFocus : false }; this.parts = themeBuilt.parts; CKEDITOR.tools.setTimeout( function() { editor.fire( 'ariaWidget', this.parts.contents ); }, 0, this ); // Set the startup styles for the dialog, avoiding it enlarging the // page size on the dialog creation. var startStyles = { position : CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed', top : 0, visibility : 'hidden' }; startStyles[ dir == 'rtl' ? 'right' : 'left' ] = 0; this.parts.dialog.setStyles( startStyles ); // Call the CKEDITOR.event constructor to initialize this instance. CKEDITOR.event.call( this ); // Fire the "dialogDefinition" event, making it possible to customize // the dialog definition. this.definition = definition = CKEDITOR.fire( 'dialogDefinition', { name : dialogName, definition : definition } , editor ).definition; var tabsToRemove = {}; // Cache tabs that should be removed. if ( !( 'removeDialogTabs' in editor._ ) && editor.config.removeDialogTabs ) { var removeContents = editor.config.removeDialogTabs.split( ';' ); for ( i = 0; i < removeContents.length; i++ ) { var parts = removeContents[ i ].split( ':' ); if ( parts.length == 2 ) { var removeDialogName = parts[ 0 ]; if ( !tabsToRemove[ removeDialogName ] ) tabsToRemove[ removeDialogName ] = []; tabsToRemove[ removeDialogName ].push( parts[ 1 ] ); } } editor._.removeDialogTabs = tabsToRemove; } // Remove tabs of this dialog. if ( editor._.removeDialogTabs && ( tabsToRemove = editor._.removeDialogTabs[ dialogName ] ) ) { for ( i = 0; i < tabsToRemove.length; i++ ) definition.removeContents( tabsToRemove[ i ] ); } // Initialize load, show, hide, ok and cancel events. if ( definition.onLoad ) this.on( 'load', definition.onLoad ); if ( definition.onShow ) this.on( 'show', definition.onShow ); if ( definition.onHide ) this.on( 'hide', definition.onHide ); if ( definition.onOk ) { this.on( 'ok', function( evt ) { // Dialog confirm might probably introduce content changes (#5415). editor.fire( 'saveSnapshot' ); setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 ); if ( definition.onOk.call( this, evt ) === false ) evt.data.hide = false; }); } if ( definition.onCancel ) { this.on( 'cancel', function( evt ) { if ( definition.onCancel.call( this, evt ) === false ) evt.data.hide = false; }); } var me = this; // Iterates over all items inside all content in the dialog, calling a // function for each of them. var iterContents = function( func ) { var contents = me._.contents, stop = false; for ( var i in contents ) { for ( var j in contents[i] ) { stop = func.call( this, contents[i][j] ); if ( stop ) return; } } }; this.on( 'ok', function( evt ) { iterContents( function( item ) { if ( item.validate ) { var retval = item.validate( this ), invalid = typeof ( retval ) == 'string' || retval === false; if ( invalid ) { evt.data.hide = false; evt.stop(); } handleFieldValidated.call( item, !invalid, typeof retval == 'string' ? retval : undefined ); return invalid; } }); }, this, null, 0 ); this.on( 'cancel', function( evt ) { iterContents( function( item ) { if ( item.isChanged() ) { if ( !confirm( editor.lang.common.confirmCancel ) ) evt.data.hide = false; return true; } }); }, this, null, 0 ); this.parts.close.on( 'click', function( evt ) { if ( this.fire( 'cancel', { hide : true } ).hide !== false ) this.hide(); evt.data.preventDefault(); }, this ); // Sort focus list according to tab order definitions. function setupFocus() { var focusList = me._.focusList; focusList.sort( function( a, b ) { // Mimics browser tab order logics; if ( a.tabIndex != b.tabIndex ) return b.tabIndex - a.tabIndex; // Sort is not stable in some browsers, // fall-back the comparator to 'focusIndex'; else return a.focusIndex - b.focusIndex; }); var size = focusList.length; for ( var i = 0; i < size; i++ ) focusList[ i ].focusIndex = i; } function changeFocus( forward ) { var focusList = me._.focusList, offset = forward ? 1 : -1; if ( focusList.length < 1 ) return; var current = me._.currentFocusIndex; // Trigger the 'blur' event of any input element before anything, // since certain UI updates may depend on it. try { focusList[ current ].getInputElement().$.blur(); } catch( e ){} var startIndex = ( current + offset + focusList.length ) % focusList.length, currentIndex = startIndex; while ( !focusList[ currentIndex ].isFocusable() ) { currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length; if ( currentIndex == startIndex ) break; } focusList[ currentIndex ].focus(); // Select whole field content. if ( focusList[ currentIndex ].type == 'text' ) focusList[ currentIndex ].select(); } this.changeFocus = changeFocus; var processed; function focusKeydownHandler( evt ) { // If I'm not the top dialog, ignore. if ( me != CKEDITOR.dialog._.currentTop ) return; var keystroke = evt.data.getKeystroke(), rtl = editor.lang.dir == 'rtl'; processed = 0; if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 ) { var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 ); // Handling Tab and Shift-Tab. if ( me._.tabBarMode ) { // Change tabs. var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ); me.selectPage( nextId ); me._.tabs[ nextId ][ 0 ].focus(); } else { // Change the focus of inputs. changeFocus( !shiftPressed ); } processed = 1; } else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 ) { // Alt-F10 puts focus into the current tab item in the tab bar. me._.tabBarMode = true; me._.tabs[ me._.currentTabId ][ 0 ].focus(); processed = 1; } else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode ) { // Arrow keys - used for changing tabs. nextId = ( keystroke == ( rtl ? 39 : 37 ) ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) ); me.selectPage( nextId ); me._.tabs[ nextId ][ 0 ].focus(); processed = 1; } else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode ) { this.selectPage( this._.currentTabId ); this._.tabBarMode = false; this._.currentFocusIndex = -1; changeFocus( true ); processed = 1; } if ( processed ) { evt.stop(); evt.data.preventDefault(); } } function focusKeyPressHandler( evt ) { processed && evt.data.preventDefault(); } var dialogElement = this._.element; // Add the dialog keyboard handlers. this.on( 'show', function() { dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 ); // Some browsers instead, don't cancel key events in the keydown, but in the // keypress. So we must do a longer trip in those cases. (#4531) if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) dialogElement.on( 'keypress', focusKeyPressHandler, this ); } ); this.on( 'hide', function() { dialogElement.removeListener( 'keydown', focusKeydownHandler ); if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) dialogElement.removeListener( 'keypress', focusKeyPressHandler ); // Reset fields state when closing dialog. iterContents( function( item ) { resetField.apply( item ); } ); } ); this.on( 'iframeAdded', function( evt ) { var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document ); doc.on( 'keydown', focusKeydownHandler, this, null, 0 ); } ); // Auto-focus logic in dialog. this.on( 'show', function() { // Setup tabIndex on showing the dialog instead of on loading // to allow dynamic tab order happen in dialog definition. setupFocus(); if ( editor.config.dialog_startupFocusTab && me._.pageCount > 1 ) { me._.tabBarMode = true; me._.tabs[ me._.currentTabId ][ 0 ].focus(); } else if ( !this._.hasFocus ) { this._.currentFocusIndex = -1; // Decide where to put the initial focus. if ( definition.onFocus ) { var initialFocus = definition.onFocus.call( this ); // Focus the field that the user specified. initialFocus && initialFocus.focus(); } // Focus the first field in layout order. else changeFocus( true ); /* * IE BUG: If the initial focus went into a non-text element (e.g. button), * then IE would still leave the caret inside the editing area. */ if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) { var $selection = editor.document.$.selection, $range = $selection.createRange(); if ( $range ) { if ( $range.parentElement && $range.parentElement().ownerDocument == editor.document.$ || $range.item && $range.item( 0 ).ownerDocument == editor.document.$ ) { var $myRange = document.body.createTextRange(); $myRange.moveToElementText( this.getElement().getFirst().$ ); $myRange.collapse( true ); $myRange.select(); } } } } }, this, null, 0xffffffff ); // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661). // This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken. if ( CKEDITOR.env.ie6Compat ) { this.on( 'load', function( evt ) { var outer = this.getElement(), inner = outer.getFirst(); inner.remove(); inner.appendTo( outer ); }, this ); } initDragAndDrop( this ); initResizeHandles( this ); // Insert the title. ( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title ); // Insert the tabs and contents. for ( var i = 0 ; i < definition.contents.length ; i++ ) { var page = definition.contents[i]; page && this.addPage( page ); } this.parts[ 'tabs' ].on( 'click', function( evt ) { var target = evt.data.getTarget(); // If we aren't inside a tab, bail out. if ( target.hasClass( 'cke_dialog_tab' ) ) { // Get the ID of the tab, without the 'cke_' prefix and the unique number suffix. var id = target.$.id; this.selectPage( id.substring( 4, id.lastIndexOf( '_' ) ) ); if ( this._.tabBarMode ) { this._.tabBarMode = false; this._.currentFocusIndex = -1; changeFocus( true ); } evt.data.preventDefault(); } }, this ); // Insert buttons. var buttonsHtml = [], buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this, { type : 'hbox', className : 'cke_dialog_footer_buttons', widths : [], children : definition.buttons }, buttonsHtml ).getChild(); this.parts.footer.setHtml( buttonsHtml.join( '' ) ); for ( i = 0 ; i < buttons.length ; i++ ) this._.buttons[ buttons[i].id ] = buttons[i]; }; // Focusable interface. Use it via dialog.addFocusable. function Focusable( dialog, element, index ) { this.element = element; this.focusIndex = index; // TODO: support tabIndex for focusables. this.tabIndex = 0; this.isFocusable = function() { return !element.getAttribute( 'disabled' ) && element.isVisible(); }; this.focus = function() { dialog._.currentFocusIndex = this.focusIndex; this.element.focus(); }; // Bind events element.on( 'keydown', function( e ) { if ( e.data.getKeystroke() in { 32:1, 13:1 } ) this.fire( 'click' ); } ); element.on( 'focus', function() { this.fire( 'mouseover' ); } ); element.on( 'blur', function() { this.fire( 'mouseout' ); } ); } CKEDITOR.dialog.prototype = { destroy : function() { this.hide(); this._.element.remove(); }, /** * Resizes the dialog. * @param {Number} width The width of the dialog in pixels. * @param {Number} height The height of the dialog in pixels. * @function * @example * dialogObj.resize( 800, 640 ); */ resize : (function() { return function( width, height ) { if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height ) return; CKEDITOR.dialog.fire( 'resize', { dialog : this, skin : this._.editor.skinName, width : width, height : height }, this._.editor ); this.fire( 'resize', { skin : this._.editor.skinName, width : width, height : height }, this._.editor ); // Update dialog position when dimension get changed in RTL. if ( this._.editor.lang.dir == 'rtl' && this._.position ) this._.position.x = CKEDITOR.document.getWindow().getViewPaneSize().width - this._.contentSize.width - parseInt( this._.element.getFirst().getStyle( 'right' ), 10 ); this._.contentSize = { width : width, height : height }; }; })(), /** * Gets the current size of the dialog in pixels. * @returns {Object} An object with "width" and "height" properties. * @example * var width = dialogObj.getSize().width; */ getSize : function() { var element = this._.element.getFirst(); return { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0}; }, /** * Moves the dialog to an (x, y) coordinate relative to the window. * @function * @param {Number} x The target x-coordinate. * @param {Number} y The target y-coordinate. * @param {Boolean} save Flag indicate whether the dialog position should be remembered on next open up. * @example * dialogObj.move( 10, 40 ); */ move : (function() { var isFixed; return function( x, y, save ) { // The dialog may be fixed positioned or absolute positioned. Ask the // browser what is the current situation first. var element = this._.element.getFirst(), rtl = this._.editor.lang.dir == 'rtl'; if ( isFixed === undefined ) isFixed = element.getComputedStyle( 'position' ) == 'fixed'; if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y ) return; // Save the current position. this._.position = { x : x, y : y }; // If not fixed positioned, add scroll position to the coordinates. if ( !isFixed ) { var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition(); x += scrollPosition.x; y += scrollPosition.y; } // Translate coordinate for RTL. if ( rtl ) { var dialogSize = this.getSize(), viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(); x = viewPaneSize.width - dialogSize.width - x; } var styles = { 'top' : ( y > 0 ? y : 0 ) + 'px' }; styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px'; element.setStyles( styles ); save && ( this._.moved = 1 ); }; })(), /** * Gets the dialog's position in the window. * @returns {Object} An object with "x" and "y" properties. * @example * var dialogX = dialogObj.getPosition().x; */ getPosition : function(){ return CKEDITOR.tools.extend( {}, this._.position ); }, /** * Shows the dialog box. * @example * dialogObj.show(); */ show : function() { // Insert the dialog's element to the root document. var element = this._.element; var definition = this.definition; if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) ) element.appendTo( CKEDITOR.document.getBody() ); else element.setStyle( 'display', 'block' ); // FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8. if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) { var dialogElement = this.parts.dialog; dialogElement.setStyle( 'position', 'absolute' ); setTimeout( function() { dialogElement.setStyle( 'position', 'fixed' ); }, 0 ); } // First, set the dialog to an appropriate size. this.resize( this._.contentSize && this._.contentSize.width || definition.width || definition.minWidth, this._.contentSize && this._.contentSize.height || definition.height || definition.minHeight ); // Reset all inputs back to their default value. this.reset(); // Select the first tab by default. this.selectPage( this.definition.contents[0].id ); // Set z-index. if ( CKEDITOR.dialog._.currentZIndex === null ) CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex; this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 ); // Maintain the dialog ordering and dialog cover. // Also register key handlers if first dialog. if ( CKEDITOR.dialog._.currentTop === null ) { CKEDITOR.dialog._.currentTop = this; this._.parentDialog = null; showCover( this._.editor ); element.on( 'keydown', accessKeyDownHandler ); element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); // Prevent some keys from bubbling up. (#4269) for ( var event in { keyup :1, keydown :1, keypress :1 } ) element.on( event, preventKeyBubbling ); } else { this._.parentDialog = CKEDITOR.dialog._.currentTop; var parentElement = this._.parentDialog.getElement().getFirst(); parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 ); CKEDITOR.dialog._.currentTop = this; } // Register the Esc hotkeys. registerAccessKey( this, this, '\x1b', null, function() { this.getButton( 'cancel' ) && this.getButton( 'cancel' ).click(); } ); // Reset the hasFocus state. this._.hasFocus = false; CKEDITOR.tools.setTimeout( function() { this.layout(); this.parts.dialog.setStyle( 'visibility', '' ); // Execute onLoad for the first show. this.fireOnce( 'load', {} ); CKEDITOR.ui.fire( 'ready', this ); this.fire( 'show', {} ); this._.editor.fire( 'dialogShow', this ); // Save the initial values of the dialog. this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); }, 100, this ); }, /** * Rearrange the dialog to its previous position or the middle of the window. * @since 3.5 */ layout : function() { var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(), dialogSize = this.getSize(); this.move( this._.moved ? this._.position.x : ( viewSize.width - dialogSize.width ) / 2, this._.moved ? this._.position.y : ( viewSize.height - dialogSize.height ) / 2 ); }, /** * Executes a function for each UI element. * @param {Function} fn Function to execute for each UI element. * @returns {CKEDITOR.dialog} The current dialog object. */ foreach : function( fn ) { for ( var i in this._.contents ) { for ( var j in this._.contents[i] ) fn.call( this, this._.contents[i][j] ); } return this; }, /** * Resets all input values in the dialog. * @example * dialogObj.reset(); * @returns {CKEDITOR.dialog} The current dialog object. */ reset : (function() { var fn = function( widget ){ if ( widget.reset ) widget.reset( 1 ); }; return function(){ this.foreach( fn ); return this; }; })(), /** * Calls the {@link CKEDITOR.dialog.definition.uiElement#setup} method of each of the UI elements, with the arguments passed through it. * It is usually being called when the dialog is opened, to put the initial value inside the field. * @example * dialogObj.setupContent(); * @example * var timestamp = ( new Date() ).valueOf(); * dialogObj.setupContent( timestamp ); */ setupContent : function() { var args = arguments; this.foreach( function( widget ) { if ( widget.setup ) widget.setup.apply( widget, args ); }); }, /** * Calls the {@link CKEDITOR.dialog.definition.uiElement#commit} method of each of the UI elements, with the arguments passed through it. * It is usually being called when the user confirms the dialog, to process the values. * @example * dialogObj.commitContent(); * @example * var timestamp = ( new Date() ).valueOf(); * dialogObj.commitContent( timestamp ); */ commitContent : function() { var args = arguments; this.foreach( function( widget ) { // Make sure IE triggers "change" event on last focused input before closing the dialog. (#7915) if ( CKEDITOR.env.ie && this._.currentFocusIndex == widget.focusIndex ) widget.getInputElement().$.blur(); if ( widget.commit ) widget.commit.apply( widget, args ); }); }, /** * Hides the dialog box. * @example * dialogObj.hide(); */ hide : function() { if ( !this.parts.dialog.isVisible() ) return; this.fire( 'hide', {} ); this._.editor.fire( 'dialogHide', this ); var element = this._.element; element.setStyle( 'display', 'none' ); this.parts.dialog.setStyle( 'visibility', 'hidden' ); // Unregister all access keys associated with this dialog. unregisterAccessKey( this ); // Close any child(top) dialogs first. while( CKEDITOR.dialog._.currentTop != this ) CKEDITOR.dialog._.currentTop.hide(); // Maintain dialog ordering and remove cover if needed. if ( !this._.parentDialog ) hideCover(); else { var parentElement = this._.parentDialog.getElement().getFirst(); parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) ); } CKEDITOR.dialog._.currentTop = this._.parentDialog; // Deduct or clear the z-index. if ( !this._.parentDialog ) { CKEDITOR.dialog._.currentZIndex = null; // Remove access key handlers. element.removeListener( 'keydown', accessKeyDownHandler ); element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); // Remove bubbling-prevention handler. (#4269) for ( var event in { keyup :1, keydown :1, keypress :1 } ) element.removeListener( event, preventKeyBubbling ); var editor = this._.editor; editor.focus(); if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) { var selection = editor.getSelection(); selection && selection.unlock( true ); } } else CKEDITOR.dialog._.currentZIndex -= 10; delete this._.parentDialog; // Reset the initial values of the dialog. this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } ); }, /** * Adds a tabbed page into the dialog. * @param {Object} contents Content definition. * @example */ addPage : function( contents ) { var pageHtml = [], titleHtml = contents.label ? ' title="' + CKEDITOR.tools.htmlEncode( contents.label ) + '"' : '', elements = contents.elements, vbox = CKEDITOR.dialog._.uiElementBuilders.vbox.build( this, { type : 'vbox', className : 'cke_dialog_page_contents', children : contents.elements, expand : !!contents.expand, padding : contents.padding, style : contents.style || 'width: 100%;height:100%' }, pageHtml ); // Create the HTML for the tab and the content block. var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) ); page.setAttribute( 'role', 'tabpanel' ); var env = CKEDITOR.env; var tabId = 'cke_' + contents.id + '_' + CKEDITOR.tools.getNextNumber(), tab = CKEDITOR.dom.element.createFromHtml( [ '<a class="cke_dialog_tab"', ( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ), titleHtml, ( !!contents.hidden ? ' style="display:none"' : '' ), ' id="', tabId, '"', env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"', ' tabIndex="-1"', ' hidefocus="true"', ' role="tab">', contents.label, '</a>' ].join( '' ) ); page.setAttribute( 'aria-labelledby', tabId ); // Take records for the tabs and elements created. this._.tabs[ contents.id ] = [ tab, page ]; this._.tabIdList.push( contents.id ); !contents.hidden && this._.pageCount++; this._.lastTab = tab; this.updateStyle(); var contentMap = this._.contents[ contents.id ] = {}, cursor, children = vbox.getChild(); while ( ( cursor = children.shift() ) ) { contentMap[ cursor.id ] = cursor; if ( typeof( cursor.getChild ) == 'function' ) children.push.apply( children, cursor.getChild() ); } // Attach the DOM nodes. page.setAttribute( 'name', contents.id ); page.appendTo( this.parts.contents ); tab.unselectable(); this.parts.tabs.append( tab ); // Add access key handlers if access key is defined. if ( contents.accessKey ) { registerAccessKey( this, this, 'CTRL+' + contents.accessKey, tabAccessKeyDown, tabAccessKeyUp ); this._.accessKeyMap[ 'CTRL+' + contents.accessKey ] = contents.id; } }, /** * Activates a tab page in the dialog by its id. * @param {String} id The id of the dialog tab to be activated. * @example * dialogObj.selectPage( 'tab_1' ); */ selectPage : function( id ) { if ( this._.currentTabId == id ) return; // Returning true means that the event has been canceled if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true ) return; // Hide the non-selected tabs and pages. for ( var i in this._.tabs ) { var tab = this._.tabs[i][0], page = this._.tabs[i][1]; if ( i != id ) { tab.removeClass( 'cke_dialog_tab_selected' ); page.hide(); } page.setAttribute( 'aria-hidden', i != id ); } var selected = this._.tabs[ id ]; selected[ 0 ].addClass( 'cke_dialog_tab_selected' ); // [IE] an invisible input[type='text'] will enlarge it's width // if it's value is long when it shows, so we clear it's value // before it shows and then recover it (#5649) if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat ) { clearOrRecoverTextInputValue( selected[ 1 ] ); selected[ 1 ].show(); setTimeout( function() { clearOrRecoverTextInputValue( selected[ 1 ], 1 ); }, 0 ); } else selected[ 1 ].show(); this._.currentTabId = id; this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id ); }, // Dialog state-specific style updates. updateStyle : function() { // If only a single page shown, a different style is used in the central pane. this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' ); }, /** * Hides a page's tab away from the dialog. * @param {String} id The page's Id. * @example * dialog.hidePage( 'tab_3' ); */ hidePage : function( id ) { var tab = this._.tabs[id] && this._.tabs[id][0]; if ( !tab || this._.pageCount == 1 || !tab.isVisible() ) return; // Switch to other tab first when we're hiding the active tab. else if ( id == this._.currentTabId ) this.selectPage( getPreviousVisibleTab.call( this ) ); tab.hide(); this._.pageCount--; this.updateStyle(); }, /** * Unhides a page's tab. * @param {String} id The page's Id. * @example * dialog.showPage( 'tab_2' ); */ showPage : function( id ) { var tab = this._.tabs[id] && this._.tabs[id][0]; if ( !tab ) return; tab.show(); this._.pageCount++; this.updateStyle(); }, /** * Gets the root DOM element of the dialog. * @returns {CKEDITOR.dom.element} The &lt;span&gt; element containing this dialog. * @example * var dialogElement = dialogObj.getElement().getFirst(); * dialogElement.setStyle( 'padding', '5px' ); */ getElement : function() { return this._.element; }, /** * Gets the name of the dialog. * @returns {String} The name of this dialog. * @example * var dialogName = dialogObj.getName(); */ getName : function() { return this._.name; }, /** * Gets a dialog UI element object from a dialog page. * @param {String} pageId id of dialog page. * @param {String} elementId id of UI element. * @example * dialogObj.getContentElement( 'tabId', 'elementId' ).setValue( 'Example' ); * @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element. */ getContentElement : function( pageId, elementId ) { var page = this._.contents[ pageId ]; return page && page[ elementId ]; }, /** * Gets the value of a dialog UI element. * @param {String} pageId id of dialog page. * @param {String} elementId id of UI element. * @example * alert( dialogObj.getValueOf( 'tabId', 'elementId' ) ); * @returns {Object} The value of the UI element. */ getValueOf : function( pageId, elementId ) { return this.getContentElement( pageId, elementId ).getValue(); }, /** * Sets the value of a dialog UI element. * @param {String} pageId id of the dialog page. * @param {String} elementId id of the UI element. * @param {Object} value The new value of the UI element. * @example * dialogObj.setValueOf( 'tabId', 'elementId', 'Example' ); */ setValueOf : function( pageId, elementId, value ) { return this.getContentElement( pageId, elementId ).setValue( value ); }, /** * Gets the UI element of a button in the dialog's button row. * @param {String} id The id of the button. * @example * @returns {CKEDITOR.ui.dialog.button} The button object. */ getButton : function( id ) { return this._.buttons[ id ]; }, /** * Simulates a click to a dialog button in the dialog's button row. * @param {String} id The id of the button. * @example * @returns The return value of the dialog's "click" event. */ click : function( id ) { return this._.buttons[ id ].click(); }, /** * Disables a dialog button. * @param {String} id The id of the button. * @example */ disableButton : function( id ) { return this._.buttons[ id ].disable(); }, /** * Enables a dialog button. * @param {String} id The id of the button. * @example */ enableButton : function( id ) { return this._.buttons[ id ].enable(); }, /** * Gets the number of pages in the dialog. * @returns {Number} Page count. */ getPageCount : function() { return this._.pageCount; }, /** * Gets the editor instance which opened this dialog. * @returns {CKEDITOR.editor} Parent editor instances. */ getParentEditor : function() { return this._.editor; }, /** * Gets the element that was selected when opening the dialog, if any. * @returns {CKEDITOR.dom.element} The element that was selected, or null. */ getSelectedElement : function() { return this.getParentEditor().getSelection().getSelectedElement(); }, /** * Adds element to dialog's focusable list. * * @param {CKEDITOR.dom.element} element * @param {Number} [index] */ addFocusable: function( element, index ) { if ( typeof index == 'undefined' ) { index = this._.focusList.length; this._.focusList.push( new Focusable( this, element, index ) ); } else { this._.focusList.splice( index, 0, new Focusable( this, element, index ) ); for ( var i = index + 1 ; i < this._.focusList.length ; i++ ) this._.focusList[ i ].focusIndex++; } } }; CKEDITOR.tools.extend( CKEDITOR.dialog, /** * @lends CKEDITOR.dialog */ { /** * Registers a dialog. * @param {String} name The dialog's name. * @param {Function|String} dialogDefinition * A function returning the dialog's definition, or the URL to the .js file holding the function. * The function should accept an argument "editor" which is the current editor instance, and * return an object conforming to {@link CKEDITOR.dialog.definition}. * @see CKEDITOR.dialog.definition * @example * // Full sample plugin, which does not only register a dialog window but also adds an item to the context menu. * // To open the dialog window, choose "Open dialog" in the context menu. * CKEDITOR.plugins.add( 'myplugin', * { * init: function( editor ) * { * editor.addCommand( 'mydialog',new CKEDITOR.dialogCommand( 'mydialog' ) ); * * if ( editor.contextMenu ) * { * editor.addMenuGroup( 'mygroup', 10 ); * editor.addMenuItem( 'My Dialog', * { * label : 'Open dialog', * command : 'mydialog', * group : 'mygroup' * }); * editor.contextMenu.addListener( function( element ) * { * return { 'My Dialog' : CKEDITOR.TRISTATE_OFF }; * }); * } * * <strong>CKEDITOR.dialog.add</strong>( 'mydialog', function( api ) * { * // CKEDITOR.dialog.definition * var <strong>dialogDefinition</strong> = * { * title : 'Sample dialog', * minWidth : 390, * minHeight : 130, * contents : [ * { * id : 'tab1', * label : 'Label', * title : 'Title', * expand : true, * padding : 0, * elements : * [ * { * type : 'html', * html : '&lt;p&gt;This is some sample HTML content.&lt;/p&gt;' * }, * { * type : 'textarea', * id : 'textareaId', * rows : 4, * cols : 40 * } * ] * } * ], * buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ], * onOk : function() { * // "this" is now a CKEDITOR.dialog object. * // Accessing dialog elements: * var textareaObj = this.<strong>getContentElement</strong>( 'tab1', 'textareaId' ); * alert( "You have entered: " + textareaObj.getValue() ); * } * }; * * return dialogDefinition; * } ); * } * } ); * * CKEDITOR.replace( 'editor1', { extraPlugins : 'myplugin' } ); */ add : function( name, dialogDefinition ) { // Avoid path registration from multiple instances override definition. if ( !this._.dialogDefinitions[name] || typeof dialogDefinition == 'function' ) this._.dialogDefinitions[name] = dialogDefinition; }, exists : function( name ) { return !!this._.dialogDefinitions[ name ]; }, getCurrent : function() { return CKEDITOR.dialog._.currentTop; }, /** * The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds. * @static * @field * @example * @type Function */ okButton : (function() { var retval = function( editor, override ) { override = override || {}; return CKEDITOR.tools.extend( { id : 'ok', type : 'button', label : editor.lang.common.ok, 'class' : 'cke_dialog_ui_button_ok', onClick : function( evt ) { var dialog = evt.data.dialog; if ( dialog.fire( 'ok', { hide : true } ).hide !== false ) dialog.hide(); } }, override, true ); }; retval.type = 'button'; retval.override = function( override ) { return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); }, { type : 'button' }, true ); }; return retval; })(), /** * The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed. * @static * @field * @example * @type Function */ cancelButton : (function() { var retval = function( editor, override ) { override = override || {}; return CKEDITOR.tools.extend( { id : 'cancel', type : 'button', label : editor.lang.common.cancel, 'class' : 'cke_dialog_ui_button_cancel', onClick : function( evt ) { var dialog = evt.data.dialog; if ( dialog.fire( 'cancel', { hide : true } ).hide !== false ) dialog.hide(); } }, override, true ); }; retval.type = 'button'; retval.override = function( override ) { return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); }, { type : 'button' }, true ); }; return retval; })(), /** * Registers a dialog UI element. * @param {String} typeName The name of the UI element. * @param {Function} builder The function to build the UI element. * @example */ addUIElement : function( typeName, builder ) { this._.uiElementBuilders[ typeName ] = builder; } }); CKEDITOR.dialog._ = { uiElementBuilders : {}, dialogDefinitions : {}, currentTop : null, currentZIndex : null }; // "Inherit" (copy actually) from CKEDITOR.event. CKEDITOR.event.implementOn( CKEDITOR.dialog ); CKEDITOR.event.implementOn( CKEDITOR.dialog.prototype, true ); var defaultDialogDefinition = { resizable : CKEDITOR.DIALOG_RESIZE_BOTH, minWidth : 600, minHeight : 400, buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] }; // Tool function used to return an item from an array based on its id // property. var getById = function( array, id, recurse ) { for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) { if ( item.id == id ) return item; if ( recurse && item[ recurse ] ) { var retval = getById( item[ recurse ], id, recurse ) ; if ( retval ) return retval; } } return null; }; // Tool function used to add an item into an array. var addById = function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) { if ( nextSiblingId ) { for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) { if ( item.id == nextSiblingId ) { array.splice( i, 0, newItem ); return newItem; } if ( recurse && item[ recurse ] ) { var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true ); if ( retval ) return retval; } } if ( nullIfNotFound ) return null; } array.push( newItem ); return newItem; }; // Tool function used to remove an item from an array based on its id. var removeById = function( array, id, recurse ) { for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) { if ( item.id == id ) return array.splice( i, 1 ); if ( recurse && item[ recurse ] ) { var retval = removeById( item[ recurse ], id, recurse ); if ( retval ) return retval; } } return null; }; /** * This class is not really part of the API. It is the "definition" property value * passed to "dialogDefinition" event handlers. * @constructor * @name CKEDITOR.dialog.definitionObject * @extends CKEDITOR.dialog.definition * @example * CKEDITOR.on( 'dialogDefinition', function( evt ) * { * var definition = evt.data.definition; * var content = definition.getContents( 'page1' ); * ... * } ); */ var definitionObject = function( dialog, dialogDefinition ) { // TODO : Check if needed. this.dialog = dialog; // Transform the contents entries in contentObjects. var contents = dialogDefinition.contents; for ( var i = 0, content ; ( content = contents[i] ) ; i++ ) contents[ i ] = content && new contentObject( dialog, content ); CKEDITOR.tools.extend( this, dialogDefinition ); }; definitionObject.prototype = /** @lends CKEDITOR.dialog.definitionObject.prototype */ { /** * Gets a content definition. * @param {String} id The id of the content definition. * @returns {CKEDITOR.dialog.definition.content} The content definition * matching id. */ getContents : function( id ) { return getById( this.contents, id ); }, /** * Gets a button definition. * @param {String} id The id of the button definition. * @returns {CKEDITOR.dialog.definition.button} The button definition * matching id. */ getButton : function( id ) { return getById( this.buttons, id ); }, /** * Adds a content definition object under this dialog definition. * @param {CKEDITOR.dialog.definition.content} contentDefinition The * content definition. * @param {String} [nextSiblingId] The id of an existing content * definition which the new content definition will be inserted * before. Omit if the new content definition is to be inserted as * the last item. * @returns {CKEDITOR.dialog.definition.content} The inserted content * definition. */ addContents : function( contentDefinition, nextSiblingId ) { return addById( this.contents, contentDefinition, nextSiblingId ); }, /** * Adds a button definition object under this dialog definition. * @param {CKEDITOR.dialog.definition.button} buttonDefinition The * button definition. * @param {String} [nextSiblingId] The id of an existing button * definition which the new button definition will be inserted * before. Omit if the new button definition is to be inserted as * the last item. * @returns {CKEDITOR.dialog.definition.button} The inserted button * definition. */ addButton : function( buttonDefinition, nextSiblingId ) { return addById( this.buttons, buttonDefinition, nextSiblingId ); }, /** * Removes a content definition from this dialog definition. * @param {String} id The id of the content definition to be removed. * @returns {CKEDITOR.dialog.definition.content} The removed content * definition. */ removeContents : function( id ) { removeById( this.contents, id ); }, /** * Removes a button definition from the dialog definition. * @param {String} id The id of the button definition to be removed. * @returns {CKEDITOR.dialog.definition.button} The removed button * definition. */ removeButton : function( id ) { removeById( this.buttons, id ); } }; /** * This class is not really part of the API. It is the template of the * objects representing content pages inside the * CKEDITOR.dialog.definitionObject. * @constructor * @name CKEDITOR.dialog.definition.contentObject * @example * CKEDITOR.on( 'dialogDefinition', function( evt ) * { * var definition = evt.data.definition; * var content = definition.getContents( 'page1' ); * content.remove( 'textInput1' ); * ... * } ); */ function contentObject( dialog, contentDefinition ) { this._ = { dialog : dialog }; CKEDITOR.tools.extend( this, contentDefinition ); } contentObject.prototype = /** @lends CKEDITOR.dialog.definition.contentObject.prototype */ { /** * Gets a UI element definition under the content definition. * @param {String} id The id of the UI element definition. * @returns {CKEDITOR.dialog.definition.uiElement} */ get : function( id ) { return getById( this.elements, id, 'children' ); }, /** * Adds a UI element definition to the content definition. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition The * UI elemnet definition to be added. * @param {String} nextSiblingId The id of an existing UI element * definition which the new UI element definition will be inserted * before. Omit if the new button definition is to be inserted as * the last item. * @returns {CKEDITOR.dialog.definition.uiElement} The element * definition inserted. */ add : function( elementDefinition, nextSiblingId ) { return addById( this.elements, elementDefinition, nextSiblingId, 'children' ); }, /** * Removes a UI element definition from the content definition. * @param {String} id The id of the UI element definition to be * removed. * @returns {CKEDITOR.dialog.definition.uiElement} The element * definition removed. * @example */ remove : function( id ) { removeById( this.elements, id, 'children' ); } }; function initDragAndDrop( dialog ) { var lastCoords = null, abstractDialogCoords = null, element = dialog.getElement().getFirst(), editor = dialog.getParentEditor(), magnetDistance = editor.config.dialog_magnetDistance, margins = editor.skin.margins || [ 0, 0, 0, 0 ]; if ( typeof magnetDistance == 'undefined' ) magnetDistance = 20; function mouseMoveHandler( evt ) { var dialogSize = dialog.getSize(), viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(), x = evt.data.$.screenX, y = evt.data.$.screenY, dx = x - lastCoords.x, dy = y - lastCoords.y, realX, realY; lastCoords = { x : x, y : y }; abstractDialogCoords.x += dx; abstractDialogCoords.y += dy; if ( abstractDialogCoords.x + margins[3] < magnetDistance ) realX = - margins[3]; else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance ) realX = viewPaneSize.width - dialogSize.width + ( editor.lang.dir == 'rtl' ? 0 : margins[1] ); else realX = abstractDialogCoords.x; if ( abstractDialogCoords.y + margins[0] < magnetDistance ) realY = - margins[0]; else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance ) realY = viewPaneSize.height - dialogSize.height + margins[2]; else realY = abstractDialogCoords.y; dialog.move( realX, realY, 1 ); evt.data.preventDefault(); } function mouseUpHandler( evt ) { CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler ); CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler ); if ( CKEDITOR.env.ie6Compat ) { var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); coverDoc.removeListener( 'mousemove', mouseMoveHandler ); coverDoc.removeListener( 'mouseup', mouseUpHandler ); } } dialog.parts.title.on( 'mousedown', function( evt ) { lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY }; CKEDITOR.document.on( 'mousemove', mouseMoveHandler ); CKEDITOR.document.on( 'mouseup', mouseUpHandler ); abstractDialogCoords = dialog.getPosition(); if ( CKEDITOR.env.ie6Compat ) { var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); coverDoc.on( 'mousemove', mouseMoveHandler ); coverDoc.on( 'mouseup', mouseUpHandler ); } evt.data.preventDefault(); }, dialog ); } function initResizeHandles( dialog ) { var def = dialog.definition, resizable = def.resizable; if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE ) return; var editor = dialog.getParentEditor(); var wrapperWidth, wrapperHeight, viewSize, origin, startSize, dialogCover; var mouseDownFn = CKEDITOR.tools.addFunction( function( $event ) { startSize = dialog.getSize(); var content = dialog.parts.contents, iframeDialog = content.$.getElementsByTagName( 'iframe' ).length; // Shim to help capturing "mousemove" over iframe. if ( iframeDialog ) { dialogCover = CKEDITOR.dom.element.createFromHtml( '<div class="cke_dialog_resize_cover" style="height: 100%; position: absolute; width: 100%;"></div>' ); content.append( dialogCover ); } // Calculate the offset between content and chrome size. wrapperHeight = startSize.height - dialog.parts.contents.getSize( 'height', ! ( CKEDITOR.env.gecko || CKEDITOR.env.opera || CKEDITOR.env.ie && CKEDITOR.env.quirks ) ); wrapperWidth = startSize.width - dialog.parts.contents.getSize( 'width', 1 ); origin = { x : $event.screenX, y : $event.screenY }; viewSize = CKEDITOR.document.getWindow().getViewPaneSize(); CKEDITOR.document.on( 'mousemove', mouseMoveHandler ); CKEDITOR.document.on( 'mouseup', mouseUpHandler ); if ( CKEDITOR.env.ie6Compat ) { var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); coverDoc.on( 'mousemove', mouseMoveHandler ); coverDoc.on( 'mouseup', mouseUpHandler ); } $event.preventDefault && $event.preventDefault(); }); // Prepend the grip to the dialog. dialog.on( 'load', function() { var direction = ''; if ( resizable == CKEDITOR.DIALOG_RESIZE_WIDTH ) direction = ' cke_resizer_horizontal'; else if ( resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT ) direction = ' cke_resizer_vertical'; var resizer = CKEDITOR.dom.element.createFromHtml( '<div' + ' class="cke_resizer' + direction + ' cke_resizer_' + editor.lang.dir + '"' + ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' + ' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event )"></div>' ); dialog.parts.footer.append( resizer, 1 ); }); editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( mouseDownFn ); } ); function mouseMoveHandler( evt ) { var rtl = editor.lang.dir == 'rtl', dx = ( evt.data.$.screenX - origin.x ) * ( rtl ? -1 : 1 ), dy = evt.data.$.screenY - origin.y, width = startSize.width, height = startSize.height, internalWidth = width + dx * ( dialog._.moved ? 1 : 2 ), internalHeight = height + dy * ( dialog._.moved ? 1 : 2 ), element = dialog._.element.getFirst(), right = rtl && element.getComputedStyle( 'right' ), position = dialog.getPosition(); if ( position.y + internalHeight > viewSize.height ) internalHeight = viewSize.height - position.y; if ( ( rtl ? right : position.x ) + internalWidth > viewSize.width ) internalWidth = viewSize.width - ( rtl ? right : position.x ); // Make sure the dialog will not be resized to the wrong side when it's in the leftmost position for RTL. if ( ( resizable == CKEDITOR.DIALOG_RESIZE_WIDTH || resizable == CKEDITOR.DIALOG_RESIZE_BOTH ) ) width = Math.max( def.minWidth || 0, internalWidth - wrapperWidth ); if ( resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT || resizable == CKEDITOR.DIALOG_RESIZE_BOTH ) height = Math.max( def.minHeight || 0, internalHeight - wrapperHeight ); dialog.resize( width, height ); if ( !dialog._.moved ) dialog.layout(); evt.data.preventDefault(); } function mouseUpHandler() { CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler ); CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler ); if ( dialogCover ) { dialogCover.remove(); dialogCover = null; } if ( CKEDITOR.env.ie6Compat ) { var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); coverDoc.removeListener( 'mouseup', mouseUpHandler ); coverDoc.removeListener( 'mousemove', mouseMoveHandler ); } } } var resizeCover; // Caching resuable covers and allowing only one cover // on screen. var covers = {}, currentCover; function cancelEvent( ev ) { ev.data.preventDefault(1); } function showCover( editor ) { var win = CKEDITOR.document.getWindow(); var config = editor.config, backgroundColorStyle = config.dialog_backgroundCoverColor || 'white', backgroundCoverOpacity = config.dialog_backgroundCoverOpacity, baseFloatZIndex = config.baseFloatZIndex, coverKey = CKEDITOR.tools.genKey( backgroundColorStyle, backgroundCoverOpacity, baseFloatZIndex ), coverElement = covers[ coverKey ]; if ( !coverElement ) { var html = [ '<div tabIndex="-1" style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ), '; z-index: ', baseFloatZIndex, '; top: 0px; left: 0px; ', ( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ), '" class="cke_dialog_background_cover">' ]; if ( CKEDITOR.env.ie6Compat ) { // Support for custom document.domain in IE. var isCustomDomain = CKEDITOR.env.isCustomDomain(), iframeHtml = '<html><body style=\\\'background-color:' + backgroundColorStyle + ';\\\'></body></html>'; html.push( '<iframe' + ' hidefocus="true"' + ' frameborder="0"' + ' id="cke_dialog_background_iframe"' + ' src="javascript:' ); html.push( 'void((function(){' + 'document.open();' + ( isCustomDomain ? 'document.domain=\'' + document.domain + '\';' : '' ) + 'document.write( \'' + iframeHtml + '\' );' + 'document.close();' + '})())' ); html.push( '"' + ' style="' + 'position:absolute;' + 'left:0;' + 'top:0;' + 'width:100%;' + 'height: 100%;' + 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)">' + '</iframe>' ); } html.push( '</div>' ); coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) ); coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 ); coverElement.on( 'keydown', cancelEvent ); coverElement.on( 'keypress', cancelEvent ); coverElement.on( 'keyup', cancelEvent ); coverElement.appendTo( CKEDITOR.document.getBody() ); covers[ coverKey ] = coverElement; } else coverElement. show(); currentCover = coverElement; var resizeFunc = function() { var size = win.getViewPaneSize(); coverElement.setStyles( { width : size.width + 'px', height : size.height + 'px' } ); }; var scrollFunc = function() { var pos = win.getScrollPosition(), cursor = CKEDITOR.dialog._.currentTop; coverElement.setStyles( { left : pos.x + 'px', top : pos.y + 'px' }); if ( cursor ) { do { var dialogPos = cursor.getPosition(); cursor.move( dialogPos.x, dialogPos.y ); } while ( ( cursor = cursor._.parentDialog ) ); } }; resizeCover = resizeFunc; win.on( 'resize', resizeFunc ); resizeFunc(); // Using Safari/Mac, focus must be kept where it is (#7027) if ( !( CKEDITOR.env.mac && CKEDITOR.env.webkit ) ) coverElement.focus(); if ( CKEDITOR.env.ie6Compat ) { // IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll. // So we need to invent a really funny way to make it work. var myScrollHandler = function() { scrollFunc(); arguments.callee.prevScrollHandler.apply( this, arguments ); }; win.$.setTimeout( function() { myScrollHandler.prevScrollHandler = window.onscroll || function(){}; window.onscroll = myScrollHandler; }, 0 ); scrollFunc(); } } function hideCover() { if ( !currentCover ) return; var win = CKEDITOR.document.getWindow(); currentCover.hide(); win.removeListener( 'resize', resizeCover ); if ( CKEDITOR.env.ie6Compat ) { win.$.setTimeout( function() { var prevScrollHandler = window.onscroll && window.onscroll.prevScrollHandler; window.onscroll = prevScrollHandler || null; }, 0 ); } resizeCover = null; } function removeCovers() { for ( var coverId in covers ) covers[ coverId ].remove(); covers = {}; } var accessKeyProcessors = {}; var accessKeyDownHandler = function( evt ) { var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, alt = evt.data.$.altKey, shift = evt.data.$.shiftKey, key = String.fromCharCode( evt.data.$.keyCode ), keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; if ( !keyProcessor || !keyProcessor.length ) return; keyProcessor = keyProcessor[keyProcessor.length - 1]; keyProcessor.keydown && keyProcessor.keydown.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); evt.data.preventDefault(); }; var accessKeyUpHandler = function( evt ) { var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, alt = evt.data.$.altKey, shift = evt.data.$.shiftKey, key = String.fromCharCode( evt.data.$.keyCode ), keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; if ( !keyProcessor || !keyProcessor.length ) return; keyProcessor = keyProcessor[keyProcessor.length - 1]; if ( keyProcessor.keyup ) { keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); evt.data.preventDefault(); } }; var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc ) { var procList = accessKeyProcessors[key] || ( accessKeyProcessors[key] = [] ); procList.push( { uiElement : uiElement, dialog : dialog, key : key, keyup : upFunc || uiElement.accessKeyUp, keydown : downFunc || uiElement.accessKeyDown } ); }; var unregisterAccessKey = function( obj ) { for ( var i in accessKeyProcessors ) { var list = accessKeyProcessors[i]; for ( var j = list.length - 1 ; j >= 0 ; j-- ) { if ( list[j].dialog == obj || list[j].uiElement == obj ) list.splice( j, 1 ); } if ( list.length === 0 ) delete accessKeyProcessors[i]; } }; var tabAccessKeyUp = function( dialog, key ) { if ( dialog._.accessKeyMap[key] ) dialog.selectPage( dialog._.accessKeyMap[key] ); }; var tabAccessKeyDown = function( dialog, key ) { }; // ESC, ENTER var preventKeyBubblingKeys = { 27 :1, 13 :1 }; var preventKeyBubbling = function( e ) { if ( e.data.getKeystroke() in preventKeyBubblingKeys ) e.data.stopPropagation(); }; (function() { CKEDITOR.ui.dialog = { /** * The base class of all dialog UI elements. * @constructor * @param {CKEDITOR.dialog} dialog Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element * definition. Accepted fields: * <ul> * <li><strong>id</strong> (Required) The id of the UI element. See {@link * CKEDITOR.dialog#getContentElement}</li> * <li><strong>type</strong> (Required) The type of the UI element. The * value to this field specifies which UI element class will be used to * generate the final widget.</li> * <li><strong>title</strong> (Optional) The popup tooltip for the UI * element.</li> * <li><strong>hidden</strong> (Optional) A flag that tells if the element * should be initially visible.</li> * <li><strong>className</strong> (Optional) Additional CSS class names * to add to the UI element. Separated by space.</li> * <li><strong>style</strong> (Optional) Additional CSS inline styles * to add to the UI element. A semicolon (;) is required after the last * style declaration.</li> * <li><strong>accessKey</strong> (Optional) The alphanumeric access key * for this element. Access keys are automatically prefixed by CTRL.</li> * <li><strong>on*</strong> (Optional) Any UI element definition field that * starts with <em>on</em> followed immediately by a capital letter and * probably more letters is an event handler. Event handlers may be further * divided into registered event handlers and DOM event handlers. Please * refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and * {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more * information.</li> * </ul> * @param {Array} htmlList * List of HTML code to be added to the dialog's content area. * @param {Function|String} nodeNameArg * A function returning a string, or a simple string for the node name for * the root DOM node. Default is 'div'. * @param {Function|Object} stylesArg * A function returning an object, or a simple object for CSS styles applied * to the DOM node. Default is empty object. * @param {Function|Object} attributesArg * A fucntion returning an object, or a simple object for attributes applied * to the DOM node. Default is empty object. * @param {Function|String} contentsArg * A function returning a string, or a simple string for the HTML code inside * the root DOM node. Default is empty string. * @example */ uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg ) { if ( arguments.length < 4 ) return; var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div', html = [ '<', nodeName, ' ' ], styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {}, attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {}, innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '', domId = this.domId = attributes.id || CKEDITOR.tools.getNextId() + '_uiElement', id = this.id = elementDefinition.id, i; // Set the id, a unique id is required for getElement() to work. attributes.id = domId; // Set the type and definition CSS class names. var classes = {}; if ( elementDefinition.type ) classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1; if ( elementDefinition.className ) classes[ elementDefinition.className ] = 1; if ( elementDefinition.disabled ) classes[ 'cke_disabled' ] = 1; var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : []; for ( i = 0 ; i < attributeClasses.length ; i++ ) { if ( attributeClasses[i] ) classes[ attributeClasses[i] ] = 1; } var finalClasses = []; for ( i in classes ) finalClasses.push( i ); attributes['class'] = finalClasses.join( ' ' ); // Set the popup tooltop. if ( elementDefinition.title ) attributes.title = elementDefinition.title; // Write the inline CSS styles. var styleStr = ( elementDefinition.style || '' ).split( ';' ); // Element alignment support. if ( elementDefinition.align ) { var align = elementDefinition.align; styles[ 'margin-left' ] = align == 'left' ? 0 : 'auto'; styles[ 'margin-right' ] = align == 'right' ? 0 : 'auto'; } for ( i in styles ) styleStr.push( i + ':' + styles[i] ); if ( elementDefinition.hidden ) styleStr.push( 'display:none' ); for ( i = styleStr.length - 1 ; i >= 0 ; i-- ) { if ( styleStr[i] === '' ) styleStr.splice( i, 1 ); } if ( styleStr.length > 0 ) attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' ); // Write the attributes. for ( i in attributes ) html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" '); // Write the content HTML. html.push( '>', innerHTML, '</', nodeName, '>' ); // Add contents to the parent HTML array. htmlList.push( html.join( '' ) ); ( this._ || ( this._ = {} ) ).dialog = dialog; // Override isChanged if it is defined in element definition. if ( typeof( elementDefinition.isChanged ) == 'boolean' ) this.isChanged = function(){ return elementDefinition.isChanged; }; if ( typeof( elementDefinition.isChanged ) == 'function' ) this.isChanged = elementDefinition.isChanged; // Overload 'get(set)Value' on definition. if ( typeof( elementDefinition.setValue ) == 'function' ) { this.setValue = CKEDITOR.tools.override( this.setValue, function( org ) { return function( val ){ org.call( this, elementDefinition.setValue.call( this, val ) ); }; } ); } if ( typeof( elementDefinition.getValue ) == 'function' ) { this.getValue = CKEDITOR.tools.override( this.getValue, function( org ) { return function(){ return elementDefinition.getValue.call( this, org.call( this ) ); }; } ); } // Add events. CKEDITOR.event.implementOn( this ); this.registerEvents( elementDefinition ); if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey ) registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey ); var me = this; dialog.on( 'load', function() { var input = me.getInputElement(); if ( input ) { var focusClass = me.type in { 'checkbox' : 1, 'ratio' : 1 } && CKEDITOR.env.ie && CKEDITOR.env.version < 8 ? 'cke_dialog_ui_focused' : ''; input.on( 'focus', function() { dialog._.tabBarMode = false; dialog._.hasFocus = true; me.fire( 'focus' ); focusClass && this.addClass( focusClass ); }); input.on( 'blur', function() { me.fire( 'blur' ); focusClass && this.removeClass( focusClass ); }); } } ); // Register the object as a tab focus if it can be included. if ( this.keyboardFocusable ) { this.tabIndex = elementDefinition.tabIndex || 0; this.focusIndex = dialog._.focusList.push( this ) - 1; this.on( 'focus', function() { dialog._.currentFocusIndex = me.focusIndex; } ); } // Completes this object with everything we have in the // definition. CKEDITOR.tools.extend( this, elementDefinition ); }, /** * Horizontal layout box for dialog UI elements, auto-expends to available width of container. * @constructor * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {Array} childObjList * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this * container. * @param {Array} childHtmlList * Array of HTML code that correspond to the HTML output of all the * objects in childObjList. * @param {Array} htmlList * Array of HTML code that this element will output to. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>widths</strong> (Optional) The widths of child cells.</li> * <li><strong>height</strong> (Optional) The height of the layout.</li> * <li><strong>padding</strong> (Optional) The padding width inside child * cells.</li> * <li><strong>align</strong> (Optional) The alignment of the whole layout * </li> * </ul> * @example */ hbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) { if ( arguments.length < 4 ) return; this._ || ( this._ = {} ); var children = this._.children = childObjList, widths = elementDefinition && elementDefinition.widths || null, height = elementDefinition && elementDefinition.height || null, styles = {}, i; /** @ignore */ var innerHTML = function() { var html = [ '<tbody><tr class="cke_dialog_ui_hbox">' ]; for ( i = 0 ; i < childHtmlList.length ; i++ ) { var className = 'cke_dialog_ui_hbox_child', styles = []; if ( i === 0 ) className = 'cke_dialog_ui_hbox_first'; if ( i == childHtmlList.length - 1 ) className = 'cke_dialog_ui_hbox_last'; html.push( '<td class="', className, '" role="presentation" ' ); if ( widths ) { if ( widths[i] ) styles.push( 'width:' + cssLength( widths[i] ) ); } else styles.push( 'width:' + Math.floor( 100 / childHtmlList.length ) + '%' ); if ( height ) styles.push( 'height:' + cssLength( height ) ); if ( elementDefinition && elementDefinition.padding != undefined ) styles.push( 'padding:' + cssLength( elementDefinition.padding ) ); // In IE Quirks alignment has to be done on table cells. (#7324) if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align ) styles.push( 'text-align:' + children[ i ].align ); if ( styles.length > 0 ) html.push( 'style="' + styles.join('; ') + '" ' ); html.push( '>', childHtmlList[i], '</td>' ); } html.push( '</tr></tbody>' ); return html.join( '' ); }; var attribs = { role : 'presentation' }; elementDefinition && elementDefinition.align && ( attribs.align = elementDefinition.align ); CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'hbox' }, htmlList, 'table', styles, attribs, innerHTML ); }, /** * Vertical layout box for dialog UI elements. * @constructor * @extends CKEDITOR.ui.dialog.hbox * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {Array} childObjList * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this * container. * @param {Array} childHtmlList * Array of HTML code that correspond to the HTML output of all the * objects in childObjList. * @param {Array} htmlList * Array of HTML code that this element will output to. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>width</strong> (Optional) The width of the layout.</li> * <li><strong>heights</strong> (Optional) The heights of individual cells. * </li> * <li><strong>align</strong> (Optional) The alignment of the layout.</li> * <li><strong>padding</strong> (Optional) The padding width inside child * cells.</li> * <li><strong>expand</strong> (Optional) Whether the layout should expand * vertically to fill its container.</li> * </ul> * @example */ vbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) { if ( arguments.length < 3 ) return; this._ || ( this._ = {} ); var children = this._.children = childObjList, width = elementDefinition && elementDefinition.width || null, heights = elementDefinition && elementDefinition.heights || null; /** @ignore */ var innerHTML = function() { var html = [ '<table role="presentation" cellspacing="0" border="0" ' ]; html.push( 'style="' ); if ( elementDefinition && elementDefinition.expand ) html.push( 'height:100%;' ); html.push( 'width:' + cssLength( width || '100%' ), ';' ); html.push( '"' ); html.push( 'align="', CKEDITOR.tools.htmlEncode( ( elementDefinition && elementDefinition.align ) || ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' ) ), '" ' ); html.push( '><tbody>' ); for ( var i = 0 ; i < childHtmlList.length ; i++ ) { var styles = []; html.push( '<tr><td role="presentation" ' ); if ( width ) styles.push( 'width:' + cssLength( width || '100%' ) ); if ( heights ) styles.push( 'height:' + cssLength( heights[i] ) ); else if ( elementDefinition && elementDefinition.expand ) styles.push( 'height:' + Math.floor( 100 / childHtmlList.length ) + '%' ); if ( elementDefinition && elementDefinition.padding != undefined ) styles.push( 'padding:' + cssLength( elementDefinition.padding ) ); // In IE Quirks alignment has to be done on table cells. (#7324) if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align ) styles.push( 'text-align:' + children[ i ].align ); if ( styles.length > 0 ) html.push( 'style="', styles.join( '; ' ), '" ' ); html.push( ' class="cke_dialog_ui_vbox_child">', childHtmlList[i], '</td></tr>' ); } html.push( '</tbody></table>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML ); } }; })(); CKEDITOR.ui.dialog.uiElement.prototype = { /** * Gets the root DOM element of this dialog UI object. * @returns {CKEDITOR.dom.element} Root DOM element of UI object. * @example * uiElement.getElement().hide(); */ getElement : function() { return CKEDITOR.document.getById( this.domId ); }, /** * Gets the DOM element that the user inputs values. * This function is used by setValue(), getValue() and focus(). It should * be overrided in child classes where the input element isn't the root * element. * @returns {CKEDITOR.dom.element} The element where the user input values. * @example * var rawValue = textInput.getInputElement().$.value; */ getInputElement : function() { return this.getElement(); }, /** * Gets the parent dialog object containing this UI element. * @returns {CKEDITOR.dialog} Parent dialog object. * @example * var dialog = uiElement.getDialog(); */ getDialog : function() { return this._.dialog; }, /** * Sets the value of this dialog UI object. * @param {Object} value The new value. * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element. * @returns {CKEDITOR.dialog.uiElement} The current UI element. * @example * uiElement.setValue( 'Dingo' ); */ setValue : function( value, noChangeEvent ) { this.getInputElement().setValue( value ); !noChangeEvent && this.fire( 'change', { value : value } ); return this; }, /** * Gets the current value of this dialog UI object. * @returns {Object} The current value. * @example * var myValue = uiElement.getValue(); */ getValue : function() { return this.getInputElement().getValue(); }, /** * Tells whether the UI object's value has changed. * @returns {Boolean} true if changed, false if not changed. * @example * if ( uiElement.isChanged() ) * &nbsp;&nbsp;confirm( 'Value changed! Continue?' ); */ isChanged : function() { // Override in input classes. return false; }, /** * Selects the parent tab of this element. Usually called by focus() or overridden focus() methods. * @returns {CKEDITOR.dialog.uiElement} The current UI element. * @example * focus : function() * { * this.selectParentTab(); * // do something else. * } */ selectParentTab : function() { var element = this.getInputElement(), cursor = element, tabId; while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 ) { /*jsl:pass*/ } // Some widgets don't have parent tabs (e.g. OK and Cancel buttons). if ( !cursor ) return this; tabId = cursor.getAttribute( 'name' ); // Avoid duplicate select. if ( this._.dialog._.currentTabId != tabId ) this._.dialog.selectPage( tabId ); return this; }, /** * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page. * @returns {CKEDITOR.dialog.uiElement} The current UI element. * @example * uiElement.focus(); */ focus : function() { this.selectParentTab().getInputElement().focus(); return this; }, /** * Registers the on* event handlers defined in the element definition. * The default behavior of this function is: * <ol> * <li> * If the on* event is defined in the class's eventProcesors list, * then the registration is delegated to the corresponding function * in the eventProcessors list. * </li> * <li> * If the on* event is not defined in the eventProcessors list, then * register the event handler under the corresponding DOM event of * the UI element's input DOM element (as defined by the return value * of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}). * </li> * </ol> * This function is only called at UI element instantiation, but can * be overridded in child classes if they require more flexibility. * @param {CKEDITOR.dialog.definition.uiElement} definition The UI element * definition. * @returns {CKEDITOR.dialog.uiElement} The current UI element. * @example */ registerEvents : function( definition ) { var regex = /^on([A-Z]\w+)/, match; var registerDomEvent = function( uiElement, dialog, eventName, func ) { dialog.on( 'load', function() { uiElement.getInputElement().on( eventName, func, uiElement ); }); }; for ( var i in definition ) { if ( !( match = i.match( regex ) ) ) continue; if ( this.eventProcessors[i] ) this.eventProcessors[i].call( this, this._.dialog, definition[i] ); else registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] ); } return this; }, /** * The event processor list used by * {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element * instantiation. The default list defines three on* events: * <ol> * <li>onLoad - Called when the element's parent dialog opens for the * first time</li> * <li>onShow - Called whenever the element's parent dialog opens.</li> * <li>onHide - Called whenever the element's parent dialog closes.</li> * </ol> * @field * @type Object * @example * // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick * // handlers in the UI element's definitions. * CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {}, * &nbsp;&nbsp;CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, * &nbsp;&nbsp;{ onClick : function( dialog, func ) { this.on( 'click', func ); } }, * &nbsp;&nbsp;true ); */ eventProcessors : { onLoad : function( dialog, func ) { dialog.on( 'load', func, this ); }, onShow : function( dialog, func ) { dialog.on( 'show', func, this ); }, onHide : function( dialog, func ) { dialog.on( 'hide', func, this ); } }, /** * The default handler for a UI element's access key down event, which * tries to put focus to the UI element.<br /> * Can be overridded in child classes for more sophisticaed behavior. * @param {CKEDITOR.dialog} dialog The parent dialog object. * @param {String} key The key combination pressed. Since access keys * are defined to always include the CTRL key, its value should always * include a 'CTRL+' prefix. * @example */ accessKeyDown : function( dialog, key ) { this.focus(); }, /** * The default handler for a UI element's access key up event, which * does nothing.<br /> * Can be overridded in child classes for more sophisticated behavior. * @param {CKEDITOR.dialog} dialog The parent dialog object. * @param {String} key The key combination pressed. Since access keys * are defined to always include the CTRL key, its value should always * include a 'CTRL+' prefix. * @example */ accessKeyUp : function( dialog, key ) { }, /** * Disables a UI element. * @example */ disable : function() { var element = this.getElement(), input = this.getInputElement(); input.setAttribute( 'disabled', 'true' ); element.addClass( 'cke_disabled' ); }, /** * Enables a UI element. * @example */ enable : function() { var element = this.getElement(), input = this.getInputElement(); input.removeAttribute( 'disabled' ); element.removeClass( 'cke_disabled' ); }, /** * Determines whether an UI element is enabled or not. * @returns {Boolean} Whether the UI element is enabled. * @example */ isEnabled : function() { return !this.getElement().hasClass( 'cke_disabled' ); }, /** * Determines whether an UI element is visible or not. * @returns {Boolean} Whether the UI element is visible. * @example */ isVisible : function() { return this.getInputElement().isVisible(); }, /** * Determines whether an UI element is focus-able or not. * Focus-able is defined as being both visible and enabled. * @returns {Boolean} Whether the UI element can be focused. * @example */ isFocusable : function() { if ( !this.isEnabled() || !this.isVisible() ) return false; return true; } }; CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** * @lends CKEDITOR.ui.dialog.hbox.prototype */ { /** * Gets a child UI element inside this container. * @param {Array|Number} indices An array or a single number to indicate the child's * position in the container's descendant tree. Omit to get all the children in an array. * @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container * if no argument given, or the specified UI element if indices is given. * @example * var checkbox = hbox.getChild( [0,1] ); * checkbox.setValue( true ); */ getChild : function( indices ) { // If no arguments, return a clone of the children array. if ( arguments.length < 1 ) return this._.children.concat(); // If indices isn't array, make it one. if ( !indices.splice ) indices = [ indices ]; // Retrieve the child element according to tree position. if ( indices.length < 2 ) return this._.children[ indices[0] ]; else return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ? this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) : null; } }, true ); CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox(); (function() { var commonBuilder = { build : function( dialog, elementDefinition, output ) { var children = elementDefinition.children, child, childHtmlList = [], childObjList = []; for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) { var childHtml = []; childHtmlList.push( childHtml ); childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); } return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition ); } }; CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder ); CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder ); })(); /** * Generic dialog command. It opens a specific dialog when executed. * @constructor * @augments CKEDITOR.commandDefinition * @param {string} dialogName The name of the dialog to open when executing * this command. * @example * // Register the "link" command, which opens the "link" dialog. * editor.addCommand( 'link', <b>new CKEDITOR.dialogCommand( 'link' )</b> ); */ CKEDITOR.dialogCommand = function( dialogName ) { this.dialogName = dialogName; }; CKEDITOR.dialogCommand.prototype = { /** @ignore */ exec : function( editor ) { // Special treatment for Opera. (#8031) CKEDITOR.env.opera ? CKEDITOR.tools.setTimeout( function() { editor.openDialog( this.dialogName ) }, 0, this ) : editor.openDialog( this.dialogName ); }, // Dialog commands just open a dialog ui, thus require no undo logic, // undo support should dedicate to specific dialog implementation. canUndo: false, editorFocus : CKEDITOR.env.ie || CKEDITOR.env.webkit }; (function() { var notEmptyRegex = /^([a]|[^a])+$/, integerRegex = /^\d*$/, numberRegex = /^\d*(?:\.\d+)?$/, htmlLengthRegex = /^(((\d*(\.\d+))|(\d*))(px|\%)?)?$/, cssLengthRegex = /^(((\d*(\.\d+))|(\d*))(px|em|ex|in|cm|mm|pt|pc|\%)?)?$/i, inlineStyleRegex = /^(\s*[\w-]+\s*:\s*[^:;]+(?:;|$))*$/; CKEDITOR.VALIDATE_OR = 1; CKEDITOR.VALIDATE_AND = 2; CKEDITOR.dialog.validate = { functions : function() { var args = arguments; return function() { /** * It's important for validate functions to be able to accept the value * as argument in addition to this.getValue(), so that it is possible to * combine validate functions together to make more sophisticated * validators. */ var value = this && this.getValue ? this.getValue() : args[ 0 ]; var msg = undefined, relation = CKEDITOR.VALIDATE_AND, functions = [], i; for ( i = 0 ; i < args.length ; i++ ) { if ( typeof( args[i] ) == 'function' ) functions.push( args[i] ); else break; } if ( i < args.length && typeof( args[i] ) == 'string' ) { msg = args[i]; i++; } if ( i < args.length && typeof( args[i]) == 'number' ) relation = args[i]; var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false ); for ( i = 0 ; i < functions.length ; i++ ) { if ( relation == CKEDITOR.VALIDATE_AND ) passed = passed && functions[i]( value ); else passed = passed || functions[i]( value ); } return !passed ? msg : true; }; }, regex : function( regex, msg ) { /* * Can be greatly shortened by deriving from functions validator if code size * turns out to be more important than performance. */ return function() { var value = this && this.getValue ? this.getValue() : arguments[0]; return !regex.test( value ) ? msg : true; }; }, notEmpty : function( msg ) { return this.regex( notEmptyRegex, msg ); }, integer : function( msg ) { return this.regex( integerRegex, msg ); }, 'number' : function( msg ) { return this.regex( numberRegex, msg ); }, 'cssLength' : function( msg ) { return this.functions( function( val ){ return cssLengthRegex.test( CKEDITOR.tools.trim( val ) ); }, msg ); }, 'htmlLength' : function( msg ) { return this.functions( function( val ){ return htmlLengthRegex.test( CKEDITOR.tools.trim( val ) ); }, msg ); }, 'inlineStyle' : function( msg ) { return this.functions( function( val ){ return inlineStyleRegex.test( CKEDITOR.tools.trim( val ) ); }, msg ); }, equals : function( value, msg ) { return this.functions( function( val ){ return val == value; }, msg ); }, notEqual : function( value, msg ) { return this.functions( function( val ){ return val != value; }, msg ); } }; CKEDITOR.on( 'instanceDestroyed', function( evt ) { // Remove dialog cover on last instance destroy. if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) ) { var currentTopDialog; while ( ( currentTopDialog = CKEDITOR.dialog._.currentTop ) ) currentTopDialog.hide(); removeCovers(); } var dialogs = evt.editor._.storedDialogs; for ( var name in dialogs ) dialogs[ name ].destroy(); }); })(); // Extend the CKEDITOR.editor class with dialog specific functions. CKEDITOR.tools.extend( CKEDITOR.editor.prototype, /** @lends CKEDITOR.editor.prototype */ { /** * Loads and opens a registered dialog. * @param {String} dialogName The registered name of the dialog. * @param {Function} callback The function to be invoked after dialog instance created. * @see CKEDITOR.dialog.add * @example * CKEDITOR.instances.editor1.openDialog( 'smiley' ); * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered. */ openDialog : function( dialogName, callback ) { if ( this.mode == 'wysiwyg' && CKEDITOR.env.ie ) { var selection = this.getSelection(); selection && selection.lock(); } var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], dialogSkin = this.skin.dialog; if ( CKEDITOR.dialog._.currentTop === null ) showCover( this ); // If the dialogDefinition is already loaded, open it immediately. if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded ) { var storedDialogs = this._.storedDialogs || ( this._.storedDialogs = {} ); var dialog = storedDialogs[ dialogName ] || ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); callback && callback.call( dialog, dialog ); dialog.show(); return dialog; } else if ( dialogDefinitions == 'failed' ) { hideCover(); throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' ); } var me = this; function onDialogFileLoaded( success ) { var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], skin = me.skin.dialog; // Check if both skin part and definition is loaded. if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) return; // In case of plugin error, mark it as loading failed. if ( typeof dialogDefinition != 'function' ) CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; me.openDialog( dialogName, callback ); } if ( typeof dialogDefinitions == 'string' ) { var loadDefinition = 1; CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 ); } CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); return null; } }); })(); CKEDITOR.plugins.add( 'dialog', { requires : [ 'dialogui' ] }); // Dialog related configurations. /** * The color of the dialog background cover. It should be a valid CSS color * string. * @name CKEDITOR.config.dialog_backgroundCoverColor * @type String * @default 'white' * @example * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; */ /** * The opacity of the dialog background cover. It should be a number within the * range [0.0, 1.0]. * @name CKEDITOR.config.dialog_backgroundCoverOpacity * @type Number * @default 0.5 * @example * config.dialog_backgroundCoverOpacity = 0.7; */ /** * If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened. * @name CKEDITOR.config.dialog_startupFocusTab * @type Boolean * @default false * @example * config.dialog_startupFocusTab = true; */ /** * The distance of magnetic borders used in moving and resizing dialogs, * measured in pixels. * @name CKEDITOR.config.dialog_magnetDistance * @type Number * @default 20 * @example * config.dialog_magnetDistance = 30; */ /** * The guideline to follow when generating the dialog buttons. There are 3 possible options: * <ul> * <li>'OS' - the buttons will be displayed in the default order of the user's OS;</li> * <li>'ltr' - for Left-To-Right order;</li> * <li>'rtl' - for Right-To-Left order.</li> * </ul> * @name CKEDITOR.config.dialog_buttonsOrder * @type String * @default 'OS' * @since 3.5 * @example * config.dialog_buttonsOrder = 'rtl'; */ /** * The dialog contents to removed. It's a string composed by dialog name and tab name with a colon between them. * Separate each pair with semicolon (see example). * <b>Note: All names are case-sensitive.</b> * <b>Note: Be cautious when specifying dialog tabs that are mandatory, like "info", dialog functionality might be broken because of this!</b> * @name CKEDITOR.config.removeDialogTabs * @type String * @since 3.5 * @default '' * @example * config.removeDialogTabs = 'flash:advanced;image:Link'; */ /** * Fired when a dialog definition is about to be used to create a dialog into * an editor instance. This event makes it possible to customize the definition * before creating it. * <p>Note that this event is called only the first time a specific dialog is * opened. Successive openings will use the cached dialog, and this event will * not get fired.</p> * @name CKEDITOR#dialogDefinition * @event * @param {CKEDITOR.dialog.definition} data The dialog defination that * is being loaded. * @param {CKEDITOR.editor} editor The editor instance that will use the * dialog. */ /** * Fired when a tab is going to be selected in a dialog * @name CKEDITOR.dialog#selectPage * @event * @param {String} page The id of the page that it's gonna be selected. * @param {String} currentPage The id of the current page. */ /** * Fired when the user tries to dismiss a dialog * @name CKEDITOR.dialog#cancel * @event * @param {Boolean} hide Whether the event should proceed or not. */ /** * Fired when the user tries to confirm a dialog * @name CKEDITOR.dialog#ok * @event * @param {Boolean} hide Whether the event should proceed or not. */ /** * Fired when a dialog is shown * @name CKEDITOR.dialog#show * @event */ /** * Fired when a dialog is shown * @name CKEDITOR.editor#dialogShow * @event */ /** * Fired when a dialog is hidden * @name CKEDITOR.dialog#hide * @event */ /** * Fired when a dialog is hidden * @name CKEDITOR.editor#dialogHide * @event */ /** * Fired when a dialog is being resized. The event is fired on * both the 'CKEDITOR.dialog' object and the dialog instance * since 3.5.3, previously it's available only in the global object. * @name CKEDITOR.dialog#resize * @since 3.5 * @event * @param {CKEDITOR.dialog} dialog The dialog being resized (if * it's fired on the dialog itself, this parameter isn't sent). * @param {String} skin The skin name. * @param {Number} width The new width. * @param {Number} height The new height. */
zysms
trunk/zysms/include/ckeditor/_source/plugins/dialog/plugin.js
JavaScript
asf20
101,141
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "showblocks" plugin. Enable it will make all block level * elements being decorated with a border and the element name * displayed on the left-right corner. */ (function() { var cssTemplate = '.%2 p,'+ '.%2 div,'+ '.%2 pre,'+ '.%2 address,'+ '.%2 blockquote,'+ '.%2 h1,'+ '.%2 h2,'+ '.%2 h3,'+ '.%2 h4,'+ '.%2 h5,'+ '.%2 h6'+ '{'+ 'background-repeat: no-repeat;'+ 'background-position: top %3;'+ 'border: 1px dotted gray;'+ 'padding-top: 8px;'+ 'padding-%3: 8px;'+ '}'+ '.%2 p'+ '{'+ '%1p.png);'+ '}'+ '.%2 div'+ '{'+ '%1div.png);'+ '}'+ '.%2 pre'+ '{'+ '%1pre.png);'+ '}'+ '.%2 address'+ '{'+ '%1address.png);'+ '}'+ '.%2 blockquote'+ '{'+ '%1blockquote.png);'+ '}'+ '.%2 h1'+ '{'+ '%1h1.png);'+ '}'+ '.%2 h2'+ '{'+ '%1h2.png);'+ '}'+ '.%2 h3'+ '{'+ '%1h3.png);'+ '}'+ '.%2 h4'+ '{'+ '%1h4.png);'+ '}'+ '.%2 h5'+ '{'+ '%1h5.png);'+ '}'+ '.%2 h6'+ '{'+ '%1h6.png);'+ '}'; var cssTemplateRegex = /%1/g, cssClassRegex = /%2/g, backgroundPositionRegex = /%3/g; var commandDefinition = { readOnly : 1, preserveState : true, editorFocus : false, exec : function ( editor ) { this.toggleState(); this.refresh( editor ); }, refresh : function( editor ) { if ( editor.document ) { var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass'; editor.document.getBody()[ funcName ]( 'cke_show_blocks' ); } } }; CKEDITOR.plugins.add( 'showblocks', { requires : [ 'wysiwygarea' ], init : function( editor ) { var command = editor.addCommand( 'showblocks', commandDefinition ); command.canUndo = false; if ( editor.config.startupOutlineBlocks ) command.setState( CKEDITOR.TRISTATE_ON ); editor.addCss( cssTemplate .replace( cssTemplateRegex, 'background-image: url(' + CKEDITOR.getUrl( this.path ) + 'images/block_' ) .replace( cssClassRegex, 'cke_show_blocks ' ) .replace( backgroundPositionRegex, editor.lang.dir == 'rtl' ? 'right' : 'left' ) ); editor.ui.addButton( 'ShowBlocks', { label : editor.lang.showBlocks, command : 'showblocks' }); // Refresh the command on setData. editor.on( 'mode', function() { if ( command.state != CKEDITOR.TRISTATE_DISABLED ) command.refresh( editor ); }); // Refresh the command on setData. editor.on( 'contentDom', function() { if ( command.state != CKEDITOR.TRISTATE_DISABLED ) command.refresh( editor ); }); } }); } )(); /** * Whether to automaticaly enable the "show block" command when the editor * loads. (StartupShowBlocks in FCKeditor) * @name CKEDITOR.config.startupOutlineBlocks * @type Boolean * @default false * @example * config.startupOutlineBlocks = true; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/showblocks/plugin.js
JavaScript
asf20
3,212
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @stylesheetParser plugin. */ (function() { // We want to extract only the elements with classes defined in the stylesheets: function parseClasses( aRules, skipSelectors, validSelectors ) { // aRules are just the different rules in the style sheets // We want to merge them and them split them by commas, so we end up with only // the selectors var s = aRules.join(' '); // Remove selectors splitting the elements, leave only the class selector (.) s = s.replace( /(,|>|\+|~)/g, ' ' ); // Remove attribute selectors: table[border="0"] s = s.replace( /\[[^\]]*/g, '' ); // Remove Ids: div#main s = s.replace( /#[^\s]*/g, '' ); // Remove pseudo-selectors and pseudo-elements: :hover :nth-child(2n+1) ::before s = s.replace( /\:{1,2}[^\s]*/g, '' ); s = s.replace( /\s+/g, ' ' ); var aSelectors = s.split( ' ' ), aClasses = []; for ( var i = 0; i < aSelectors.length ; i++ ) { var selector = aSelectors[ i ]; if ( validSelectors.test( selector ) && !skipSelectors.test( selector ) ) { // If we still don't know about this one, add it if ( CKEDITOR.tools.indexOf( aClasses, selector ) == -1 ) aClasses.push( selector ); } } return aClasses; } function LoadStylesCSS( theDoc, skipSelectors, validSelectors ) { var styles = [], // It will hold all the rules of the applied stylesheets (except those internal to CKEditor) aRules = [], i; for ( i = 0; i < theDoc.styleSheets.length; i++ ) { var sheet = theDoc.styleSheets[ i ], node = sheet.ownerNode || sheet.owningElement; // Skip the internal stylesheets if ( node.getAttribute( 'data-cke-temp' ) ) continue; // Exclude stylesheets injected by extensions if ( sheet.href && sheet.href.substr(0, 9) == 'chrome://' ) continue; var sheetRules = sheet.cssRules || sheet.rules; for ( var j = 0; j < sheetRules.length; j++ ) aRules.push( sheetRules[ j ].selectorText ); } var aClasses = parseClasses( aRules, skipSelectors, validSelectors ); // Add each style to our "Styles" collection. for ( i = 0; i < aClasses.length; i++ ) { var oElement = aClasses[ i ].split( '.' ), element = oElement[ 0 ].toLowerCase(), sClassName = oElement[ 1 ]; styles.push( { name : element + '.' + sClassName, element : element, attributes : {'class' : sClassName} }); } return styles; } // Register a plugin named "stylesheetparser". CKEDITOR.plugins.add( 'stylesheetparser', { requires: [ 'styles' ], onLoad : function() { var obj = CKEDITOR.editor.prototype; obj.getStylesSet = CKEDITOR.tools.override( obj.getStylesSet, function( org ) { return function( callback ) { var self = this; org.call( this, function( definitions ) { // Rules that must be skipped var skipSelectors = self.config.stylesheetParser_skipSelectors || ( /(^body\.|^\.)/i ), // Rules that are valid validSelectors = self.config.stylesheetParser_validSelectors || ( /\w+\.\w+/ ); callback( ( self._.stylesDefinitions = definitions.concat( LoadStylesCSS( self.document.$, skipSelectors, validSelectors ) ) ) ); }); }; }); } }); })(); /** * A regular expression that defines whether a CSS rule will be * skipped by the Stylesheet Parser plugin. A CSS rule matching * the regular expression will be ignored and will not be available * in the Styles drop-down list. * @name CKEDITOR.config.stylesheetParser_skipSelectors * @type RegExp * @default /(^body\.|^\.)/i * @since 3.6 * @see CKEDITOR.config.stylesheetParser_validSelectors * @example * // Ignore rules for body and caption elements, classes starting with "high", and any class defined for no specific element. * config.stylesheetParser_skipSelectors = /(^body\.|^caption\.|\.high|^\.)/i; */ /** * A regular expression that defines which CSS rules will be used * by the Stylesheet Parser plugin. A CSS rule matching the regular * expression will be available in the Styles drop-down list. * @name CKEDITOR.config.stylesheetParser_validSelectors * @type RegExp * @default /\w+\.\w+/ * @since 3.6 * @see CKEDITOR.config.stylesheetParser_skipSelectors * @example * // Only add rules for p and span elements. * config.stylesheetParser_validSelectors = /\^(p|span)\.\w+/; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/stylesheetparser/plugin.js
JavaScript
asf20
4,621
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** @fileoverview The "dialogui" plugin. */ CKEDITOR.plugins.add( 'dialogui' ); (function() { var initPrivateObject = function( elementDefinition ) { this._ || ( this._ = {} ); this._['default'] = this._.initValue = elementDefinition['default'] || ''; this._.required = elementDefinition[ 'required' ] || false; var args = [ this._ ]; for ( var i = 1 ; i < arguments.length ; i++ ) args.push( arguments[i] ); args.push( true ); CKEDITOR.tools.extend.apply( CKEDITOR.tools, args ); return this._; }, textBuilder = { build : function( dialog, elementDefinition, output ) { return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output ); } }, commonBuilder = { build : function( dialog, elementDefinition, output ) { return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output ); } }, containerBuilder = { build : function( dialog, elementDefinition, output ) { var children = elementDefinition.children, child, childHtmlList = [], childObjList = []; for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) { var childHtml = []; childHtmlList.push( childHtml ); childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); } return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition ); } }, commonPrototype = { isChanged : function() { return this.getValue() != this.getInitValue(); }, reset : function( noChangeEvent ) { this.setValue( this.getInitValue(), noChangeEvent ); }, setInitValue : function() { this._.initValue = this.getValue(); }, resetInitValue : function() { this._.initValue = this._['default']; }, getInitValue : function() { return this._.initValue; } }, commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, { onChange : function( dialog, func ) { if ( !this._.domOnChangeRegistered ) { dialog.on( 'load', function() { this.getInputElement().on( 'change', function() { // Make sure 'onchange' doesn't get fired after dialog closed. (#5719) if ( !dialog.parts.dialog.isVisible() ) return; this.fire( 'change', { value : this.getValue() } ); }, this ); }, this ); this._.domOnChangeRegistered = true; } this.on( 'change', func ); } }, true ), eventRegex = /^on([A-Z]\w+)/, cleanInnerDefinition = function( def ) { // An inner UI element should not have the parent's type, title or events. for ( var i in def ) { if ( eventRegex.test( i ) || i == 'title' || i == 'type' ) delete def[i]; } return def; }; CKEDITOR.tools.extend( CKEDITOR.ui.dialog, /** @lends CKEDITOR.ui.dialog */ { /** * Base class for all dialog elements with a textual label on the left. * @constructor * @example * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>label</strong> (Required) The label string.</li> * <li><strong>labelLayout</strong> (Optional) Put 'horizontal' here if the * label element is to be layed out horizontally. Otherwise a vertical * layout will be used.</li> * <li><strong>widths</strong> (Optional) This applies only for horizontal * layouts - an 2-element array of lengths to specify the widths of the * label and the content element.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. * @param {Function} contentHtml * A function returning the HTML code string to be added inside the content * cell. */ labeledElement : function( dialog, elementDefinition, htmlList, contentHtml ) { if ( arguments.length < 4 ) return; var _ = initPrivateObject.call( this, elementDefinition ); _.labelId = CKEDITOR.tools.getNextId() + '_label'; var children = this._.children = []; /** @ignore */ var innerHTML = function() { var html = [], requiredClass = elementDefinition.required ? ' cke_required' : '' ; if ( elementDefinition.labelLayout != 'horizontal' ) html.push( '<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ', ' id="'+ _.labelId + '"', ' for="' + _.inputId + '"', ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>', elementDefinition.label, '</label>', '<div class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + ' role="presentation">', contentHtml.call( this, dialog, elementDefinition ), '</div>' ); else { var hboxDefinition = { type : 'hbox', widths : elementDefinition.widths, padding : 0, children : [ { type : 'html', html : '<label class="cke_dialog_ui_labeled_label' + requiredClass + '"' + ' id="' + _.labelId + '"' + ' for="' + _.inputId + '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>' + CKEDITOR.tools.htmlEncode( elementDefinition.label ) + '</span>' }, { type : 'html', html : '<span class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + '>' + contentHtml.call( this, dialog, elementDefinition ) + '</span>' } ] }; CKEDITOR.dialog._.uiElementBuilders.hbox.build( dialog, hboxDefinition, html ); } return html.join( '' ); }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'div', null, { role : 'presentation' }, innerHTML ); }, /** * A text input with a label. This UI element class represents both the * single-line text inputs and password inputs in dialog boxes. * @constructor * @example * @extends CKEDITOR.ui.dialog.labeledElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>default</strong> (Optional) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function. </li> * <li><strong>maxLength</strong> (Optional) The maximum length of text box * contents.</li> * <li><strong>size</strong> (Optional) The size of the text box. This is * usually overridden by the size defined by the skin, however.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ textInput : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; initPrivateObject.call( this, elementDefinition ); var domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textInput', attributes = { 'class' : 'cke_dialog_ui_input_' + elementDefinition.type, id : domId, type : 'text' }, i; // Set the validator, if any. if ( elementDefinition.validate ) this.validate = elementDefinition.validate; // Set the max length and size. if ( elementDefinition.maxLength ) attributes.maxlength = elementDefinition.maxLength; if ( elementDefinition.size ) attributes.size = elementDefinition.size; if ( elementDefinition.inputStyle ) attributes.style = elementDefinition.inputStyle; // If user presses Enter in a text box, it implies clicking OK for the dialog. var me = this, keyPressedOnMe = false; dialog.on( 'load', function() { me.getInputElement().on( 'keydown', function( evt ) { if ( evt.data.getKeystroke() == 13 ) keyPressedOnMe = true; } ); // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749) me.getInputElement().on( 'keyup', function( evt ) { if ( evt.data.getKeystroke() == 13 && keyPressedOnMe ) { dialog.getButton( 'ok' ) && setTimeout( function () { dialog.getButton( 'ok' ).click(); }, 0 ); keyPressedOnMe = false; } }, null, null, 1000 ); } ); /** @ignore */ var innerHTML = function() { // IE BUG: Text input fields in IE at 100% would exceed a <td> or inline // container's width, so need to wrap it inside a <div>. var html = [ '<div class="cke_dialog_ui_input_', elementDefinition.type, '" role="presentation"' ]; if ( elementDefinition.width ) html.push( 'style="width:'+ elementDefinition.width +'" ' ); html.push( '><input ' ); attributes[ 'aria-labelledby' ] = this._.labelId; this._.required && ( attributes[ 'aria-required' ] = this._.required ); for ( var i in attributes ) html.push( i + '="' + attributes[i] + '" ' ); html.push( ' /></div>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A text area with a label on the top or left. * @constructor * @extends CKEDITOR.ui.dialog.labeledElement * @example * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>rows</strong> (Optional) The number of rows displayed. * Defaults to 5 if not defined.</li> * <li><strong>cols</strong> (Optional) The number of cols displayed. * Defaults to 20 if not defined. Usually overridden by skins.</li> * <li><strong>default</strong> (Optional) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function. </li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ textarea : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; initPrivateObject.call( this, elementDefinition ); var me = this, domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textarea', attributes = {}; if ( elementDefinition.validate ) this.validate = elementDefinition.validate; // Generates the essential attributes for the textarea tag. attributes.rows = elementDefinition.rows || 5; attributes.cols = elementDefinition.cols || 20; if ( typeof elementDefinition.inputStyle != 'undefined' ) attributes.style = elementDefinition.inputStyle; /** @ignore */ var innerHTML = function() { attributes[ 'aria-labelledby' ] = this._.labelId; this._.required && ( attributes[ 'aria-required' ] = this._.required ); var html = [ '<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea class="cke_dialog_ui_input_textarea" id="', domId, '" ' ]; for ( var i in attributes ) html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ' ); html.push( '>', CKEDITOR.tools.htmlEncode( me._['default'] ), '</textarea></div>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A single checkbox with a label on the right. * @constructor * @extends CKEDITOR.ui.dialog.uiElement * @example * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>checked</strong> (Optional) Whether the checkbox is checked * on instantiation. Defaults to false.</li> * <li><strong>validate</strong> (Optional) The validation function.</li> * <li><strong>label</strong> (Optional) The checkbox label.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ checkbox : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var _ = initPrivateObject.call( this, elementDefinition, { 'default' : !!elementDefinition[ 'default' ] } ); if ( elementDefinition.validate ) this.validate = elementDefinition.validate; /** @ignore */ var innerHTML = function() { var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { id : elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextId() + '_checkbox' }, true ), html = []; var labelId = CKEDITOR.tools.getNextId() + '_label'; var attributes = { 'class' : 'cke_dialog_ui_checkbox_input', type : 'checkbox', 'aria-labelledby' : labelId }; cleanInnerDefinition( myDefinition ); if ( elementDefinition[ 'default' ] ) attributes.checked = 'checked'; if ( typeof myDefinition.inputStyle != 'undefined' ) myDefinition.style = myDefinition.inputStyle; _.checkbox = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'input', null, attributes ); html.push( ' <label id="', labelId, '" for="', attributes.id, '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>', CKEDITOR.tools.htmlEncode( elementDefinition.label ), '</label>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'span', null, null, innerHTML ); }, /** * A group of radio buttons. * @constructor * @example * @extends CKEDITOR.ui.dialog.labeledElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>default</strong> (Required) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function.</li> * <li><strong>items</strong> (Required) An array of options. Each option * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' * is missing, then the value would be assumed to be the same as the * description.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ radio : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3) return; initPrivateObject.call( this, elementDefinition ); if ( !this._['default'] ) this._['default'] = this._.initValue = elementDefinition.items[0][1]; if ( elementDefinition.validate ) this.validate = elementDefinition.valdiate; var children = [], me = this; /** @ignore */ var innerHTML = function() { var inputHtmlList = [], html = [], commonAttributes = { 'class' : 'cke_dialog_ui_radio_item', 'aria-labelledby' : this._.labelId }, commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio'; for ( var i = 0 ; i < elementDefinition.items.length ; i++ ) { var item = elementDefinition.items[i], title = item[2] !== undefined ? item[2] : item[0], value = item[1] !== undefined ? item[1] : item[0], inputId = CKEDITOR.tools.getNextId() + '_radio_input', labelId = inputId + '_label', inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { id : inputId, title : null, type : null }, true ), labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, { title : title }, true ), inputAttributes = { type : 'radio', 'class' : 'cke_dialog_ui_radio_input', name : commonName, value : value, 'aria-labelledby' : labelId }, inputHtml = []; if ( me._['default'] == value ) inputAttributes.checked = 'checked'; cleanInnerDefinition( inputDefinition ); cleanInnerDefinition( labelDefinition ); if ( typeof inputDefinition.inputStyle != 'undefined' ) inputDefinition.style = inputDefinition.inputStyle; children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) ); inputHtml.push( ' ' ); new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id : labelId, 'for' : inputAttributes.id }, item[0] ); inputHtmlList.push( inputHtml.join( '' ) ); } new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); this._.children = children; }, /** * A button with a label inside. * @constructor * @example * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>label</strong> (Required) The button label.</li> * <li><strong>disabled</strong> (Optional) Set to true if you want the * button to appear in disabled state.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ button : function( dialog, elementDefinition, htmlList ) { if ( !arguments.length ) return; if ( typeof elementDefinition == 'function' ) elementDefinition = elementDefinition( dialog.getParentEditor() ); initPrivateObject.call( this, elementDefinition, { disabled : elementDefinition.disabled || false } ); // Add OnClick event to this input. CKEDITOR.event.implementOn( this ); var me = this; // Register an event handler for processing button clicks. dialog.on( 'load', function( eventInfo ) { var element = this.getElement(); (function() { element.on( 'click', function( evt ) { me.fire( 'click', { dialog : me.getDialog() } ); evt.data.preventDefault(); } ); element.on( 'keydown', function( evt ) { if ( evt.data.getKeystroke() in { 32:1 } ) { me.click(); evt.data.preventDefault(); } } ); })(); element.unselectable(); }, this ); var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition ); delete outerDefinition.style; var labelId = CKEDITOR.tools.getNextId() + '_label'; CKEDITOR.ui.dialog.uiElement.call( this, dialog, outerDefinition, htmlList, 'a', null, { style : elementDefinition.style, href : 'javascript:void(0)', title : elementDefinition.label, hidefocus : 'true', 'class' : elementDefinition['class'], role : 'button', 'aria-labelledby' : labelId }, '<span id="' + labelId + '" class="cke_dialog_ui_button">' + CKEDITOR.tools.htmlEncode( elementDefinition.label ) + '</span>' ); }, /** * A select box. * @extends CKEDITOR.ui.dialog.uiElement * @example * @constructor * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>default</strong> (Required) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function.</li> * <li><strong>items</strong> (Required) An array of options. Each option * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' * is missing, then the value would be assumed to be the same as the * description.</li> * <li><strong>multiple</strong> (Optional) Set this to true if you'd like * to have a multiple-choice select box.</li> * <li><strong>size</strong> (Optional) The number of items to display in * the select box.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ select : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var _ = initPrivateObject.call( this, elementDefinition ); if ( elementDefinition.validate ) this.validate = elementDefinition.validate; _.inputId = CKEDITOR.tools.getNextId() + '_select'; /** @ignore */ var innerHTML = function() { var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { id : elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextId() + '_select' }, true ), html = [], innerHTML = [], attributes = { 'id' : _.inputId, 'class' : 'cke_dialog_ui_input_select', 'aria-labelledby' : this._.labelId }; // Add multiple and size attributes from element definition. if ( elementDefinition.size != undefined ) attributes.size = elementDefinition.size; if ( elementDefinition.multiple != undefined ) attributes.multiple = elementDefinition.multiple; cleanInnerDefinition( myDefinition ); for ( var i = 0, item ; i < elementDefinition.items.length && ( item = elementDefinition.items[i] ) ; i++ ) { innerHTML.push( '<option value="', CKEDITOR.tools.htmlEncode( item[1] !== undefined ? item[1] : item[0] ).replace( /"/g, '&quot;' ), '" /> ', CKEDITOR.tools.htmlEncode( item[0] ) ); } if ( typeof myDefinition.inputStyle != 'undefined' ) myDefinition.style = myDefinition.inputStyle; _.select = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'select', null, attributes, innerHTML.join( '' ) ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A file upload input. * @extends CKEDITOR.ui.dialog.labeledElement * @example * @constructor * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>validate</strong> (Optional) The validation function.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ file : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; if ( elementDefinition['default'] === undefined ) elementDefinition['default'] = ''; var _ = CKEDITOR.tools.extend( initPrivateObject.call( this, elementDefinition ), { definition : elementDefinition, buttons : [] } ); if ( elementDefinition.validate ) this.validate = elementDefinition.validate; /** @ignore */ var innerHTML = function() { _.frameId = CKEDITOR.tools.getNextId() + '_fileInput'; // Support for custom document.domain in IE. var isCustomDomain = CKEDITOR.env.isCustomDomain(); var html = [ '<iframe' + ' frameborder="0"' + ' allowtransparency="0"' + ' class="cke_dialog_ui_input_file"' + ' id="', _.frameId, '"' + ' title="', elementDefinition.label, '"' + ' src="javascript:void(' ]; html.push( isCustomDomain ? '(function(){' + 'document.open();' + 'document.domain=\'' + document.domain + '\';' + 'document.close();' + '})()' : '0' ); html.push( ')">' + '</iframe>' ); return html.join( '' ); }; // IE BUG: Parent container does not resize to contain the iframe automatically. dialog.on( 'load', function() { var iframe = CKEDITOR.document.getById( _.frameId ), contentDiv = iframe.getParent(); contentDiv.addClass( 'cke_dialog_ui_input_file' ); } ); CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A button for submitting the file in a file upload input. * @extends CKEDITOR.ui.dialog.button * @example * @constructor * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>for</strong> (Required) The file input's page and element Id * to associate to, in a 2-item array format: [ 'page_id', 'element_id' ]. * </li> * <li><strong>validate</strong> (Optional) The validation function.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ fileButton : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var _ = initPrivateObject.call( this, elementDefinition ), me = this; if ( elementDefinition.validate ) this.validate = elementDefinition.validate; var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition ); var onClick = myDefinition.onClick; myDefinition.className = ( myDefinition.className ? myDefinition.className + ' ' : '' ) + 'cke_dialog_ui_button'; myDefinition.onClick = function( evt ) { var target = elementDefinition[ 'for' ]; // [ pageId, elementId ] if ( !onClick || onClick.call( this, evt ) !== false ) { dialog.getContentElement( target[0], target[1] ).submit(); this.disable(); } }; dialog.on( 'load', function() { dialog.getContentElement( elementDefinition[ 'for' ][0], elementDefinition[ 'for' ][1] )._.buttons.push( me ); } ); CKEDITOR.ui.dialog.button.call( this, dialog, myDefinition, htmlList ); }, html : (function() { var myHtmlRe = /^\s*<[\w:]+\s+([^>]*)?>/, theirHtmlRe = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/, emptyTagRe = /\/$/; /** * A dialog element made from raw HTML code. * @extends CKEDITOR.ui.dialog.uiElement * @name CKEDITOR.ui.dialog.html * @param {CKEDITOR.dialog} dialog Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element definition. * Accepted fields: * <ul> * <li><strong>html</strong> (Required) HTML code of this element.</li> * </ul> * @param {Array} htmlList List of HTML code to be added to the dialog's content area. * @example * @constructor */ return function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var myHtmlList = [], myHtml, theirHtml = elementDefinition.html, myMatch, theirMatch; // If the HTML input doesn't contain any tags at the beginning, add a <span> tag around it. if ( theirHtml.charAt( 0 ) != '<' ) theirHtml = '<span>' + theirHtml + '</span>'; // Look for focus function in definition. var focus = elementDefinition.focus; if ( focus ) { var oldFocus = this.focus; this.focus = function() { oldFocus.call( this ); typeof focus == 'function' && focus.call( this ); this.fire( 'focus' ); }; if ( elementDefinition.isFocusable ) { var oldIsFocusable = this.isFocusable; this.isFocusable = oldIsFocusable; } this.keyboardFocusable = true; } CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, myHtmlList, 'span', null, null, '' ); // Append the attributes created by the uiElement call to the real HTML. myHtml = myHtmlList.join( '' ); myMatch = myHtml.match( myHtmlRe ); theirMatch = theirHtml.match( theirHtmlRe ) || [ '', '', '' ]; if ( emptyTagRe.test( theirMatch[1] ) ) { theirMatch[1] = theirMatch[1].slice( 0, -1 ); theirMatch[2] = '/' + theirMatch[2]; } htmlList.push( [ theirMatch[1], ' ', myMatch[1] || '', theirMatch[2] ].join( '' ) ); }; })(), /** * Form fieldset for grouping dialog UI elements. * @constructor * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog Parent dialog object. * @param {Array} childObjList * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this * container. * @param {Array} childHtmlList * Array of HTML code that correspond to the HTML output of all the * objects in childObjList. * @param {Array} htmlList * Array of HTML code that this element will output to. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>label</strong> (Optional) The legend of the this fieldset.</li> * <li><strong>children</strong> (Required) An array of dialog field definitions which will be grouped inside this fieldset. </li> * </ul> */ fieldset : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) { var legendLabel = elementDefinition.label; /** @ignore */ var innerHTML = function() { var html = []; legendLabel && html.push( '<legend>' + legendLabel + '</legend>' ); for ( var i = 0; i < childHtmlList.length; i++ ) html.push( childHtmlList[ i ] ); return html.join( '' ); }; this._ = { children : childObjList }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'fieldset', null, null, innerHTML ); } }, true ); CKEDITOR.ui.dialog.html.prototype = new CKEDITOR.ui.dialog.uiElement; CKEDITOR.ui.dialog.labeledElement.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.labeledElement.prototype */ { /** * Sets the label text of the element. * @param {String} label The new label text. * @returns {CKEDITOR.ui.dialog.labeledElement} The current labeled element. * @example */ setLabel : function( label ) { var node = CKEDITOR.document.getById( this._.labelId ); if ( node.getChildCount() < 1 ) ( new CKEDITOR.dom.text( label, CKEDITOR.document ) ).appendTo( node ); else node.getChild( 0 ).$.nodeValue = label; return this; }, /** * Retrieves the current label text of the elment. * @returns {String} The current label text. * @example */ getLabel : function() { var node = CKEDITOR.document.getById( this._.labelId ); if ( !node || node.getChildCount() < 1 ) return ''; else return node.getChild( 0 ).getText(); }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : commonEventProcessors }, true ); CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.button.prototype */ { /** * Simulates a click to the button. * @example * @returns {Object} Return value of the 'click' event. */ click : function() { if ( !this._.disabled ) return this.fire( 'click', { dialog : this._.dialog } ); this.getElement().$.blur(); return false; }, /** * Enables the button. * @example */ enable : function() { this._.disabled = false; var element = this.getElement(); element && element.removeClass( 'cke_disabled' ); }, /** * Disables the button. * @example */ disable : function() { this._.disabled = true; this.getElement().addClass( 'cke_disabled' ); }, isVisible : function() { return this.getElement().getFirst().isVisible(); }, isEnabled : function() { return !this._.disabled; }, /** * Defines the onChange event and onClick for button element definitions. * @field * @type Object * @example */ eventProcessors : CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, { /** @ignore */ onClick : function( dialog, func ) { this.on( 'click', func ); } }, true ), /** * Handler for the element's access key up event. Simulates a click to * the button. * @example */ accessKeyUp : function() { this.click(); }, /** * Handler for the element's access key down event. Simulates a mouse * down to the button. * @example */ accessKeyDown : function() { this.focus(); }, keyboardFocusable : true }, true ); CKEDITOR.ui.dialog.textInput.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement, /** @lends CKEDITOR.ui.dialog.textInput.prototype */ { /** * Gets the text input DOM element under this UI object. * @example * @returns {CKEDITOR.dom.element} The DOM element of the text input. */ getInputElement : function() { return CKEDITOR.document.getById( this._.inputId ); }, /** * Puts focus into the text input. * @example */ focus : function() { var me = this.selectParentTab(); // GECKO BUG: setTimeout() is needed to workaround invisible selections. setTimeout( function() { var element = me.getInputElement(); element && element.$.focus(); }, 0 ); }, /** * Selects all the text in the text input. * @example */ select : function() { var me = this.selectParentTab(); // GECKO BUG: setTimeout() is needed to workaround invisible selections. setTimeout( function() { var e = me.getInputElement(); if ( e ) { e.$.focus(); e.$.select(); } }, 0 ); }, /** * Handler for the text input's access key up event. Makes a select() * call to the text input. * @example */ accessKeyUp : function() { this.select(); }, /** * Sets the value of this text input object. * @param {Object} value The new value. * @returns {CKEDITOR.ui.dialog.textInput} The current UI element. * @example * uiElement.setValue( 'Blamo' ); */ setValue : function( value ) { !value && ( value = '' ); return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply( this, arguments ); }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.textarea.prototype = new CKEDITOR.ui.dialog.textInput(); CKEDITOR.ui.dialog.select.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement, /** @lends CKEDITOR.ui.dialog.select.prototype */ { /** * Gets the DOM element of the select box. * @returns {CKEDITOR.dom.element} The &lt;select&gt; element of this UI * element. * @example */ getInputElement : function() { return this._.select.getElement(); }, /** * Adds an option to the select box. * @param {String} label Option label. * @param {String} value (Optional) Option value, if not defined it'll be * assumed to be the same as the label. * @param {Number} index (Optional) Position of the option to be inserted * to. If not defined the new option will be inserted to the end of list. * @example * @returns {CKEDITOR.ui.dialog.select} The current select UI element. */ add : function( label, value, index ) { var option = new CKEDITOR.dom.element( 'option', this.getDialog().getParentEditor().document ), selectElement = this.getInputElement().$; option.$.text = label; option.$.value = ( value === undefined || value === null ) ? label : value; if ( index === undefined || index === null ) { if ( CKEDITOR.env.ie ) selectElement.add( option.$ ); else selectElement.add( option.$, null ); } else selectElement.add( option.$, index ); return this; }, /** * Removes an option from the selection list. * @param {Number} index Index of the option to be removed. * @example * @returns {CKEDITOR.ui.dialog.select} The current select UI element. */ remove : function( index ) { var selectElement = this.getInputElement().$; selectElement.remove( index ); return this; }, /** * Clears all options out of the selection list. * @returns {CKEDITOR.ui.dialog.select} The current select UI element. */ clear : function() { var selectElement = this.getInputElement().$; while ( selectElement.length > 0 ) selectElement.remove( 0 ); return this; }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.checkbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.checkbox.prototype */ { /** * Gets the checkbox DOM element. * @example * @returns {CKEDITOR.dom.element} The DOM element of the checkbox. */ getInputElement : function() { return this._.checkbox.getElement(); }, /** * Sets the state of the checkbox. * @example * @param {Boolean} true to tick the checkbox, false to untick it. * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element. */ setValue : function( checked, noChangeEvent ) { this.getInputElement().$.checked = checked; !noChangeEvent && this.fire( 'change', { value : checked } ); }, /** * Gets the state of the checkbox. * @example * @returns {Boolean} true means the checkbox is ticked, false means it's not ticked. */ getValue : function() { return this.getInputElement().$.checked; }, /** * Handler for the access key up event. Toggles the checkbox. * @example */ accessKeyUp : function() { this.setValue( !this.getValue() ); }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : { onChange : function( dialog, func ) { if ( !CKEDITOR.env.ie ) return commonEventProcessors.onChange.apply( this, arguments ); else { dialog.on( 'load', function() { var element = this._.checkbox.getElement(); element.on( 'propertychange', function( evt ) { evt = evt.data.$; if ( evt.propertyName == 'checked' ) this.fire( 'change', { value : element.$.checked } ); }, this ); }, this ); this.on( 'change', func ); } return null; } }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.radio.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.radio.prototype */ { /** * Checks one of the radio buttons in this button group. * @example * @param {String} value The value of the button to be chcked. * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element. */ setValue : function( value, noChangeEvent ) { var children = this._.children, item; for ( var i = 0 ; ( i < children.length ) && ( item = children[i] ) ; i++ ) item.getElement().$.checked = ( item.getValue() == value ); !noChangeEvent && this.fire( 'change', { value : value } ); }, /** * Gets the value of the currently checked radio button. * @example * @returns {String} The currently checked button's value. */ getValue : function() { var children = this._.children; for ( var i = 0 ; i < children.length ; i++ ) { if ( children[i].getElement().$.checked ) return children[i].getValue(); } return null; }, /** * Handler for the access key up event. Focuses the currently * selected radio button, or the first radio button if none is * selected. * @example */ accessKeyUp : function() { var children = this._.children, i; for ( i = 0 ; i < children.length ; i++ ) { if ( children[i].getElement().$.checked ) { children[i].getElement().focus(); return; } } children[0].getElement().focus(); }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : { onChange : function( dialog, func ) { if ( !CKEDITOR.env.ie ) return commonEventProcessors.onChange.apply( this, arguments ); else { dialog.on( 'load', function() { var children = this._.children, me = this; for ( var i = 0 ; i < children.length ; i++ ) { var element = children[i].getElement(); element.on( 'propertychange', function( evt ) { evt = evt.data.$; if ( evt.propertyName == 'checked' && this.$.checked ) me.fire( 'change', { value : this.getAttribute( 'value' ) } ); } ); } }, this ); this.on( 'change', func ); } return null; } }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.file.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement, commonPrototype, /** @lends CKEDITOR.ui.dialog.file.prototype */ { /** * Gets the &lt;input&gt; element of this file input. * @returns {CKEDITOR.dom.element} The file input element. * @example */ getInputElement : function() { var frameDocument = CKEDITOR.document.getById( this._.frameId ).getFrameDocument(); return frameDocument.$.forms.length > 0 ? new CKEDITOR.dom.element( frameDocument.$.forms[0].elements[0] ) : this.getElement(); }, /** * Uploads the file in the file input. * @returns {CKEDITOR.ui.dialog.file} This object. * @example */ submit : function() { this.getInputElement().getParent().$.submit(); return this; }, /** * Get the action assigned to the form. * @returns {String} The value of the action. * @example */ getAction : function() { return this.getInputElement().getParent().$.action; }, /** * The events must be applied on the inner input element, and * that must be done when the iframe & form has been loaded */ registerEvents : function( definition ) { var regex = /^on([A-Z]\w+)/, match; var registerDomEvent = function( uiElement, dialog, eventName, func ) { uiElement.on( 'formLoaded', function() { uiElement.getInputElement().on( eventName, func, uiElement ); }); }; for ( var i in definition ) { if ( !( match = i.match( regex ) ) ) continue; if ( this.eventProcessors[i] ) this.eventProcessors[i].call( this, this._.dialog, definition[i] ); else registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] ); } return this; }, /** * Redraws the file input and resets the file path in the file input. * The redraw logic is necessary because non-IE browsers tend to clear * the &lt;iframe&gt; containing the file input after closing the dialog. * @example */ reset : function() { var _ = this._, frameElement = CKEDITOR.document.getById( _.frameId ), frameDocument = frameElement.getFrameDocument(), elementDefinition = _.definition, buttons = _.buttons, callNumber = this.formLoadedNumber, unloadNumber = this.formUnloadNumber, langDir = _.dialog._.editor.lang.dir, langCode = _.dialog._.editor.langCode; // The callback function for the iframe, but we must call tools.addFunction only once // so we store the function number in this.formLoadedNumber if ( !callNumber ) { callNumber = this.formLoadedNumber = CKEDITOR.tools.addFunction( function() { // Now we can apply the events to the input type=file this.fire( 'formLoaded' ) ; }, this ) ; // Remove listeners attached to the content of the iframe (the file input) unloadNumber = this.formUnloadNumber = CKEDITOR.tools.addFunction( function() { this.getInputElement().clearCustomData(); }, this ) ; this.getDialog()._.editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( callNumber ); CKEDITOR.tools.removeFunction( unloadNumber ); } ); } function generateFormField() { frameDocument.$.open(); // Support for custom document.domain in IE. if ( CKEDITOR.env.isCustomDomain() ) frameDocument.$.domain = document.domain; var size = ''; if ( elementDefinition.size ) size = elementDefinition.size - ( CKEDITOR.env.ie ? 7 : 0 ); // "Browse" button is bigger in IE. frameDocument.$.write( [ '<html dir="' + langDir + '" lang="' + langCode + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">', '<form enctype="multipart/form-data" method="POST" dir="' + langDir + '" lang="' + langCode + '" action="', CKEDITOR.tools.htmlEncode( elementDefinition.action ), '">', '<input type="file" name="', CKEDITOR.tools.htmlEncode( elementDefinition.id || 'cke_upload' ), '" size="', CKEDITOR.tools.htmlEncode( size > 0 ? size : "" ), '" />', '</form>', '</body></html>', '<script>window.parent.CKEDITOR.tools.callFunction(' + callNumber + ');', 'window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(' + unloadNumber + ')}</script>' ].join( '' ) ); frameDocument.$.close(); for ( var i = 0 ; i < buttons.length ; i++ ) buttons[i].enable(); } // #3465: Wait for the browser to finish rendering the dialog first. if ( CKEDITOR.env.gecko ) setTimeout( generateFormField, 500 ); else generateFormField(); }, getValue : function() { return this.getInputElement().$.value || ''; }, /*** * The default value of input type="file" is an empty string, but during initialization * of this UI element, the iframe still isn't ready so it can't be read from that object * Setting it manually prevents later issues about the current value ("") being different * of the initial value (undefined as it asked for .value of a div) */ setInitValue : function() { this._.initValue = ''; }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : { onChange : function( dialog, func ) { // If this method is called several times (I'm not sure about how this can happen but the default // onChange processor includes this protection) // In order to reapply to the new element, the property is deleted at the beggining of the registerEvents method if ( !this._.domOnChangeRegistered ) { // By listening for the formLoaded event, this handler will get reapplied when a new // form is created this.on( 'formLoaded', function() { this.getInputElement().on( 'change', function(){ this.fire( 'change', { value : this.getValue() } ); }, this ); }, this ); this._.domOnChangeRegistered = true; } this.on( 'change', func ); } }, keyboardFocusable : true }, true ); CKEDITOR.ui.dialog.fileButton.prototype = new CKEDITOR.ui.dialog.button; CKEDITOR.ui.dialog.fieldset.prototype = CKEDITOR.tools.clone( CKEDITOR.ui.dialog.hbox.prototype ); CKEDITOR.dialog.addUIElement( 'text', textBuilder ); CKEDITOR.dialog.addUIElement( 'password', textBuilder ); CKEDITOR.dialog.addUIElement( 'textarea', commonBuilder ); CKEDITOR.dialog.addUIElement( 'checkbox', commonBuilder ); CKEDITOR.dialog.addUIElement( 'radio', commonBuilder ); CKEDITOR.dialog.addUIElement( 'button', commonBuilder ); CKEDITOR.dialog.addUIElement( 'select', commonBuilder ); CKEDITOR.dialog.addUIElement( 'file', commonBuilder ); CKEDITOR.dialog.addUIElement( 'fileButton', commonBuilder ); CKEDITOR.dialog.addUIElement( 'html', commonBuilder ); CKEDITOR.dialog.addUIElement( 'fieldset', containerBuilder ); })(); /** * Fired when the value of the uiElement is changed * @name CKEDITOR.ui.dialog.uiElement#change * @event */ /** * Fired when the inner frame created by the element is ready. * Each time the button is used or the dialog is loaded a new * form might be created. * @name CKEDITOR.ui.dialog.fileButton#formLoaded * @event */
zysms
trunk/zysms/include/ckeditor/_source/plugins/dialogui/plugin.js
JavaScript
asf20
51,012
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var cssStyle = CKEDITOR.htmlParser.cssStyle, cssLength = CKEDITOR.tools.cssLength; var cssLengthRegex = /^((?:\d*(?:\.\d+))|(?:\d+))(.*)?$/i; /* * Replacing the former CSS length value with the later one, with * adjustment to the length unit. */ function replaceCssLength( length1, length2 ) { var parts1 = cssLengthRegex.exec( length1 ), parts2 = cssLengthRegex.exec( length2 ); // Omit pixel length unit when necessary, // e.g. replaceCssLength( 10, '20px' ) -> 20 if ( parts1 ) { if ( !parts1[ 2 ] && parts2[ 2 ] == 'px' ) return parts2[ 1 ]; if ( parts1[ 2 ] == 'px' && !parts2[ 2 ] ) return parts2[ 1 ] + 'px'; } return length2; } var htmlFilterRules = { elements : { $ : function( element ) { var attributes = element.attributes, realHtml = attributes && attributes[ 'data-cke-realelement' ], realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ), realElement = realFragment && realFragment.children[ 0 ]; // Width/height in the fake object are subjected to clone into the real element. if ( realElement && element.attributes[ 'data-cke-resizable' ] ) { var styles = new cssStyle( element ).rules, realAttrs = realElement.attributes, width = styles.width, height = styles.height; width && ( realAttrs.width = replaceCssLength( realAttrs.width, width ) ); height && ( realAttrs.height = replaceCssLength( realAttrs.height, height ) ); } return realElement; } } }; CKEDITOR.plugins.add( 'fakeobjects', { requires : [ 'htmlwriter' ], afterInit : function( editor ) { var dataProcessor = editor.dataProcessor, htmlFilter = dataProcessor && dataProcessor.htmlFilter; if ( htmlFilter ) htmlFilter.addRules( htmlFilterRules ); } }); CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable ) { var lang = this.lang.fakeobjects, label = lang[ realElementType ] || lang.unknown; var attributes = { 'class' : className, src : CKEDITOR.getUrl( 'images/spacer.gif' ), 'data-cke-realelement' : encodeURIComponent( realElement.getOuterHtml() ), 'data-cke-real-node-type' : realElement.type, alt : label, title : label, align : realElement.getAttribute( 'align' ) || '' }; if ( realElementType ) attributes[ 'data-cke-real-element-type' ] = realElementType; if ( isResizable ) { attributes[ 'data-cke-resizable' ] = isResizable; var fakeStyle = new cssStyle(); var width = realElement.getAttribute( 'width' ), height = realElement.getAttribute( 'height' ); width && ( fakeStyle.rules.width = cssLength( width ) ); height && ( fakeStyle.rules.height = cssLength( height ) ); fakeStyle.populate( attributes ); } return this.document.createElement( 'img', { attributes : attributes } ); }; CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, className, realElementType, isResizable ) { var lang = this.lang.fakeobjects, label = lang[ realElementType ] || lang.unknown, html; var writer = new CKEDITOR.htmlParser.basicWriter(); realElement.writeHtml( writer ); html = writer.getHtml(); var attributes = { 'class' : className, src : CKEDITOR.getUrl( 'images/spacer.gif' ), 'data-cke-realelement' : encodeURIComponent( html ), 'data-cke-real-node-type' : realElement.type, alt : label, title : label, align : realElement.attributes.align || '' }; if ( realElementType ) attributes[ 'data-cke-real-element-type' ] = realElementType; if ( isResizable ) { attributes[ 'data-cke-resizable' ] = isResizable; var realAttrs = realElement.attributes, fakeStyle = new cssStyle(); var width = realAttrs.width, height = realAttrs.height; width != undefined && ( fakeStyle.rules.width = cssLength( width ) ); height != undefined && ( fakeStyle.rules.height = cssLength ( height ) ); fakeStyle.populate( attributes ); } return new CKEDITOR.htmlParser.element( 'img', attributes ); }; CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement ) { if ( fakeElement.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT ) return null; var element = CKEDITOR.dom.element.createFromHtml( decodeURIComponent( fakeElement.data( 'cke-realelement' ) ), this.document ); if ( fakeElement.data( 'cke-resizable') ) { var width = fakeElement.getStyle( 'width' ), height = fakeElement.getStyle( 'height' ); width && element.setAttribute( 'width', replaceCssLength( element.getAttribute( 'width' ), width ) ); height && element.setAttribute( 'height', replaceCssLength( element.getAttribute( 'height' ), height ) ); } return element; }; })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/fakeobjects/plugin.js
JavaScript
asf20
5,160
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'floatpanel', { requires : [ 'panel' ] }); (function() { var panels = {}; var isShowing = false; function getPanel( editor, doc, parentElement, definition, level ) { // Generates the panel key: docId-eleId-skinName-langDir[-uiColor][-CSSs][-level] var key = CKEDITOR.tools.genKey( doc.getUniqueId(), parentElement.getUniqueId(), editor.skinName, editor.lang.dir, editor.uiColor || '', definition.css || '', level || '' ); var panel = panels[ key ]; if ( !panel ) { panel = panels[ key ] = new CKEDITOR.ui.panel( doc, definition ); panel.element = parentElement.append( CKEDITOR.dom.element.createFromHtml( panel.renderHtml( editor ), doc ) ); panel.element.setStyles( { display : 'none', position : 'absolute' }); } return panel; } CKEDITOR.ui.floatPanel = CKEDITOR.tools.createClass( { $ : function( editor, parentElement, definition, level ) { definition.forceIFrame = 1; var doc = parentElement.getDocument(), panel = getPanel( editor, doc, parentElement, definition, level || 0 ), element = panel.element, iframe = element.getFirst().getFirst(); this.element = element; this._ = { editor : editor, // The panel that will be floating. panel : panel, parentElement : parentElement, definition : definition, document : doc, iframe : iframe, children : [], dir : editor.lang.dir }; editor.on( 'mode', function(){ this.hide(); }, this ); }, proto : { addBlock : function( name, block ) { return this._.panel.addBlock( name, block ); }, addListBlock : function( name, multiSelect ) { return this._.panel.addListBlock( name, multiSelect ); }, getBlock : function( name ) { return this._.panel.getBlock( name ); }, /* corner (LTR): 1 = top-left 2 = top-right 3 = bottom-right 4 = bottom-left corner (RTL): 1 = top-right 2 = top-left 3 = bottom-left 4 = bottom-right */ showBlock : function( name, offsetParent, corner, offsetX, offsetY ) { var panel = this._.panel, block = panel.showBlock( name ); this.allowBlur( false ); isShowing = 1; // Record from where the focus is when open panel. this._.returnFocus = this._.editor.focusManager.hasFocus ? this._.editor : new CKEDITOR.dom.element( CKEDITOR.document.$.activeElement ); var element = this.element, iframe = this._.iframe, definition = this._.definition, position = offsetParent.getDocumentPosition( element.getDocument() ), rtl = this._.dir == 'rtl'; var left = position.x + ( offsetX || 0 ), top = position.y + ( offsetY || 0 ); // Floating panels are off by (-1px, 0px) in RTL mode. (#3438) if ( rtl && ( corner == 1 || corner == 4 ) ) left += offsetParent.$.offsetWidth; else if ( !rtl && ( corner == 2 || corner == 3 ) ) left += offsetParent.$.offsetWidth - 1; if ( corner == 3 || corner == 4 ) top += offsetParent.$.offsetHeight - 1; // Memorize offsetParent by it's ID. this._.panel._.offsetParentId = offsetParent.getId(); element.setStyles( { top : top + 'px', left: 0, display : '' }); // Don't use display or visibility style because we need to // calculate the rendering layout later and focus the element. element.setOpacity( 0 ); // To allow the context menu to decrease back their width element.getFirst().removeStyle( 'width' ); // Configure the IFrame blur event. Do that only once. if ( !this._.blurSet ) { // Non IE prefer the event into a window object. var focused = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow ); // With addEventListener compatible browsers, we must // useCapture when registering the focus/blur events to // guarantee they will be firing in all situations. (#3068, #3222 ) CKEDITOR.event.useCapture = true; focused.on( 'blur', function( ev ) { if ( !this.allowBlur() ) return; // As we are using capture to register the listener, // the blur event may get fired even when focusing // inside the window itself, so we must ensure the // target is out of it. var target = ev.data.getTarget() ; if ( target.getName && target.getName() != 'iframe' ) return; if ( this.visible && !this._.activeChild && !isShowing ) { // Panel close is caused by user's navigating away the focus, e.g. click outside the panel. // DO NOT restore focus in this case. delete this._.returnFocus; this.hide(); } }, this ); focused.on( 'focus', function() { this._.focused = true; this.hideChild(); this.allowBlur( true ); }, this ); CKEDITOR.event.useCapture = false; this._.blurSet = 1; } panel.onEscape = CKEDITOR.tools.bind( function( keystroke ) { if ( this.onEscape && this.onEscape( keystroke ) === false ) return false; }, this ); CKEDITOR.tools.setTimeout( function() { if ( rtl ) left -= element.$.offsetWidth; var panelLoad = CKEDITOR.tools.bind( function () { var target = element.getFirst(); if ( block.autoSize ) { // We must adjust first the width or IE6 could include extra lines in the height computation var widthNode = block.element.$; if ( CKEDITOR.env.gecko || CKEDITOR.env.opera ) widthNode = widthNode.parentNode; if ( CKEDITOR.env.ie ) widthNode = widthNode.document.body; var width = widthNode.scrollWidth; // Account for extra height needed due to IE quirks box model bug: // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug // (#3426) if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && width > 0 ) width += ( target.$.offsetWidth || 0 ) - ( target.$.clientWidth || 0 ) + 3; // A little extra at the end. // If not present, IE6 might break into the next line, but also it looks better this way width += 4 ; target.setStyle( 'width', width + 'px' ); // IE doesn't compute the scrollWidth if a filter is applied previously block.element.addClass( 'cke_frameLoaded' ); var height = block.element.$.scrollHeight; // Account for extra height needed due to IE quirks box model bug: // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug // (#3426) if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && height > 0 ) height += ( target.$.offsetHeight || 0 ) - ( target.$.clientHeight || 0 ) + 3; target.setStyle( 'height', height + 'px' ); // Fix IE < 8 visibility. panel._.currentBlock.element.setStyle( 'display', 'none' ).removeStyle( 'display' ); } else target.removeStyle( 'height' ); var panelElement = panel.element, panelWindow = panelElement.getWindow(), windowScroll = panelWindow.getScrollPosition(), viewportSize = panelWindow.getViewPaneSize(), panelSize = { 'height' : panelElement.$.offsetHeight, 'width' : panelElement.$.offsetWidth }; // If the menu is horizontal off, shift it toward // the opposite language direction. if ( rtl ? left < 0 : left + panelSize.width > viewportSize.width + windowScroll.x ) left += ( panelSize.width * ( rtl ? 1 : -1 ) ); // Vertical off screen is simpler. if ( top + panelSize.height > viewportSize.height + windowScroll.y ) top -= panelSize.height; // If IE is in RTL, we have troubles with absolute // position and horizontal scrolls. Here we have a // series of hacks to workaround it. (#6146) if ( CKEDITOR.env.ie ) { var offsetParent = new CKEDITOR.dom.element( element.$.offsetParent ), scrollParent = offsetParent; // Quirks returns <body>, but standards returns <html>. if ( scrollParent.getName() == 'html' ) scrollParent = scrollParent.getDocument().getBody(); if ( scrollParent.getComputedStyle( 'direction' ) == 'rtl' ) { // For IE8, there is not much logic on this, but it works. if ( CKEDITOR.env.ie8Compat ) left -= element.getDocument().getDocumentElement().$.scrollLeft * 2; else left -= ( offsetParent.$.scrollWidth - offsetParent.$.clientWidth ); } } // Trigger the onHide event of the previously active panel to prevent // incorrect styles from being applied (#6170) var innerElement = element.getFirst(), activePanel; if ( ( activePanel = innerElement.getCustomData( 'activePanel' ) ) ) activePanel.onHide && activePanel.onHide.call( this, 1 ); innerElement.setCustomData( 'activePanel', this ); element.setStyles( { top : top + 'px', left : left + 'px' } ); element.setOpacity( 1 ); } , this ); panel.isLoaded ? panelLoad() : panel.onLoad = panelLoad; // Set the panel frame focus, so the blur event gets fired. CKEDITOR.tools.setTimeout( function() { iframe.$.contentWindow.focus(); // We need this get fired manually because of unfired focus() function. this.allowBlur( true ); }, 0, this); }, CKEDITOR.env.air ? 200 : 0, this); this.visible = 1; if ( this.onShow ) this.onShow.call( this ); isShowing = 0; }, hide : function( returnFocus ) { if ( this.visible && ( !this.onHide || this.onHide.call( this ) !== true ) ) { this.hideChild(); // Blur previously focused element. (#6671) CKEDITOR.env.gecko && this._.iframe.getFrameDocument().$.activeElement.blur(); this.element.setStyle( 'display', 'none' ); this.visible = 0; this.element.getFirst().removeCustomData( 'activePanel' ); // Return focus properly. (#6247) var focusReturn = returnFocus !== false && this._.returnFocus; if ( focusReturn ) { // Webkit requires focus moved out panel iframe first. if ( CKEDITOR.env.webkit && focusReturn.type ) focusReturn.getWindow().$.focus(); focusReturn.focus(); } } }, allowBlur : function( allow ) // Prevent editor from hiding the panel. #3222. { var panel = this._.panel; if ( allow != undefined ) panel.allowBlur = allow; return panel.allowBlur; }, showAsChild : function( panel, blockName, offsetParent, corner, offsetX, offsetY ) { // Skip reshowing of child which is already visible. if ( this._.activeChild == panel && panel._.panel._.offsetParentId == offsetParent.getId() ) return; this.hideChild(); panel.onHide = CKEDITOR.tools.bind( function() { // Use a timeout, so we give time for this menu to get // potentially focused. CKEDITOR.tools.setTimeout( function() { if ( !this._.focused ) this.hide(); }, 0, this ); }, this ); this._.activeChild = panel; this._.focused = false; panel.showBlock( blockName, offsetParent, corner, offsetX, offsetY ); /* #3767 IE: Second level menu may not have borders */ if ( CKEDITOR.env.ie7Compat || ( CKEDITOR.env.ie8 && CKEDITOR.env.ie6Compat ) ) { setTimeout(function() { panel.element.getChild( 0 ).$.style.cssText += ''; }, 100); } }, hideChild : function() { var activeChild = this._.activeChild; if ( activeChild ) { delete activeChild.onHide; // Sub panels don't manage focus. (#7881) delete activeChild._.returnFocus; delete this._.activeChild; activeChild.hide(); } } } }); CKEDITOR.on( 'instanceDestroyed', function() { var isLastInstance = CKEDITOR.tools.isEmpty( CKEDITOR.instances ); for ( var i in panels ) { var panel = panels[ i ]; // Safe to destroy it since there're no more instances.(#4241) if ( isLastInstance ) panel.destroy(); // Panel might be used by other instances, just hide them.(#4552) else panel.element.hide(); } // Remove the registration. isLastInstance && ( panels = {} ); } ); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/floatpanel/plugin.js
JavaScript
asf20
13,020
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { function forceHtmlMode( evt ) { evt.data.mode = 'html'; } CKEDITOR.plugins.add( 'pastefromword', { init : function( editor ) { // Flag indicate this command is actually been asked instead of a generic // pasting. var forceFromWord = 0; var resetFromWord = function( evt ) { evt && evt.removeListener(); editor.removeListener( 'beforePaste', forceHtmlMode ); forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 ); }; // Features bring by this command beside the normal process: // 1. No more bothering of user about the clean-up. // 2. Perform the clean-up even if content is not from MS-Word. // (e.g. from a MS-Word similar application.) editor.addCommand( 'pastefromword', { canUndo : false, exec : function() { // Ensure the received data format is HTML and apply content filtering. (#6718) forceFromWord = 1; editor.on( 'beforePaste', forceHtmlMode ); if ( editor.execCommand( 'paste', 'html' ) === false ) { editor.on( 'dialogShow', function ( evt ) { evt.removeListener(); evt.data.on( 'cancel', resetFromWord ); }); editor.on( 'dialogHide', function( evt ) { evt.data.removeListener( 'cancel', resetFromWord ); } ); } editor.on( 'afterPaste', resetFromWord ); } }); // Register the toolbar button. editor.ui.addButton( 'PasteFromWord', { label : editor.lang.pastefromword.toolbar, command : 'pastefromword' }); editor.on( 'pasteState', function( evt ) { editor.getCommand( 'pastefromword' ).setState( evt.data ); }); editor.on( 'paste', function( evt ) { var data = evt.data, mswordHtml; // MS-WORD format sniffing. if ( ( mswordHtml = data[ 'html' ] ) && ( forceFromWord || ( /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/ ).test( mswordHtml ) ) ) { var isLazyLoad = this.loadFilterRules( function() { // Event continuation with the original data. if ( isLazyLoad ) editor.fire( 'paste', data ); else if ( !editor.config.pasteFromWordPromptCleanup || ( forceFromWord || confirm( editor.lang.pastefromword.confirmCleanup ) ) ) { data[ 'html' ] = CKEDITOR.cleanWord( mswordHtml, editor ); } }); // The cleanup rules are to be loaded, we should just cancel // this event. isLazyLoad && evt.cancel(); } }, this ); }, loadFilterRules : function( callback ) { var isLoaded = CKEDITOR.cleanWord; if ( isLoaded ) callback(); else { var filterFilePath = CKEDITOR.getUrl( CKEDITOR.config.pasteFromWordCleanupFile || ( this.path + 'filter/default.js' ) ); // Load with busy indicator. CKEDITOR.scriptLoader.load( filterFilePath, callback, null, true ); } return !isLoaded; }, requires : [ 'clipboard' ] }); })(); /** * Whether to prompt the user about the clean up of content being pasted from * MS Word. * @name CKEDITOR.config.pasteFromWordPromptCleanup * @since 3.1 * @type Boolean * @default undefined * @example * config.pasteFromWordPromptCleanup = true; */ /** * The file that provides the MS Word cleanup function for pasting operations. * Note: This is a global configuration shared by all editor instances present * in the page. * @name CKEDITOR.config.pasteFromWordCleanupFile * @since 3.1 * @type String * @default 'default' * @example * // Load from 'pastefromword' plugin 'filter' sub folder (custom.js file). * CKEDITOR.config.pasteFromWordCleanupFile = 'custom'; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/pastefromword/plugin.js
JavaScript
asf20
3,943
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var fragmentPrototype = CKEDITOR.htmlParser.fragment.prototype, elementPrototype = CKEDITOR.htmlParser.element.prototype; fragmentPrototype.onlyChild = elementPrototype.onlyChild = function() { var children = this.children, count = children.length, firstChild = ( count == 1 ) && children[ 0 ]; return firstChild || null; }; elementPrototype.removeAnyChildWithName = function( tagName ) { var children = this.children, childs = [], child; for ( var i = 0; i < children.length; i++ ) { child = children[ i ]; if ( !child.name ) continue; if ( child.name == tagName ) { childs.push( child ); children.splice( i--, 1 ); } childs = childs.concat( child.removeAnyChildWithName( tagName ) ); } return childs; }; elementPrototype.getAncestor = function( tagNameRegex ) { var parent = this.parent; while ( parent && !( parent.name && parent.name.match( tagNameRegex ) ) ) parent = parent.parent; return parent; }; fragmentPrototype.firstChild = elementPrototype.firstChild = function( evaluator ) { var child; for ( var i = 0 ; i < this.children.length ; i++ ) { child = this.children[ i ]; if ( evaluator( child ) ) return child; else if ( child.name ) { child = child.firstChild( evaluator ); if ( child ) return child; } } return null; }; // Adding a (set) of styles to the element's 'style' attributes. elementPrototype.addStyle = function( name, value, isPrepend ) { var styleText, addingStyleText = ''; // name/value pair. if ( typeof value == 'string' ) addingStyleText += name + ':' + value + ';'; else { // style literal. if ( typeof name == 'object' ) { for ( var style in name ) { if ( name.hasOwnProperty( style ) ) addingStyleText += style + ':' + name[ style ] + ';'; } } // raw style text form. else addingStyleText += name; isPrepend = value; } if ( !this.attributes ) this.attributes = {}; styleText = this.attributes.style || ''; styleText = ( isPrepend ? [ addingStyleText, styleText ] : [ styleText, addingStyleText ] ).join( ';' ); this.attributes.style = styleText.replace( /^;|;(?=;)/, '' ); }; /** * Return the DTD-valid parent tag names of the specified one. * @param tagName */ CKEDITOR.dtd.parentOf = function( tagName ) { var result = {}; for ( var tag in this ) { if ( tag.indexOf( '$' ) == -1 && this[ tag ][ tagName ] ) result[ tag ] = 1; } return result; }; // 1. move consistent list item styles up to list root. // 2. clear out unnecessary list item numbering. function postProcessList( list ) { var children = list.children, child, attrs, count = list.children.length, match, mergeStyle, styleTypeRegexp = /list-style-type:(.*?)(?:;|$)/, stylesFilter = CKEDITOR.plugins.pastefromword.filters.stylesFilter; attrs = list.attributes; if ( styleTypeRegexp.exec( attrs.style ) ) return; for ( var i = 0; i < count; i++ ) { child = children[ i ]; if ( child.attributes.value && Number( child.attributes.value ) == i + 1 ) delete child.attributes.value; match = styleTypeRegexp.exec( child.attributes.style ); if ( match ) { if ( match[ 1 ] == mergeStyle || !mergeStyle ) mergeStyle = match[ 1 ]; else { mergeStyle = null; break; } } } if ( mergeStyle ) { for ( i = 0; i < count; i++ ) { attrs = children[ i ].attributes; attrs.style && ( attrs.style = stylesFilter( [ [ 'list-style-type'] ] )( attrs.style ) || '' ); } list.addStyle( 'list-style-type', mergeStyle ); } } var cssLengthRelativeUnit = /^([.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz){1}?/i; var emptyMarginRegex = /^(?:\b0[^\s]*\s*){1,4}$/; // e.g. 0px 0pt 0px var romanLiternalPattern = '^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$', lowerRomanLiteralRegex = new RegExp( romanLiternalPattern ), upperRomanLiteralRegex = new RegExp( romanLiternalPattern.toUpperCase() ); var orderedPatterns = { 'decimal' : /\d+/, 'lower-roman': lowerRomanLiteralRegex, 'upper-roman': upperRomanLiteralRegex, 'lower-alpha' : /^[a-z]+$/, 'upper-alpha': /^[A-Z]+$/ }, unorderedPatterns = { 'disc' : /[l\u00B7\u2002]/, 'circle' : /[\u006F\u00D8]/,'square' : /[\u006E\u25C6]/}, listMarkerPatterns = { 'ol' : orderedPatterns, 'ul' : unorderedPatterns }, romans = [ [1000, 'M'], [900, 'CM'], [500, 'D'], [400, 'CD'], [100, 'C'], [90, 'XC'], [50, 'L'], [40, 'XL'], [10, 'X'], [9, 'IX'], [5, 'V'], [4, 'IV'], [1, 'I'] ], alpahbets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // Convert roman numbering back to decimal. function fromRoman( str ) { str = str.toUpperCase(); var l = romans.length, retVal = 0; for ( var i = 0; i < l; ++i ) { for ( var j = romans[i], k = j[1].length; str.substr( 0, k ) == j[1]; str = str.substr( k ) ) retVal += j[ 0 ]; } return retVal; } // Convert alphabet numbering back to decimal. function fromAlphabet( str ) { str = str.toUpperCase(); var l = alpahbets.length, retVal = 1; for ( var x = 1; str.length > 0; x *= l ) { retVal += alpahbets.indexOf( str.charAt( str.length - 1 ) ) * x; str = str.substr( 0, str.length - 1 ); } return retVal; } var listBaseIndent = 0, previousListItemMargin = null, previousListId; var plugin = ( CKEDITOR.plugins.pastefromword = { utils : { // Create a <cke:listbullet> which indicate an list item type. createListBulletMarker : function ( bullet, bulletText ) { var marker = new CKEDITOR.htmlParser.element( 'cke:listbullet' ); marker.attributes = { 'cke:listsymbol' : bullet[ 0 ] }; marker.add( new CKEDITOR.htmlParser.text( bulletText ) ); return marker; }, isListBulletIndicator : function( element ) { var styleText = element.attributes && element.attributes.style; if ( /mso-list\s*:\s*Ignore/i.test( styleText ) ) return true; }, isContainingOnlySpaces : function( element ) { var text; return ( ( text = element.onlyChild() ) && ( /^(:?\s|&nbsp;)+$/ ).test( text.value ) ); }, resolveList : function( element ) { // <cke:listbullet> indicate a list item. var attrs = element.attributes, listMarker; if ( ( listMarker = element.removeAnyChildWithName( 'cke:listbullet' ) ) && listMarker.length && ( listMarker = listMarker[ 0 ] ) ) { element.name = 'cke:li'; if ( attrs.style ) { attrs.style = plugin.filters.stylesFilter( [ // Text-indent is not representing list item level any more. [ 'text-indent' ], [ 'line-height' ], // First attempt is to resolve indent level from on a constant margin increment. [ ( /^margin(:?-left)?$/ ), null, function( margin ) { // Deal with component/short-hand form. var values = margin.split( ' ' ); margin = CKEDITOR.tools.convertToPx( values[ 3 ] || values[ 1 ] || values [ 0 ] ); // Figure out the indent unit by checking the first time of incrementation. if ( !listBaseIndent && previousListItemMargin !== null && margin > previousListItemMargin ) listBaseIndent = margin - previousListItemMargin; previousListItemMargin = margin; attrs[ 'cke:indent' ] = listBaseIndent && ( Math.ceil( margin / listBaseIndent ) + 1 ) || 1; } ], // The best situation: "mso-list:l0 level1 lfo2" tells the belonged list root, list item indentation, etc. [ ( /^mso-list$/ ), null, function( val ) { val = val.split( ' ' ); var listId = Number( val[ 0 ].match( /\d+/ ) ), indent = Number( val[ 1 ].match( /\d+/ ) ); if ( indent == 1 ) { listId !== previousListId && ( attrs[ 'cke:reset' ] = 1 ); previousListId = listId; } attrs[ 'cke:indent' ] = indent; } ] ] )( attrs.style, element ) || ''; } // First level list item might be presented without a margin. // In case all above doesn't apply. if ( !attrs[ 'cke:indent' ] ) { previousListItemMargin = 0; attrs[ 'cke:indent' ] = 1; } // Inherit attributes from bullet. CKEDITOR.tools.extend( attrs, listMarker.attributes ); return true; } // Current list disconnected. else previousListId = previousListItemMargin = listBaseIndent = null; return false; }, // Providing a shorthand style then retrieve one or more style component values. getStyleComponents : ( function() { var calculator = CKEDITOR.dom.element.createFromHtml( '<div style="position:absolute;left:-9999px;top:-9999px;"></div>', CKEDITOR.document ); CKEDITOR.document.getBody().append( calculator ); return function( name, styleValue, fetchList ) { calculator.setStyle( name, styleValue ); var styles = {}, count = fetchList.length; for ( var i = 0; i < count; i++ ) styles[ fetchList[ i ] ] = calculator.getStyle( fetchList[ i ] ); return styles; }; } )(), listDtdParents : CKEDITOR.dtd.parentOf( 'ol' ) }, filters : { // Transform a normal list into flat list items only presentation. // E.g. <ul><li>level1<ol><li>level2</li></ol></li> => // <cke:li cke:listtype="ul" cke:indent="1">level1</cke:li> // <cke:li cke:listtype="ol" cke:indent="2">level2</cke:li> flattenList : function( element, level ) { level = typeof level == 'number' ? level : 1; var attrs = element.attributes, listStyleType; // All list items are of the same type. switch ( attrs.type ) { case 'a' : listStyleType = 'lower-alpha'; break; case '1' : listStyleType = 'decimal'; break; // TODO: Support more list style type from MS-Word. } var children = element.children, child; for ( var i = 0; i < children.length; i++ ) { child = children[ i ]; if ( child.name in CKEDITOR.dtd.$listItem ) { var attributes = child.attributes, listItemChildren = child.children, count = listItemChildren.length, last = listItemChildren[ count - 1 ]; // Move out nested list. if ( last.name in CKEDITOR.dtd.$list ) { element.add( last, i + 1 ); // Remove the parent list item if it's just a holder. if ( !--listItemChildren.length ) children.splice( i--, 1 ); } child.name = 'cke:li'; // Inherit numbering from list root on the first list item. attrs.start && !i && ( attributes.value = attrs.start ); plugin.filters.stylesFilter( [ [ 'tab-stops', null, function( val ) { var margin = val.split( ' ' )[ 1 ].match( cssLengthRelativeUnit ); margin && ( previousListItemMargin = CKEDITOR.tools.convertToPx( margin[ 0 ] ) ); } ], ( level == 1 ? [ 'mso-list', null, function( val ) { val = val.split( ' ' ); var listId = Number( val[ 0 ].match( /\d+/ ) ); listId !== previousListId && ( attributes[ 'cke:reset' ] = 1 ); previousListId = listId; } ] : null ) ] )( attributes.style ); attributes[ 'cke:indent' ] = level; attributes[ 'cke:listtype' ] = element.name; attributes[ 'cke:list-style-type' ] = listStyleType; } // Flatten sub list. else if ( child.name in CKEDITOR.dtd.$list ) { // Absorb sub list children. arguments.callee.apply( this, [ child, level + 1 ] ); children = children.slice( 0, i ).concat( child.children ).concat( children.slice( i + 1 ) ); element.children = []; for ( var j = 0, num = children.length; j < num ; j++ ) element.add( children[ j ] ); } } delete element.name; // We're loosing tag name here, signalize this element as a list. attrs[ 'cke:list' ] = 1; }, /** * Try to collect all list items among the children and establish one * or more HTML list structures for them. * @param element */ assembleList : function( element ) { var children = element.children, child, listItem, // The current processing cke:li element. listItemAttrs, listItemIndent, // Indent level of current list item. lastIndent, lastListItem, // The previous one just been added to the list. list, // Current staging list and it's parent list if any. openedLists = [], previousListStyleType, previousListType; // Properties of the list item are to be resolved from the list bullet. var bullet, listType, listStyleType, itemNumeric; for ( var i = 0; i < children.length; i++ ) { child = children[ i ]; if ( 'cke:li' == child.name ) { child.name = 'li'; listItem = child; listItemAttrs = listItem.attributes; bullet = listItemAttrs[ 'cke:listsymbol' ]; bullet = bullet && bullet.match( /^(?:[(]?)([^\s]+?)([.)]?)$/ ); listType = listStyleType = itemNumeric = null; if ( listItemAttrs[ 'cke:ignored' ] ) { children.splice( i--, 1 ); continue; } // This's from a new list root. listItemAttrs[ 'cke:reset' ] && ( list = lastIndent = lastListItem = null ); // List item indent level might come from a real list indentation or // been resolved from a pseudo list item's margin value, even get // no indentation at all. listItemIndent = Number( listItemAttrs[ 'cke:indent' ] ); // We're moving out of the current list, cleaning up. if ( listItemIndent != lastIndent ) previousListType = previousListStyleType = null; // List type and item style are already resolved. if ( !bullet ) { listType = listItemAttrs[ 'cke:listtype' ] || 'ol'; listStyleType = listItemAttrs[ 'cke:list-style-type' ]; } else { // Probably share the same list style type with previous list item, // give it priority to avoid ambiguous between C(Alpha) and C.(Roman). if ( previousListType && listMarkerPatterns[ previousListType ] [ previousListStyleType ].test( bullet[ 1 ] ) ) { listType = previousListType; listStyleType = previousListStyleType; } else { for ( var type in listMarkerPatterns ) { for ( var style in listMarkerPatterns[ type ] ) { if ( listMarkerPatterns[ type ][ style ].test( bullet[ 1 ] ) ) { // Small numbering has higher priority, when dealing with ambiguous // between C(Alpha) and C.(Roman). if ( type == 'ol' && ( /alpha|roman/ ).test( style ) ) { var num = /roman/.test( style ) ? fromRoman( bullet[ 1 ] ) : fromAlphabet( bullet[ 1 ] ); if ( !itemNumeric || num < itemNumeric ) { itemNumeric = num; listType = type; listStyleType = style; } } else { listType = type; listStyleType = style; break; } } } } } // Simply use decimal/disc for the rest forms of unrepresentable // numerals, e.g. Chinese..., but as long as there a second part // included, it has a bigger chance of being a order list ;) !listType && ( listType = bullet[ 2 ] ? 'ol' : 'ul' ); } previousListType = listType; previousListStyleType = listStyleType || ( listType == 'ol' ? 'decimal' : 'disc' ); if ( listStyleType && listStyleType != ( listType == 'ol' ? 'decimal' : 'disc' ) ) listItem.addStyle( 'list-style-type', listStyleType ); // Figure out start numbering. if ( listType == 'ol' && bullet ) { switch ( listStyleType ) { case 'decimal' : itemNumeric = Number( bullet[ 1 ] ); break; case 'lower-roman': case 'upper-roman': itemNumeric = fromRoman( bullet[ 1 ] ); break; case 'lower-alpha': case 'upper-alpha': itemNumeric = fromAlphabet( bullet[ 1 ] ); break; } // Always create the numbering, swipe out unnecessary ones later. listItem.attributes.value = itemNumeric; } // Start the list construction. if ( !list ) { openedLists.push( list = new CKEDITOR.htmlParser.element( listType ) ); list.add( listItem ); children[ i ] = list; } else { if ( listItemIndent > lastIndent ) { openedLists.push( list = new CKEDITOR.htmlParser.element( listType ) ); list.add( listItem ); lastListItem.add( list ); } else if ( listItemIndent < lastIndent ) { // There might be a negative gap between two list levels. (#4944) var diff = lastIndent - listItemIndent, parent; while ( diff-- && ( parent = list.parent ) ) list = parent.parent; list.add( listItem ); } else list.add( listItem ); children.splice( i--, 1 ); } lastListItem = listItem; lastIndent = listItemIndent; } else if ( list ) list = lastIndent = lastListItem = null; } for ( i = 0; i < openedLists.length; i++ ) postProcessList( openedLists[ i ] ); list = lastIndent = lastListItem = previousListId = previousListItemMargin = listBaseIndent = null; }, /** * A simple filter which always rejecting. */ falsyFilter : function( value ) { return false; }, /** * A filter dedicated on the 'style' attribute filtering, e.g. dropping/replacing style properties. * @param styles {Array} in form of [ styleNameRegexp, styleValueRegexp, * newStyleValue/newStyleGenerator, newStyleName ] where only the first * parameter is mandatory. * @param whitelist {Boolean} Whether the {@param styles} will be considered as a white-list. */ stylesFilter : function( styles, whitelist ) { return function( styleText, element ) { var rules = []; // html-encoded quote might be introduced by 'font-family' // from MS-Word which confused the following regexp. e.g. //'font-family: &quot;Lucida, Console&quot;' ( styleText || '' ) .replace( /&quot;/g, '"' ) .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value ) { name = name.toLowerCase(); name == 'font-family' && ( value = value.replace( /["']/g, '' ) ); var namePattern, valuePattern, newValue, newName; for ( var i = 0 ; i < styles.length; i++ ) { if ( styles[ i ] ) { namePattern = styles[ i ][ 0 ]; valuePattern = styles[ i ][ 1 ]; newValue = styles[ i ][ 2 ]; newName = styles[ i ][ 3 ]; if ( name.match( namePattern ) && ( !valuePattern || value.match( valuePattern ) ) ) { name = newName || name; whitelist && ( newValue = newValue || value ); if ( typeof newValue == 'function' ) newValue = newValue( value, element, name ); // Return an couple indicate both name and value // changed. if ( newValue && newValue.push ) name = newValue[ 0 ], newValue = newValue[ 1 ]; if ( typeof newValue == 'string' ) rules.push( [ name, newValue ] ); return; } } } !whitelist && rules.push( [ name, value ] ); }); for ( var i = 0 ; i < rules.length ; i++ ) rules[ i ] = rules[ i ].join( ':' ); return rules.length ? ( rules.join( ';' ) + ';' ) : false; }; }, /** * Migrate the element by decorate styles on it. * @param styleDefiniton * @param variables */ elementMigrateFilter : function ( styleDefiniton, variables ) { return function( element ) { var styleDef = variables ? new CKEDITOR.style( styleDefiniton, variables )._.definition : styleDefiniton; element.name = styleDef.element; CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) ); element.addStyle( CKEDITOR.style.getStyleText( styleDef ) ); }; }, /** * Migrate styles by creating a new nested stylish element. * @param styleDefinition */ styleMigrateFilter : function( styleDefinition, variableName ) { var elementMigrateFilter = this.elementMigrateFilter; return function( value, element ) { // Build an stylish element first. var styleElement = new CKEDITOR.htmlParser.element( null ), variables = {}; variables[ variableName ] = value; elementMigrateFilter( styleDefinition, variables )( styleElement ); // Place the new element inside the existing span. styleElement.children = element.children; element.children = [ styleElement ]; }; }, /** * A filter which remove cke-namespaced-attribute on * all none-cke-namespaced elements. * @param value * @param element */ bogusAttrFilter : function( value, element ) { if ( element.name.indexOf( 'cke:' ) == -1 ) return false; }, /** * A filter which will be used to apply inline css style according the stylesheet * definition rules, is generated lazily when filtering. */ applyStyleFilter : null }, getRules : function( editor ) { var dtd = CKEDITOR.dtd, blockLike = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ), config = editor.config, filters = this.filters, falsyFilter = filters.falsyFilter, stylesFilter = filters.stylesFilter, elementMigrateFilter = filters.elementMigrateFilter, styleMigrateFilter = CKEDITOR.tools.bind( this.filters.styleMigrateFilter, this.filters ), createListBulletMarker = this.utils.createListBulletMarker, flattenList = filters.flattenList, assembleList = filters.assembleList, isListBulletIndicator = this.utils.isListBulletIndicator, containsNothingButSpaces = this.utils.isContainingOnlySpaces, resolveListItem = this.utils.resolveList, convertToPx = function( value ) { value = CKEDITOR.tools.convertToPx( value ); return isNaN( value ) ? value : value + 'px'; }, getStyleComponents = this.utils.getStyleComponents, listDtdParents = this.utils.listDtdParents, removeFontStyles = config.pasteFromWordRemoveFontStyles !== false, removeStyles = config.pasteFromWordRemoveStyles !== false; return { elementNames : [ // Remove script, meta and link elements. [ ( /meta|link|script/ ), '' ] ], root : function( element ) { element.filterChildren(); assembleList( element ); }, elements : { '^' : function( element ) { // Transform CSS style declaration to inline style. var applyStyleFilter; if ( CKEDITOR.env.gecko && ( applyStyleFilter = filters.applyStyleFilter ) ) applyStyleFilter( element ); }, $ : function( element ) { var tagName = element.name || '', attrs = element.attributes; // Convert length unit of width/height on blocks to // a more editor-friendly way (px). if ( tagName in blockLike && attrs.style ) { attrs.style = stylesFilter( [ [ ( /^(:?width|height)$/ ), null, convertToPx ] ] )( attrs.style ) || ''; } // Processing headings. if ( tagName.match( /h\d/ ) ) { element.filterChildren(); // Is the heading actually a list item? if ( resolveListItem( element ) ) return; // Adapt heading styles to editor's convention. elementMigrateFilter( config[ 'format_' + tagName ] )( element ); } // Remove inline elements which contain only empty spaces. else if ( tagName in dtd.$inline ) { element.filterChildren(); if ( containsNothingButSpaces( element ) ) delete element.name; } // Remove element with ms-office namespace, // with it's content preserved, e.g. 'o:p'. else if ( tagName.indexOf( ':' ) != -1 && tagName.indexOf( 'cke' ) == -1 ) { element.filterChildren(); // Restore image real link from vml. if ( tagName == 'v:imagedata' ) { var href = element.attributes[ 'o:href' ]; if ( href ) element.attributes.src = href; element.name = 'img'; return; } delete element.name; } // Assembling list items into a whole list. if ( tagName in listDtdParents ) { element.filterChildren(); assembleList( element ); } }, // We'll drop any style sheet, but Firefox conclude // certain styles in a single style element, which are // required to be changed into inline ones. 'style' : function( element ) { if ( CKEDITOR.env.gecko ) { // Grab only the style definition section. var styleDefSection = element.onlyChild().value.match( /\/\* Style Definitions \*\/([\s\S]*?)\/\*/ ), styleDefText = styleDefSection && styleDefSection[ 1 ], rules = {}; // Storing the parsed result. if ( styleDefText ) { styleDefText // Remove line-breaks. .replace(/[\n\r]/g,'') // Extract selectors and style properties. .replace( /(.+?)\{(.+?)\}/g, function( rule, selectors, styleBlock ) { selectors = selectors.split( ',' ); var length = selectors.length, selector; for ( var i = 0; i < length; i++ ) { // Assume MS-Word mostly generate only simple // selector( [Type selector][Class selector]). CKEDITOR.tools.trim( selectors[ i ] ) .replace( /^(\w+)(\.[\w-]+)?$/g, function( match, tagName, className ) { tagName = tagName || '*'; className = className.substring( 1, className.length ); // Reject MS-Word Normal styles. if ( className.match( /MsoNormal/ ) ) return; if ( !rules[ tagName ] ) rules[ tagName ] = {}; if ( className ) rules[ tagName ][ className ] = styleBlock; else rules[ tagName ] = styleBlock; } ); } }); filters.applyStyleFilter = function( element ) { var name = rules[ '*' ] ? '*' : element.name, className = element.attributes && element.attributes[ 'class' ], style; if ( name in rules ) { style = rules[ name ]; if ( typeof style == 'object' ) style = style[ className ]; // Maintain style rules priorities. style && element.addStyle( style, true ); } }; } } return false; }, 'p' : function( element ) { // This's a fall-back approach to recognize list item in FF3.6, // as it's not perfect as not all list style (e.g. "heading list") is shipped // with this pattern. (#6662) if ( /MsoListParagraph/.exec( element.attributes[ 'class' ] ) ) { var bulletText = element.firstChild( function( node ) { return node.type == CKEDITOR.NODE_TEXT && !containsNothingButSpaces( node.parent ); }); var bullet = bulletText && bulletText.parent, bulletAttrs = bullet && bullet.attributes; bulletAttrs && !bulletAttrs.style && ( bulletAttrs.style = 'mso-list: Ignore;' ); } element.filterChildren(); // Is the paragraph actually a list item? if ( resolveListItem( element ) ) return; // Adapt paragraph formatting to editor's convention // according to enter-mode. if ( config.enterMode == CKEDITOR.ENTER_BR ) { // We suffer from attribute/style lost in this situation. delete element.name; element.add( new CKEDITOR.htmlParser.element( 'br' ) ); } else elementMigrateFilter( config[ 'format_' + ( config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ] )( element ); }, 'div' : function( element ) { // Aligned table with no text surrounded is represented by a wrapper div, from which // table cells inherit as text-align styles, which is wrong. // Instead we use a clear-float div after the table to properly achieve the same layout. var singleChild = element.onlyChild(); if ( singleChild && singleChild.name == 'table' ) { var attrs = element.attributes; singleChild.attributes = CKEDITOR.tools.extend( singleChild.attributes, attrs ); attrs.style && singleChild.addStyle( attrs.style ); var clearFloatDiv = new CKEDITOR.htmlParser.element( 'div' ); clearFloatDiv.addStyle( 'clear' ,'both' ); element.add( clearFloatDiv ); delete element.name; } }, 'td' : function ( element ) { // 'td' in 'thead' is actually <th>. if ( element.getAncestor( 'thead') ) element.name = 'th'; }, // MS-Word sometimes present list as a mixing of normal list // and pseudo-list, normalize the previous ones into pseudo form. 'ol' : flattenList, 'ul' : flattenList, 'dl' : flattenList, 'font' : function( element ) { // Drop the font tag if it comes from list bullet text. if ( isListBulletIndicator( element.parent ) ) { delete element.name; return; } element.filterChildren(); var attrs = element.attributes, styleText = attrs.style, parent = element.parent; if ( 'font' == parent.name ) // Merge nested <font> tags. { CKEDITOR.tools.extend( parent.attributes, element.attributes ); styleText && parent.addStyle( styleText ); delete element.name; } // Convert the merged into a span with all attributes preserved. else { styleText = styleText || ''; // IE's having those deprecated attributes, normalize them. if ( attrs.color ) { attrs.color != '#000000' && ( styleText += 'color:' + attrs.color + ';' ); delete attrs.color; } if ( attrs.face ) { styleText += 'font-family:' + attrs.face + ';'; delete attrs.face; } // TODO: Mapping size in ranges of xx-small, // x-small, small, medium, large, x-large, xx-large. if ( attrs.size ) { styleText += 'font-size:' + ( attrs.size > 3 ? 'large' : ( attrs.size < 3 ? 'small' : 'medium' ) ) + ';'; delete attrs.size; } element.name = 'span'; element.addStyle( styleText ); } }, 'span' : function( element ) { // Remove the span if it comes from list bullet text. if ( isListBulletIndicator( element.parent ) ) return false; element.filterChildren(); if ( containsNothingButSpaces( element ) ) { delete element.name; return null; } // List item bullet type is supposed to be indicated by // the text of a span with style 'mso-list : Ignore' or an image. if ( isListBulletIndicator( element ) ) { var listSymbolNode = element.firstChild( function( node ) { return node.value || node.name == 'img'; }); var listSymbol = listSymbolNode && ( listSymbolNode.value || 'l.' ), listType = listSymbol && listSymbol.match( /^(?:[(]?)([^\s]+?)([.)]?)$/ ); if ( listType ) { var marker = createListBulletMarker( listType, listSymbol ); // Some non-existed list items might be carried by an inconsequential list, indicate by "mso-hide:all/display:none", // those are to be removed later, now mark it with "cke:ignored". var ancestor = element.getAncestor( 'span' ); if ( ancestor && (/ mso-hide:\s*all|display:\s*none /).test( ancestor.attributes.style ) ) marker.attributes[ 'cke:ignored' ] = 1; return marker; } } // Update the src attribute of image element with href. var children = element.children, attrs = element.attributes, styleText = attrs && attrs.style, firstChild = children && children[ 0 ]; // Assume MS-Word mostly carry font related styles on <span>, // adapting them to editor's convention. if ( styleText ) { attrs.style = stylesFilter( [ // Drop 'inline-height' style which make lines overlapping. [ 'line-height' ], [ ( /^font-family$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'font_style' ], 'family' ) : null ] , [ ( /^font-size$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'fontSize_style' ], 'size' ) : null ] , [ ( /^color$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_foreStyle' ], 'color' ) : null ] , [ ( /^background-color$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_backStyle' ], 'color' ) : null ] ] )( styleText, element ) || ''; } return null; }, // Migrate basic style formats to editor configured ones. 'b' : elementMigrateFilter( config[ 'coreStyles_bold' ] ), 'i' : elementMigrateFilter( config[ 'coreStyles_italic' ] ), 'u' : elementMigrateFilter( config[ 'coreStyles_underline' ] ), 's' : elementMigrateFilter( config[ 'coreStyles_strike' ] ), 'sup' : elementMigrateFilter( config[ 'coreStyles_superscript' ] ), 'sub' : elementMigrateFilter( config[ 'coreStyles_subscript' ] ), // Editor doesn't support anchor with content currently (#3582), // drop such anchors with content preserved. 'a' : function( element ) { var attrs = element.attributes; if ( attrs && !attrs.href && attrs.name ) delete element.name; else if ( CKEDITOR.env.webkit && attrs.href && attrs.href.match( /file:\/\/\/[\S]+#/i ) ) attrs.href = attrs.href.replace( /file:\/\/\/[^#]+/i,'' ); }, 'cke:listbullet' : function( element ) { if ( element.getAncestor( /h\d/ ) && !config.pasteFromWordNumberedHeadingToList ) delete element.name; } }, attributeNames : [ // Remove onmouseover and onmouseout events (from MS Word comments effect) [ ( /^onmouse(:?out|over)/ ), '' ], // Onload on image element. [ ( /^onload$/ ), '' ], // Remove office and vml attribute from elements. [ ( /(?:v|o):\w+/ ), '' ], // Remove lang/language attributes. [ ( /^lang/ ), '' ] ], attributes : { 'style' : stylesFilter( removeStyles ? // Provide a white-list of styles that we preserve, those should // be the ones that could later be altered with editor tools. [ // Leave list-style-type [ ( /^list-style-type$/ ), null ], // Preserve margin-left/right which used as default indent style in the editor. [ ( /^margin$|^margin-(?!bottom|top)/ ), null, function( value, element, name ) { if ( element.name in { p : 1, div : 1 } ) { var indentStyleName = config.contentsLangDirection == 'ltr' ? 'margin-left' : 'margin-right'; // Extract component value from 'margin' shorthand. if ( name == 'margin' ) { value = getStyleComponents( name, value, [ indentStyleName ] )[ indentStyleName ]; } else if ( name != indentStyleName ) return null; if ( value && !emptyMarginRegex.test( value ) ) return [ indentStyleName, value ]; } return null; } ], // Preserve clear float style. [ ( /^clear$/ ) ], [ ( /^border.*|margin.*|vertical-align|float$/ ), null, function( value, element ) { if ( element.name == 'img' ) return value; } ], [ (/^width|height$/ ), null, function( value, element ) { if ( element.name in { table : 1, td : 1, th : 1, img : 1 } ) return value; } ] ] : // Otherwise provide a black-list of styles that we remove. [ [ ( /^mso-/ ) ], // Fixing color values. [ ( /-color$/ ), null, function( value ) { if ( value == 'transparent' ) return false; if ( CKEDITOR.env.gecko ) return value.replace( /-moz-use-text-color/g, 'transparent' ); } ], // Remove empty margin values, e.g. 0.00001pt 0em 0pt [ ( /^margin$/ ), emptyMarginRegex ], [ 'text-indent', '0cm' ], [ 'page-break-before' ], [ 'tab-stops' ], [ 'display', 'none' ], removeFontStyles ? [ ( /font-?/ ) ] : null ], removeStyles ), // Prefer width styles over 'width' attributes. 'width' : function( value, element ) { if ( element.name in dtd.$tableContent ) return false; }, // Prefer border styles over table 'border' attributes. 'border' : function( value, element ) { if ( element.name in dtd.$tableContent ) return false; }, // Only Firefox carry style sheet from MS-Word, which // will be applied by us manually. For other browsers // the css className is useless. 'class' : falsyFilter, // MS-Word always generate 'background-color' along with 'bgcolor', // simply drop the deprecated attributes. 'bgcolor' : falsyFilter, // Deprecate 'valign' attribute in favor of 'vertical-align'. 'valign' : removeStyles ? falsyFilter : function( value, element ) { element.addStyle( 'vertical-align', value ); return false; } }, // Fore none-IE, some useful data might be buried under these IE-conditional // comments where RegExp were the right approach to dig them out where usual approach // is transform it into a fake element node which hold the desired data. comment : !CKEDITOR.env.ie ? function( value, node ) { var imageInfo = value.match( /<img.*?>/ ), listInfo = value.match( /^\[if !supportLists\]([\s\S]*?)\[endif\]$/ ); // Seek for list bullet indicator. if ( listInfo ) { // Bullet symbol could be either text or an image. var listSymbol = listInfo[ 1 ] || ( imageInfo && 'l.' ), listType = listSymbol && listSymbol.match( />(?:[(]?)([^\s]+?)([.)]?)</ ); return createListBulletMarker( listType, listSymbol ); } // Reveal the <img> element in conditional comments for Firefox. if ( CKEDITOR.env.gecko && imageInfo ) { var img = CKEDITOR.htmlParser.fragment.fromHtml( imageInfo[ 0 ] ).children[ 0 ], previousComment = node.previous, // Try to dig the real image link from vml markup from previous comment text. imgSrcInfo = previousComment && previousComment.value.match( /<v:imagedata[^>]*o:href=['"](.*?)['"]/ ), imgSrc = imgSrcInfo && imgSrcInfo[ 1 ]; // Is there a real 'src' url to be used? imgSrc && ( img.attributes.src = imgSrc ); return img; } return false; } : falsyFilter }; } }); // The paste processor here is just a reduced copy of html data processor. var pasteProcessor = function() { this.dataFilter = new CKEDITOR.htmlParser.filter(); }; pasteProcessor.prototype = { toHtml : function( data ) { var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data, false ), writer = new CKEDITOR.htmlParser.basicWriter(); fragment.writeHtml( writer, this.dataFilter ); return writer.getHtml( true ); } }; CKEDITOR.cleanWord = function( data, editor ) { // Firefox will be confused by those downlevel-revealed IE conditional // comments, fixing them first( convert it to upperlevel-revealed one ). // e.g. <![if !vml]>...<![endif]> if ( CKEDITOR.env.gecko ) data = data.replace( /(<!--\[if[^<]*?\])-->([\S\s]*?)<!--(\[endif\]-->)/gi, '$1$2$3' ); var dataProcessor = new pasteProcessor(), dataFilter = dataProcessor.dataFilter; // These rules will have higher priorities than default ones. dataFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor ) ); // Allow extending data filter rules. editor.fire( 'beforeCleanWord', { filter : dataFilter } ); try { data = dataProcessor.toHtml( data, false ); } catch ( e ) { alert( editor.lang.pastefromword.error ); } /* Below post processing those things that are unable to delivered by filter rules. */ // Remove 'cke' namespaced attribute used in filter rules as marker. data = data.replace( /cke:.*?".*?"/g, '' ); // Remove empty style attribute. data = data.replace( /style=""/g, '' ); // Remove the dummy spans ( having no inline style ). data = data.replace( /<span>/g, '' ); return data; }; })(); /** * Whether to ignore all font related formatting styles, including: * <ul> <li>font size;</li> * <li>font family;</li> * <li>font foreground/background color.</li></ul> * @name CKEDITOR.config.pasteFromWordRemoveFontStyles * @since 3.1 * @type Boolean * @default true * @example * config.pasteFromWordRemoveFontStyles = false; */ /** * Whether to transform MS Word outline numbered headings into lists. * @name CKEDITOR.config.pasteFromWordNumberedHeadingToList * @since 3.1 * @type Boolean * @default false * @example * config.pasteFromWordNumberedHeadingToList = true; */ /** * Whether to remove element styles that can't be managed with the editor. Note * that this doesn't handle the font specific styles, which depends on the * {@link CKEDITOR.config.pasteFromWordRemoveFontStyles} setting instead. * @name CKEDITOR.config.pasteFromWordRemoveStyles * @since 3.1 * @type Boolean * @default true * @example * config.pasteFromWordRemoveStyles = false; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/pastefromword/filter/default.js
JavaScript
asf20
44,458
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "wysiwygarea" plugin. It registers the "wysiwyg" editing * mode, which handles the main editing area space. */ (function() { // Matching an empty paragraph at the end of document. var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi; var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true ); // Elements that could blink the cursor anchoring beside it, like hr, page-break. (#6554) function nonEditable( element ) { return element.isBlockBoundary() && CKEDITOR.dtd.$empty[ element.getName() ]; } function onInsert( insertFunc ) { return function( evt ) { if ( this.mode == 'wysiwyg' ) { this.focus(); this.fire( 'saveSnapshot' ); insertFunc.call( this, evt.data ); // Save snaps after the whole execution completed. // This's a workaround for make DOM modification's happened after // 'insertElement' to be included either, e.g. Form-based dialogs' 'commitContents' // call. CKEDITOR.tools.setTimeout( function() { this.fire( 'saveSnapshot' ); }, 0, this ); } }; } function doInsertHtml( data ) { if ( this.dataProcessor ) data = this.dataProcessor.toHtml( data ); if ( !data ) return; // HTML insertion only considers the first range. var selection = this.getSelection(), range = selection.getRanges()[ 0 ]; if ( range.checkReadOnly() ) return; // Opera: force block splitting when pasted content contains block. (#7801) if ( CKEDITOR.env.opera ) { var path = new CKEDITOR.dom.elementPath( range.startContainer ); if ( path.block ) { var nodes = CKEDITOR.htmlParser.fragment.fromHtml( data, false ).children; for ( var i = 0, count = nodes.length; i < count; i++ ) { if ( nodes[ i ]._.isBlockLike ) { range.splitBlock( this.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' ); range.insertNode( range.document.createText( '' ) ); range.select(); break; } } } } if ( CKEDITOR.env.ie ) { var selIsLocked = selection.isLocked; if ( selIsLocked ) selection.unlock(); var $sel = selection.getNative(); // Delete control selections to avoid IE bugs on pasteHTML. if ( $sel.type == 'Control' ) $sel.clear(); else if ( selection.getType() == CKEDITOR.SELECTION_TEXT ) { // Due to IE bugs on handling contenteditable=false blocks // (#6005), we need to make some checks and eventually // delete the selection first. range = selection.getRanges()[ 0 ]; var endContainer = range && range.endContainer; if ( endContainer && endContainer.type == CKEDITOR.NODE_ELEMENT && endContainer.getAttribute( 'contenteditable' ) == 'false' && range.checkBoundaryOfElement( endContainer, CKEDITOR.END ) ) { range.setEndAfter( range.endContainer ); range.deleteContents(); } } $sel.createRange().pasteHTML( data ); if ( selIsLocked ) this.getSelection().lock(); } else this.document.$.execCommand( 'inserthtml', false, data ); // Webkit does not scroll to the cursor position after pasting (#5558) if ( CKEDITOR.env.webkit ) { selection = this.getSelection(); selection.scrollIntoView(); } } function doInsertText( text ) { var selection = this.getSelection(), mode = selection.getStartElement().hasAscendant( 'pre', true ) ? CKEDITOR.ENTER_BR : this.config.enterMode, isEnterBrMode = mode == CKEDITOR.ENTER_BR; var html = CKEDITOR.tools.htmlEncode( text.replace( /\r\n|\r/g, '\n' ) ); // Convert leading and trailing whitespaces into &nbsp; html = html.replace( /^[ \t]+|[ \t]+$/g, function( match, offset, s ) { if ( match.length == 1 ) // one space, preserve it return '&nbsp;'; else if ( !offset ) // beginning of block return CKEDITOR.tools.repeat( '&nbsp;', match.length - 1 ) + ' '; else // end of block return ' ' + CKEDITOR.tools.repeat( '&nbsp;', match.length - 1 ); } ); // Convert subsequent whitespaces into &nbsp; html = html.replace( /[ \t]{2,}/g, function ( match ) { return CKEDITOR.tools.repeat( '&nbsp;', match.length - 1 ) + ' '; } ); var paragraphTag = mode == CKEDITOR.ENTER_P ? 'p' : 'div'; // Two line-breaks create one paragraph. if ( !isEnterBrMode ) { html = html.replace( /(\n{2})([\s\S]*?)(?:$|\1)/g, function( match, group1, text ) { return '<'+paragraphTag + '>' + text + '</' + paragraphTag + '>'; }); } // One <br> per line-break. html = html.replace( /\n/g, '<br>' ); // Compensate padding <br> for non-IE. if ( !( isEnterBrMode || CKEDITOR.env.ie ) ) { html = html.replace( new RegExp( '<br>(?=</' + paragraphTag + '>)' ), function( match ) { return CKEDITOR.tools.repeat( match, 2 ); } ); } // Inline styles have to be inherited in Firefox. if ( CKEDITOR.env.gecko || CKEDITOR.env.webkit ) { var path = new CKEDITOR.dom.elementPath( selection.getStartElement() ), context = []; for ( var i = 0; i < path.elements.length; i++ ) { var tag = path.elements[ i ].getName(); if ( tag in CKEDITOR.dtd.$inline ) context.unshift( path.elements[ i ].getOuterHtml().match( /^<.*?>/) ); else if ( tag in CKEDITOR.dtd.$block ) break; } // Reproduce the context by preceding the pasted HTML with opening inline tags. html = context.join( '' ) + html; } doInsertHtml.call( this, html ); } function doInsertElement( element ) { var selection = this.getSelection(), ranges = selection.getRanges(), elementName = element.getName(), isBlock = CKEDITOR.dtd.$block[ elementName ]; var selIsLocked = selection.isLocked; if ( selIsLocked ) selection.unlock(); var range, clone, lastElement, bookmark; for ( var i = ranges.length - 1 ; i >= 0 ; i-- ) { range = ranges[ i ]; if ( !range.checkReadOnly() ) { // Remove the original contents, merge splitted nodes. range.deleteContents( 1 ); clone = !i && element || element.clone( 1 ); // If we're inserting a block at dtd-violated position, split // the parent blocks until we reach blockLimit. var current, dtd; if ( isBlock ) { while ( ( current = range.getCommonAncestor( 0, 1 ) ) && ( dtd = CKEDITOR.dtd[ current.getName() ] ) && !( dtd && dtd [ elementName ] ) ) { // Split up inline elements. if ( current.getName() in CKEDITOR.dtd.span ) range.splitElement( current ); // If we're in an empty block which indicate a new paragraph, // simply replace it with the inserting block.(#3664) else if ( range.checkStartOfBlock() && range.checkEndOfBlock() ) { range.setStartBefore( current ); range.collapse( true ); current.remove(); } else range.splitBlock(); } } // Insert the new node. range.insertNode( clone ); // Save the last element reference so we can make the // selection later. if ( !lastElement ) lastElement = clone; } } if ( lastElement ) { range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END ); // If we're inserting a block element immediatelly followed by // another block element, the selection must move there. (#3100,#5436) if ( isBlock ) { var next = lastElement.getNext( notWhitespaceEval ), nextName = next && next.type == CKEDITOR.NODE_ELEMENT && next.getName(); // Check if it's a block element that accepts text. if ( nextName && CKEDITOR.dtd.$block[ nextName ] && CKEDITOR.dtd[ nextName ]['#'] ) range.moveToElementEditStart( next ); } } selection.selectRanges( [ range ] ); if ( selIsLocked ) this.getSelection().lock(); } // DOM modification here should not bother dirty flag.(#4385) function restoreDirty( editor ) { if ( !editor.checkDirty() ) setTimeout( function(){ editor.resetDirty(); }, 0 ); } var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ), isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ); function isNotEmpty( node ) { return isNotWhitespace( node ) && isNotBookmark( node ); } function isNbsp( node ) { return node.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.trim( node.getText() ).match( /^(?:&nbsp;|\xa0)$/ ); } function restoreSelection( selection ) { if ( selection.isLocked ) { selection.unlock(); setTimeout( function() { selection.lock(); }, 0 ); } } function isBlankParagraph( block ) { return block.getOuterHtml().match( emptyParagraphRegexp ); } isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ); // Gecko need a key event to 'wake up' the editing // ability when document is empty.(#3864, #5781) function activateEditing( editor ) { var win = editor.window, doc = editor.document, body = editor.document.getBody(), bodyFirstChild = body.getFirst(), bodyChildsNum = body.getChildren().count(); if ( !bodyChildsNum || bodyChildsNum == 1 && bodyFirstChild.type == CKEDITOR.NODE_ELEMENT && bodyFirstChild.hasAttribute( '_moz_editor_bogus_node' ) ) { restoreDirty( editor ); // Memorize scroll position to restore it later (#4472). var hostDocument = editor.element.getDocument(); var hostDocumentElement = hostDocument.getDocumentElement(); var scrollTop = hostDocumentElement.$.scrollTop; var scrollLeft = hostDocumentElement.$.scrollLeft; // Simulating keyboard character input by dispatching a keydown of white-space text. var keyEventSimulate = doc.$.createEvent( "KeyEvents" ); keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false, false, false, false, 0, 32 ); doc.$.dispatchEvent( keyEventSimulate ); if ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft ) hostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop ); // Restore the original document status by placing the cursor before a bogus br created (#5021). bodyChildsNum && body.getFirst().remove(); doc.getBody().appendBogus(); var nativeRange = new CKEDITOR.dom.range( doc ); nativeRange.setStartAt( body , CKEDITOR.POSITION_AFTER_START ); nativeRange.select(); } } /** * Auto-fixing block-less content by wrapping paragraph (#3190), prevent * non-exitable-block by padding extra br.(#3189) */ function onSelectionChangeFixBody( evt ) { var editor = evt.editor, path = evt.data.path, blockLimit = path.blockLimit, selection = evt.data.selection, range = selection.getRanges()[0], body = editor.document.getBody(), enterMode = editor.config.enterMode; if ( CKEDITOR.env.gecko ) { activateEditing( editor ); // Ensure bogus br could help to move cursor (out of styles) to the end of block. (#7041) var pathBlock = path.block || path.blockLimit, lastNode = pathBlock && pathBlock.getLast( isNotEmpty ); // Check some specialities of the current path block: // 1. It is really displayed as block; (#7221) // 2. It doesn't end with one inner block; (#7467) // 3. It doesn't have bogus br yet. if ( pathBlock && pathBlock.isBlockBoundary() && !( lastNode && lastNode.type == CKEDITOR.NODE_ELEMENT && lastNode.isBlockBoundary() ) && !pathBlock.is( 'pre' ) && !pathBlock.getBogus() ) { pathBlock.appendBogus(); } } // When we're in block enter mode, a new paragraph will be established // to encapsulate inline contents right under body. (#3657) if ( editor.config.autoParagraph !== false && enterMode != CKEDITOR.ENTER_BR && range.collapsed && blockLimit.getName() == 'body' && !path.block ) { var fixedBlock = range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' ); // For IE, we should remove any filler node which was introduced before. if ( CKEDITOR.env.ie ) { var first = fixedBlock.getFirst( isNotEmpty ); first && isNbsp( first ) && first.remove(); } // If the fixed block is actually blank and is already followed by an exitable blank // block, we should revert the fix and move into the existed one. (#3684) if ( isBlankParagraph( fixedBlock ) ) { var element = fixedBlock.getNext( isNotWhitespace ); if ( element && element.type == CKEDITOR.NODE_ELEMENT && !nonEditable( element ) ) { range.moveToElementEditStart( element ); fixedBlock.remove(); } else { element = fixedBlock.getPrevious( isNotWhitespace ); if ( element && element.type == CKEDITOR.NODE_ELEMENT && !nonEditable( element ) ) { range.moveToElementEditEnd( element ); fixedBlock.remove(); } } } range.select(); // Cancel this selection change in favor of the next (correct). (#6811) evt.cancel(); } // Browsers are incapable of moving cursor out of certain block elements (e.g. table, div, pre) // at the end of document, makes it unable to continue adding content, we have to make this // easier by opening an new empty paragraph. var testRange = new CKEDITOR.dom.range( editor.document ); testRange.moveToElementEditEnd( editor.document.getBody() ); var testPath = new CKEDITOR.dom.elementPath( testRange.startContainer ); if ( !testPath.blockLimit.is( 'body') ) { var paddingBlock; if ( enterMode != CKEDITOR.ENTER_BR ) paddingBlock = body.append( editor.document.createElement( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ); else paddingBlock = body; if ( !CKEDITOR.env.ie ) paddingBlock.appendBogus(); } } CKEDITOR.plugins.add( 'wysiwygarea', { requires : [ 'editingblock' ], init : function( editor ) { var fixForBody = ( editor.config.enterMode != CKEDITOR.ENTER_BR && editor.config.autoParagraph !== false ) ? editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' : false; var frameLabel = editor.lang.editorTitle.replace( '%1', editor.name ); var contentDomReadyHandler; editor.on( 'editingBlockReady', function() { var mainElement, iframe, isLoadingData, isPendingFocus, frameLoaded, fireMode; // Support for custom document.domain in IE. var isCustomDomain = CKEDITOR.env.isCustomDomain(); // Creates the iframe that holds the editable document. var createIFrame = function( data ) { if ( iframe ) iframe.remove(); var src = 'document.open();' + // The document domain must be set any time we // call document.open(). ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + 'document.close();'; // With IE, the custom domain has to be taken care at first, // for other browers, the 'src' attribute should be left empty to // trigger iframe's 'load' event. src = CKEDITOR.env.air ? 'javascript:void(0)' : CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( src ) + '}())' : ''; iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' + ' style="width:100%;height:100%"' + ' frameBorder="0"' + ' title="' + frameLabel + '"' + ' src="' + src + '"' + ' tabIndex="' + ( CKEDITOR.env.webkit? -1 : editor.tabIndex ) + '"' + ' allowTransparency="true"' + '></iframe>' ); // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689) if ( document.location.protocol == 'chrome:' ) CKEDITOR.event.useCapture = true; // With FF, it's better to load the data on iframe.load. (#3894,#4058) iframe.on( 'load', function( ev ) { frameLoaded = 1; ev.removeListener(); var doc = iframe.getFrameDocument(); doc.write( data ); CKEDITOR.env.air && contentDomReady( doc.getWindow().$ ); }); // Reset adjustment back to default (#5689) if ( document.location.protocol == 'chrome:' ) CKEDITOR.event.useCapture = false; mainElement.append( iframe ); }; // The script that launches the bootstrap logic on 'domReady', so the document // is fully editable even before the editing iframe is fully loaded (#4455). contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady ); var activationScript = '<script id="cke_actscrpt" type="text/javascript" data-cke-temp="1">' + ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + 'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' + '</script>'; // Editing area bootstrap code. function contentDomReady( domWindow ) { if ( !frameLoaded ) return; frameLoaded = 0; editor.fire( 'ariaWidget', iframe ); var domDocument = domWindow.document, body = domDocument.body; // Remove this script from the DOM. var script = domDocument.getElementById( "cke_actscrpt" ); script && script.parentNode.removeChild( script ); body.spellcheck = !editor.config.disableNativeSpellChecker; var editable = !editor.readOnly; if ( CKEDITOR.env.ie ) { // Don't display the focus border. body.hideFocus = true; // Disable and re-enable the body to avoid IE from // taking the editing focus at startup. (#141 / #523) body.disabled = true; body.contentEditable = editable; body.removeAttribute( 'disabled' ); } else { // Avoid opening design mode in a frame window thread, // which will cause host page scrolling.(#4397) setTimeout( function() { // Prefer 'contentEditable' instead of 'designMode'. (#3593) if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 || CKEDITOR.env.opera ) domDocument.$.body.contentEditable = editable; else if ( CKEDITOR.env.webkit ) domDocument.$.body.parentNode.contentEditable = editable; else domDocument.$.designMode = editable? 'off' : 'on'; }, 0 ); } editable && CKEDITOR.env.gecko && CKEDITOR.tools.setTimeout( activateEditing, 0, null, editor ); domWindow = editor.window = new CKEDITOR.dom.window( domWindow ); domDocument = editor.document = new CKEDITOR.dom.document( domDocument ); editable && domDocument.on( 'dblclick', function( evt ) { var element = evt.data.getTarget(), data = { element : element, dialog : '' }; editor.fire( 'doubleclick', data ); data.dialog && editor.openDialog( data.dialog ); }); // Prevent automatic submission in IE #6336 CKEDITOR.env.ie && domDocument.on( 'click', function( evt ) { var element = evt.data.getTarget(); if ( element.is( 'input' ) ) { var type = element.getAttribute( 'type' ); if ( type == 'submit' || type == 'reset' ) evt.data.preventDefault(); } }); // Gecko/Webkit need some help when selecting control type elements. (#3448) if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ) { domDocument.on( 'mousedown', function( ev ) { var control = ev.data.getTarget(); if ( control.is( 'img', 'hr', 'input', 'textarea', 'select' ) ) editor.getSelection().selectElement( control ); } ); } if ( CKEDITOR.env.gecko ) { domDocument.on( 'mouseup', function( ev ) { if ( ev.data.$.button == 2 ) { var target = ev.data.getTarget(); // Prevent right click from selecting an empty block even // when selection is anchored inside it. (#5845) if ( !target.getOuterHtml().replace( emptyParagraphRegexp, '' ) ) { var range = new CKEDITOR.dom.range( domDocument ); range.moveToElementEditStart( target ); range.select( true ); } } } ); } // Prevent the browser opening links in read-only blocks. (#6032) domDocument.on( 'click', function( ev ) { ev = ev.data; if ( ev.getTarget().is( 'a' ) && ev.$.button != 2 ) ev.preventDefault(); }); // Webkit: avoid from editing form control elements content. if ( CKEDITOR.env.webkit ) { // Mark that cursor will right blinking (#7113). domDocument.on( 'mousedown', function() { wasFocused = 1; } ); // Prevent from tick checkbox/radiobox/select domDocument.on( 'click', function( ev ) { if ( ev.data.getTarget().is( 'input', 'select' ) ) ev.data.preventDefault(); } ); // Prevent from editig textfield/textarea value. domDocument.on( 'mouseup', function( ev ) { if ( ev.data.getTarget().is( 'input', 'textarea' ) ) ev.data.preventDefault(); } ); } // IE standard compliant in editing frame doesn't focus the editor when // clicking outside actual content, manually apply the focus. (#1659) if ( editable && CKEDITOR.env.ie && domDocument.$.compatMode == 'CSS1Compat' || CKEDITOR.env.gecko || CKEDITOR.env.opera ) { var htmlElement = domDocument.getDocumentElement(); htmlElement.on( 'mousedown', function( evt ) { // Setting focus directly on editor doesn't work, we // have to use here a temporary element to 'redirect' // the focus. if ( evt.data.getTarget().equals( htmlElement ) ) { if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 ) blinkCursor(); focusGrabber.focus(); } } ); } var focusTarget = CKEDITOR.env.ie ? iframe : domWindow; focusTarget.on( 'blur', function() { editor.focusManager.blur(); }); var wasFocused; focusTarget.on( 'focus', function() { var doc = editor.document; if ( editable && CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 ) blinkCursor(); else if ( CKEDITOR.env.opera ) doc.getBody().focus(); // Webkit needs focus for the first time on the HTML element. (#6153) else if ( CKEDITOR.env.webkit ) { if ( !wasFocused ) { editor.document.getDocumentElement().focus(); wasFocused = 1; } } editor.focusManager.focus(); }); var keystrokeHandler = editor.keystrokeHandler; // Prevent backspace from navigating off the page. keystrokeHandler.blockedKeystrokes[ 8 ] = !editable; keystrokeHandler.attach( domDocument ); domDocument.getDocumentElement().addClass( domDocument.$.compatMode ); // Override keystroke behaviors. editable && domDocument.on( 'keydown', function( evt ) { var keyCode = evt.data.getKeystroke(); // Backspace OR Delete. if ( keyCode in { 8 : 1, 46 : 1 } ) { var sel = editor.getSelection(), selected = sel.getSelectedElement(), range = sel.getRanges()[ 0 ]; // Override keystrokes which should have deletion behavior // on fully selected element . (#4047) (#7645) if ( selected ) { // Make undo snapshot. editor.fire( 'saveSnapshot' ); // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will // break up the selection, safely manage it here. (#4795) range.moveToPosition( selected, CKEDITOR.POSITION_BEFORE_START ); // Remove the control manually. selected.remove(); range.select(); editor.fire( 'saveSnapshot' ); evt.data.preventDefault(); return; } } } ); // PageUp/PageDown scrolling is broken in document // with standard doctype, manually fix it. (#4736) if ( CKEDITOR.env.ie && domDocument.$.compatMode == 'CSS1Compat' ) { var pageUpDownKeys = { 33 : 1, 34 : 1 }; domDocument.on( 'keydown', function( evt ) { if ( evt.data.getKeystroke() in pageUpDownKeys ) { setTimeout( function () { editor.getSelection().scrollIntoView(); }, 0 ); } } ); } // Prevent IE from leaving new paragraph after deleting all contents in body. (#6966) if ( CKEDITOR.env.ie && editor.config.enterMode != CKEDITOR.ENTER_P ) { domDocument.on( 'selectionchange', function() { var body = domDocument.getBody(), range = editor.getSelection().getRanges()[ 0 ]; if ( body.getHtml().match( /^<p>&nbsp;<\/p>$/i ) && range.startContainer.equals( body ) ) { // Avoid the ambiguity from a real user cursor position. setTimeout( function () { range = editor.getSelection().getRanges()[ 0 ]; if ( !range.startContainer.equals ( 'body' ) ) { body.getFirst().remove( 1 ); range.moveToElementEditEnd( body ); range.select( 1 ); } }, 0 ); } }); } // Adds the document body as a context menu target. if ( editor.contextMenu ) editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false ); setTimeout( function() { editor.fire( 'contentDom' ); if ( fireMode ) { editor.mode = 'wysiwyg'; editor.fire( 'mode', { previousMode : editor._.previousMode } ); fireMode = false; } isLoadingData = false; if ( isPendingFocus ) { editor.focus(); isPendingFocus = false; } setTimeout( function() { editor.fire( 'dataReady' ); }, 0 ); // IE, Opera and Safari may not support it and throw errors. try { editor.document.$.execCommand( 'enableInlineTableEditing', false, !editor.config.disableNativeTableHandles ); } catch(e) {} if ( editor.config.disableObjectResizing ) { try { editor.document.$.execCommand( 'enableObjectResizing', false, false ); } catch(e) { // For browsers in which the above method failed, we can cancel the resizing on the fly (#4208) editor.document.getBody().on( CKEDITOR.env.ie ? 'resizestart' : 'resize', function( evt ) { evt.data.preventDefault(); }); } } /* * IE BUG: IE might have rendered the iframe with invisible contents. * (#3623). Push some inconsequential CSS style changes to force IE to * refresh it. * * Also, for some unknown reasons, short timeouts (e.g. 100ms) do not * fix the problem. :( */ if ( CKEDITOR.env.ie ) { setTimeout( function() { if ( editor.document ) { var $body = editor.document.$.body; $body.runtimeStyle.marginBottom = '0px'; $body.runtimeStyle.marginBottom = ''; } }, 1000 ); } }, 0 ); } editor.addMode( 'wysiwyg', { load : function( holderElement, data, isSnapshot ) { mainElement = holderElement; if ( CKEDITOR.env.ie && CKEDITOR.env.quirks ) holderElement.setStyle( 'position', 'relative' ); // The editor data "may be dirty" after this // point. editor.mayBeDirty = true; fireMode = true; if ( isSnapshot ) this.loadSnapshotData( data ); else this.loadData( data ); }, loadData : function( data ) { isLoadingData = true; editor._.dataStore = { id : 1 }; var config = editor.config, fullPage = config.fullPage, docType = config.docType; // Build the additional stuff to be included into <head>. var headExtra = '<style type="text/css" data-cke-temp="1">' + editor._.styles.join( '\n' ) + '</style>'; !fullPage && ( headExtra = CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) + headExtra ); var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" data-cke-temp="1" />' : ''; if ( fullPage ) { // Search and sweep out the doctype declaration. data = data.replace( /<!DOCTYPE[^>]*>/i, function( match ) { editor.docType = docType = match; return ''; }).replace( /<\?xml\s[^\?]*\?>/i, function( match ) { editor.xmlDeclaration = match; return ''; }); } // Get the HTML version of the data. if ( editor.dataProcessor ) data = editor.dataProcessor.toHtml( data, fixForBody ); if ( fullPage ) { // Check if the <body> tag is available. if ( !(/<body[\s|>]/).test( data ) ) data = '<body>' + data; // Check if the <html> tag is available. if ( !(/<html[\s|>]/).test( data ) ) data = '<html>' + data + '</html>'; // Check if the <head> tag is available. if ( !(/<head[\s|>]/).test( data ) ) data = data.replace( /<html[^>]*>/, '$&<head><title></title></head>' ) ; else if ( !(/<title[\s|>]/).test( data ) ) data = data.replace( /<head[^>]*>/, '$&<title></title>' ) ; // The base must be the first tag in the HEAD, e.g. to get relative // links on styles. baseTag && ( data = data.replace( /<head>/, '$&' + baseTag ) ); // Inject the extra stuff into <head>. // Attention: do not change it before testing it well. (V2) // This is tricky... if the head ends with <meta ... content type>, // Firefox will break. But, it works if we place our extra stuff as // the last elements in the HEAD. data = data.replace( /<\/head\s*>/, headExtra + '$&' ); // Add the DOCTYPE back to it. data = docType + data; } else { data = config.docType + '<html dir="' + config.contentsLangDirection + '"' + ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' + '<head>' + '<title>' + frameLabel + '</title>' + baseTag + headExtra + '</head>' + '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) + ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) + '>' + data + '</html>'; } // Distinguish bogus to normal BR at the end of document for Mozilla. (#5293). if ( CKEDITOR.env.gecko ) data = data.replace( /<br \/>(?=\s*<\/(:?html|body)>)/, '$&<br type="_moz" />' ); data += activationScript; // The iframe is recreated on each call of setData, so we need to clear DOM objects this.onDispose(); createIFrame( data ); }, getData : function() { var config = editor.config, fullPage = config.fullPage, docType = fullPage && editor.docType, xmlDeclaration = fullPage && editor.xmlDeclaration, doc = iframe.getFrameDocument(); var data = fullPage ? doc.getDocumentElement().getOuterHtml() : doc.getBody().getHtml(); // BR at the end of document is bogus node for Mozilla. (#5293). if ( CKEDITOR.env.gecko ) data = data.replace( /<br>(?=\s*(:?$|<\/body>))/, '' ); if ( editor.dataProcessor ) data = editor.dataProcessor.toDataFormat( data, fixForBody ); // Reset empty if the document contains only one empty paragraph. if ( config.ignoreEmptyParagraph ) data = data.replace( emptyParagraphRegexp, function( match, lookback ) { return lookback; } ); if ( xmlDeclaration ) data = xmlDeclaration + '\n' + data; if ( docType ) data = docType + '\n' + data; return data; }, getSnapshotData : function() { return iframe.getFrameDocument().getBody().getHtml(); }, loadSnapshotData : function( data ) { iframe.getFrameDocument().getBody().setHtml( data ); }, onDispose : function() { if ( !editor.document ) return; editor.document.getDocumentElement().clearCustomData(); editor.document.getBody().clearCustomData(); editor.window.clearCustomData(); editor.document.clearCustomData(); iframe.clearCustomData(); /* * IE BUG: When destroying editor DOM with the selection remains inside * editing area would break IE7/8's selection system, we have to put the editing * iframe offline first. (#3812 and #5441) */ iframe.remove(); }, unload : function( holderElement ) { this.onDispose(); editor.window = editor.document = iframe = mainElement = isPendingFocus = null; editor.fire( 'contentDomUnload' ); }, focus : function() { var win = editor.window; if ( isLoadingData ) isPendingFocus = true; else if ( win ) { // AIR needs a while to focus when moving from a link. CKEDITOR.env.air ? setTimeout( function () { win.focus(); }, 0 ) : win.focus(); editor.selectionChange(); } } }); editor.on( 'insertHtml', onInsert( doInsertHtml ) , null, null, 20 ); editor.on( 'insertElement', onInsert( doInsertElement ), null, null, 20 ); editor.on( 'insertText', onInsert( doInsertText ), null, null, 20 ); // Auto fixing on some document structure weakness to enhance usabilities. (#3190 and #3189) editor.on( 'selectionChange', function( evt ) { if ( editor.readOnly ) return; var sel = editor.getSelection(); // Do it only when selection is not locked. (#8222) if ( sel && !sel.isLocked ) { var isDirty = editor.checkDirty(); editor.fire( 'saveSnapshot', { contentOnly : 1 } ); onSelectionChangeFixBody.call( this, evt ); editor.fire( 'updateSnapshot' ); !isDirty && editor.resetDirty(); } }, null, null, 1 ); }); var titleBackup; // Setting voice label as window title, backup the original one // and restore it before running into use. editor.on( 'contentDom', function() { var title = editor.document.getElementsByTag( 'title' ).getItem( 0 ); title.data( 'cke-title', editor.document.$.title ); editor.document.$.title = frameLabel; }); editor.on( 'readOnly', function() { if ( editor.mode == 'wysiwyg' ) { // Symply reload the wysiwyg area. It'll take care of read-only. var wysiwyg = editor.getMode(); wysiwyg.loadData( wysiwyg.getData() ); } }); // IE>=8 stricts mode doesn't have 'contentEditable' in effect // on element unless it has layout. (#5562) if ( CKEDITOR.document.$.documentMode >= 8 ) { editor.addCss( 'html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}' ); var selectors = []; for ( var tag in CKEDITOR.dtd.$removeEmpty ) selectors.push( 'html.CSS1Compat ' + tag + '[contenteditable=false]' ); editor.addCss( selectors.join( ',' ) + '{ display:inline-block;}' ); } // Set the HTML style to 100% to have the text cursor in affect (#6341) else if ( CKEDITOR.env.gecko ) { editor.addCss( 'html { height: 100% !important; }' ); editor.addCss( 'img:-moz-broken { -moz-force-broken-image-icon : 1; width : 24px; height : 24px; }' ); } /* #3658: [IE6] Editor document has horizontal scrollbar on long lines To prevent this misbehavior, we show the scrollbar always */ /* #6341: The text cursor must be set on the editor area. */ /* #6632: Avoid having "text" shape of cursor in IE7 scrollbars.*/ editor.addCss( 'html { _overflow-y: scroll; cursor: text; *cursor:auto;}' ); // Use correct cursor for these elements editor.addCss( 'img, input, textarea { cursor: default;}' ); // Switch on design mode for a short while and close it after then. function blinkCursor( retry ) { if ( editor.readOnly ) return; CKEDITOR.tools.tryThese( function() { editor.document.$.designMode = 'on'; setTimeout( function() { editor.document.$.designMode = 'off'; if ( CKEDITOR.currentInstance == editor ) editor.document.getBody().focus(); }, 50 ); }, function() { // The above call is known to fail when parent DOM // tree layout changes may break design mode. (#5782) // Refresh the 'contentEditable' is a cue to this. editor.document.$.designMode = 'off'; var body = editor.document.getBody(); body.setAttribute( 'contentEditable', false ); body.setAttribute( 'contentEditable', true ); // Try it again once.. !retry && blinkCursor( 1 ); }); } // Create an invisible element to grab focus. if ( CKEDITOR.env.gecko || CKEDITOR.env.ie || CKEDITOR.env.opera ) { var focusGrabber; editor.on( 'uiReady', function() { focusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml( // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049) '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ) ); focusGrabber.on( 'focus', function() { editor.focus(); } ); editor.focusGrabber = focusGrabber; } ); editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( contentDomReadyHandler ); focusGrabber.clearCustomData(); delete editor.focusGrabber; } ); } // Disable form elements editing mode provided by some browers. (#5746) editor.on( 'insertElement', function ( evt ) { var element = evt.data; if ( element.type == CKEDITOR.NODE_ELEMENT && ( element.is( 'input' ) || element.is( 'textarea' ) ) ) { // We should flag that the element was locked by our code so // it'll be editable by the editor functions (#6046). var readonly = element.getAttribute( 'contenteditable' ) == 'false'; if ( !readonly ) { element.data( 'cke-editable', element.hasAttribute( 'contenteditable' ) ? 'true' : '1' ); element.setAttribute( 'contenteditable', false ); } } }); } }); // Fixing Firefox 'Back-Forward Cache' break design mode. (#4514) if ( CKEDITOR.env.gecko ) { (function() { var body = document.body; if ( !body ) window.addEventListener( 'load', arguments.callee, false ); else { var currentHandler = body.getAttribute( 'onpageshow' ); body.setAttribute( 'onpageshow', ( currentHandler ? currentHandler + ';' : '') + 'event.persisted && (function(){' + 'var allInstances = CKEDITOR.instances, editor, doc;' + 'for ( var i in allInstances )' + '{' + ' editor = allInstances[ i ];' + ' doc = editor.document;' + ' if ( doc )' + ' {' + ' doc.$.designMode = "off";' + ' doc.$.designMode = "on";' + ' }' + '}' + '})();' ); } } )(); } })(); /** * Disables the ability of resize objects (image and tables) in the editing * area. * @type Boolean * @default false * @example * config.disableObjectResizing = true; */ CKEDITOR.config.disableObjectResizing = false; /** * Disables the "table tools" offered natively by the browser (currently * Firefox only) to make quick table editing operations, like adding or * deleting rows and columns. * @type Boolean * @default true * @example * config.disableNativeTableHandles = false; */ CKEDITOR.config.disableNativeTableHandles = true; /** * Disables the built-in words spell checker if browser provides one.<br /><br /> * * <strong>Note:</strong> Although word suggestions provided by browsers (natively) will not appear in CKEditor's default context menu, * users can always reach the native context menu by holding the <em>Ctrl</em> key when right-clicking if {@link CKEDITOR.config.browserContextMenuOnCtrl} * is enabled or you're simply not using the context menu plugin. * * @type Boolean * @default true * @example * config.disableNativeSpellChecker = false; */ CKEDITOR.config.disableNativeSpellChecker = true; /** * Whether the editor must output an empty value ("") if it's contents is made * by an empty paragraph only. * @type Boolean * @default true * @example * config.ignoreEmptyParagraph = false; */ CKEDITOR.config.ignoreEmptyParagraph = true; /** * Fired when data is loaded and ready for retrieval in an editor instance. * @name CKEDITOR.editor#dataReady * @event */ /** * Whether automatically create wrapping blocks around inline contents inside document body, * this helps to ensure the integrality of the block enter mode. * <strong>Note:</strong> Changing the default value might introduce unpredictable usability issues. * @name CKEDITOR.config.autoParagraph * @since 3.6 * @type Boolean * @default true * @example * config.autoParagraph = false; */ /** * Fired when some elements are added to the document * @name CKEDITOR.editor#ariaWidget * @event * @param {Object} element The element being added */
zysms
trunk/zysms/include/ckeditor/_source/plugins/wysiwygarea/plugin.js
JavaScript
asf20
43,412
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { CKEDITOR.plugins.add( 'stylescombo', { requires : [ 'richcombo', 'styles' ], init : function( editor ) { var config = editor.config, lang = editor.lang.stylesCombo, styles = {}, stylesList = [], combo; function loadStylesSet( callback ) { editor.getStylesSet( function( stylesDefinitions ) { if ( !stylesList.length ) { var style, styleName; // Put all styles into an Array. for ( var i = 0, count = stylesDefinitions.length ; i < count ; i++ ) { var styleDefinition = stylesDefinitions[ i ]; styleName = styleDefinition.name; style = styles[ styleName ] = new CKEDITOR.style( styleDefinition ); style._name = styleName; style._.enterMode = config.enterMode; stylesList.push( style ); } // Sorts the Array, so the styles get grouped by type. stylesList.sort( sortStyles ); } callback && callback(); }); } editor.ui.addRichCombo( 'Styles', { label : lang.label, title : lang.panelTitle, className : 'cke_styles', panel : { css : editor.skin.editor.css.concat( config.contentsCss ), multiSelect : true, attributes : { 'aria-label' : lang.panelTitle } }, init : function() { combo = this; loadStylesSet( function() { var style, styleName, lastType, type, i, count; // Loop over the Array, adding all items to the // combo. for ( i = 0, count = stylesList.length ; i < count ; i++ ) { style = stylesList[ i ]; styleName = style._name; type = style.type; if ( type != lastType ) { combo.startGroup( lang[ 'panelTitle' + String( type ) ] ); lastType = type; } combo.add( styleName, style.type == CKEDITOR.STYLE_OBJECT ? styleName : style.buildPreview(), styleName ); } combo.commit(); }); }, onClick : function( value ) { editor.focus(); editor.fire( 'saveSnapshot' ); var style = styles[ value ], selection = editor.getSelection(), elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() ); style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document ); editor.fire( 'saveSnapshot' ); }, onRender : function() { editor.on( 'selectionChange', function( ev ) { var currentValue = this.getValue(), elementPath = ev.data.path, elements = elementPath.elements; // For each element into the elements path. for ( var i = 0, count = elements.length, element ; i < count ; i++ ) { element = elements[i]; // Check if the element is removable by any of // the styles. for ( var value in styles ) { if ( styles[ value ].checkElementRemovable( element, true ) ) { if ( value != currentValue ) this.setValue( value ); return; } } } // If no styles match, just empty it. this.setValue( '' ); }, this); }, onOpen : function() { if ( CKEDITOR.env.ie || CKEDITOR.env.webkit ) editor.focus(); var selection = editor.getSelection(), element = selection.getSelectedElement(), elementPath = new CKEDITOR.dom.elementPath( element || selection.getStartElement() ), counter = [ 0, 0, 0, 0 ]; this.showAll(); this.unmarkAll(); for ( var name in styles ) { var style = styles[ name ], type = style.type; if ( style.checkActive( elementPath ) ) this.mark( name ); else if ( type == CKEDITOR.STYLE_OBJECT && !style.checkApplicable( elementPath ) ) { this.hideItem( name ); counter[ type ]--; } counter[ type ]++; } if ( !counter[ CKEDITOR.STYLE_BLOCK ] ) this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_BLOCK ) ] ); if ( !counter[ CKEDITOR.STYLE_INLINE ] ) this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_INLINE ) ] ); if ( !counter[ CKEDITOR.STYLE_OBJECT ] ) this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_OBJECT ) ] ); }, // Force a reload of the data reset: function() { if ( combo ) { delete combo._.panel; delete combo._.list; combo._.committed = 0; combo._.items = {}; combo._.state = CKEDITOR.TRISTATE_OFF; } styles = {}; stylesList = []; loadStylesSet(); } }); editor.on( 'instanceReady', function() { loadStylesSet(); } ); } }); function sortStyles( styleA, styleB ) { var typeA = styleA.type, typeB = styleB.type; return typeA == typeB ? 0 : typeA == CKEDITOR.STYLE_OBJECT ? -1 : typeB == CKEDITOR.STYLE_OBJECT ? 1 : typeB == CKEDITOR.STYLE_BLOCK ? 1 : -1; } })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/stylescombo/plugin.js
JavaScript
asf20
5,515
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'find', { init : function( editor ) { var forms = CKEDITOR.plugins.find; editor.ui.addButton( 'Find', { label : editor.lang.findAndReplace.find, command : 'find' }); var findCommand = editor.addCommand( 'find', new CKEDITOR.dialogCommand( 'find' ) ); findCommand.canUndo = false; findCommand.readOnly = 1; editor.ui.addButton( 'Replace', { label : editor.lang.findAndReplace.replace, command : 'replace' }); var replaceCommand = editor.addCommand( 'replace', new CKEDITOR.dialogCommand( 'replace' ) ); replaceCommand.canUndo = false; CKEDITOR.dialog.add( 'find', this.path + 'dialogs/find.js' ); CKEDITOR.dialog.add( 'replace', this.path + 'dialogs/find.js' ); }, requires : [ 'styles' ] } ); /** * Defines the style to be used to highlight results with the find dialog. * @type Object * @default { element : 'span', styles : { 'background-color' : '#004', 'color' : '#fff' } } * @example * // Highlight search results with blue on yellow. * config.find_highlight = * { * element : 'span', * styles : { 'background-color' : '#ff0', 'color' : '#00f' } * }; */ CKEDITOR.config.find_highlight = { element : 'span', styles : { 'background-color' : '#004', 'color' : '#fff' } };
zysms
trunk/zysms/include/ckeditor/_source/plugins/find/plugin.js
JavaScript
asf20
1,483
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var isReplace; function findEvaluator( node ) { return node.type == CKEDITOR.NODE_TEXT && node.getLength() > 0 && ( !isReplace || !node.isReadOnly() ); } /** * Elements which break characters been considered as sequence. */ function nonCharactersBoundary( node ) { return !( node.type == CKEDITOR.NODE_ELEMENT && node.isBlockBoundary( CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$empty, CKEDITOR.dtd.$nonEditable ) ) ); } /** * Get the cursor object which represent both current character and it's dom * position thing. */ var cursorStep = function() { return { textNode : this.textNode, offset : this.offset, character : this.textNode ? this.textNode.getText().charAt( this.offset ) : null, hitMatchBoundary : this._.matchBoundary }; }; var pages = [ 'find', 'replace' ], fieldsMapping = [ [ 'txtFindFind', 'txtFindReplace' ], [ 'txtFindCaseChk', 'txtReplaceCaseChk' ], [ 'txtFindWordChk', 'txtReplaceWordChk' ], [ 'txtFindCyclic', 'txtReplaceCyclic' ] ]; /** * Synchronize corresponding filed values between 'replace' and 'find' pages. * @param {String} currentPageId The page id which receive values. */ function syncFieldsBetweenTabs( currentPageId ) { var sourceIndex, targetIndex, sourceField, targetField; sourceIndex = currentPageId === 'find' ? 1 : 0; targetIndex = 1 - sourceIndex; var i, l = fieldsMapping.length; for ( i = 0 ; i < l ; i++ ) { sourceField = this.getContentElement( pages[ sourceIndex ], fieldsMapping[ i ][ sourceIndex ] ); targetField = this.getContentElement( pages[ targetIndex ], fieldsMapping[ i ][ targetIndex ] ); targetField.setValue( sourceField.getValue() ); } } var findDialog = function( editor, startupPage ) { // Style object for highlights: (#5018) // 1. Defined as full match style to avoid compromising ordinary text color styles. // 2. Must be apply onto inner-most text to avoid conflicting with ordinary text color styles visually. var highlightStyle = new CKEDITOR.style( CKEDITOR.tools.extend( { attributes : { 'data-cke-highlight': 1 }, fullMatch : 1, ignoreReadonly : 1, childRule : function(){ return 0; } }, editor.config.find_highlight, true ) ); /** * Iterator which walk through the specified range char by char. By * default the walking will not stop at the character boundaries, until * the end of the range is encountered. * @param { CKEDITOR.dom.range } range * @param {Boolean} matchWord Whether the walking will stop at character boundary. */ var characterWalker = function( range , matchWord ) { var self = this; var walker = new CKEDITOR.dom.walker( range ); walker.guard = matchWord ? nonCharactersBoundary : function( node ) { !nonCharactersBoundary( node ) && ( self._.matchBoundary = true ); }; walker[ 'evaluator' ] = findEvaluator; walker.breakOnFalse = 1; if ( range.startContainer.type == CKEDITOR.NODE_TEXT ) { this.textNode = range.startContainer; this.offset = range.startOffset - 1; } this._ = { matchWord : matchWord, walker : walker, matchBoundary : false }; }; characterWalker.prototype = { next : function() { return this.move(); }, back : function() { return this.move( true ); }, move : function( rtl ) { var currentTextNode = this.textNode; // Already at the end of document, no more character available. if ( currentTextNode === null ) return cursorStep.call( this ); this._.matchBoundary = false; // There are more characters in the text node, step forward. if ( currentTextNode && rtl && this.offset > 0 ) { this.offset--; return cursorStep.call( this ); } else if ( currentTextNode && this.offset < currentTextNode.getLength() - 1 ) { this.offset++; return cursorStep.call( this ); } else { currentTextNode = null; // At the end of the text node, walking foward for the next. while ( !currentTextNode ) { currentTextNode = this._.walker[ rtl ? 'previous' : 'next' ].call( this._.walker ); // Stop searching if we're need full word match OR // already reach document end. if ( this._.matchWord && !currentTextNode || this._.walker._.end ) break; } // Found a fresh text node. this.textNode = currentTextNode; if ( currentTextNode ) this.offset = rtl ? currentTextNode.getLength() - 1 : 0; else this.offset = 0; } return cursorStep.call( this ); } }; /** * A range of cursors which represent a trunk of characters which try to * match, it has the same length as the pattern string. */ var characterRange = function( characterWalker, rangeLength ) { this._ = { walker : characterWalker, cursors : [], rangeLength : rangeLength, highlightRange : null, isMatched : 0 }; }; characterRange.prototype = { /** * Translate this range to {@link CKEDITOR.dom.range} */ toDomRange : function() { var range = new CKEDITOR.dom.range( editor.document ); var cursors = this._.cursors; if ( cursors.length < 1 ) { var textNode = this._.walker.textNode; if ( textNode ) range.setStartAfter( textNode ); else return null; } else { var first = cursors[0], last = cursors[ cursors.length - 1 ]; range.setStart( first.textNode, first.offset ); range.setEnd( last.textNode, last.offset + 1 ); } return range; }, /** * Reflect the latest changes from dom range. */ updateFromDomRange : function( domRange ) { var cursor, walker = new characterWalker( domRange ); this._.cursors = []; do { cursor = walker.next(); if ( cursor.character ) this._.cursors.push( cursor ); } while ( cursor.character ); this._.rangeLength = this._.cursors.length; }, setMatched : function() { this._.isMatched = true; }, clearMatched : function() { this._.isMatched = false; }, isMatched : function() { return this._.isMatched; }, /** * Hightlight the current matched chunk of text. */ highlight : function() { // Do not apply if nothing is found. if ( this._.cursors.length < 1 ) return; // Remove the previous highlight if there's one. if ( this._.highlightRange ) this.removeHighlight(); // Apply the highlight. var range = this.toDomRange(), bookmark = range.createBookmark(); highlightStyle.applyToRange( range ); range.moveToBookmark( bookmark ); this._.highlightRange = range; // Scroll the editor to the highlighted area. var element = range.startContainer; if ( element.type != CKEDITOR.NODE_ELEMENT ) element = element.getParent(); element.scrollIntoView(); // Update the character cursors. this.updateFromDomRange( range ); }, /** * Remove highlighted find result. */ removeHighlight : function() { if ( !this._.highlightRange ) return; var bookmark = this._.highlightRange.createBookmark(); highlightStyle.removeFromRange( this._.highlightRange ); this._.highlightRange.moveToBookmark( bookmark ); this.updateFromDomRange( this._.highlightRange ); this._.highlightRange = null; }, isReadOnly : function() { if ( !this._.highlightRange ) return 0; return this._.highlightRange.startContainer.isReadOnly(); }, moveBack : function() { var retval = this._.walker.back(), cursors = this._.cursors; if ( retval.hitMatchBoundary ) this._.cursors = cursors = []; cursors.unshift( retval ); if ( cursors.length > this._.rangeLength ) cursors.pop(); return retval; }, moveNext : function() { var retval = this._.walker.next(), cursors = this._.cursors; // Clear the cursors queue if we've crossed a match boundary. if ( retval.hitMatchBoundary ) this._.cursors = cursors = []; cursors.push( retval ); if ( cursors.length > this._.rangeLength ) cursors.shift(); return retval; }, getEndCharacter : function() { var cursors = this._.cursors; if ( cursors.length < 1 ) return null; return cursors[ cursors.length - 1 ].character; }, getNextCharacterRange : function( maxLength ) { var lastCursor, nextRangeWalker, cursors = this._.cursors; if ( ( lastCursor = cursors[ cursors.length - 1 ] ) && lastCursor.textNode ) nextRangeWalker = new characterWalker( getRangeAfterCursor( lastCursor ) ); // In case it's an empty range (no cursors), figure out next range from walker (#4951). else nextRangeWalker = this._.walker; return new characterRange( nextRangeWalker, maxLength ); }, getCursors : function() { return this._.cursors; } }; // The remaining document range after the character cursor. function getRangeAfterCursor( cursor , inclusive ) { var range = new CKEDITOR.dom.range(); range.setStart( cursor.textNode, ( inclusive ? cursor.offset : cursor.offset + 1 ) ); range.setEndAt( editor.document.getBody(), CKEDITOR.POSITION_BEFORE_END ); return range; } // The document range before the character cursor. function getRangeBeforeCursor( cursor ) { var range = new CKEDITOR.dom.range(); range.setStartAt( editor.document.getBody(), CKEDITOR.POSITION_AFTER_START ); range.setEnd( cursor.textNode, cursor.offset ); return range; } var KMP_NOMATCH = 0, KMP_ADVANCED = 1, KMP_MATCHED = 2; /** * Examination the occurrence of a word which implement KMP algorithm. */ var kmpMatcher = function( pattern, ignoreCase ) { var overlap = [ -1 ]; if ( ignoreCase ) pattern = pattern.toLowerCase(); for ( var i = 0 ; i < pattern.length ; i++ ) { overlap.push( overlap[i] + 1 ); while ( overlap[ i + 1 ] > 0 && pattern.charAt( i ) != pattern .charAt( overlap[ i + 1 ] - 1 ) ) overlap[ i + 1 ] = overlap[ overlap[ i + 1 ] - 1 ] + 1; } this._ = { overlap : overlap, state : 0, ignoreCase : !!ignoreCase, pattern : pattern }; }; kmpMatcher.prototype = { feedCharacter : function( c ) { if ( this._.ignoreCase ) c = c.toLowerCase(); while ( true ) { if ( c == this._.pattern.charAt( this._.state ) ) { this._.state++; if ( this._.state == this._.pattern.length ) { this._.state = 0; return KMP_MATCHED; } return KMP_ADVANCED; } else if ( !this._.state ) return KMP_NOMATCH; else this._.state = this._.overlap[ this._.state ]; } return null; }, reset : function() { this._.state = 0; } }; var wordSeparatorRegex = /[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/; var isWordSeparator = function( c ) { if ( !c ) return true; var code = c.charCodeAt( 0 ); return ( code >= 9 && code <= 0xd ) || ( code >= 0x2000 && code <= 0x200a ) || wordSeparatorRegex.test( c ); }; var finder = { searchRange : null, matchRange : null, find : function( pattern, matchCase, matchWord, matchCyclic, highlightMatched, cyclicRerun ) { if ( !this.matchRange ) this.matchRange = new characterRange( new characterWalker( this.searchRange ), pattern.length ); else { this.matchRange.removeHighlight(); this.matchRange = this.matchRange.getNextCharacterRange( pattern.length ); } var matcher = new kmpMatcher( pattern, !matchCase ), matchState = KMP_NOMATCH, character = '%'; while ( character !== null ) { this.matchRange.moveNext(); while ( ( character = this.matchRange.getEndCharacter() ) ) { matchState = matcher.feedCharacter( character ); if ( matchState == KMP_MATCHED ) break; if ( this.matchRange.moveNext().hitMatchBoundary ) matcher.reset(); } if ( matchState == KMP_MATCHED ) { if ( matchWord ) { var cursors = this.matchRange.getCursors(), tail = cursors[ cursors.length - 1 ], head = cursors[ 0 ]; var headWalker = new characterWalker( getRangeBeforeCursor( head ), true ), tailWalker = new characterWalker( getRangeAfterCursor( tail ), true ); if ( ! ( isWordSeparator( headWalker.back().character ) && isWordSeparator( tailWalker.next().character ) ) ) continue; } this.matchRange.setMatched(); if ( highlightMatched !== false ) this.matchRange.highlight(); return true; } } this.matchRange.clearMatched(); this.matchRange.removeHighlight(); // Clear current session and restart with the default search // range. // Re-run the finding once for cyclic.(#3517) if ( matchCyclic && !cyclicRerun ) { this.searchRange = getSearchRange( 1 ); this.matchRange = null; return arguments.callee.apply( this, Array.prototype.slice.call( arguments ).concat( [ true ] ) ); } return false; }, /** * Record how much replacement occurred toward one replacing. */ replaceCounter : 0, replace : function( dialog, pattern, newString, matchCase, matchWord, matchCyclic , isReplaceAll ) { isReplace = 1; // Successiveness of current replace/find. var result = 0; // 1. Perform the replace when there's already a match here. // 2. Otherwise perform the find but don't replace it immediately. if ( this.matchRange && this.matchRange.isMatched() && !this.matchRange._.isReplaced && !this.matchRange.isReadOnly() ) { // Turn off highlight for a while when saving snapshots. this.matchRange.removeHighlight(); var domRange = this.matchRange.toDomRange(); var text = editor.document.createText( newString ); if ( !isReplaceAll ) { // Save undo snaps before and after the replacement. var selection = editor.getSelection(); selection.selectRanges( [ domRange ] ); editor.fire( 'saveSnapshot' ); } domRange.deleteContents(); domRange.insertNode( text ); if ( !isReplaceAll ) { selection.selectRanges( [ domRange ] ); editor.fire( 'saveSnapshot' ); } this.matchRange.updateFromDomRange( domRange ); if ( !isReplaceAll ) this.matchRange.highlight(); this.matchRange._.isReplaced = true; this.replaceCounter++; result = 1; } else result = this.find( pattern, matchCase, matchWord, matchCyclic, !isReplaceAll ); isReplace = 0; return result; } }; /** * The range in which find/replace happened, receive from user * selection prior. */ function getSearchRange( isDefault ) { var searchRange, sel = editor.getSelection(), body = editor.document.getBody(); if ( sel && !isDefault ) { searchRange = sel.getRanges()[ 0 ].clone(); searchRange.collapse( true ); } else { searchRange = new CKEDITOR.dom.range(); searchRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START ); } searchRange.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); return searchRange; } var lang = editor.lang.findAndReplace; return { title : lang.title, resizable : CKEDITOR.DIALOG_RESIZE_NONE, minWidth : 350, minHeight : 170, buttons : [ CKEDITOR.dialog.cancelButton ], // Cancel button only. contents : [ { id : 'find', label : lang.find, title : lang.find, accessKey : '', elements : [ { type : 'hbox', widths : [ '230px', '90px' ], children : [ { type : 'text', id : 'txtFindFind', label : lang.findWhat, isChanged : false, labelLayout : 'horizontal', accessKey : 'F' }, { type : 'button', id : 'btnFind', align : 'left', style : 'width:100%', label : lang.find, onClick : function() { var dialog = this.getDialog(); if ( !finder.find( dialog.getValueOf( 'find', 'txtFindFind' ), dialog.getValueOf( 'find', 'txtFindCaseChk' ), dialog.getValueOf( 'find', 'txtFindWordChk' ), dialog.getValueOf( 'find', 'txtFindCyclic' ) ) ) alert( lang .notFoundMsg ); } } ] }, { type : 'fieldset', label : CKEDITOR.tools.htmlEncode( lang.findOptions ), style : 'margin-top:29px', children : [ { type : 'vbox', padding : 0, children : [ { type : 'checkbox', id : 'txtFindCaseChk', isChanged : false, label : lang.matchCase }, { type : 'checkbox', id : 'txtFindWordChk', isChanged : false, label : lang.matchWord }, { type : 'checkbox', id : 'txtFindCyclic', isChanged : false, 'default' : true, label : lang.matchCyclic } ] } ] } ] }, { id : 'replace', label : lang.replace, accessKey : 'M', elements : [ { type : 'hbox', widths : [ '230px', '90px' ], children : [ { type : 'text', id : 'txtFindReplace', label : lang.findWhat, isChanged : false, labelLayout : 'horizontal', accessKey : 'F' }, { type : 'button', id : 'btnFindReplace', align : 'left', style : 'width:100%', label : lang.replace, onClick : function() { var dialog = this.getDialog(); if ( !finder.replace( dialog, dialog.getValueOf( 'replace', 'txtFindReplace' ), dialog.getValueOf( 'replace', 'txtReplace' ), dialog.getValueOf( 'replace', 'txtReplaceCaseChk' ), dialog.getValueOf( 'replace', 'txtReplaceWordChk' ), dialog.getValueOf( 'replace', 'txtReplaceCyclic' ) ) ) alert( lang .notFoundMsg ); } } ] }, { type : 'hbox', widths : [ '230px', '90px' ], children : [ { type : 'text', id : 'txtReplace', label : lang.replaceWith, isChanged : false, labelLayout : 'horizontal', accessKey : 'R' }, { type : 'button', id : 'btnReplaceAll', align : 'left', style : 'width:100%', label : lang.replaceAll, isChanged : false, onClick : function() { var dialog = this.getDialog(); var replaceNums; finder.replaceCounter = 0; // Scope to full document. finder.searchRange = getSearchRange( 1 ); if ( finder.matchRange ) { finder.matchRange.removeHighlight(); finder.matchRange = null; } editor.fire( 'saveSnapshot' ); while ( finder.replace( dialog, dialog.getValueOf( 'replace', 'txtFindReplace' ), dialog.getValueOf( 'replace', 'txtReplace' ), dialog.getValueOf( 'replace', 'txtReplaceCaseChk' ), dialog.getValueOf( 'replace', 'txtReplaceWordChk' ), false, true ) ) { /*jsl:pass*/ } if ( finder.replaceCounter ) { alert( lang.replaceSuccessMsg.replace( /%1/, finder.replaceCounter ) ); editor.fire( 'saveSnapshot' ); } else alert( lang.notFoundMsg ); } } ] }, { type : 'fieldset', label : CKEDITOR.tools.htmlEncode( lang.findOptions ), children : [ { type : 'vbox', padding : 0, children : [ { type : 'checkbox', id : 'txtReplaceCaseChk', isChanged : false, label : lang.matchCase }, { type : 'checkbox', id : 'txtReplaceWordChk', isChanged : false, label : lang.matchWord }, { type : 'checkbox', id : 'txtReplaceCyclic', isChanged : false, 'default' : true, label : lang.matchCyclic } ] } ] } ] } ], onLoad : function() { var dialog = this; // Keep track of the current pattern field in use. var patternField, wholeWordChkField; // Ignore initial page select on dialog show var isUserSelect = 0; this.on( 'hide', function() { isUserSelect = 0; }); this.on( 'show', function() { isUserSelect = 1; }); this.selectPage = CKEDITOR.tools.override( this.selectPage, function( originalFunc ) { return function( pageId ) { originalFunc.call( dialog, pageId ); var currPage = dialog._.tabs[ pageId ]; var patternFieldInput, patternFieldId, wholeWordChkFieldId; patternFieldId = pageId === 'find' ? 'txtFindFind' : 'txtFindReplace'; wholeWordChkFieldId = pageId === 'find' ? 'txtFindWordChk' : 'txtReplaceWordChk'; patternField = dialog.getContentElement( pageId, patternFieldId ); wholeWordChkField = dialog.getContentElement( pageId, wholeWordChkFieldId ); // Prepare for check pattern text filed 'keyup' event if ( !currPage.initialized ) { patternFieldInput = CKEDITOR.document .getById( patternField._.inputId ); currPage.initialized = true; } // Synchronize fields on tab switch. if ( isUserSelect ) syncFieldsBetweenTabs.call( this, pageId ); }; } ); }, onShow : function() { // Establish initial searching start position. finder.searchRange = getSearchRange(); // Fill in the find field with selected text. var selectedText = this.getParentEditor().getSelection().getSelectedText(), patternFieldId = ( startupPage == 'find' ? 'txtFindFind' : 'txtFindReplace' ); var field = this.getContentElement( startupPage, patternFieldId ); field.setValue( selectedText ); field.select(); this.selectPage( startupPage ); this[ ( startupPage == 'find' && this._.editor.readOnly? 'hide' : 'show' ) + 'Page' ]( 'replace'); }, onHide : function() { var range; if ( finder.matchRange && finder.matchRange.isMatched() ) { finder.matchRange.removeHighlight(); editor.focus(); range = finder.matchRange.toDomRange(); if ( range ) editor.getSelection().selectRanges( [ range ] ); } // Clear current session before dialog close delete finder.matchRange; }, onFocus : function() { if ( startupPage == 'replace' ) return this.getContentElement( 'replace', 'txtFindReplace' ); else return this.getContentElement( 'find', 'txtFindFind' ); } }; }; CKEDITOR.dialog.add( 'find', function( editor ) { return findDialog( editor, 'find' ); }); CKEDITOR.dialog.add( 'replace', function( editor ) { return findDialog( editor, 'replace' ); }); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/find/dialogs/find.js
JavaScript
asf20
24,690
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'htmlwriter' ); /** * Class used to write HTML data. * @constructor * @example * var writer = new CKEDITOR.htmlWriter(); * writer.openTag( 'p' ); * writer.attribute( 'class', 'MyClass' ); * writer.openTagClose( 'p' ); * writer.text( 'Hello' ); * writer.closeTag( 'p' ); * alert( writer.getHtml() ); "&lt;p class="MyClass"&gt;Hello&lt;/p&gt;" */ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( { base : CKEDITOR.htmlParser.basicWriter, $ : function() { // Call the base contructor. this.base(); /** * The characters to be used for each identation step. * @type String * @default "\t" (tab) * @example * // Use two spaces for indentation. * editorInstance.dataProcessor.writer.indentationChars = ' '; */ this.indentationChars = '\t'; /** * The characters to be used to close "self-closing" elements, like "br" or * "img". * @type String * @default " /&gt;" * @example * // Use HTML4 notation for self-closing elements. * editorInstance.dataProcessor.writer.selfClosingEnd = '>'; */ this.selfClosingEnd = ' />'; /** * The characters to be used for line breaks. * @type String * @default "\n" (LF) * @example * // Use CRLF for line breaks. * editorInstance.dataProcessor.writer.lineBreakChars = '\r\n'; */ this.lineBreakChars = '\n'; this.forceSimpleAmpersand = 0; this.sortAttributes = 1; this._.indent = 0; this._.indentation = ''; // Indicate preformatted block context status. (#5789) this._.inPre = 0; this._.rules = {}; var dtd = CKEDITOR.dtd; for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { this.setRules( e, { indent : 1, breakBeforeOpen : 1, breakAfterOpen : 1, breakBeforeClose : !dtd[ e ][ '#' ], breakAfterClose : 1 }); } this.setRules( 'br', { breakAfterOpen : 1 }); this.setRules( 'title', { indent : 0, breakAfterOpen : 0 }); this.setRules( 'style', { indent : 0, breakBeforeClose : 1 }); // Disable indentation on <pre>. this.setRules( 'pre', { indent : 0 }); }, proto : { /** * Writes the tag opening part for a opener tag. * @param {String} tagName The element name for this tag. * @param {Object} attributes The attributes defined for this tag. The * attributes could be used to inspect the tag. * @example * // Writes "&lt;p". * writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } ); */ openTag : function( tagName, attributes ) { var rules = this._.rules[ tagName ]; if ( this._.indent ) this.indentation(); // Do not break if indenting. else if ( rules && rules.breakBeforeOpen ) { this.lineBreak(); this.indentation(); } this._.output.push( '<', tagName ); }, /** * Writes the tag closing part for a opener tag. * @param {String} tagName The element name for this tag. * @param {Boolean} isSelfClose Indicates that this is a self-closing tag, * like "br" or "img". * @example * // Writes "&gt;". * writer.openTagClose( 'p', false ); * @example * // Writes " /&gt;". * writer.openTagClose( 'br', true ); */ openTagClose : function( tagName, isSelfClose ) { var rules = this._.rules[ tagName ]; if ( isSelfClose ) this._.output.push( this.selfClosingEnd ); else { this._.output.push( '>' ); if ( rules && rules.indent ) this._.indentation += this.indentationChars; } if ( rules && rules.breakAfterOpen ) this.lineBreak(); tagName == 'pre' && ( this._.inPre = 1 ); }, /** * Writes an attribute. This function should be called after opening the * tag with {@link #openTagClose}. * @param {String} attName The attribute name. * @param {String} attValue The attribute value. * @example * // Writes ' class="MyClass"'. * writer.attribute( 'class', 'MyClass' ); */ attribute : function( attName, attValue ) { if ( typeof attValue == 'string' ) { this.forceSimpleAmpersand && ( attValue = attValue.replace( /&amp;/g, '&' ) ); // Browsers don't always escape special character in attribute values. (#4683, #4719). attValue = CKEDITOR.tools.htmlEncodeAttr( attValue ); } this._.output.push( ' ', attName, '="', attValue, '"' ); }, /** * Writes a closer tag. * @param {String} tagName The element name for this tag. * @example * // Writes "&lt;/p&gt;". * writer.closeTag( 'p' ); */ closeTag : function( tagName ) { var rules = this._.rules[ tagName ]; if ( rules && rules.indent ) this._.indentation = this._.indentation.substr( this.indentationChars.length ); if ( this._.indent ) this.indentation(); // Do not break if indenting. else if ( rules && rules.breakBeforeClose ) { this.lineBreak(); this.indentation(); } this._.output.push( '</', tagName, '>' ); tagName == 'pre' && ( this._.inPre = 0 ); if ( rules && rules.breakAfterClose ) this.lineBreak(); }, /** * Writes text. * @param {String} text The text value * @example * // Writes "Hello Word". * writer.text( 'Hello Word' ); */ text : function( text ) { if ( this._.indent ) { this.indentation(); !this._.inPre && ( text = CKEDITOR.tools.ltrim( text ) ); } this._.output.push( text ); }, /** * Writes a comment. * @param {String} comment The comment text. * @example * // Writes "&lt;!-- My comment --&gt;". * writer.comment( ' My comment ' ); */ comment : function( comment ) { if ( this._.indent ) this.indentation(); this._.output.push( '<!--', comment, '-->' ); }, /** * Writes a line break. It uses the {@link #lineBreakChars} property for it. * @example * // Writes "\n" (e.g.). * writer.lineBreak(); */ lineBreak : function() { if ( !this._.inPre && this._.output.length > 0 ) this._.output.push( this.lineBreakChars ); this._.indent = 1; }, /** * Writes the current indentation chars. It uses the * {@link #indentationChars} property, repeating it for the current * indentation steps. * @example * // Writes "\t" (e.g.). * writer.indentation(); */ indentation : function() { if( !this._.inPre ) this._.output.push( this._.indentation ); this._.indent = 0; }, /** * Sets formatting rules for a give element. The possible rules are: * <ul> * <li><b>indent</b>: indent the element contents.</li> * <li><b>breakBeforeOpen</b>: break line before the opener tag for this element.</li> * <li><b>breakAfterOpen</b>: break line after the opener tag for this element.</li> * <li><b>breakBeforeClose</b>: break line before the closer tag for this element.</li> * <li><b>breakAfterClose</b>: break line after the closer tag for this element.</li> * </ul> * * All rules default to "false". Each call to the function overrides * already present rules, leaving the undefined untouched. * * By default, all elements available in the {@link CKEDITOR.dtd.$block), * {@link CKEDITOR.dtd.$listItem} and {@link CKEDITOR.dtd.$tableContent} * lists have all the above rules set to "true". Additionaly, the "br" * element has the "breakAfterOpen" set to "true". * @param {String} tagName The element name to which set the rules. * @param {Object} rules An object containing the element rules. * @example * // Break line before and after "img" tags. * writer.setRules( 'img', * { * breakBeforeOpen : true * breakAfterOpen : true * }); * @example * // Reset the rules for the "h1" tag. * writer.setRules( 'h1', {} ); */ setRules : function( tagName, rules ) { var currentRules = this._.rules[ tagName ]; if ( currentRules ) CKEDITOR.tools.extend( currentRules, rules, true ); else this._.rules[ tagName ] = rules; } } });
zysms
trunk/zysms/include/ckeditor/_source/plugins/htmlwriter/plugin.js
JavaScript
asf20
8,463
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview Undo/Redo system for saving shapshot for document modification * and other recordable changes. */ (function() { CKEDITOR.plugins.add( 'undo', { requires : [ 'selection', 'wysiwygarea' ], init : function( editor ) { var undoManager = new UndoManager( editor ); var undoCommand = editor.addCommand( 'undo', { exec : function() { if ( undoManager.undo() ) { editor.selectionChange(); this.fire( 'afterUndo' ); } }, state : CKEDITOR.TRISTATE_DISABLED, canUndo : false }); var redoCommand = editor.addCommand( 'redo', { exec : function() { if ( undoManager.redo() ) { editor.selectionChange(); this.fire( 'afterRedo' ); } }, state : CKEDITOR.TRISTATE_DISABLED, canUndo : false }); undoManager.onChange = function() { undoCommand.setState( undoManager.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); redoCommand.setState( undoManager.redoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); }; function recordCommand( event ) { // If the command hasn't been marked to not support undo. if ( undoManager.enabled && event.data.command.canUndo !== false ) undoManager.save(); } // We'll save snapshots before and after executing a command. editor.on( 'beforeCommandExec', recordCommand ); editor.on( 'afterCommandExec', recordCommand ); // Save snapshots before doing custom changes. editor.on( 'saveSnapshot', function( evt ) { undoManager.save( evt.data && evt.data.contentOnly ); }); // Registering keydown on every document recreation.(#3844) editor.on( 'contentDom', function() { editor.document.on( 'keydown', function( event ) { // Do not capture CTRL hotkeys. if ( !event.data.$.ctrlKey && !event.data.$.metaKey ) undoManager.type( event ); }); }); // Always save an undo snapshot - the previous mode might have // changed editor contents. editor.on( 'beforeModeUnload', function() { editor.mode == 'wysiwyg' && undoManager.save( true ); }); // Make the undo manager available only in wysiwyg mode. editor.on( 'mode', function() { undoManager.enabled = editor.readOnly ? false : editor.mode == 'wysiwyg'; undoManager.onChange(); }); editor.ui.addButton( 'Undo', { label : editor.lang.undo, command : 'undo' }); editor.ui.addButton( 'Redo', { label : editor.lang.redo, command : 'redo' }); editor.resetUndo = function() { // Reset the undo stack. undoManager.reset(); // Create the first image. editor.fire( 'saveSnapshot' ); }; /** * Amend the top of undo stack (last undo image) with the current DOM changes. * @name CKEDITOR.editor#updateUndo * @example * function() * { * editor.fire( 'saveSnapshot' ); * editor.document.body.append(...); * // Make new changes following the last undo snapshot part of it. * editor.fire( 'updateSnapshot' ); * ... * } */ editor.on( 'updateSnapshot', function() { if ( undoManager.currentImage ) undoManager.update(); }); } }); CKEDITOR.plugins.undo = {}; /** * Undo snapshot which represents the current document status. * @name CKEDITOR.plugins.undo.Image * @param editor The editor instance on which the image is created. */ var Image = CKEDITOR.plugins.undo.Image = function( editor ) { this.editor = editor; editor.fire( 'beforeUndoImage' ); var contents = editor.getSnapshot(), selection = contents && editor.getSelection(); // In IE, we need to remove the expando attributes. CKEDITOR.env.ie && contents && ( contents = contents.replace( /\s+data-cke-expando=".*?"/g, '' ) ); this.contents = contents; this.bookmarks = selection && selection.createBookmarks2( true ); editor.fire( 'afterUndoImage' ); }; // Attributes that browser may changing them when setting via innerHTML. var protectedAttrs = /\b(?:href|src|name)="[^"]*?"/gi; Image.prototype = { equals : function( otherImage, contentOnly ) { var thisContents = this.contents, otherContents = otherImage.contents; // For IE6/7 : Comparing only the protected attribute values but not the original ones.(#4522) if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ) { thisContents = thisContents.replace( protectedAttrs, '' ); otherContents = otherContents.replace( protectedAttrs, '' ); } if ( thisContents != otherContents ) return false; if ( contentOnly ) return true; var bookmarksA = this.bookmarks, bookmarksB = otherImage.bookmarks; if ( bookmarksA || bookmarksB ) { if ( !bookmarksA || !bookmarksB || bookmarksA.length != bookmarksB.length ) return false; for ( var i = 0 ; i < bookmarksA.length ; i++ ) { var bookmarkA = bookmarksA[ i ], bookmarkB = bookmarksB[ i ]; if ( bookmarkA.startOffset != bookmarkB.startOffset || bookmarkA.endOffset != bookmarkB.endOffset || !CKEDITOR.tools.arrayCompare( bookmarkA.start, bookmarkB.start ) || !CKEDITOR.tools.arrayCompare( bookmarkA.end, bookmarkB.end ) ) { return false; } } } return true; } }; /** * @constructor Main logic for Redo/Undo feature. */ function UndoManager( editor ) { this.editor = editor; // Reset the undo stack. this.reset(); } var editingKeyCodes = { /*Backspace*/ 8:1, /*Delete*/ 46:1 }, modifierKeyCodes = { /*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1 }, navigationKeyCodes = { 37:1, 38:1, 39:1, 40:1 }; // Arrows: L, T, R, B UndoManager.prototype = { /** * Process undo system regard keystrikes. * @param {CKEDITOR.dom.event} event */ type : function( event ) { var keystroke = event && event.data.getKey(), isModifierKey = keystroke in modifierKeyCodes, isEditingKey = keystroke in editingKeyCodes, wasEditingKey = this.lastKeystroke in editingKeyCodes, sameAsLastEditingKey = isEditingKey && keystroke == this.lastKeystroke, // Keystrokes which navigation through contents. isReset = keystroke in navigationKeyCodes, wasReset = this.lastKeystroke in navigationKeyCodes, // Keystrokes which just introduce new contents. isContent = ( !isEditingKey && !isReset ), // Create undo snap for every different modifier key. modifierSnapshot = ( isEditingKey && !sameAsLastEditingKey ), // Create undo snap on the following cases: // 1. Just start to type . // 2. Typing some content after a modifier. // 3. Typing some content after make a visible selection. startedTyping = !( isModifierKey || this.typing ) || ( isContent && ( wasEditingKey || wasReset ) ); if ( startedTyping || modifierSnapshot ) { var beforeTypeImage = new Image( this.editor ); // Use setTimeout, so we give the necessary time to the // browser to insert the character into the DOM. CKEDITOR.tools.setTimeout( function() { var currentSnapshot = this.editor.getSnapshot(); // In IE, we need to remove the expando attributes. if ( CKEDITOR.env.ie ) currentSnapshot = currentSnapshot.replace( /\s+data-cke-expando=".*?"/g, '' ); if ( beforeTypeImage.contents != currentSnapshot ) { // It's safe to now indicate typing state. this.typing = true; // This's a special save, with specified snapshot // and without auto 'fireChange'. if ( !this.save( false, beforeTypeImage, false ) ) // Drop future snapshots. this.snapshots.splice( this.index + 1, this.snapshots.length - this.index - 1 ); this.hasUndo = true; this.hasRedo = false; this.typesCount = 1; this.modifiersCount = 1; this.onChange(); } }, 0, this ); } this.lastKeystroke = keystroke; // Create undo snap after typed too much (over 25 times). if ( isEditingKey ) { this.typesCount = 0; this.modifiersCount++; if ( this.modifiersCount > 25 ) { this.save( false, null, false ); this.modifiersCount = 1; } } else if ( !isReset ) { this.modifiersCount = 0; this.typesCount++; if ( this.typesCount > 25 ) { this.save( false, null, false ); this.typesCount = 1; } } }, reset : function() // Reset the undo stack. { /** * Remember last pressed key. */ this.lastKeystroke = 0; /** * Stack for all the undo and redo snapshots, they're always created/removed * in consistency. */ this.snapshots = []; /** * Current snapshot history index. */ this.index = -1; this.limit = this.editor.config.undoStackSize || 20; this.currentImage = null; this.hasUndo = false; this.hasRedo = false; this.resetType(); }, /** * Reset all states about typing. * @see UndoManager.type */ resetType : function() { this.typing = false; delete this.lastKeystroke; this.typesCount = 0; this.modifiersCount = 0; }, fireChange : function() { this.hasUndo = !!this.getNextImage( true ); this.hasRedo = !!this.getNextImage( false ); // Reset typing this.resetType(); this.onChange(); }, /** * Save a snapshot of document image for later retrieve. */ save : function( onContentOnly, image, autoFireChange ) { var snapshots = this.snapshots; // Get a content image. if ( !image ) image = new Image( this.editor ); // Do nothing if it was not possible to retrieve an image. if ( image.contents === false ) return false; // Check if this is a duplicate. In such case, do nothing. if ( this.currentImage && image.equals( this.currentImage, onContentOnly ) ) return false; // Drop future snapshots. snapshots.splice( this.index + 1, snapshots.length - this.index - 1 ); // If we have reached the limit, remove the oldest one. if ( snapshots.length == this.limit ) snapshots.shift(); // Add the new image, updating the current index. this.index = snapshots.push( image ) - 1; this.currentImage = image; if ( autoFireChange !== false ) this.fireChange(); return true; }, restoreImage : function( image ) { this.editor.loadSnapshot( image.contents ); if ( image.bookmarks ) this.editor.getSelection().selectBookmarks( image.bookmarks ); else if ( CKEDITOR.env.ie ) { // IE BUG: If I don't set the selection to *somewhere* after setting // document contents, then IE would create an empty paragraph at the bottom // the next time the document is modified. var $range = this.editor.document.getBody().$.createTextRange(); $range.collapse( true ); $range.select(); } this.index = image.index; // Update current image with the actual editor // content, since actualy content may differ from // the original snapshot due to dom change. (#4622) this.update(); this.fireChange(); }, // Get the closest available image. getNextImage : function( isUndo ) { var snapshots = this.snapshots, currentImage = this.currentImage, image, i; if ( currentImage ) { if ( isUndo ) { for ( i = this.index - 1 ; i >= 0 ; i-- ) { image = snapshots[ i ]; if ( !currentImage.equals( image, true ) ) { image.index = i; return image; } } } else { for ( i = this.index + 1 ; i < snapshots.length ; i++ ) { image = snapshots[ i ]; if ( !currentImage.equals( image, true ) ) { image.index = i; return image; } } } } return null; }, /** * Check the current redo state. * @return {Boolean} Whether the document has previous state to * retrieve. */ redoable : function() { return this.enabled && this.hasRedo; }, /** * Check the current undo state. * @return {Boolean} Whether the document has future state to restore. */ undoable : function() { return this.enabled && this.hasUndo; }, /** * Perform undo on current index. */ undo : function() { if ( this.undoable() ) { this.save( true ); var image = this.getNextImage( true ); if ( image ) return this.restoreImage( image ), true; } return false; }, /** * Perform redo on current index. */ redo : function() { if ( this.redoable() ) { // Try to save. If no changes have been made, the redo stack // will not change, so it will still be redoable. this.save( true ); // If instead we had changes, we can't redo anymore. if ( this.redoable() ) { var image = this.getNextImage( false ); if ( image ) return this.restoreImage( image ), true; } } return false; }, /** * Update the last snapshot of the undo stack with the current editor content. */ update : function() { this.snapshots.splice( this.index, 1, ( this.currentImage = new Image( this.editor ) ) ); } }; })(); /** * The number of undo steps to be saved. The higher this setting value the more * memory is used for it. * @name CKEDITOR.config.undoStackSize * @type Number * @default 20 * @example * config.undoStackSize = 50; */ /** * Fired when the editor is about to save an undo snapshot. This event can be * fired by plugins and customizations to make the editor saving undo snapshots. * @name CKEDITOR.editor#saveSnapshot * @event */ /** * Fired before an undo image is to be taken. An undo image represents the * editor state at some point. It's saved into an undo store, so the editor is * able to recover the editor state on undo and redo operations. * @name CKEDITOR.editor#beforeUndoImage * @since 3.5.3 * @see CKEDITOR.editor#afterUndoImage * @event */ /** * Fired after an undo image is taken. An undo image represents the * editor state at some point. It's saved into an undo store, so the editor is * able to recover the editor state on undo and redo operations. * @name CKEDITOR.editor#afterUndoImage * @since 3.5.3 * @see CKEDITOR.editor#beforeUndoImage * @event */
zysms
trunk/zysms/include/ckeditor/_source/plugins/undo/plugin.js
JavaScript
asf20
15,032
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Forms Plugin */ CKEDITOR.plugins.add( 'forms', { init : function( editor ) { var lang = editor.lang; editor.addCss( 'form' + '{' + 'border: 1px dotted #FF0000;' + 'padding: 2px;' + '}\n' ); editor.addCss( 'img.cke_hidden' + '{' + 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/hiddenfield.gif' ) + ');' + 'background-position: center center;' + 'background-repeat: no-repeat;' + 'border: 1px solid #a9a9a9;' + 'width: 16px !important;' + 'height: 16px !important;' + '}' ); // All buttons use the same code to register. So, to avoid // duplications, let's use this tool function. var addButtonCommand = function( buttonName, commandName, dialogFile ) { editor.addCommand( commandName, new CKEDITOR.dialogCommand( commandName ) ); editor.ui.addButton( buttonName, { label : lang.common[ buttonName.charAt(0).toLowerCase() + buttonName.slice(1) ], command : commandName }); CKEDITOR.dialog.add( commandName, dialogFile ); }; var dialogPath = this.path + 'dialogs/'; addButtonCommand( 'Form', 'form', dialogPath + 'form.js' ); addButtonCommand( 'Checkbox', 'checkbox', dialogPath + 'checkbox.js' ); addButtonCommand( 'Radio', 'radio', dialogPath + 'radio.js' ); addButtonCommand( 'TextField', 'textfield', dialogPath + 'textfield.js' ); addButtonCommand( 'Textarea', 'textarea', dialogPath + 'textarea.js' ); addButtonCommand( 'Select', 'select', dialogPath + 'select.js' ); addButtonCommand( 'Button', 'button', dialogPath + 'button.js' ); addButtonCommand( 'ImageButton', 'imagebutton', CKEDITOR.plugins.getPath('image') + 'dialogs/image.js' ); addButtonCommand( 'HiddenField', 'hiddenfield', dialogPath + 'hiddenfield.js' ); // If the "menu" plugin is loaded, register the menu items. if ( editor.addMenuItems ) { editor.addMenuItems( { form : { label : lang.form.menu, command : 'form', group : 'form' }, checkbox : { label : lang.checkboxAndRadio.checkboxTitle, command : 'checkbox', group : 'checkbox' }, radio : { label : lang.checkboxAndRadio.radioTitle, command : 'radio', group : 'radio' }, textfield : { label : lang.textfield.title, command : 'textfield', group : 'textfield' }, hiddenfield : { label : lang.hidden.title, command : 'hiddenfield', group : 'hiddenfield' }, imagebutton : { label : lang.image.titleButton, command : 'imagebutton', group : 'imagebutton' }, button : { label : lang.button.title, command : 'button', group : 'button' }, select : { label : lang.select.title, command : 'select', group : 'select' }, textarea : { label : lang.textarea.title, command : 'textarea', group : 'textarea' } }); } // If the "contextmenu" plugin is loaded, register the listeners. if ( editor.contextMenu ) { editor.contextMenu.addListener( function( element ) { if ( element && element.hasAscendant( 'form', true ) && !element.isReadOnly() ) return { form : CKEDITOR.TRISTATE_OFF }; }); editor.contextMenu.addListener( function( element ) { if ( element && !element.isReadOnly() ) { var name = element.getName(); if ( name == 'select' ) return { select : CKEDITOR.TRISTATE_OFF }; if ( name == 'textarea' ) return { textarea : CKEDITOR.TRISTATE_OFF }; if ( name == 'input' ) { switch( element.getAttribute( 'type' ) ) { case 'button' : case 'submit' : case 'reset' : return { button : CKEDITOR.TRISTATE_OFF }; case 'checkbox' : return { checkbox : CKEDITOR.TRISTATE_OFF }; case 'radio' : return { radio : CKEDITOR.TRISTATE_OFF }; case 'image' : return { imagebutton : CKEDITOR.TRISTATE_OFF }; default : return { textfield : CKEDITOR.TRISTATE_OFF }; } } if ( name == 'img' && element.data( 'cke-real-element-type' ) == 'hiddenfield' ) return { hiddenfield : CKEDITOR.TRISTATE_OFF }; } }); } editor.on( 'doubleclick', function( evt ) { var element = evt.data.element; if ( element.is( 'form' ) ) evt.data.dialog = 'form'; else if ( element.is( 'select' ) ) evt.data.dialog = 'select'; else if ( element.is( 'textarea' ) ) evt.data.dialog = 'textarea'; else if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' ) evt.data.dialog = 'hiddenfield'; else if ( element.is( 'input' ) ) { switch ( element.getAttribute( 'type' ) ) { case 'button' : case 'submit' : case 'reset' : evt.data.dialog = 'button'; break; case 'checkbox' : evt.data.dialog = 'checkbox'; break; case 'radio' : evt.data.dialog = 'radio'; break; case 'image' : evt.data.dialog = 'imagebutton'; break; default : evt.data.dialog = 'textfield'; break; } } }); }, afterInit : function( editor ) { var dataProcessor = editor.dataProcessor, htmlFilter = dataProcessor && dataProcessor.htmlFilter, dataFilter = dataProcessor && dataProcessor.dataFilter; // Cleanup certain IE form elements default values. if ( CKEDITOR.env.ie ) { htmlFilter && htmlFilter.addRules( { elements : { input : function( input ) { var attrs = input.attributes, type = attrs.type; // Old IEs don't provide type for Text inputs #5522 if ( !type ) attrs.type = 'text'; if ( type == 'checkbox' || type == 'radio' ) attrs.value == 'on' && delete attrs.value; } } } ); } if ( dataFilter ) { dataFilter.addRules( { elements : { input : function( element ) { if ( element.attributes.type == 'hidden' ) return editor.createFakeParserElement( element, 'cke_hidden', 'hiddenfield' ); } } } ); } }, requires : [ 'image', 'fakeobjects' ] } ); if ( CKEDITOR.env.ie ) { CKEDITOR.dom.element.prototype.hasAttribute = CKEDITOR.tools.override( CKEDITOR.dom.element.prototype.hasAttribute, function( original ) { return function( name ) { var $attr = this.$.attributes.getNamedItem( name ); if ( this.getName() == 'input' ) { switch ( name ) { case 'class' : return this.$.className.length > 0; case 'checked' : return !!this.$.checked; case 'value' : var type = this.getAttribute( 'type' ); return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : this.$.value; } } return original.apply( this, arguments ); }; }); }
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/plugin.js
JavaScript
asf20
7,438
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'select', function( editor ) { // Add a new option to a SELECT object (combo or list). function addOption( combo, optionText, optionValue, documentObject, index ) { combo = getSelect( combo ); var oOption; if ( documentObject ) oOption = documentObject.createElement( "OPTION" ); else oOption = document.createElement( "OPTION" ); if ( combo && oOption && oOption.getName() == 'option' ) { if ( CKEDITOR.env.ie ) { if ( !isNaN( parseInt( index, 10) ) ) combo.$.options.add( oOption.$, index ); else combo.$.options.add( oOption.$ ); oOption.$.innerHTML = optionText.length > 0 ? optionText : ''; oOption.$.value = optionValue; } else { if ( index !== null && index < combo.getChildCount() ) combo.getChild( index < 0 ? 0 : index ).insertBeforeMe( oOption ); else combo.append( oOption ); oOption.setText( optionText.length > 0 ? optionText : '' ); oOption.setValue( optionValue ); } } else return false; return oOption; } // Remove all selected options from a SELECT object. function removeSelectedOptions( combo ) { combo = getSelect( combo ); // Save the selected index var iSelectedIndex = getSelectedIndex( combo ); // Remove all selected options. for ( var i = combo.getChildren().count() - 1 ; i >= 0 ; i-- ) { if ( combo.getChild( i ).$.selected ) combo.getChild( i ).remove(); } // Reset the selection based on the original selected index. setSelectedIndex( combo, iSelectedIndex ); } //Modify option from a SELECT object. function modifyOption( combo, index, title, value ) { combo = getSelect( combo ); if ( index < 0 ) return false; var child = combo.getChild( index ); child.setText( title ); child.setValue( value ); return child; } function removeAllOptions( combo ) { combo = getSelect( combo ); while ( combo.getChild( 0 ) && combo.getChild( 0 ).remove() ) { /*jsl:pass*/ } } // Moves the selected option by a number of steps (also negative). function changeOptionPosition( combo, steps, documentObject ) { combo = getSelect( combo ); var iActualIndex = getSelectedIndex( combo ); if ( iActualIndex < 0 ) return false; var iFinalIndex = iActualIndex + steps; iFinalIndex = ( iFinalIndex < 0 ) ? 0 : iFinalIndex; iFinalIndex = ( iFinalIndex >= combo.getChildCount() ) ? combo.getChildCount() - 1 : iFinalIndex; if ( iActualIndex == iFinalIndex ) return false; var oOption = combo.getChild( iActualIndex ), sText = oOption.getText(), sValue = oOption.getValue(); oOption.remove(); oOption = addOption( combo, sText, sValue, ( !documentObject ) ? null : documentObject, iFinalIndex ); setSelectedIndex( combo, iFinalIndex ); return oOption; } function getSelectedIndex( combo ) { combo = getSelect( combo ); return combo ? combo.$.selectedIndex : -1; } function setSelectedIndex( combo, index ) { combo = getSelect( combo ); if ( index < 0 ) return null; var count = combo.getChildren().count(); combo.$.selectedIndex = ( index >= count ) ? ( count - 1 ) : index; return combo; } function getOptions( combo ) { combo = getSelect( combo ); return combo ? combo.getChildren() : false; } function getSelect( obj ) { if ( obj && obj.domId && obj.getInputElement().$ ) // Dialog element. return obj.getInputElement(); else if ( obj && obj.$ ) return obj; return false; } return { title : editor.lang.select.title, minWidth : CKEDITOR.env.ie ? 460 : 395, minHeight : CKEDITOR.env.ie ? 320 : 300, onShow : function() { delete this.selectBox; this.setupContent( 'clear' ); var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.getName() == "select" ) { this.selectBox = element; this.setupContent( element.getName(), element ); // Load Options into dialog. var objOptions = getOptions( element ); for ( var i = 0 ; i < objOptions.count() ; i++ ) this.setupContent( 'option', objOptions.getItem( i ) ); } }, onOk : function() { var editor = this.getParentEditor(), element = this.selectBox, isInsertMode = !element; if ( isInsertMode ) element = editor.document.createElement( 'select' ); this.commitContent( element ); if ( isInsertMode ) { editor.insertElement( element ); if ( CKEDITOR.env.ie ) { var sel = editor.getSelection(), bms = sel.createBookmarks(); setTimeout(function() { sel.selectBookmarks( bms ); }, 0 ); } } }, contents : [ { id : 'info', label : editor.lang.select.selectInfo, title : editor.lang.select.selectInfo, accessKey : '', elements : [ { id : 'txtName', type : 'text', widths : [ '25%','75%' ], labelLayout : 'horizontal', label : editor.lang.common.name, 'default' : '', accessKey : 'N', style : 'width:350px', setup : function( name, element ) { if ( name == 'clear' ) this.setValue( this[ 'default' ] || '' ); else if ( name == 'select' ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); } }, commit : function( element ) { if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { id : 'txtValue', type : 'text', widths : [ '25%','75%' ], labelLayout : 'horizontal', label : editor.lang.select.value, style : 'width:350px', 'default' : '', className : 'cke_disabled', onLoad : function() { this.getInputElement().setAttribute( 'readOnly', true ); }, setup : function( name, element ) { if ( name == 'clear' ) this.setValue( '' ); else if ( name == 'option' && element.getAttribute( 'selected' ) ) this.setValue( element.$.value ); } }, { type : 'hbox', widths : [ '175px', '170px' ], children : [ { id : 'txtSize', type : 'text', labelLayout : 'horizontal', label : editor.lang.select.size, 'default' : '', accessKey : 'S', style : 'width:175px', validate: function() { var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ); return ( ( this.getValue() === '' ) || func.apply( this ) ); }, setup : function( name, element ) { if ( name == 'select' ) this.setValue( element.getAttribute( 'size' ) || '' ); if ( CKEDITOR.env.webkit ) this.getInputElement().setStyle( 'width', '86px' ); }, commit : function( element ) { if ( this.getValue() ) element.setAttribute( 'size', this.getValue() ); else element.removeAttribute( 'size' ); } }, { type : 'html', html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.lines ) + '</span>' } ] }, { type : 'html', html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.opAvail ) + '</span>' }, { type : 'hbox', widths : [ '115px', '115px' ,'100px' ], children : [ { type : 'vbox', children : [ { id : 'txtOptName', type : 'text', label : editor.lang.select.opText, style : 'width:115px', setup : function( name, element ) { if ( name == 'clear' ) this.setValue( "" ); } }, { type : 'select', id : 'cmbName', label : '', title : '', size : 5, style : 'width:115px;height:75px', items : [], onChange : function() { var dialog = this.getDialog(), values = dialog.getContentElement( 'info', 'cmbValue' ), optName = dialog.getContentElement( 'info', 'txtOptName' ), optValue = dialog.getContentElement( 'info', 'txtOptValue' ), iIndex = getSelectedIndex( this ); setSelectedIndex( values, iIndex ); optName.setValue( this.getValue() ); optValue.setValue( values.getValue() ); }, setup : function( name, element ) { if ( name == 'clear' ) removeAllOptions( this ); else if ( name == 'option' ) addOption( this, element.getText(), element.getText(), this.getDialog().getParentEditor().document ); }, commit : function( element ) { var dialog = this.getDialog(), optionsNames = getOptions( this ), optionsValues = getOptions( dialog.getContentElement( 'info', 'cmbValue' ) ), selectValue = dialog.getContentElement( 'info', 'txtValue' ).getValue(); removeAllOptions( element ); for ( var i = 0 ; i < optionsNames.count() ; i++ ) { var oOption = addOption( element, optionsNames.getItem( i ).getValue(), optionsValues.getItem( i ).getValue(), dialog.getParentEditor().document ); if ( optionsValues.getItem( i ).getValue() == selectValue ) { oOption.setAttribute( 'selected', 'selected' ); oOption.selected = true; } } } } ] }, { type : 'vbox', children : [ { id : 'txtOptValue', type : 'text', label : editor.lang.select.opValue, style : 'width:115px', setup : function( name, element ) { if ( name == 'clear' ) this.setValue( "" ); } }, { type : 'select', id : 'cmbValue', label : '', size : 5, style : 'width:115px;height:75px', items : [], onChange : function() { var dialog = this.getDialog(), names = dialog.getContentElement( 'info', 'cmbName' ), optName = dialog.getContentElement( 'info', 'txtOptName' ), optValue = dialog.getContentElement( 'info', 'txtOptValue' ), iIndex = getSelectedIndex( this ); setSelectedIndex( names, iIndex ); optName.setValue( names.getValue() ); optValue.setValue( this.getValue() ); }, setup : function( name, element ) { if ( name == 'clear' ) removeAllOptions( this ); else if ( name == 'option' ) { var oValue = element.getValue(); addOption( this, oValue, oValue, this.getDialog().getParentEditor().document ); if ( element.getAttribute( 'selected' ) == 'selected' ) this.getDialog().getContentElement( 'info', 'txtValue' ).setValue( oValue ); } } } ] }, { type : 'vbox', padding : 5, children : [ { type : 'button', id : 'btnAdd', style : '', label : editor.lang.select.btnAdd, title : editor.lang.select.btnAdd, style : 'width:100%;', onClick : function() { //Add new option. var dialog = this.getDialog(), parentEditor = dialog.getParentEditor(), optName = dialog.getContentElement( 'info', 'txtOptName' ), optValue = dialog.getContentElement( 'info', 'txtOptValue' ), names = dialog.getContentElement( 'info', 'cmbName' ), values = dialog.getContentElement( 'info', 'cmbValue' ); addOption(names, optName.getValue(), optName.getValue(), dialog.getParentEditor().document ); addOption(values, optValue.getValue(), optValue.getValue(), dialog.getParentEditor().document ); optName.setValue( "" ); optValue.setValue( "" ); } }, { type : 'button', id : 'btnModify', label : editor.lang.select.btnModify, title : editor.lang.select.btnModify, style : 'width:100%;', onClick : function() { //Modify selected option. var dialog = this.getDialog(), optName = dialog.getContentElement( 'info', 'txtOptName' ), optValue = dialog.getContentElement( 'info', 'txtOptValue' ), names = dialog.getContentElement( 'info', 'cmbName' ), values = dialog.getContentElement( 'info', 'cmbValue' ), iIndex = getSelectedIndex( names ); if ( iIndex >= 0 ) { modifyOption( names, iIndex, optName.getValue(), optName.getValue() ); modifyOption( values, iIndex, optValue.getValue(), optValue.getValue() ); } } }, { type : 'button', id : 'btnUp', style : 'width:100%;', label : editor.lang.select.btnUp, title : editor.lang.select.btnUp, onClick : function() { //Move up. var dialog = this.getDialog(), names = dialog.getContentElement( 'info', 'cmbName' ), values = dialog.getContentElement( 'info', 'cmbValue' ); changeOptionPosition( names, -1, dialog.getParentEditor().document ); changeOptionPosition( values, -1, dialog.getParentEditor().document ); } }, { type : 'button', id : 'btnDown', style : 'width:100%;', label : editor.lang.select.btnDown, title : editor.lang.select.btnDown, onClick : function() { //Move down. var dialog = this.getDialog(), names = dialog.getContentElement( 'info', 'cmbName' ), values = dialog.getContentElement( 'info', 'cmbValue' ); changeOptionPosition( names, 1, dialog.getParentEditor().document ); changeOptionPosition( values, 1, dialog.getParentEditor().document ); } } ] } ] }, { type : 'hbox', widths : [ '40%', '20%', '40%' ], children : [ { type : 'button', id : 'btnSetValue', label : editor.lang.select.btnSetValue, title : editor.lang.select.btnSetValue, onClick : function() { //Set as default value. var dialog = this.getDialog(), values = dialog.getContentElement( 'info', 'cmbValue' ), txtValue = dialog.getContentElement( 'info', 'txtValue' ); txtValue.setValue( values.getValue() ); } }, { type : 'button', id : 'btnDelete', label : editor.lang.select.btnDelete, title : editor.lang.select.btnDelete, onClick : function() { // Delete option. var dialog = this.getDialog(), names = dialog.getContentElement( 'info', 'cmbName' ), values = dialog.getContentElement( 'info', 'cmbValue' ), optName = dialog.getContentElement( 'info', 'txtOptName' ), optValue = dialog.getContentElement( 'info', 'txtOptValue' ); removeSelectedOptions( names ); removeSelectedOptions( values ); optName.setValue( "" ); optValue.setValue( "" ); } }, { id : 'chkMulti', type : 'checkbox', label : editor.lang.select.chkMulti, 'default' : '', accessKey : 'M', value : "checked", setup : function( name, element ) { if ( name == 'select' ) this.setValue( element.getAttribute( 'multiple' ) ); if ( CKEDITOR.env.webkit ) this.getElement().getParent().setStyle( 'vertical-align', 'middle' ); }, commit : function( element ) { if ( this.getValue() ) element.setAttribute( 'multiple', this.getValue() ); else element.removeAttribute( 'multiple' ); } } ] } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/select.js
JavaScript
asf20
17,251
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'textfield', function( editor ) { var autoAttributes = { value : 1, size : 1, maxLength : 1 }; var acceptedTypes = { text : 1, password : 1 }; return { title : editor.lang.textfield.title, minWidth : 350, minHeight : 150, onShow : function() { delete this.textField; var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.getName() == "input" && ( acceptedTypes[ element.getAttribute( 'type' ) ] || !element.getAttribute( 'type' ) ) ) { this.textField = element; this.setupContent( element ); } }, onOk : function() { var editor, element = this.textField, isInsertMode = !element; if ( isInsertMode ) { editor = this.getParentEditor(); element = editor.document.createElement( 'input' ); element.setAttribute( 'type', 'text' ); } if ( isInsertMode ) editor.insertElement( element ); this.commitContent( { element : element } ); }, onLoad : function() { var autoSetup = function( element ) { var value = element.hasAttribute( this.id ) && element.getAttribute( this.id ); this.setValue( value || '' ); }; var autoCommit = function( data ) { var element = data.element; var value = this.getValue(); if ( value ) element.setAttribute( this.id, value ); else element.removeAttribute( this.id ); }; this.foreach( function( contentObj ) { if ( autoAttributes[ contentObj.id ] ) { contentObj.setup = autoSetup; contentObj.commit = autoCommit; } } ); }, contents : [ { id : 'info', label : editor.lang.textfield.title, title : editor.lang.textfield.title, elements : [ { type : 'hbox', widths : [ '50%', '50%' ], children : [ { id : '_cke_saved_name', type : 'text', label : editor.lang.textfield.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( data ) { var element = data.element; if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { id : 'value', type : 'text', label : editor.lang.textfield.value, 'default' : '', accessKey : 'V' } ] }, { type : 'hbox', widths : [ '50%', '50%' ], children : [ { id : 'size', type : 'text', label : editor.lang.textfield.charWidth, 'default' : '', accessKey : 'C', style : 'width:50px', validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ) }, { id : 'maxLength', type : 'text', label : editor.lang.textfield.maxChars, 'default' : '', accessKey : 'M', style : 'width:50px', validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ) } ], onLoad : function() { // Repaint the style for IE7 (#6068) if ( CKEDITOR.env.ie7Compat ) this.getElement().setStyle( 'zoom', '100%' ); } }, { id : 'type', type : 'select', label : editor.lang.textfield.type, 'default' : 'text', accessKey : 'M', items : [ [ editor.lang.textfield.typeText, 'text' ], [ editor.lang.textfield.typePass, 'password' ] ], setup : function( element ) { this.setValue( element.getAttribute( 'type' ) ); }, commit : function( data ) { var element = data.element; if ( CKEDITOR.env.ie ) { var elementType = element.getAttribute( 'type' ); var myType = this.getValue(); if ( elementType != myType ) { var replace = CKEDITOR.dom.element.createFromHtml( '<input type="' + myType + '"></input>', editor.document ); element.copyAttributes( replace, { type : 1 } ); replace.replace( element ); editor.getSelection().selectElement( replace ); data.element = replace; } } else element.setAttribute( 'type', this.getValue() ); } } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/textfield.js
JavaScript
asf20
4,962
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'hiddenfield', function( editor ) { return { title : editor.lang.hidden.title, hiddenField : null, minWidth : 350, minHeight : 110, onShow : function() { delete this.hiddenField; var editor = this.getParentEditor(), selection = editor.getSelection(), element = selection.getSelectedElement(); if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' ) { this.hiddenField = element; element = editor.restoreRealElement( this.hiddenField ); this.setupContent( element ); selection.selectElement( this.hiddenField ); } }, onOk : function() { var name = this.getValueOf( 'info', '_cke_saved_name' ), value = this.getValueOf( 'info', 'value' ), editor = this.getParentEditor(), element = CKEDITOR.env.ie && !( CKEDITOR.document.$.documentMode >= 8 ) ? editor.document.createElement( '<input name="' + CKEDITOR.tools.htmlEncode( name ) + '">' ) : editor.document.createElement( 'input' ); element.setAttribute( 'type', 'hidden' ); this.commitContent( element ); var fakeElement = editor.createFakeElement( element, 'cke_hidden', 'hiddenfield' ); if ( !this.hiddenField ) editor.insertElement( fakeElement ); else { fakeElement.replace( this.hiddenField ); editor.getSelection().selectElement( fakeElement ); } return true; }, contents : [ { id : 'info', label : editor.lang.hidden.title, title : editor.lang.hidden.title, elements : [ { id : '_cke_saved_name', type : 'text', label : editor.lang.hidden.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( element ) { if ( this.getValue() ) element.setAttribute( 'name', this.getValue() ); else { element.removeAttribute( 'name' ); } } }, { id : 'value', type : 'text', label : editor.lang.hidden.value, 'default' : '', accessKey : 'V', setup : function( element ) { this.setValue( element.getAttribute( 'value' ) || '' ); }, commit : function( element ) { if ( this.getValue() ) element.setAttribute( 'value', this.getValue() ); else element.removeAttribute( 'value' ); } } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/hiddenfield.js
JavaScript
asf20
2,811
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'button', function( editor ) { function commitAttributes( element ) { var val = this.getValue(); if ( val ) { element.attributes[ this.id ] = val; if ( this.id == 'name' ) element.attributes[ 'data-cke-saved-name' ] = val; } else { delete element.attributes[ this.id ]; if ( this.id == 'name' ) delete element.attributes[ 'data-cke-saved-name' ]; } } return { title : editor.lang.button.title, minWidth : 350, minHeight : 150, onShow : function() { delete this.button; var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.is( 'input' ) ) { var type = element.getAttribute( 'type' ); if ( type in { button:1, reset:1, submit:1 } ) { this.button = element; this.setupContent( element ); } } }, onOk : function() { var editor = this.getParentEditor(), element = this.button, isInsertMode = !element; var fake = element ? CKEDITOR.htmlParser.fragment.fromHtml( element.getOuterHtml() ).children[ 0 ] : new CKEDITOR.htmlParser.element( 'input' ); this.commitContent( fake ); var writer = new CKEDITOR.htmlParser.basicWriter(); fake.writeHtml( writer ); var newElement = CKEDITOR.dom.element.createFromHtml( writer.getHtml(), editor.document ); if ( isInsertMode ) editor.insertElement( newElement ); else { newElement.replace( element ); editor.getSelection().selectElement( newElement ); } }, contents : [ { id : 'info', label : editor.lang.button.title, title : editor.lang.button.title, elements : [ { id : 'name', type : 'text', label : editor.lang.common.name, 'default' : '', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : commitAttributes }, { id : 'value', type : 'text', label : editor.lang.button.text, accessKey : 'V', 'default' : '', setup : function( element ) { this.setValue( element.getAttribute( 'value' ) || '' ); }, commit : commitAttributes }, { id : 'type', type : 'select', label : editor.lang.button.type, 'default' : 'button', accessKey : 'T', items : [ [ editor.lang.button.typeBtn, 'button' ], [ editor.lang.button.typeSbm, 'submit' ], [ editor.lang.button.typeRst, 'reset' ] ], setup : function( element ) { this.setValue( element.getAttribute( 'type' ) || '' ); }, commit : commitAttributes } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/button.js
JavaScript
asf20
3,007
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'form', function( editor ) { var autoAttributes = { action : 1, id : 1, method : 1, enctype : 1, target : 1 }; return { title : editor.lang.form.title, minWidth : 350, minHeight : 200, onShow : function() { delete this.form; var element = this.getParentEditor().getSelection().getStartElement(); var form = element && element.getAscendant( 'form', true ); if ( form ) { this.form = form; this.setupContent( form ); } }, onOk : function() { var editor, element = this.form, isInsertMode = !element; if ( isInsertMode ) { editor = this.getParentEditor(); element = editor.document.createElement( 'form' ); !CKEDITOR.env.ie && element.append( editor.document.createElement( 'br' ) ); } if ( isInsertMode ) editor.insertElement( element ); this.commitContent( element ); }, onLoad : function() { function autoSetup( element ) { this.setValue( element.getAttribute( this.id ) || '' ); } function autoCommit( element ) { if ( this.getValue() ) element.setAttribute( this.id, this.getValue() ); else element.removeAttribute( this.id ); } this.foreach( function( contentObj ) { if ( autoAttributes[ contentObj.id ] ) { contentObj.setup = autoSetup; contentObj.commit = autoCommit; } } ); }, contents : [ { id : 'info', label : editor.lang.form.title, title : editor.lang.form.title, elements : [ { id : 'txtName', type : 'text', label : editor.lang.common.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( element ) { if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { id : 'action', type : 'text', label : editor.lang.form.action, 'default' : '', accessKey : 'T' }, { type : 'hbox', widths : [ '45%', '55%' ], children : [ { id : 'id', type : 'text', label : editor.lang.common.id, 'default' : '', accessKey : 'I' }, { id : 'enctype', type : 'select', label : editor.lang.form.encoding, style : 'width:100%', accessKey : 'E', 'default' : '', items : [ [ '' ], [ 'text/plain' ], [ 'multipart/form-data' ], [ 'application/x-www-form-urlencoded' ] ] } ] }, { type : 'hbox', widths : [ '45%', '55%' ], children : [ { id : 'target', type : 'select', label : editor.lang.common.target, style : 'width:100%', accessKey : 'M', 'default' : '', items : [ [ editor.lang.common.notSet, '' ], [ editor.lang.common.targetNew, '_blank' ], [ editor.lang.common.targetTop, '_top' ], [ editor.lang.common.targetSelf, '_self' ], [ editor.lang.common.targetParent, '_parent' ] ] }, { id : 'method', type : 'select', label : editor.lang.form.method, accessKey : 'M', 'default' : 'GET', items : [ [ 'GET', 'get' ], [ 'POST', 'post' ] ] } ] } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/form.js
JavaScript
asf20
4,016
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'textarea', function( editor ) { return { title : editor.lang.textarea.title, minWidth : 350, minHeight : 220, onShow : function() { delete this.textarea; var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.getName() == "textarea" ) { this.textarea = element; this.setupContent( element ); } }, onOk : function() { var editor, element = this.textarea, isInsertMode = !element; if ( isInsertMode ) { editor = this.getParentEditor(); element = editor.document.createElement( 'textarea' ); } this.commitContent( element ); if ( isInsertMode ) editor.insertElement( element ); }, contents : [ { id : 'info', label : editor.lang.textarea.title, title : editor.lang.textarea.title, elements : [ { id : '_cke_saved_name', type : 'text', label : editor.lang.common.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( element ) { if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { type : 'hbox', widths:['50%','50%'], children:[ { id : 'cols', type : 'text', label : editor.lang.textarea.cols, 'default' : '', accessKey : 'C', style : 'width:50px', validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ), setup : function( element ) { var value = element.hasAttribute( 'cols' ) && element.getAttribute( 'cols' ); this.setValue( value || '' ); }, commit : function( element ) { if ( this.getValue() ) element.setAttribute( 'cols', this.getValue() ); else element.removeAttribute( 'cols' ); } }, { id : 'rows', type : 'text', label : editor.lang.textarea.rows, 'default' : '', accessKey : 'R', style : 'width:50px', validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ), setup : function( element ) { var value = element.hasAttribute( 'rows' ) && element.getAttribute( 'rows' ); this.setValue( value || '' ); }, commit : function( element ) { if ( this.getValue() ) element.setAttribute( 'rows', this.getValue() ); else element.removeAttribute( 'rows' ); } } ] }, { id : 'value', type : 'textarea', label : editor.lang.textfield.value, 'default' : '', setup : function( element ) { this.setValue( element.$.defaultValue ); }, commit : function( element ) { element.$.value = element.$.defaultValue = this.getValue() ; } } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/textarea.js
JavaScript
asf20
3,527
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'radio', function( editor ) { return { title : editor.lang.checkboxAndRadio.radioTitle, minWidth : 350, minHeight : 140, onShow : function() { delete this.radioButton; var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'radio' ) { this.radioButton = element; this.setupContent( element ); } }, onOk : function() { var editor, element = this.radioButton, isInsertMode = !element; if ( isInsertMode ) { editor = this.getParentEditor(); element = editor.document.createElement( 'input' ); element.setAttribute( 'type', 'radio' ); } if ( isInsertMode ) editor.insertElement( element ); this.commitContent( { element : element } ); }, contents : [ { id : 'info', label : editor.lang.checkboxAndRadio.radioTitle, title : editor.lang.checkboxAndRadio.radioTitle, elements : [ { id : 'name', type : 'text', label : editor.lang.common.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( data ) { var element = data.element; if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { id : 'value', type : 'text', label : editor.lang.checkboxAndRadio.value, 'default' : '', accessKey : 'V', setup : function( element ) { this.setValue( element.getAttribute( 'value' ) || '' ); }, commit : function( data ) { var element = data.element; if ( this.getValue() ) element.setAttribute( 'value', this.getValue() ); else element.removeAttribute( 'value' ); } }, { id : 'checked', type : 'checkbox', label : editor.lang.checkboxAndRadio.selected, 'default' : '', accessKey : 'S', value : "checked", setup : function( element ) { this.setValue( element.getAttribute( 'checked' ) ); }, commit : function( data ) { var element = data.element; if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ) { if ( this.getValue() ) element.setAttribute( 'checked', 'checked' ); else element.removeAttribute( 'checked' ); } else { var isElementChecked = element.getAttribute( 'checked' ); var isChecked = !!this.getValue(); if ( isElementChecked != isChecked ) { var replace = CKEDITOR.dom.element.createFromHtml( '<input type="radio"' + ( isChecked ? ' checked="checked"' : '' ) + '></input>', editor.document ); element.copyAttributes( replace, { type : 1, checked : 1 } ); replace.replace( element ); editor.getSelection().selectElement( replace ); data.element = replace; } } } } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/radio.js
JavaScript
asf20
3,596
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'checkbox', function( editor ) { return { title : editor.lang.checkboxAndRadio.checkboxTitle, minWidth : 350, minHeight : 140, onShow : function() { delete this.checkbox; var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.getAttribute( 'type' ) == 'checkbox' ) { this.checkbox = element; this.setupContent( element ); } }, onOk : function() { var editor, element = this.checkbox, isInsertMode = !element; if ( isInsertMode ) { editor = this.getParentEditor(); element = editor.document.createElement( 'input' ); element.setAttribute( 'type', 'checkbox' ); editor.insertElement( element ); } this.commitContent( { element : element } ); }, contents : [ { id : 'info', label : editor.lang.checkboxAndRadio.checkboxTitle, title : editor.lang.checkboxAndRadio.checkboxTitle, startupFocus : 'txtName', elements : [ { id : 'txtName', type : 'text', label : editor.lang.common.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( data ) { var element = data.element; // IE failed to update 'name' property on input elements, protect it now. if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { id : 'txtValue', type : 'text', label : editor.lang.checkboxAndRadio.value, 'default' : '', accessKey : 'V', setup : function( element ) { var value = element.getAttribute( 'value' ); // IE Return 'on' as default attr value. this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value ); }, commit : function( data ) { var element = data.element, value = this.getValue(); if ( value && !( CKEDITOR.env.ie && value == 'on' ) ) element.setAttribute( 'value', value ); else { if ( CKEDITOR.env.ie ) { // Remove attribute 'value' of checkbox (#4721). var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() ); element.copyAttributes( checkbox, { value: 1 } ); checkbox.replace( element ); editor.getSelection().selectElement( checkbox ); data.element = checkbox; } else element.removeAttribute( 'value' ); } } }, { id : 'cmbSelected', type : 'checkbox', label : editor.lang.checkboxAndRadio.selected, 'default' : '', accessKey : 'S', value : "checked", setup : function( element ) { this.setValue( element.getAttribute( 'checked' ) ); }, commit : function( data ) { var element = data.element; if ( CKEDITOR.env.ie ) { var isElementChecked = !!element.getAttribute( 'checked' ), isChecked = !!this.getValue(); if ( isElementChecked != isChecked ) { var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"' + ( isChecked ? ' checked="checked"' : '' ) + '/>', editor.document ); element.copyAttributes( replace, { type : 1, checked : 1 } ); replace.replace( element ); editor.getSelection().selectElement( replace ); data.element = replace; } } else { var value = this.getValue(); if ( value ) element.setAttribute( 'checked', 'checked' ); else element.removeAttribute( 'checked' ); } } } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/forms/dialogs/checkbox.js
JavaScript
asf20
4,267
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ // Register a plugin named "sample". CKEDITOR.plugins.add( 'keystrokes', { beforeInit : function( editor ) { /** * Controls keystrokes typing in this editor instance. * @name CKEDITOR.editor.prototype.keystrokeHandler * @type CKEDITOR.keystrokeHandler * @example */ editor.keystrokeHandler = new CKEDITOR.keystrokeHandler( editor ); editor.specialKeys = {}; }, init : function( editor ) { var keystrokesConfig = editor.config.keystrokes, blockedConfig = editor.config.blockedKeystrokes; var keystrokes = editor.keystrokeHandler.keystrokes, blockedKeystrokes = editor.keystrokeHandler.blockedKeystrokes; for ( var i = 0 ; i < keystrokesConfig.length ; i++ ) keystrokes[ keystrokesConfig[i][0] ] = keystrokesConfig[i][1]; for ( i = 0 ; i < blockedConfig.length ; i++ ) blockedKeystrokes[ blockedConfig[i] ] = 1; } }); /** * Controls keystrokes typing in an editor instance. * @constructor * @param {CKEDITOR.editor} editor The editor instance. * @example */ CKEDITOR.keystrokeHandler = function( editor ) { if ( editor.keystrokeHandler ) return editor.keystrokeHandler; /** * List of keystrokes associated to commands. Each entry points to the * command to be executed. * @type Object * @example */ this.keystrokes = {}; /** * List of keystrokes that should be blocked if not defined at * {@link keystrokes}. In this way it is possible to block the default * browser behavior for those keystrokes. * @type Object * @example */ this.blockedKeystrokes = {}; this._ = { editor : editor }; return this; }; (function() { var cancel; var onKeyDown = function( event ) { // The DOM event object is passed by the "data" property. event = event.data; var keyCombination = event.getKeystroke(); var command = this.keystrokes[ keyCombination ]; var editor = this._.editor; cancel = ( editor.fire( 'key', { keyCode : keyCombination } ) === true ); if ( !cancel ) { if ( command ) { var data = { from : 'keystrokeHandler' }; cancel = ( editor.execCommand( command, data ) !== false ); } if ( !cancel ) { var handler = editor.specialKeys[ keyCombination ]; cancel = ( handler && handler( editor ) === true ); if ( !cancel ) cancel = !!this.blockedKeystrokes[ keyCombination ]; } } if ( cancel ) event.preventDefault( true ); return !cancel; }; var onKeyPress = function( event ) { if ( cancel ) { cancel = false; event.data.preventDefault( true ); } }; CKEDITOR.keystrokeHandler.prototype = { /** * Attaches this keystroke handle to a DOM object. Keystrokes typed ** over this object will get handled by this keystrokeHandler. * @param {CKEDITOR.dom.domObject} domObject The DOM object to attach * to. * @example */ attach : function( domObject ) { // For most browsers, it is enough to listen to the keydown event // only. domObject.on( 'keydown', onKeyDown, this ); // Some browsers instead, don't cancel key events in the keydown, but in the // keypress. So we must do a longer trip in those cases. if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) domObject.on( 'keypress', onKeyPress, this ); } }; })(); /** * A list of keystrokes to be blocked if not defined in the {@link CKEDITOR.config.keystrokes} * setting. In this way it is possible to block the default browser behavior * for those keystrokes. * @type Array * @default (see example) * @example * // This is actually the default value. * config.blockedKeystrokes = * [ * CKEDITOR.CTRL + 66 &#47;*B*&#47;, * CKEDITOR.CTRL + 73 &#47;*I*&#47;, * CKEDITOR.CTRL + 85 &#47;*U*&#47; * ]; */ CKEDITOR.config.blockedKeystrokes = [ CKEDITOR.CTRL + 66 /*B*/, CKEDITOR.CTRL + 73 /*I*/, CKEDITOR.CTRL + 85 /*U*/ ]; /** * A list associating keystrokes to editor commands. Each element in the list * is an array where the first item is the keystroke, and the second is the * name of the command to be executed. * @type Array * @default (see example) * @example * // This is actually the default value. * config.keystrokes = * [ * [ CKEDITOR.ALT + 121 &#47;*F10*&#47;, 'toolbarFocus' ], * [ CKEDITOR.ALT + 122 &#47;*F11*&#47;, 'elementsPathFocus' ], * * [ CKEDITOR.SHIFT + 121 &#47;*F10*&#47;, 'contextMenu' ], * * [ CKEDITOR.CTRL + 90 &#47;*Z*&#47;, 'undo' ], * [ CKEDITOR.CTRL + 89 &#47;*Y*&#47;, 'redo' ], * [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 &#47;*Z*&#47;, 'redo' ], * * [ CKEDITOR.CTRL + 76 &#47;*L*&#47;, 'link' ], * * [ CKEDITOR.CTRL + 66 &#47;*B*&#47;, 'bold' ], * [ CKEDITOR.CTRL + 73 &#47;*I*&#47;, 'italic' ], * [ CKEDITOR.CTRL + 85 &#47;*U*&#47;, 'underline' ], * * [ CKEDITOR.ALT + 109 &#47;*-*&#47;, 'toolbarCollapse' ] * ]; */ CKEDITOR.config.keystrokes = [ [ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ], [ CKEDITOR.ALT + 122 /*F11*/, 'elementsPathFocus' ], [ CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ], [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ], [ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ], [ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ], [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ], [ CKEDITOR.CTRL + 76 /*L*/, 'link' ], [ CKEDITOR.CTRL + 66 /*B*/, 'bold' ], [ CKEDITOR.CTRL + 73 /*I*/, 'italic' ], [ CKEDITOR.CTRL + 85 /*U*/, 'underline' ], [ CKEDITOR.ALT + ( CKEDITOR.env.ie || CKEDITOR.env.webkit ? 189 : 109 ) /*-*/, 'toolbarCollapse' ], [ CKEDITOR.ALT + 48 /*0*/, 'a11yHelp' ] ]; /** * Fired when any keyboard key (or combination) is pressed into the editing area. * @name CKEDITOR.editor#key * @event * @param {Number} data.keyCode A number representing the key code (or * combination). It is the sum of the current key code and the * {@link CKEDITOR.CTRL}, {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} * constants, if those are pressed. */
zysms
trunk/zysms/include/ckeditor/_source/plugins/keystrokes/plugin.js
JavaScript
asf20
6,299
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file DOM iterator, which iterates over list items, lines and paragraphs. */ CKEDITOR.plugins.add( 'domiterator' ); (function() { /** * @name CKEDITOR.dom.iterator */ function iterator( range ) { if ( arguments.length < 1 ) return; this.range = range; this.forceBrBreak = 0; // Whether include <br>s into the enlarged range.(#3730). this.enlargeBr = 1; this.enforceRealBlocks = 0; this._ || ( this._ = {} ); } var beginWhitespaceRegex = /^[\r\n\t ]+$/, // Ignore bookmark nodes.(#3783) bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true ), whitespacesGuard = CKEDITOR.dom.walker.whitespaces( true ), skipGuard = function( node ) { return bookmarkGuard( node ) && whitespacesGuard( node ); }; // Get a reference for the next element, bookmark nodes are skipped. function getNextSourceNode( node, startFromSibling, lastNode ) { var next = node.getNextSourceNode( startFromSibling, null, lastNode ); while ( !bookmarkGuard( next ) ) next = next.getNextSourceNode( startFromSibling, null, lastNode ); return next; } iterator.prototype = { getNextParagraph : function( blockTag ) { // The block element to be returned. var block; // The range object used to identify the paragraph contents. var range; // Indicats that the current element in the loop is the last one. var isLast; // Indicate at least one of the range boundaries is inside a preformat block. var touchPre; // Instructs to cleanup remaining BRs. var removePreviousBr, removeLastBr; // This is the first iteration. Let's initialize it. if ( !this._.lastNode ) { range = this.range.clone(); // Shrink the range to exclude harmful "noises" (#4087, #4450, #5435). range.shrink( CKEDITOR.NODE_ELEMENT, true ); touchPre = range.endContainer.hasAscendant( 'pre', true ) || range.startContainer.hasAscendant( 'pre', true ); range.enlarge( this.forceBrBreak && !touchPre || !this.enlargeBr ? CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS : CKEDITOR.ENLARGE_BLOCK_CONTENTS ); var walker = new CKEDITOR.dom.walker( range ), ignoreBookmarkTextEvaluator = CKEDITOR.dom.walker.bookmark( true, true ); // Avoid anchor inside bookmark inner text. walker.evaluator = ignoreBookmarkTextEvaluator; this._.nextNode = walker.next(); // TODO: It's better to have walker.reset() used here. walker = new CKEDITOR.dom.walker( range ); walker.evaluator = ignoreBookmarkTextEvaluator; var lastNode = walker.previous(); this._.lastNode = lastNode.getNextSourceNode( true ); // We may have an empty text node at the end of block due to [3770]. // If that node is the lastNode, it would cause our logic to leak to the // next block.(#3887) if ( this._.lastNode && this._.lastNode.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim( this._.lastNode.getText() ) && this._.lastNode.getParent().isBlockBoundary() ) { var testRange = new CKEDITOR.dom.range( range.document ); testRange.moveToPosition( this._.lastNode, CKEDITOR.POSITION_AFTER_END ); if ( testRange.checkEndOfBlock() ) { var path = new CKEDITOR.dom.elementPath( testRange.endContainer ); var lastBlock = path.block || path.blockLimit; this._.lastNode = lastBlock.getNextSourceNode( true ); } } // Probably the document end is reached, we need a marker node. if ( !this._.lastNode ) { this._.lastNode = this._.docEndMarker = range.document.createText( '' ); this._.lastNode.insertAfter( lastNode ); } // Let's reuse this variable. range = null; } var currentNode = this._.nextNode; lastNode = this._.lastNode; this._.nextNode = null; while ( currentNode ) { // closeRange indicates that a paragraph boundary has been found, // so the range can be closed. var closeRange = 0, parentPre = currentNode.hasAscendant( 'pre' ); // includeNode indicates that the current node is good to be part // of the range. By default, any non-element node is ok for it. var includeNode = ( currentNode.type != CKEDITOR.NODE_ELEMENT ), continueFromSibling = 0; // If it is an element node, let's check if it can be part of the // range. if ( !includeNode ) { var nodeName = currentNode.getName(); if ( currentNode.isBlockBoundary( this.forceBrBreak && !parentPre && { br : 1 } ) ) { // <br> boundaries must be part of the range. It will // happen only if ForceBrBreak. if ( nodeName == 'br' ) includeNode = 1; else if ( !range && !currentNode.getChildCount() && nodeName != 'hr' ) { // If we have found an empty block, and haven't started // the range yet, it means we must return this block. block = currentNode; isLast = currentNode.equals( lastNode ); break; } // The range must finish right before the boundary, // including possibly skipped empty spaces. (#1603) if ( range ) { range.setEndAt( currentNode, CKEDITOR.POSITION_BEFORE_START ); // The found boundary must be set as the next one at this // point. (#1717) if ( nodeName != 'br' ) this._.nextNode = currentNode; } closeRange = 1; } else { // If we have child nodes, let's check them. if ( currentNode.getFirst() ) { // If we don't have a range yet, let's start it. if ( !range ) { range = new CKEDITOR.dom.range( this.range.document ); range.setStartAt( currentNode, CKEDITOR.POSITION_BEFORE_START ); } currentNode = currentNode.getFirst(); continue; } includeNode = 1; } } else if ( currentNode.type == CKEDITOR.NODE_TEXT ) { // Ignore normal whitespaces (i.e. not including &nbsp; or // other unicode whitespaces) before/after a block node. if ( beginWhitespaceRegex.test( currentNode.getText() ) ) includeNode = 0; } // The current node is good to be part of the range and we are // starting a new range, initialize it first. if ( includeNode && !range ) { range = new CKEDITOR.dom.range( this.range.document ); range.setStartAt( currentNode, CKEDITOR.POSITION_BEFORE_START ); } // The last node has been found. isLast = ( ( !closeRange || includeNode ) && currentNode.equals( lastNode ) ); // If we are in an element boundary, let's check if it is time // to close the range, otherwise we include the parent within it. if ( range && !closeRange ) { while ( !currentNode.getNext( skipGuard ) && !isLast ) { var parentNode = currentNode.getParent(); if ( parentNode.isBlockBoundary( this.forceBrBreak && !parentPre && { br : 1 } ) ) { closeRange = 1; includeNode = 0; isLast = isLast || ( parentNode.equals( lastNode) ); // Make sure range includes bookmarks at the end of the block. (#7359) range.setEndAt( parentNode, CKEDITOR.POSITION_BEFORE_END ); break; } currentNode = parentNode; includeNode = 1; isLast = ( currentNode.equals( lastNode ) ); continueFromSibling = 1; } } // Now finally include the node. if ( includeNode ) range.setEndAt( currentNode, CKEDITOR.POSITION_AFTER_END ); currentNode = getNextSourceNode ( currentNode, continueFromSibling, lastNode ); isLast = !currentNode; // We have found a block boundary. Let's close the range and move out of the // loop. if ( isLast || ( closeRange && range ) ) break; } // Now, based on the processed range, look for (or create) the block to be returned. if ( !block ) { // If no range has been found, this is the end. if ( !range ) { this._.docEndMarker && this._.docEndMarker.remove(); this._.nextNode = null; return null; } var startPath = new CKEDITOR.dom.elementPath( range.startContainer ); var startBlockLimit = startPath.blockLimit, checkLimits = { div : 1, th : 1, td : 1 }; block = startPath.block; if ( !block && !this.enforceRealBlocks && checkLimits[ startBlockLimit.getName() ] && range.checkStartOfBlock() && range.checkEndOfBlock() ) block = startBlockLimit; else if ( !block || ( this.enforceRealBlocks && block.getName() == 'li' ) ) { // Create the fixed block. block = this.range.document.createElement( blockTag || 'p' ); // Move the contents of the temporary range to the fixed block. range.extractContents().appendTo( block ); block.trim(); // Insert the fixed block into the DOM. range.insertNode( block ); removePreviousBr = removeLastBr = true; } else if ( block.getName() != 'li' ) { // If the range doesn't includes the entire contents of the // block, we must split it, isolating the range in a dedicated // block. if ( !range.checkStartOfBlock() || !range.checkEndOfBlock() ) { // The resulting block will be a clone of the current one. block = block.clone( false ); // Extract the range contents, moving it to the new block. range.extractContents().appendTo( block ); block.trim(); // Split the block. At this point, the range will be in the // right position for our intents. var splitInfo = range.splitBlock(); removePreviousBr = !splitInfo.wasStartOfBlock; removeLastBr = !splitInfo.wasEndOfBlock; // Insert the new block into the DOM. range.insertNode( block ); } } else if ( !isLast ) { // LIs are returned as is, with all their children (due to the // nested lists). But, the next node is the node right after // the current range, which could be an <li> child (nested // lists) or the next sibling <li>. this._.nextNode = ( block.equals( lastNode ) ? null : getNextSourceNode( range.getBoundaryNodes().endNode, 1, lastNode ) ); } } if ( removePreviousBr ) { var previousSibling = block.getPrevious(); if ( previousSibling && previousSibling.type == CKEDITOR.NODE_ELEMENT ) { if ( previousSibling.getName() == 'br' ) previousSibling.remove(); else if ( previousSibling.getLast() && previousSibling.getLast().$.nodeName.toLowerCase() == 'br' ) previousSibling.getLast().remove(); } } if ( removeLastBr ) { var lastChild = block.getLast(); if ( lastChild && lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.getName() == 'br' ) { // Take care not to remove the block expanding <br> in non-IE browsers. if ( CKEDITOR.env.ie || lastChild.getPrevious( bookmarkGuard ) || lastChild.getNext( bookmarkGuard ) ) lastChild.remove(); } } // Get a reference for the next element. This is important because the // above block can be removed or changed, so we can rely on it for the // next interation. if ( !this._.nextNode ) { this._.nextNode = ( isLast || block.equals( lastNode ) ) ? null : getNextSourceNode( block, 1, lastNode ); } return block; } }; CKEDITOR.dom.range.prototype.createIterator = function() { return new iterator( this ); }; })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/domiterator/plugin.js
JavaScript
asf20
11,871
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'table', { init : function( editor ) { var table = CKEDITOR.plugins.table, lang = editor.lang.table; editor.addCommand( 'table', new CKEDITOR.dialogCommand( 'table' ) ); editor.addCommand( 'tableProperties', new CKEDITOR.dialogCommand( 'tableProperties' ) ); editor.ui.addButton( 'Table', { label : lang.toolbar, command : 'table' }); CKEDITOR.dialog.add( 'table', this.path + 'dialogs/table.js' ); CKEDITOR.dialog.add( 'tableProperties', this.path + 'dialogs/table.js' ); // If the "menu" plugin is loaded, register the menu items. if ( editor.addMenuItems ) { editor.addMenuItems( { table : { label : lang.menu, command : 'tableProperties', group : 'table', order : 5 }, tabledelete : { label : lang.deleteTable, command : 'tableDelete', group : 'table', order : 1 } } ); } editor.on( 'doubleclick', function( evt ) { var element = evt.data.element; if ( element.is( 'table' ) ) evt.data.dialog = 'tableProperties'; }); // If the "contextmenu" plugin is loaded, register the listeners. if ( editor.contextMenu ) { editor.contextMenu.addListener( function( element, selection ) { if ( !element || element.isReadOnly() ) return null; var isTable = element.hasAscendant( 'table', 1 ); if ( isTable ) { return { tabledelete : CKEDITOR.TRISTATE_OFF, table : CKEDITOR.TRISTATE_OFF }; } return null; } ); } } } );
zysms
trunk/zysms/include/ckeditor/_source/plugins/table/plugin.js
JavaScript
asf20
1,800
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var defaultToPixel = CKEDITOR.tools.cssLength; var commitValue = function( data ) { var id = this.id; if ( !data.info ) data.info = {}; data.info[id] = this.getValue(); }; function tableColumns( table ) { var cols = 0, maxCols = 0; for ( var i = 0, row, rows = table.$.rows.length; i < rows; i++ ) { row = table.$.rows[ i ], cols = 0; for ( var j = 0, cell, cells = row.cells.length; j < cells; j++ ) { cell = row.cells[ j ]; cols += cell.colSpan; } cols > maxCols && ( maxCols = cols ); } return maxCols; } function tableDialog( editor, command ) { var makeElement = function( name ) { return new CKEDITOR.dom.element( name, editor.document ); }; var dialogadvtab = editor.plugins.dialogadvtab; return { title : editor.lang.table.title, minWidth : 310, minHeight : CKEDITOR.env.ie ? 310 : 280, onLoad : function() { var dialog = this; var styles = dialog.getContentElement( 'advanced', 'advStyles' ); if ( styles ) { styles.on( 'change', function( evt ) { // Synchronize width value. var width = this.getStyle( 'width', '' ), txtWidth = dialog.getContentElement( 'info', 'txtWidth' ); txtWidth && txtWidth.setValue( width, true ); // Synchronize height value. var height = this.getStyle( 'height', '' ), txtHeight = dialog.getContentElement( 'info', 'txtHeight' ); txtHeight && txtHeight.setValue( height, true ); }); } }, onShow : function() { // Detect if there's a selected table. var selection = editor.getSelection(), ranges = selection.getRanges(), selectedTable = null; var rowsInput = this.getContentElement( 'info', 'txtRows' ), colsInput = this.getContentElement( 'info', 'txtCols' ), widthInput = this.getContentElement( 'info', 'txtWidth' ), heightInput = this.getContentElement( 'info', 'txtHeight' ); if ( command == 'tableProperties' ) { if ( ( selectedTable = selection.getSelectedElement() ) ) selectedTable = selectedTable.getAscendant( 'table', true ); else if ( ranges.length > 0 ) { // Webkit could report the following range on cell selection (#4948): // <table><tr><td>[&nbsp;</td></tr></table>] if ( CKEDITOR.env.webkit ) ranges[ 0 ].shrink( CKEDITOR.NODE_ELEMENT ); var rangeRoot = ranges[0].getCommonAncestor( true ); selectedTable = rangeRoot.getAscendant( 'table', true ); } // Save a reference to the selected table, and push a new set of default values. this._.selectedElement = selectedTable; } // Enable or disable the row, cols, width fields. if ( selectedTable ) { this.setupContent( selectedTable ); rowsInput && rowsInput.disable(); colsInput && colsInput.disable(); } else { rowsInput && rowsInput.enable(); colsInput && colsInput.enable(); } // Call the onChange method for the widht and height fields so // they get reflected into the Advanced tab. widthInput && widthInput.onChange(); heightInput && heightInput.onChange(); }, onOk : function() { var selection = editor.getSelection(), bms = this._.selectedElement && selection.createBookmarks(); var table = this._.selectedElement || makeElement( 'table' ), me = this, data = {}; this.commitContent( data, table ); if ( data.info ) { var info = data.info; // Generate the rows and cols. if ( !this._.selectedElement ) { var tbody = table.append( makeElement( 'tbody' ) ), rows = parseInt( info.txtRows, 10 ) || 0, cols = parseInt( info.txtCols, 10 ) || 0; for ( var i = 0 ; i < rows ; i++ ) { var row = tbody.append( makeElement( 'tr' ) ); for ( var j = 0 ; j < cols ; j++ ) { var cell = row.append( makeElement( 'td' ) ); if ( !CKEDITOR.env.ie ) cell.append( makeElement( 'br' ) ); } } } // Modify the table headers. Depends on having rows and cols generated // correctly so it can't be done in commit functions. // Should we make a <thead>? var headers = info.selHeaders; if ( !table.$.tHead && ( headers == 'row' || headers == 'both' ) ) { var thead = new CKEDITOR.dom.element( table.$.createTHead() ); tbody = table.getElementsByTag( 'tbody' ).getItem( 0 ); var theRow = tbody.getElementsByTag( 'tr' ).getItem( 0 ); // Change TD to TH: for ( i = 0 ; i < theRow.getChildCount() ; i++ ) { var th = theRow.getChild( i ); // Skip bookmark nodes. (#6155) if ( th.type == CKEDITOR.NODE_ELEMENT && !th.data( 'cke-bookmark' ) ) { th.renameNode( 'th' ); th.setAttribute( 'scope', 'col' ); } } thead.append( theRow.remove() ); } if ( table.$.tHead !== null && !( headers == 'row' || headers == 'both' ) ) { // Move the row out of the THead and put it in the TBody: thead = new CKEDITOR.dom.element( table.$.tHead ); tbody = table.getElementsByTag( 'tbody' ).getItem( 0 ); var previousFirstRow = tbody.getFirst(); while ( thead.getChildCount() > 0 ) { theRow = thead.getFirst(); for ( i = 0; i < theRow.getChildCount() ; i++ ) { var newCell = theRow.getChild( i ); if ( newCell.type == CKEDITOR.NODE_ELEMENT ) { newCell.renameNode( 'td' ); newCell.removeAttribute( 'scope' ); } } theRow.insertBefore( previousFirstRow ); } thead.remove(); } // Should we make all first cells in a row TH? if ( !this.hasColumnHeaders && ( headers == 'col' || headers == 'both' ) ) { for ( row = 0 ; row < table.$.rows.length ; row++ ) { newCell = new CKEDITOR.dom.element( table.$.rows[ row ].cells[ 0 ] ); newCell.renameNode( 'th' ); newCell.setAttribute( 'scope', 'row' ); } } // Should we make all first TH-cells in a row make TD? If 'yes' we do it the other way round :-) if ( ( this.hasColumnHeaders ) && !( headers == 'col' || headers == 'both' ) ) { for ( i = 0 ; i < table.$.rows.length ; i++ ) { row = new CKEDITOR.dom.element( table.$.rows[i] ); if ( row.getParent().getName() == 'tbody' ) { newCell = new CKEDITOR.dom.element( row.$.cells[0] ); newCell.renameNode( 'td' ); newCell.removeAttribute( 'scope' ); } } } // Set the width and height. info.txtHeight ? table.setStyle( 'height', info.txtHeight ) : table.removeStyle( 'height' ); info.txtWidth ? table.setStyle( 'width', info.txtWidth ) : table.removeStyle( 'width' ); if ( !table.getAttribute( 'style' ) ) table.removeAttribute( 'style' ); } // Insert the table element if we're creating one. if ( !this._.selectedElement ) { editor.insertElement( table ); // Override the default cursor position after insertElement to place // cursor inside the first cell (#7959), IE needs a while. setTimeout( function() { var firstCell = new CKEDITOR.dom.element( table.$.rows[ 0 ].cells[ 0 ] ); var range = new CKEDITOR.dom.range( editor.document ); range.moveToPosition( firstCell, CKEDITOR.POSITION_AFTER_START ); range.select( 1 ); }, 0 ); } // Properly restore the selection, (#4822) but don't break // because of this, e.g. updated table caption. else try { selection.selectBookmarks( bms ); } catch( er ){} }, contents : [ { id : 'info', label : editor.lang.table.title, elements : [ { type : 'hbox', widths : [ null, null ], styles : [ 'vertical-align:top' ], children : [ { type : 'vbox', padding : 0, children : [ { type : 'text', id : 'txtRows', 'default' : 3, label : editor.lang.table.rows, required : true, controlStyle : 'width:5em', validate : function() { var pass = true, value = this.getValue(); pass = pass && CKEDITOR.dialog.validate.integer()( value ) && value > 0; if ( !pass ) { alert( editor.lang.table.invalidRows ); this.select(); } return pass; }, setup : function( selectedElement ) { this.setValue( selectedElement.$.rows.length ); }, commit : commitValue }, { type : 'text', id : 'txtCols', 'default' : 2, label : editor.lang.table.columns, required : true, controlStyle : 'width:5em', validate : function() { var pass = true, value = this.getValue(); pass = pass && CKEDITOR.dialog.validate.integer()( value ) && value > 0; if ( !pass ) { alert( editor.lang.table.invalidCols ); this.select(); } return pass; }, setup : function( selectedTable ) { this.setValue( tableColumns( selectedTable ) ); }, commit : commitValue }, { type : 'html', html : '&nbsp;' }, { type : 'select', id : 'selHeaders', 'default' : '', label : editor.lang.table.headers, items : [ [ editor.lang.table.headersNone, '' ], [ editor.lang.table.headersRow, 'row' ], [ editor.lang.table.headersColumn, 'col' ], [ editor.lang.table.headersBoth, 'both' ] ], setup : function( selectedTable ) { // Fill in the headers field. var dialog = this.getDialog(); dialog.hasColumnHeaders = true; // Check if all the first cells in every row are TH for ( var row = 0 ; row < selectedTable.$.rows.length ; row++ ) { // If just one cell isn't a TH then it isn't a header column var headCell = selectedTable.$.rows[row].cells[0]; if ( headCell && headCell.nodeName.toLowerCase() != 'th' ) { dialog.hasColumnHeaders = false; break; } } // Check if the table contains <thead>. if ( ( selectedTable.$.tHead !== null) ) this.setValue( dialog.hasColumnHeaders ? 'both' : 'row' ); else this.setValue( dialog.hasColumnHeaders ? 'col' : '' ); }, commit : commitValue }, { type : 'text', id : 'txtBorder', 'default' : 1, label : editor.lang.table.border, controlStyle : 'width:3em', validate : CKEDITOR.dialog.validate['number']( editor.lang.table.invalidBorder ), setup : function( selectedTable ) { this.setValue( selectedTable.getAttribute( 'border' ) || '' ); }, commit : function( data, selectedTable ) { if ( this.getValue() ) selectedTable.setAttribute( 'border', this.getValue() ); else selectedTable.removeAttribute( 'border' ); } }, { id : 'cmbAlign', type : 'select', 'default' : '', label : editor.lang.common.align, items : [ [ editor.lang.common.notSet , ''], [ editor.lang.common.alignLeft , 'left'], [ editor.lang.common.alignCenter , 'center'], [ editor.lang.common.alignRight , 'right'] ], setup : function( selectedTable ) { this.setValue( selectedTable.getAttribute( 'align' ) || '' ); }, commit : function( data, selectedTable ) { if ( this.getValue() ) selectedTable.setAttribute( 'align', this.getValue() ); else selectedTable.removeAttribute( 'align' ); } } ] }, { type : 'vbox', padding : 0, children : [ { type : 'hbox', widths : [ '5em' ], children : [ { type : 'text', id : 'txtWidth', controlStyle : 'width:5em', label : editor.lang.common.width, title : editor.lang.common.cssLengthTooltip, 'default' : 500, getValue : defaultToPixel, validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength.replace( '%1', editor.lang.common.width ) ), onChange : function() { var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' ); styles && styles.updateStyle( 'width', this.getValue() ); }, setup : function( selectedTable ) { var val = selectedTable.getStyle( 'width' ); val && this.setValue( val ); }, commit : commitValue } ] }, { type : 'hbox', widths : [ '5em' ], children : [ { type : 'text', id : 'txtHeight', controlStyle : 'width:5em', label : editor.lang.common.height, title : editor.lang.common.cssLengthTooltip, 'default' : '', getValue : defaultToPixel, validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength.replace( '%1', editor.lang.common.height ) ), onChange : function() { var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' ); styles && styles.updateStyle( 'height', this.getValue() ); }, setup : function( selectedTable ) { var val = selectedTable.getStyle( 'width' ); val && this.setValue( val ); }, commit : commitValue } ] }, { type : 'html', html : '&nbsp;' }, { type : 'text', id : 'txtCellSpace', controlStyle : 'width:3em', label : editor.lang.table.cellSpace, 'default' : 1, validate : CKEDITOR.dialog.validate.number( editor.lang.table.invalidCellSpacing ), setup : function( selectedTable ) { this.setValue( selectedTable.getAttribute( 'cellSpacing' ) || '' ); }, commit : function( data, selectedTable ) { if ( this.getValue() ) selectedTable.setAttribute( 'cellSpacing', this.getValue() ); else selectedTable.removeAttribute( 'cellSpacing' ); } }, { type : 'text', id : 'txtCellPad', controlStyle : 'width:3em', label : editor.lang.table.cellPad, 'default' : 1, validate : CKEDITOR.dialog.validate.number( editor.lang.table.invalidCellPadding ), setup : function( selectedTable ) { this.setValue( selectedTable.getAttribute( 'cellPadding' ) || '' ); }, commit : function( data, selectedTable ) { if ( this.getValue() ) selectedTable.setAttribute( 'cellPadding', this.getValue() ); else selectedTable.removeAttribute( 'cellPadding' ); } } ] } ] }, { type : 'html', align : 'right', html : '' }, { type : 'vbox', padding : 0, children : [ { type : 'text', id : 'txtCaption', label : editor.lang.table.caption, setup : function( selectedTable ) { this.enable(); var nodeList = selectedTable.getElementsByTag( 'caption' ); if ( nodeList.count() > 0 ) { var caption = nodeList.getItem( 0 ); var firstElementChild = caption.getFirst( CKEDITOR.dom.walker.nodeType( CKEDITOR.NODE_ELEMENT ) ); if ( firstElementChild && !firstElementChild.equals( caption.getBogus() ) ) { this.disable(); this.setValue( caption.getText() ); return; } caption = CKEDITOR.tools.trim( caption.getText() ); this.setValue( caption ); } }, commit : function( data, table ) { if ( !this.isEnabled() ) return; var caption = this.getValue(), captionElement = table.getElementsByTag( 'caption' ); if ( caption ) { if ( captionElement.count() > 0 ) { captionElement = captionElement.getItem( 0 ); captionElement.setHtml( '' ); } else { captionElement = new CKEDITOR.dom.element( 'caption', editor.document ); if ( table.getChildCount() ) captionElement.insertBefore( table.getFirst() ); else captionElement.appendTo( table ); } captionElement.append( new CKEDITOR.dom.text( caption, editor.document ) ); } else if ( captionElement.count() > 0 ) { for ( var i = captionElement.count() - 1 ; i >= 0 ; i-- ) captionElement.getItem( i ).remove(); } } }, { type : 'text', id : 'txtSummary', label : editor.lang.table.summary, setup : function( selectedTable ) { this.setValue( selectedTable.getAttribute( 'summary' ) || '' ); }, commit : function( data, selectedTable ) { if ( this.getValue() ) selectedTable.setAttribute( 'summary', this.getValue() ); else selectedTable.removeAttribute( 'summary' ); } } ] } ] }, dialogadvtab && dialogadvtab.createAdvancedTab( editor ) ] }; } CKEDITOR.dialog.add( 'table', function( editor ) { return tableDialog( editor, 'table' ); } ); CKEDITOR.dialog.add( 'tableProperties', function( editor ) { return tableDialog( editor, 'tableProperties' ); } ); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/table/dialogs/table.js
JavaScript
asf20
19,765
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Horizontal Page Break */ // Register a plugin named "newpage". CKEDITOR.plugins.add( 'newpage', { init : function( editor ) { editor.addCommand( 'newpage', { modes : { wysiwyg:1, source:1 }, exec : function( editor ) { var command = this; editor.setData( editor.config.newpage_html || '', function() { // Save the undo snapshot after all document changes are affected. (#4889) setTimeout( function () { editor.fire( 'afterCommandExec', { name: command.name, command: command } ); editor.selectionChange(); }, 200 ); } ); editor.focus(); }, async : true }); editor.ui.addButton( 'NewPage', { label : editor.lang.newPage, command : 'newpage' }); } }); /** * The HTML to load in the editor when the "new page" command is executed. * @name CKEDITOR.config.newpage_html * @type String * @default '' * @example * config.newpage_html = '&lt;p&gt;Type your text here.&lt;/p&gt;'; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/newpage/plugin.js
JavaScript
asf20
1,244
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'format', { requires : [ 'richcombo', 'styles' ], init : function( editor ) { var config = editor.config, lang = editor.lang.format; // Gets the list of tags from the settings. var tags = config.format_tags.split( ';' ); // Create style objects for all defined styles. var styles = {}; for ( var i = 0 ; i < tags.length ; i++ ) { var tag = tags[ i ]; styles[ tag ] = new CKEDITOR.style( config[ 'format_' + tag ] ); styles[ tag ]._.enterMode = editor.config.enterMode; } editor.ui.addRichCombo( 'Format', { label : lang.label, title : lang.panelTitle, className : 'cke_format', panel : { css : editor.skin.editor.css.concat( config.contentsCss ), multiSelect : false, attributes : { 'aria-label' : lang.panelTitle } }, init : function() { this.startGroup( lang.panelTitle ); for ( var tag in styles ) { var label = lang[ 'tag_' + tag ]; // Add the tag entry to the panel list. this.add( tag, styles[tag].buildPreview( label ), label ); } }, onClick : function( value ) { editor.focus(); editor.fire( 'saveSnapshot' ); var style = styles[ value ], elementPath = new CKEDITOR.dom.elementPath( editor.getSelection().getStartElement() ); style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document ); // Save the undo snapshot after all changes are affected. (#4899) setTimeout( function() { editor.fire( 'saveSnapshot' ); }, 0 ); }, onRender : function() { editor.on( 'selectionChange', function( ev ) { var currentTag = this.getValue(); var elementPath = ev.data.path; for ( var tag in styles ) { if ( styles[ tag ].checkActive( elementPath ) ) { if ( tag != currentTag ) this.setValue( tag, editor.lang.format[ 'tag_' + tag ] ); return; } } // If no styles match, just empty it. this.setValue( '' ); }, this); } }); } }); /** * A list of semi colon separated style names (by default tags) representing * the style definition for each entry to be displayed in the Format combo in * the toolbar. Each entry must have its relative definition configuration in a * setting named "format_(tagName)". For example, the "p" entry has its * definition taken from config.format_p. * @type String * @default 'p;h1;h2;h3;h4;h5;h6;pre;address;div' * @example * config.format_tags = 'p;h2;h3;pre' */ CKEDITOR.config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div'; /** * The style definition to be used to apply the "Normal" format. * @type Object * @default { element : 'p' } * @example * config.format_p = { element : 'p', attributes : { 'class' : 'normalPara' } }; */ CKEDITOR.config.format_p = { element : 'p' }; /** * The style definition to be used to apply the "Normal (DIV)" format. * @type Object * @default { element : 'div' } * @example * config.format_div = { element : 'div', attributes : { 'class' : 'normalDiv' } }; */ CKEDITOR.config.format_div = { element : 'div' }; /** * The style definition to be used to apply the "Formatted" format. * @type Object * @default { element : 'pre' } * @example * config.format_pre = { element : 'pre', attributes : { 'class' : 'code' } }; */ CKEDITOR.config.format_pre = { element : 'pre' }; /** * The style definition to be used to apply the "Address" format. * @type Object * @default { element : 'address' } * @example * config.format_address = { element : 'address', attributes : { 'class' : 'styledAddress' } }; */ CKEDITOR.config.format_address = { element : 'address' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h1' } * @example * config.format_h1 = { element : 'h1', attributes : { 'class' : 'contentTitle1' } }; */ CKEDITOR.config.format_h1 = { element : 'h1' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h2' } * @example * config.format_h2 = { element : 'h2', attributes : { 'class' : 'contentTitle2' } }; */ CKEDITOR.config.format_h2 = { element : 'h2' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h3' } * @example * config.format_h3 = { element : 'h3', attributes : { 'class' : 'contentTitle3' } }; */ CKEDITOR.config.format_h3 = { element : 'h3' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h4' } * @example * config.format_h4 = { element : 'h4', attributes : { 'class' : 'contentTitle4' } }; */ CKEDITOR.config.format_h4 = { element : 'h4' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h5' } * @example * config.format_h5 = { element : 'h5', attributes : { 'class' : 'contentTitle5' } }; */ CKEDITOR.config.format_h5 = { element : 'h5' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h6' } * @example * config.format_h6 = { element : 'h6', attributes : { 'class' : 'contentTitle6' } }; */ CKEDITOR.config.format_h6 = { element : 'h6' };
zysms
trunk/zysms/include/ckeditor/_source/plugins/format/plugin.js
JavaScript
asf20
5,708
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Special Character plugin */ CKEDITOR.plugins.add( 'specialchar', { // List of available localizations. availableLangs : { en:1 }, init : function( editor ) { var pluginName = 'specialchar', plugin = this; // Register the dialog. CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/specialchar.js' ); editor.addCommand( pluginName, { exec : function() { var langCode = editor.langCode; langCode = plugin.availableLangs[ langCode ] ? langCode : 'en'; CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( plugin.path + 'lang/' + langCode + '.js' ), function() { CKEDITOR.tools.extend( editor.lang.specialChar, plugin.langEntries[ langCode ] ); editor.openDialog( pluginName ); }); }, modes : { wysiwyg:1 }, canUndo : false }); // Register the toolbar button. editor.ui.addButton( 'SpecialChar', { label : editor.lang.specialChar.toolbar, command : pluginName }); } } ); /** * The list of special characters visible in the Special Character dialog window. * @type Array * @example * config.specialChars = [ '&quot;', '&rsquo;', [ '&custom;', 'Custom label' ] ]; * config.specialChars = config.specialChars.concat( [ '&quot;', [ '&rsquo;', 'Custom label' ] ] ); */ CKEDITOR.config.specialChars = [ '!','&quot;','#','$','%','&amp;',"'",'(',')','*','+','-','.','/', '0','1','2','3','4','5','6','7','8','9',':',';', '&lt;','=','&gt;','?','@', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'P','Q','R','S','T','U','V','W','X','Y','Z', '[',']','^','_','`', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p', 'q','r','s','t','u','v','w','x','y','z', '{','|','}','~', "&euro;", "&lsquo;", "&rsquo;", "&ldquo;", "&rdquo;", "&ndash;", "&mdash;", "&iexcl;", "&cent;", "&pound;", "&curren;", "&yen;", "&brvbar;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&reg;", "&macr;", "&deg;", "&sup2;", "&sup3;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&sup1;", "&ordm;", "&raquo;", "&frac14;", "&frac12;", "&frac34;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&ETH;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&times;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&Yacute;", "&THORN;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;", "&OElig;", "&oelig;", "&#372;", "&#374", "&#373", "&#375;", "&sbquo;", "&#8219;", "&bdquo;", "&hellip;", "&trade;", "&#9658;", "&bull;", "&rarr;", "&rArr;", "&hArr;", "&diams;", "&asymp;" ];
zysms
trunk/zysms/include/ckeditor/_source/plugins/specialchar/plugin.js
JavaScript
asf20
3,267
 CKEDITOR.plugins.setLang( 'specialchar', 'en', { euro: "Euro sign", lsquo: "Left single quotation mark", rsquo: "Right single quotation mark", ldquo: "Left double quotation mark", rdquo: "Right double quotation mark", ndash: "En dash", mdash: "Em dash", iexcl: "Inverted exclamation mark", cent: "Cent sign", pound: "Pound sign", curren: "Currency sign", yen: "Yen sign", brvbar: "Broken bar", sect: "Section sign", uml: "Diaeresis", copy: "Copyright sign", ordf: "Feminine ordinal indicator", laquo: "Left-pointing double angle quotation mark", not: "Not sign", reg: "Registered sign", macr: "Macron", deg: "Degree sign", sup2: "Superscript two", sup3: "Superscript three", acute: "Acute accent", micro: "Micro sign", para: "Pilcrow sign", middot: "Middle dot", cedil: "Cedilla", sup1: "Superscript one", ordm: "Masculine ordinal indicator", raquo: "Right-pointing double angle quotation mark", frac14: "Vulgar fraction one quarter", frac12: "Vulgar fraction one half", frac34: "Vulgar fraction three quarters", iquest: "Inverted question mark", Agrave: "Latin capital letter A with grave accent", Aacute: "Latin capital letter A with acute accent", Acirc: "Latin capital letter A with circumflex", Atilde: "Latin capital letter A with tilde", Auml: "Latin capital letter A with diaeresis", Aring: "Latin capital letter A with ring above", AElig: "Latin Capital letter Æ", Ccedil: "Latin capital letter C with cedilla", Egrave: "Latin capital letter E with grave accent", Eacute: "Latin capital letter E with acute accent", Ecirc: "Latin capital letter E with circumflex", Euml: "Latin capital letter E with diaeresis", Igrave: "Latin capital letter I with grave accent", Iacute: "Latin capital letter I with acute accent", Icirc: "Latin capital letter I with circumflex", Iuml: "Latin capital letter I with diaeresis", ETH: "Latin capital letter Eth", Ntilde: "Latin capital letter N with tilde", Ograve: "Latin capital letter O with grave accent", Oacute: "Latin capital letter O with acute accent", Ocirc: "Latin capital letter O with circumflex", Otilde: "Latin capital letter O with tilde", Ouml: "Latin capital letter O with diaeresis", times: "Multiplication sign", Oslash: "Latin capital letter O with stroke", Ugrave: "Latin capital letter U with grave accent", Uacute: "Latin capital letter U with acute accent", Ucirc: "Latin capital letter U with circumflex", Uuml: "Latin capital letter U with diaeresis", Yacute: "Latin capital letter Y with acute accent", THORN: "Latin capital letter Thorn", szlig: "Latin small letter sharp s", agrave: "Latin small letter a with grave accent", aacute: "Latin small letter a with acute accent", acirc: "Latin small letter a with circumflex", atilde: "Latin small letter a with tilde", auml: "Latin small letter a with diaeresis", aring: "Latin small letter a with ring above", aelig: "Latin small letter æ", ccedil: "Latin small letter c with cedilla", egrave: "Latin small letter e with grave accent", eacute: "Latin small letter e with acute accent", ecirc: "Latin small letter e with circumflex", euml: "Latin small letter e with diaeresis", igrave: "Latin small letter i with grave accent", iacute: "Latin small letter i with acute accent", icirc: "Latin small letter i with circumflex", iuml: "Latin small letter i with diaeresis", eth: "Latin small letter eth", ntilde: "Latin small letter n with tilde", ograve: "Latin small letter o with grave accent", oacute: "Latin small letter o with acute accent", ocirc: "Latin small letter o with circumflex", otilde: "Latin small letter o with tilde", ouml: "Latin small letter o with diaeresis", divide: "Division sign", oslash: "Latin small letter o with stroke", ugrave: "Latin small letter u with grave accent", uacute: "Latin small letter u with acute accent", ucirc: "Latin small letter u with circumflex", uuml: "Latin small letter u with diaeresis", yacute: "Latin small letter y with acute accent", thorn: "Latin small letter thorn", yuml: "Latin small letter y with diaeresis", OElig: "Latin capital ligature OE", oelig: "Latin small ligature oe", '372': "Latin capital letter W with circumflex", '374': "Latin capital letter Y with circumflex", '373': "Latin small letter w with circumflex", '375': "Latin small letter y with circumflex", sbquo: "Single low-9 quotation mark", '8219': "Single high-reversed-9 quotation mark", bdquo: "Double low-9 quotation mark", hellip: "Horizontal ellipsis", trade: "Trade mark sign", '9658': "Black right-pointing pointer", bull: "Bullet", rarr: "Rightwards arrow", rArr: "Rightwards double arrow", hArr: "Left right double arrow", diams: "Black diamond suit", asymp: "Almost equal to" });
zysms
trunk/zysms/include/ckeditor/_source/plugins/specialchar/lang/en.js
JavaScript
asf20
4,884
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'specialchar', function( editor ) { /** * Simulate "this" of a dialog for non-dialog events. * @type {CKEDITOR.dialog} */ var dialog, lang = editor.lang.specialChar; var onChoice = function( evt ) { var target, value; if ( evt.data ) target = evt.data.getTarget(); else target = new CKEDITOR.dom.element( evt ); if ( target.getName() == 'a' && ( value = target.getChild( 0 ).getHtml() ) ) { target.removeClass( "cke_light_background" ); dialog.hide(); // We must use "insertText" here to keep text styled. var span = editor.document.createElement( 'span' ); span.setHtml( value ); editor.insertText( span.getText() ); } }; var onClick = CKEDITOR.tools.addFunction( onChoice ); var focusedNode; var onFocus = function( evt, target ) { var value; target = target || evt.data.getTarget(); if ( target.getName() == 'span' ) target = target.getParent(); if ( target.getName() == 'a' && ( value = target.getChild( 0 ).getHtml() ) ) { // Trigger blur manually if there is focused node. if ( focusedNode ) onBlur( null, focusedNode ); var htmlPreview = dialog.getContentElement( 'info', 'htmlPreview' ).getElement(); dialog.getContentElement( 'info', 'charPreview' ).getElement().setHtml( value ); htmlPreview.setHtml( CKEDITOR.tools.htmlEncode( value ) ); target.getParent().addClass( "cke_light_background" ); // Memorize focused node. focusedNode = target; } }; var onBlur = function( evt, target ) { target = target || evt.data.getTarget(); if ( target.getName() == 'span' ) target = target.getParent(); if ( target.getName() == 'a' ) { dialog.getContentElement( 'info', 'charPreview' ).getElement().setHtml( '&nbsp;' ); dialog.getContentElement( 'info', 'htmlPreview' ).getElement().setHtml( '&nbsp;' ); target.getParent().removeClass( "cke_light_background" ); focusedNode = undefined; } }; var onKeydown = CKEDITOR.tools.addFunction( function( ev ) { ev = new CKEDITOR.dom.event( ev ); // Get an Anchor element. var element = ev.getTarget(); var relative, nodeToMove; var keystroke = ev.getKeystroke(), rtl = editor.lang.dir == 'rtl'; switch ( keystroke ) { // UP-ARROW case 38 : // relative is TR if ( ( relative = element.getParent().getParent().getPrevious() ) ) { nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] ); nodeToMove.focus(); onBlur( null, element ); onFocus( null, nodeToMove ); } ev.preventDefault(); break; // DOWN-ARROW case 40 : // relative is TR if ( ( relative = element.getParent().getParent().getNext() ) ) { nodeToMove = relative.getChild( [ element.getParent().getIndex(), 0 ] ); if ( nodeToMove && nodeToMove.type == 1 ) { nodeToMove.focus(); onBlur( null, element ); onFocus( null, nodeToMove ); } } ev.preventDefault(); break; // SPACE // ENTER is already handled as onClick case 32 : onChoice( { data: ev } ); ev.preventDefault(); break; // RIGHT-ARROW case rtl ? 37 : 39 : // TAB case 9 : // relative is TD if ( ( relative = element.getParent().getNext() ) ) { nodeToMove = relative.getChild( 0 ); if ( nodeToMove.type == 1 ) { nodeToMove.focus(); onBlur( null, element ); onFocus( null, nodeToMove ); ev.preventDefault( true ); } else onBlur( null, element ); } // relative is TR else if ( ( relative = element.getParent().getParent().getNext() ) ) { nodeToMove = relative.getChild( [ 0, 0 ] ); if ( nodeToMove && nodeToMove.type == 1 ) { nodeToMove.focus(); onBlur( null, element ); onFocus( null, nodeToMove ); ev.preventDefault( true ); } else onBlur( null, element ); } break; // LEFT-ARROW case rtl ? 39 : 37 : // SHIFT + TAB case CKEDITOR.SHIFT + 9 : // relative is TD if ( ( relative = element.getParent().getPrevious() ) ) { nodeToMove = relative.getChild( 0 ); nodeToMove.focus(); onBlur( null, element ); onFocus( null, nodeToMove ); ev.preventDefault( true ); } // relative is TR else if ( ( relative = element.getParent().getParent().getPrevious() ) ) { nodeToMove = relative.getLast().getChild( 0 ); nodeToMove.focus(); onBlur( null, element ); onFocus( null, nodeToMove ); ev.preventDefault( true ); } else onBlur( null, element ); break; default : // Do not stop not handled events. return; } }); return { title : lang.title, minWidth : 430, minHeight : 280, buttons : [ CKEDITOR.dialog.cancelButton ], charColumns : 17, onLoad : function() { var columns = this.definition.charColumns, extraChars = editor.config.extraSpecialChars, chars = editor.config.specialChars; var charsTableLabel = CKEDITOR.tools.getNextId() + '_specialchar_table_label'; var html = [ '<table role="listbox" aria-labelledby="' + charsTableLabel + '"' + ' style="width: 320px; height: 100%; border-collapse: separate;"' + ' align="center" cellspacing="2" cellpadding="2" border="0">' ]; var i = 0, size = chars.length, character, charDesc; while ( i < size ) { html.push( '<tr>' ) ; for ( var j = 0 ; j < columns ; j++, i++ ) { if ( ( character = chars[ i ] ) ) { charDesc = ''; if ( character instanceof Array ) { charDesc = character[ 1 ]; character = character[ 0 ]; } else { var _tmpName = character.replace( '&', '' ).replace( ';', '' ).replace( '#', '' ); // Use character in case description unavailable. charDesc = lang[ _tmpName ] || character; } var charLabelId = 'cke_specialchar_label_' + i + '_' + CKEDITOR.tools.getNextNumber(); html.push( '<td class="cke_dark_background" style="cursor: default" role="presentation">' + '<a href="javascript: void(0);" role="option"' + ' aria-posinset="' + ( i +1 ) + '"', ' aria-setsize="' + size + '"', ' aria-labelledby="' + charLabelId + '"', ' style="cursor: inherit; display: block; height: 1.25em; margin-top: 0.25em; text-align: center;" title="', CKEDITOR.tools.htmlEncode( charDesc ), '"' + ' onkeydown="CKEDITOR.tools.callFunction( ' + onKeydown + ', event, this )"' + ' onclick="CKEDITOR.tools.callFunction(' + onClick + ', this); return false;"' + ' tabindex="-1">' + '<span style="margin: 0 auto;cursor: inherit">' + character + '</span>' + '<span class="cke_voice_label" id="' + charLabelId + '">' + charDesc + '</span></a>'); } else html.push( '<td class="cke_dark_background">&nbsp;' ); html.push( '</td>' ); } html.push( '</tr>' ); } html.push( '</tbody></table>', '<span id="' + charsTableLabel + '" class="cke_voice_label">' + lang.options +'</span>' ); this.getContentElement( 'info', 'charContainer' ).getElement().setHtml( html.join( '' ) ); }, contents : [ { id : 'info', label : editor.lang.common.generalTab, title : editor.lang.common.generalTab, padding : 0, align : 'top', elements : [ { type : 'hbox', align : 'top', widths : [ '320px', '90px' ], children : [ { type : 'html', id : 'charContainer', html : '', onMouseover : onFocus, onMouseout : onBlur, focus : function() { var firstChar = this.getElement().getElementsByTag( 'a' ).getItem( 0 ); setTimeout( function() { firstChar.focus(); onFocus( null, firstChar ); }, 0 ); }, onShow : function() { var firstChar = this.getElement().getChild( [ 0, 0, 0, 0, 0 ] ); setTimeout( function() { firstChar.focus(); onFocus( null, firstChar ); }, 0 ); }, onLoad : function( event ) { dialog = event.sender; } }, { type : 'hbox', align : 'top', widths : [ '100%' ], children : [ { type : 'vbox', align : 'top', children : [ { type : 'html', html : '<div></div>' }, { type : 'html', id : 'charPreview', className : 'cke_dark_background', style : 'border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:\'Microsoft Sans Serif\',Arial,Helvetica,Verdana;text-align:center;', html : '<div>&nbsp;</div>' }, { type : 'html', id : 'htmlPreview', className : 'cke_dark_background', style : 'border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:\'Microsoft Sans Serif\',Arial,Helvetica,Verdana;text-align:center;', html : '<div>&nbsp;</div>' } ] } ] } ] } ] } ] }; } );
zysms
trunk/zysms/include/ckeditor/_source/plugins/specialchar/dialogs/specialchar.js
JavaScript
asf20
9,816
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Spell checker */ // Register a plugin named "wsc". CKEDITOR.plugins.add( 'wsc', { requires : [ 'dialog' ], init : function( editor ) { var commandName = 'checkspell'; var command = editor.addCommand( commandName, new CKEDITOR.dialogCommand( commandName ) ); // SpellChecker doesn't work in Opera and with custom domain command.modes = { wysiwyg : ( !CKEDITOR.env.opera && !CKEDITOR.env.air && document.domain == window.location.hostname ) }; editor.ui.addButton( 'SpellChecker', { label : editor.lang.spellCheck.toolbar, command : commandName }); CKEDITOR.dialog.add( commandName, this.path + 'dialogs/wsc.js' ); } }); CKEDITOR.config.wsc_customerId = CKEDITOR.config.wsc_customerId || '1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk' ; CKEDITOR.config.wsc_customLoaderScript = CKEDITOR.config.wsc_customLoaderScript || null;
zysms
trunk/zysms/include/ckeditor/_source/plugins/wsc/plugin.js
JavaScript
asf20
1,082
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function doLoadScript( url ) { if ( !url ) return false ; var s = document.createElement( "script" ) ; s.type = "text/javascript" ; s.src = url ; document.getElementsByTagName( "head" )[ 0 ].appendChild( s ) ; return true ; } var opener; function tryLoad() { opener = window.parent; // get access to global parameters var oParams = window.opener.oldFramesetPageParams; // make frameset rows string prepare var sFramesetRows = ( parseInt( oParams.firstframeh, 10 ) || '30') + ",*," + ( parseInt( oParams.thirdframeh, 10 ) || '150' ) + ',0' ; document.getElementById( 'itFrameset' ).rows = sFramesetRows ; // dynamic including init frames and crossdomain transport code // from config sproxy_js_frameset url var addScriptUrl = oParams.sproxy_js_frameset ; doLoadScript( addScriptUrl ) ; } </script> </head> <frameset id="itFrameset" onload="tryLoad();" border="0" rows="30,*,*,0"> <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="2" src="" name="navbar"></frame> <frame scrolling="auto" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="0" src="" name="mid"></frame> <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="bot"></frame> <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="spellsuggestall"></frame> </frameset> </html>
zysms
trunk/zysms/include/ckeditor/_source/plugins/wsc/dialogs/tmpFrameset.html
HTML
asf20
1,935
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'checkspell', function( editor ) { var number = CKEDITOR.tools.getNextNumber(), iframeId = 'cke_frame_' + number, textareaId = 'cke_data_' + number, errorBoxId = 'cke_error_' + number, interval, protocol = document.location.protocol || 'http:', errorMsg = editor.lang.spellCheck.notAvailable; var pasteArea = '<textarea'+ ' style="display: none"' + ' id="' + textareaId + '"' + ' rows="10"' + ' cols="40">' + ' </textarea><div' + ' id="' + errorBoxId + '"' + ' style="display:none;color:red;font-size:16px;font-weight:bold;padding-top:160px;text-align:center;z-index:11;">' + '</div><iframe' + ' src=""' + ' style="width:100%;background-color:#f1f1e3;"' + ' frameborder="0"' + ' name="' + iframeId + '"' + ' id="' + iframeId + '"' + ' allowtransparency="1">' + '</iframe>'; var wscCoreUrl = editor.config.wsc_customLoaderScript || ( protocol + '//loader.webspellchecker.net/sproxy_fck/sproxy.php' + '?plugin=fck2' + '&customerid=' + editor.config.wsc_customerId + '&cmd=script&doc=wsc&schema=22' ); if ( editor.config.wsc_customLoaderScript ) errorMsg += '<p style="color:#000;font-size:11px;font-weight: normal;text-align:center;padding-top:10px">' + editor.lang.spellCheck.errorLoading.replace( /%s/g, editor.config.wsc_customLoaderScript ) + '</p>'; function burnSpelling( dialog, errorMsg ) { var i = 0; return function () { if ( typeof( window.doSpell ) == 'function' ) { //Call from window.setInteval expected at once. if ( typeof( interval ) != 'undefined' ) window.clearInterval( interval ); initAndSpell( dialog ); } else if ( i++ == 180 ) // Timeout: 180 * 250ms = 45s. window._cancelOnError( errorMsg ); }; } window._cancelOnError = function( m ) { if ( typeof( window.WSC_Error ) == 'undefined' ) { CKEDITOR.document.getById( iframeId ).setStyle( 'display', 'none' ); var errorBox = CKEDITOR.document.getById( errorBoxId ); errorBox.setStyle( 'display', 'block' ); errorBox.setHtml( m || editor.lang.spellCheck.notAvailable ); } }; function initAndSpell( dialog ) { var LangComparer = new window._SP_FCK_LangCompare(), // Language abbr standarts comparer. pluginPath = CKEDITOR.getUrl( editor.plugins.wsc.path + 'dialogs/' ), // Service paths corecting/preparing. framesetPath = pluginPath + 'tmpFrameset.html'; // global var is used in FCK specific core // change on equal var used in fckplugin.js window.gFCKPluginName = 'wsc'; LangComparer.setDefaulLangCode( editor.config.defaultLanguage ); window.doSpell({ ctrl : textareaId, lang : editor.config.wsc_lang || LangComparer.getSPLangCode(editor.langCode ), intLang: editor.config.wsc_uiLang || LangComparer.getSPLangCode(editor.langCode ), winType : iframeId, // If not defined app will run on winpopup. // Callback binding section. onCancel : function() { dialog.hide(); }, onFinish : function( dT ) { editor.focus(); dialog.getParentEditor().setData( dT.value ); dialog.hide(); }, // Some manipulations with client static pages. staticFrame : framesetPath, framesetPath : framesetPath, iframePath : pluginPath + 'ciframe.html', // Styles defining. schemaURI : pluginPath + 'wsc.css', userDictionaryName: editor.config.wsc_userDictionaryName, customDictionaryName: editor.config.wsc_customDictionaryIds && editor.config.wsc_customDictionaryIds.split(","), domainName: editor.config.wsc_domainName }); // Hide user message console (if application was loaded more then after timeout). CKEDITOR.document.getById( errorBoxId ).setStyle( 'display', 'none' ); CKEDITOR.document.getById( iframeId ).setStyle( 'display', 'block' ); } return { title : editor.config.wsc_dialogTitle || editor.lang.spellCheck.title, minWidth : 485, minHeight : 380, buttons : [ CKEDITOR.dialog.cancelButton ], onShow : function() { var contentArea = this.getContentElement( 'general', 'content' ).getElement(); contentArea.setHtml( pasteArea ); contentArea.getChild( 2 ).setStyle( 'height', this._.contentSize.height + 'px' ); if ( typeof( window.doSpell ) != 'function' ) { // Load script. CKEDITOR.document.getHead().append( CKEDITOR.document.createElement( 'script', { attributes : { type : 'text/javascript', src : wscCoreUrl } }) ); } var sData = editor.getData(); // Get the data to be checked. CKEDITOR.document.getById( textareaId ).setValue( sData ); interval = window.setInterval( burnSpelling( this, errorMsg ), 250 ); }, onHide : function() { window.ooo = undefined; window.int_framsetLoaded = undefined; window.framesetLoaded = undefined; window.is_window_opened = false; }, contents : [ { id : 'general', label : editor.config.wsc_dialogTitle || editor.lang.spellCheck.title, padding : 0, elements : [ { type : 'html', id : 'content', html : '' } ] } ] }; }); // Expand the spell-check frame when dialog resized. (#6829) CKEDITOR.dialog.on( 'resize', function( evt ) { var data = evt.data, dialog = data.dialog; if ( dialog._.name == 'checkspell' ) { var content = dialog.getContentElement( 'general', 'content' ).getElement(), iframe = content && content.getChild( 2 ); iframe && iframe.setSize( 'height', data.height ); iframe && iframe.setSize( 'width', data.width ); } });
zysms
trunk/zysms/include/ckeditor/_source/plugins/wsc/dialogs/wsc.js
JavaScript
asf20
5,893
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ html, body { background-color: transparent; margin: 0px; padding: 0px; } body { padding: 10px; } body, td, input, select, textarea { font-size: 11px; font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana; } .midtext { padding:0px; margin:10px; } .midtext p { padding:0px; margin:10px; } .Button { border: #737357 1px solid; color: #3b3b1f; background-color: #c7c78f; } .PopupTabArea { color: #737357; background-color: #e3e3c7; } .PopupTitleBorder { border-bottom: #d5d59d 1px solid; } .PopupTabEmptyArea { padding-left: 10px; border-bottom: #d5d59d 1px solid; } .PopupTab, .PopupTabSelected { border-right: #d5d59d 1px solid; border-top: #d5d59d 1px solid; border-left: #d5d59d 1px solid; padding: 3px 5px 3px 5px; color: #737357; } .PopupTab { margin-top: 1px; border-bottom: #d5d59d 1px solid; cursor: pointer; } .PopupTabSelected { font-weight: bold; cursor: default; padding-top: 4px; border-bottom: #f1f1e3 1px solid; background-color: #f1f1e3; }
zysms
trunk/zysms/include/ckeditor/_source/plugins/wsc/dialogs/wsc.css
CSS
asf20
1,232
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function gup( name ) { name = name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) ; var regexS = '[\\?&]' + name + '=([^&#]*)' ; var regex = new RegExp( regexS ) ; var results = regex.exec( window.location.href ) ; if ( results ) return results[ 1 ] ; else return '' ; } var interval; function sendData2Master() { var destination = window.parent.parent ; try { if ( destination.XDTMaster ) { var t = destination.XDTMaster.read( [ gup( 'cmd' ), gup( 'data' ) ] ) ; window.clearInterval( interval ) ; } } catch (e) {} } function onLoad() { interval = window.setInterval( sendData2Master, 100 ); } </script> </head> <body onload="onLoad()"><p></p></body> </html>
zysms
trunk/zysms/include/ckeditor/_source/plugins/wsc/dialogs/ciframe.html
HTML
asf20
1,120
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "filebrowser" plugin that adds support for file uploads and * browsing. * * When a file is uploaded or selected inside the file browser, its URL is * inserted automatically into a field defined in the <code>filebrowser</code> * attribute. In order to specify a field that should be updated, pass the tab ID and * the element ID, separated with a colon.<br /><br /> * * <strong>Example 1: (Browse)</strong> * * <pre> * { * type : 'button', * id : 'browse', * filebrowser : 'tabId:elementId', * label : editor.lang.common.browseServer * } * </pre> * * If you set the <code>filebrowser</code> attribute for an element other than * the <code>fileButton</code>, the <code>Browse</code> action will be triggered.<br /><br /> * * <strong>Example 2: (Quick Upload)</strong> * * <pre> * { * type : 'fileButton', * id : 'uploadButton', * filebrowser : 'tabId:elementId', * label : editor.lang.common.uploadSubmit, * 'for' : [ 'upload', 'upload' ] * } * </pre> * * If you set the <code>filebrowser</code> attribute for a <code>fileButton</code> * element, the <code>QuickUpload</code> action will be executed.<br /><br /> * * The filebrowser plugin also supports more advanced configuration performed through * a JavaScript object. * * The following settings are supported: * * <ul> * <li><code>action</code> &ndash; <code>Browse</code> or <code>QuickUpload</code>.</li> * <li><code>target</code> &ndash; the field to update in the <code><em>tabId:elementId</em></code> format.</li> * <li><code>params</code> &ndash; additional arguments to be passed to the server connector (optional).</li> * <li><code>onSelect</code> &ndash; a function to execute when the file is selected/uploaded (optional).</li> * <li><code>url</code> &ndash; the URL to be called (optional).</li> * </ul> * * <strong>Example 3: (Quick Upload)</strong> * * <pre> * { * type : 'fileButton', * label : editor.lang.common.uploadSubmit, * id : 'buttonId', * filebrowser : * { * action : 'QuickUpload', // required * target : 'tab1:elementId', // required * params : // optional * { * type : 'Files', * currentFolder : '/folder/' * }, * onSelect : function( fileUrl, errorMessage ) // optional * { * // Do not call the built-in selectFuntion. * // return false; * } * }, * 'for' : [ 'tab1', 'myFile' ] * } * </pre> * * Suppose you have a file element with an ID of <code>myFile</code>, a text * field with an ID of <code>elementId</code> and a <code>fileButton</code>. * If the <code>filebowser.url</code> attribute is not specified explicitly, * the form action will be set to <code>filebrowser[<em>DialogWindowName</em>]UploadUrl</code> * or, if not specified, to <code>filebrowserUploadUrl</code>. Additional parameters * from the <code>params</code> object will be added to the query string. It is * possible to create your own <code>uploadHandler</code> and cancel the built-in * <code>updateTargetElement</code> command.<br /><br /> * * <strong>Example 4: (Browse)</strong> * * <pre> * { * type : 'button', * id : 'buttonId', * label : editor.lang.common.browseServer, * filebrowser : * { * action : 'Browse', * url : '/ckfinder/ckfinder.html&amp;type=Images', * target : 'tab1:elementId' * } * } * </pre> * * In this example, when the button is pressed, the file browser will be opened in a * popup window. If you do not specify the <code>filebrowser.url</code> attribute, * <code>filebrowser[<em>DialogName</em>]BrowseUrl</code> or * <code>filebrowserBrowseUrl</code> will be used. After selecting a file in the file * browser, an element with an ID of <code>elementId</code> will be updated. Just * like in the third example, a custom <code>onSelect</code> function may be defined. */ ( function() { /* * Adds (additional) arguments to given url. * * @param {String} * url The url. * @param {Object} * params Additional parameters. */ function addQueryString( url, params ) { var queryString = []; if ( !params ) return url; else { for ( var i in params ) queryString.push( i + "=" + encodeURIComponent( params[ i ] ) ); } return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" ); } /* * Make a string's first character uppercase. * * @param {String} * str String. */ function ucFirst( str ) { str += ''; var f = str.charAt( 0 ).toUpperCase(); return f + str.substr( 1 ); } /* * The onlick function assigned to the 'Browse Server' button. Opens the * file browser and updates target field when file is selected. * * @param {CKEDITOR.event} * evt The event object. */ function browseServer( evt ) { var dialog = this.getDialog(); var editor = dialog.getParentEditor(); editor._.filebrowserSe = this; var width = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowWidth' ] || editor.config.filebrowserWindowWidth || '80%'; var height = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowHeight' ] || editor.config.filebrowserWindowHeight || '70%'; var params = this.filebrowser.params || {}; params.CKEditor = editor.name; params.CKEditorFuncNum = editor._.filebrowserFn; if ( !params.langCode ) params.langCode = editor.langCode; var url = addQueryString( this.filebrowser.url, params ); // TODO: V4: Remove backward compatibility (#8163). editor.popup( url, width, height, editor.config.filebrowserWindowFeatures || editor.config.fileBrowserWindowFeatures ); } /* * The onlick function assigned to the 'Upload' button. Makes the final * decision whether form is really submitted and updates target field when * file is uploaded. * * @param {CKEDITOR.event} * evt The event object. */ function uploadFile( evt ) { var dialog = this.getDialog(); var editor = dialog.getParentEditor(); editor._.filebrowserSe = this; // If user didn't select the file, stop the upload. if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement().$.value ) return false; if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getAction() ) return false; return true; } /* * Setups the file element. * * @param {CKEDITOR.ui.dialog.file} * fileInput The file element used during file upload. * @param {Object} * filebrowser Object containing filebrowser settings assigned to * the fileButton associated with this file element. */ function setupFileElement( editor, fileInput, filebrowser ) { var params = filebrowser.params || {}; params.CKEditor = editor.name; params.CKEditorFuncNum = editor._.filebrowserFn; if ( !params.langCode ) params.langCode = editor.langCode; fileInput.action = addQueryString( filebrowser.url, params ); fileInput.filebrowser = filebrowser; } /* * Traverse through the content definition and attach filebrowser to * elements with 'filebrowser' attribute. * * @param String * dialogName Dialog name. * @param {CKEDITOR.dialog.definitionObject} * definition Dialog definition. * @param {Array} * elements Array of {@link CKEDITOR.dialog.definition.content} * objects. */ function attachFileBrowser( editor, dialogName, definition, elements ) { var element, fileInput; for ( var i in elements ) { element = elements[ i ]; if ( element.type == 'hbox' || element.type == 'vbox' ) attachFileBrowser( editor, dialogName, definition, element.children ); if ( !element.filebrowser ) continue; if ( typeof element.filebrowser == 'string' ) { var fb = { action : ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse', target : element.filebrowser }; element.filebrowser = fb; } if ( element.filebrowser.action == 'Browse' ) { var url = element.filebrowser.url; if ( url === undefined ) { url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ]; if ( url === undefined ) url = editor.config.filebrowserBrowseUrl; } if ( url ) { element.onClick = browseServer; element.filebrowser.url = url; element.hidden = false; } } else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] ) { url = element.filebrowser.url; if ( url === undefined ) { url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ]; if ( url === undefined ) url = editor.config.filebrowserUploadUrl; } if ( url ) { var onClick = element.onClick; element.onClick = function( evt ) { // "element" here means the definition object, so we need to find the correct // button to scope the event call var sender = evt.sender; if ( onClick && onClick.call( sender, evt ) === false ) return false; return uploadFile.call( sender, evt ); }; element.filebrowser.url = url; element.hidden = false; setupFileElement( editor, definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser ); } } } } /* * Updates the target element with the url of uploaded/selected file. * * @param {String} * url The url of a file. */ function updateTargetElement( url, sourceElement ) { var dialog = sourceElement.getDialog(); var targetElement = sourceElement.filebrowser.target || null; url = url.replace( /#/g, '%23' ); // If there is a reference to targetElement, update it. if ( targetElement ) { var target = targetElement.split( ':' ); var element = dialog.getContentElement( target[ 0 ], target[ 1 ] ); if ( element ) { element.setValue( url ); dialog.selectPage( target[ 0 ] ); } } } /* * Returns true if filebrowser is configured in one of the elements. * * @param {CKEDITOR.dialog.definitionObject} * definition Dialog definition. * @param String * tabId The tab id where element(s) can be found. * @param String * elementId The element id (or ids, separated with a semicolon) to check. */ function isConfigured( definition, tabId, elementId ) { if ( elementId.indexOf( ";" ) !== -1 ) { var ids = elementId.split( ";" ); for ( var i = 0 ; i < ids.length ; i++ ) { if ( isConfigured( definition, tabId, ids[i] ) ) return true; } return false; } var elementFileBrowser = definition.getContents( tabId ).get( elementId ).filebrowser; return ( elementFileBrowser && elementFileBrowser.url ); } function setUrl( fileUrl, data ) { var dialog = this._.filebrowserSe.getDialog(), targetInput = this._.filebrowserSe[ 'for' ], onSelect = this._.filebrowserSe.filebrowser.onSelect; if ( targetInput ) dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).reset(); if ( typeof data == 'function' && data.call( this._.filebrowserSe ) === false ) return; if ( onSelect && onSelect.call( this._.filebrowserSe, fileUrl, data ) === false ) return; // The "data" argument may be used to pass the error message to the editor. if ( typeof data == 'string' && data ) alert( data ); if ( fileUrl ) updateTargetElement( fileUrl, this._.filebrowserSe ); } CKEDITOR.plugins.add( 'filebrowser', { init : function( editor, pluginPath ) { editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUrl, editor ); editor.on( 'destroy', function () { CKEDITOR.tools.removeFunction( this._.filebrowserFn ); } ); } } ); CKEDITOR.on( 'dialogDefinition', function( evt ) { var definition = evt.data.definition, element; // Associate filebrowser to elements with 'filebrowser' attribute. for ( var i in definition.contents ) { if ( ( element = definition.contents[ i ] ) ) { attachFileBrowser( evt.editor, evt.data.name, definition, element.elements ); if ( element.hidden && element.filebrowser ) { element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser ); } } } } ); } )(); /** * The location of an external file browser that should be launched when the <strong>Browse Server</strong> * button is pressed. If configured, the <strong>Browse Server</strong> button will appear in the * <strong>Link</strong>, <strong>Image</strong>, and <strong>Flash</strong> dialog windows. * @see The <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)">File Browser/Uploader</a> documentation. * @name CKEDITOR.config.filebrowserBrowseUrl * @since 3.0 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserBrowseUrl = '/browser/browse.php'; */ /** * The location of the script that handles file uploads. * If set, the <strong>Upload</strong> tab will appear in the <strong>Link</strong>, <strong>Image</strong>, * and <strong>Flash</strong> dialog windows. * @name CKEDITOR.config.filebrowserUploadUrl * @see The <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)">File Browser/Uploader</a> documentation. * @since 3.0 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserUploadUrl = '/uploader/upload.php'; */ /** * The location of an external file browser that should be launched when the <strong>Browse Server</strong> * button is pressed in the <strong>Image</strong> dialog window. * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserBrowseUrl}</code>. * @name CKEDITOR.config.filebrowserImageBrowseUrl * @since 3.0 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images'; */ /** * The location of an external file browser that should be launched when the <strong>Browse Server</strong> * button is pressed in the <strong>Flash</strong> dialog window. * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserBrowseUrl}</code>. * @name CKEDITOR.config.filebrowserFlashBrowseUrl * @since 3.0 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserFlashBrowseUrl = '/browser/browse.php?type=Flash'; */ /** * The location of the script that handles file uploads in the <strong>Image</strong> dialog window. * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserUploadUrl}</code>. * @name CKEDITOR.config.filebrowserImageUploadUrl * @since 3.0 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserImageUploadUrl = '/uploader/upload.php?type=Images'; */ /** * The location of the script that handles file uploads in the <strong>Flash</strong> dialog window. * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserUploadUrl}</code>. * @name CKEDITOR.config.filebrowserFlashUploadUrl * @since 3.0 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserFlashUploadUrl = '/uploader/upload.php?type=Flash'; */ /** * The location of an external file browser that should be launched when the <strong>Browse Server</strong> * button is pressed in the <strong>Link</strong> tab of the <strong>Image</strong> dialog window. * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserBrowseUrl}</code>. * @name CKEDITOR.config.filebrowserImageBrowseLinkUrl * @since 3.2 * @type String * @default <code>''</code> (empty string = disabled) * @example * config.filebrowserImageBrowseLinkUrl = '/browser/browse.php'; */ /** * The features to use in the file browser popup window. * @name CKEDITOR.config.filebrowserWindowFeatures * @since 3.4.1 * @type String * @default <code>'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes'</code> * @example * config.filebrowserWindowFeatures = 'resizable=yes,scrollbars=no'; */ /** * The width of the file browser popup window. It can be a number denoting a value in * pixels or a percent string. * @name CKEDITOR.config.filebrowserWindowWidth * @type Number|String * @default <code>'80%'</code> * @example * config.filebrowserWindowWidth = 750; * @example * config.filebrowserWindowWidth = '50%'; */ /** * The height of the file browser popup window. It can be a number denoting a value in * pixels or a percent string. * @name CKEDITOR.config.filebrowserWindowHeight * @type Number|String * @default <code>'70%'</code> * @example * config.filebrowserWindowHeight = 580; * @example * config.filebrowserWindowHeight = '50%'; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/filebrowser/plugin.js
JavaScript
asf20
17,567
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview Spell Check As You Type (SCAYT). * Button name : Scayt. */ (function() { var commandName = 'scaytcheck', openPage = ''; // Checks if a value exists in an array function in_array( needle, haystack ) { var found = 0, key; for ( key in haystack ) { if ( haystack[ key ] == needle ) { found = 1; break; } } return found; } var onEngineLoad = function() { var editor = this; var createInstance = function() // Create new instance every time Document is created. { var config = editor.config; // Initialise Scayt instance. var oParams = {}; // Get the iframe. oParams.srcNodeRef = editor.document.getWindow().$.frameElement; // syntax : AppName.AppVersion@AppRevision oParams.assocApp = 'CKEDITOR.' + CKEDITOR.version + '@' + CKEDITOR.revision; oParams.customerid = config.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2'; oParams.customDictionaryIds = config.scayt_customDictionaryIds || ''; oParams.userDictionaryName = config.scayt_userDictionaryName || ''; oParams.sLang = config.scayt_sLang || 'en_US'; // Introduce SCAYT onLoad callback. (#5632) oParams.onLoad = function() { // Draw down word marker to avoid being covered by background-color style.(#5466) if ( !( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) ) this.addStyle( this.selectorCss(), 'padding-bottom: 2px !important;' ); // Call scayt_control.focus when SCAYT loaded // and only if editor has focus and scayt control creates at first time (#5720) if ( editor.focusManager.hasFocus && !plugin.isControlRestored( editor ) ) this.focus(); }; oParams.onBeforeChange = function() { if ( plugin.getScayt( editor ) && !editor.checkDirty() ) setTimeout( function(){ editor.resetDirty(); }, 0 ); }; var scayt_custom_params = window.scayt_custom_params; if ( typeof scayt_custom_params == 'object' ) { for ( var k in scayt_custom_params ) oParams[ k ] = scayt_custom_params[ k ]; } // needs for restoring a specific scayt control settings if ( plugin.getControlId( editor ) ) oParams.id = plugin.getControlId( editor ); var scayt_control = new window.scayt( oParams ); scayt_control.afterMarkupRemove.push( function( node ) { ( new CKEDITOR.dom.element( node, scayt_control.document ) ).mergeSiblings(); } ); // Copy config. var lastInstance = plugin.instances[ editor.name ]; if ( lastInstance ) { scayt_control.sLang = lastInstance.sLang; scayt_control.option( lastInstance.option() ); scayt_control.paused = lastInstance.paused; } plugin.instances[ editor.name ] = scayt_control; try { scayt_control.setDisabled( plugin.isPaused( editor ) === false ); } catch (e) {} editor.fire( 'showScaytState' ); }; editor.on( 'contentDom', createInstance ); editor.on( 'contentDomUnload', function() { // Remove scripts. var scripts = CKEDITOR.document.getElementsByTag( 'script' ), scaytIdRegex = /^dojoIoScript(\d+)$/i, scaytSrcRegex = /^https?:\/\/svc\.webspellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i; for ( var i=0; i < scripts.count(); i++ ) { var script = scripts.getItem( i ), id = script.getId(), src = script.getAttribute( 'src' ); if ( id && src && id.match( scaytIdRegex ) && src.match( scaytSrcRegex )) script.remove(); } }); editor.on( 'beforeCommandExec', function( ev ) // Disable SCAYT before Source command execution. { if ( ( ev.data.name == 'source' || ev.data.name == 'newpage' ) && editor.mode == 'wysiwyg' ) { var scayt_instance = plugin.getScayt( editor ); if ( scayt_instance ) { plugin.setPaused( editor, !scayt_instance.disabled ); // store a control id for restore a specific scayt control settings plugin.setControlId( editor, scayt_instance.id ); scayt_instance.destroy( true ); delete plugin.instances[ editor.name ]; } } // Catch on source mode switch off (#5720) else if ( ev.data.name == 'source' && editor.mode == 'source' ) plugin.markControlRestore( editor ); }); editor.on( 'afterCommandExec', function( ev ) { if ( !plugin.isScaytEnabled( editor ) ) return; if ( editor.mode == 'wysiwyg' && ( ev.data.name == 'undo' || ev.data.name == 'redo' ) ) window.setTimeout( function() { plugin.getScayt( editor ).refresh(); }, 10 ); }); editor.on( 'destroy', function( ev ) { var editor = ev.editor, scayt_instance = plugin.getScayt( editor ); // SCAYT instance might already get destroyed by mode switch (#5744). if ( !scayt_instance ) return; delete plugin.instances[ editor.name ]; // store a control id for restore a specific scayt control settings plugin.setControlId( editor, scayt_instance.id ); scayt_instance.destroy( true ); }); // Listen to data manipulation to reflect scayt markup. editor.on( 'afterSetData', function() { if ( plugin.isScaytEnabled( editor ) ) { window.setTimeout( function() { var instance = plugin.getScayt( editor ); instance && instance.refresh(); }, 10 ); } }); // Reload spell-checking for current word after insertion completed. editor.on( 'insertElement', function() { var scayt_instance = plugin.getScayt( editor ); if ( plugin.isScaytEnabled( editor ) ) { // Unlock the selection before reload, SCAYT will take // care selection update. if ( CKEDITOR.env.ie ) editor.getSelection().unlock( true ); // Return focus to the editor and refresh SCAYT markup (#5573). window.setTimeout( function() { scayt_instance.focus(); scayt_instance.refresh(); }, 10 ); } }, this, null, 50 ); editor.on( 'insertHtml', function() { var scayt_instance = plugin.getScayt( editor ); if ( plugin.isScaytEnabled( editor ) ) { // Unlock the selection before reload, SCAYT will take // care selection update. if ( CKEDITOR.env.ie ) editor.getSelection().unlock( true ); // Return focus to the editor (#5573) // Refresh SCAYT markup window.setTimeout( function() { scayt_instance.focus(); scayt_instance.refresh(); }, 10 ); } }, this, null, 50 ); editor.on( 'scaytDialog', function( ev ) // Communication with dialog. { ev.data.djConfig = window.djConfig; ev.data.scayt_control = plugin.getScayt( editor ); ev.data.tab = openPage; ev.data.scayt = window.scayt; }); var dataProcessor = editor.dataProcessor, htmlFilter = dataProcessor && dataProcessor.htmlFilter; if ( htmlFilter ) { htmlFilter.addRules( { elements : { span : function( element ) { if ( element.attributes[ 'data-scayt_word' ] && element.attributes[ 'data-scaytid' ] ) { delete element.name; // Write children, but don't write this node. return element; } } } } ); } // Override Image.equals method avoid CK snapshot module to add SCAYT markup to snapshots. (#5546) var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype; undoImagePrototype.equals = CKEDITOR.tools.override( undoImagePrototype.equals, function( org ) { return function( otherImage ) { var thisContents = this.contents, otherContents = otherImage.contents; var scayt_instance = plugin.getScayt( this.editor ); // Making the comparison based on content without SCAYT word markers. if ( scayt_instance && plugin.isScaytReady( this.editor ) ) { // scayt::reset might return value undefined. (#5742) this.contents = scayt_instance.reset( thisContents ) || ''; otherImage.contents = scayt_instance.reset( otherContents ) || ''; } var retval = org.apply( this, arguments ); this.contents = thisContents; otherImage.contents = otherContents; return retval; }; }); if ( editor.document ) createInstance(); }; CKEDITOR.plugins.scayt = { engineLoaded : false, instances : {}, // Data storage for SCAYT control, based on editor instances controlInfo : {}, setControlInfo : function( editor, o ) { if ( editor && editor.name && typeof ( this.controlInfo[ editor.name ] ) != 'object' ) this.controlInfo[ editor.name ] = {}; for ( var infoOpt in o ) this.controlInfo[ editor.name ][ infoOpt ] = o[ infoOpt ]; }, isControlRestored : function( editor ) { if ( editor && editor.name && this.controlInfo[ editor.name ] ) { return this.controlInfo[ editor.name ].restored ; } return false; }, markControlRestore : function( editor ) { this.setControlInfo( editor, { restored:true } ); }, setControlId: function( editor, id ) { this.setControlInfo( editor, { id:id } ); }, getControlId: function( editor ) { if ( editor && editor.name && this.controlInfo[ editor.name ] && this.controlInfo[ editor.name ].id ) { return this.controlInfo[ editor.name ].id; } return null; }, setPaused: function( editor , bool ) { this.setControlInfo( editor, { paused:bool } ); }, isPaused: function( editor ) { if ( editor && editor.name && this.controlInfo[editor.name] ) { return this.controlInfo[editor.name].paused; } return undefined; }, getScayt : function( editor ) { return this.instances[ editor.name ]; }, isScaytReady : function( editor ) { return this.engineLoaded === true && 'undefined' !== typeof window.scayt && this.getScayt( editor ); }, isScaytEnabled : function( editor ) { var scayt_instance = this.getScayt( editor ); return ( scayt_instance ) ? scayt_instance.disabled === false : false; }, getUiTabs : function( editor ) { var uiTabs = []; // read UI tabs value from config var configUiTabs = editor.config.scayt_uiTabs || "1,1,1"; // convert string to array configUiTabs = configUiTabs.split( ',' ); // "About us" should be always shown for standard config configUiTabs[3] = "1"; for ( var i = 0; i < 4; i++ ) { uiTabs[i] = (typeof window.scayt != "undefined" && typeof window.scayt.uiTags != "undefined") ? (parseInt(configUiTabs[i],10) && window.scayt.uiTags[i]) : parseInt(configUiTabs[i],10); } return uiTabs; }, loadEngine : function( editor ) { // SCAYT doesn't work with Firefox2, Opera and AIR. if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 || CKEDITOR.env.opera || CKEDITOR.env.air ) return editor.fire( 'showScaytState' ); if ( this.engineLoaded === true ) return onEngineLoad.apply( editor ); // Add new instance. else if ( this.engineLoaded == -1 ) // We are waiting. return CKEDITOR.on( 'scaytReady', function(){ onEngineLoad.apply( editor ); } ); // Use function(){} to avoid rejection as duplicate. CKEDITOR.on( 'scaytReady', onEngineLoad, editor ); CKEDITOR.on( 'scaytReady', function() { this.engineLoaded = true; }, this, null, 0 ); // First to run. this.engineLoaded = -1; // Loading in progress. // compose scayt url var protocol = document.location.protocol; // Default to 'http' for unknown. protocol = protocol.search( /https?:/) != -1? protocol : 'http:'; var baseUrl = 'svc.webspellchecker.net/scayt26/loader__base.js'; var scaytUrl = editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl ); var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + '/'; if( window.scayt == undefined ) { CKEDITOR._djScaytConfig = { baseUrl: scaytConfigBaseUrl, addOnLoad: [ function() { CKEDITOR.fireOnce( 'scaytReady' ); } ], isDebug: false }; // Append javascript code. CKEDITOR.document.getHead().append( CKEDITOR.document.createElement( 'script', { attributes : { type : 'text/javascript', async : 'true', src : scaytUrl } }) ); } else CKEDITOR.fireOnce( 'scaytReady' ); return null; }, parseUrl : function ( data ) { var match; if ( data.match && ( match = data.match(/(.*)[\/\\](.*?\.\w+)$/) ) ) return { path: match[1], file: match[2] }; else return data; } }; var plugin = CKEDITOR.plugins.scayt; // Context menu constructing. var addButtonCommand = function( editor, buttonName, buttonLabel, commandName, command, menugroup, menuOrder ) { editor.addCommand( commandName, command ); // If the "menu" plugin is loaded, register the menu item. editor.addMenuItem( commandName, { label : buttonLabel, command : commandName, group : menugroup, order : menuOrder }); }; var commandDefinition = { preserveState : true, editorFocus : false, canUndo : false, exec: function( editor ) { if ( plugin.isScaytReady( editor ) ) { var isEnabled = plugin.isScaytEnabled( editor ); this.setState( isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_ON ); var scayt_control = plugin.getScayt( editor ); // the place where the status of editor focus should be restored // after there will be ability to store its state before SCAYT button click // if (storedFocusState is focused ) // scayt_control.focus(); // // now focus is set certainly scayt_control.focus(); scayt_control.setDisabled( isEnabled ); } else if ( !editor.config.scayt_autoStartup && plugin.engineLoaded >= 0 ) // Load first time { this.setState( CKEDITOR.TRISTATE_DISABLED ); plugin.loadEngine( editor ); } } }; // Add scayt plugin. CKEDITOR.plugins.add( 'scayt', { requires : [ 'menubutton' ], beforeInit : function( editor ) { var items_order = editor.config.scayt_contextMenuItemsOrder || 'suggest|moresuggest|control', items_order_str = ""; items_order = items_order.split( '|' ); if ( items_order && items_order.length ) { for ( var pos = 0 ; pos < items_order.length ; pos++ ) items_order_str += 'scayt_' + items_order[ pos ] + ( items_order.length != parseInt( pos, 10 ) + 1 ? ',' : '' ); } // Put it on top of all context menu items (#5717) editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups; }, init : function( editor ) { // Delete span[data-scaytid] when text pasting in editor (#6921) var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter; var dataFilterRules = { elements : { span : function( element ) { var attrs = element.attributes; if ( attrs && attrs[ 'data-scaytid' ] ) delete element.name; } } }; dataFilter && dataFilter.addRules( dataFilterRules ); var moreSuggestions = {}, mainSuggestions = {}; // Scayt command. var command = editor.addCommand( commandName, commandDefinition ); // Add Options dialog. CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) ); var uiTabs = plugin.getUiTabs( editor ); var menuGroup = 'scaytButton'; editor.addMenuGroup( menuGroup ); // combine menu items to render var uiMenuItems = {}; var lang = editor.lang.scayt; // always added uiMenuItems.scaytToggle = { label : lang.enable, command : commandName, group : menuGroup }; if ( uiTabs[0] == 1 ) uiMenuItems.scaytOptions = { label : lang.options, group : menuGroup, onClick : function() { openPage = 'options'; editor.openDialog( commandName ); } }; if ( uiTabs[1] == 1 ) uiMenuItems.scaytLangs = { label : lang.langs, group : menuGroup, onClick : function() { openPage = 'langs'; editor.openDialog( commandName ); } }; if ( uiTabs[2] == 1 ) uiMenuItems.scaytDict = { label : lang.dictionariesTab, group : menuGroup, onClick : function() { openPage = 'dictionaries'; editor.openDialog( commandName ); } }; // always added uiMenuItems.scaytAbout = { label : editor.lang.scayt.about, group : menuGroup, onClick : function() { openPage = 'about'; editor.openDialog( commandName ); } }; editor.addMenuItems( uiMenuItems ); editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON, { label : lang.title, title : CKEDITOR.env.opera ? lang.opera_title : lang.title, className : 'cke_button_scayt', modes : { wysiwyg : 1 }, onRender: function() { command.on( 'state', function() { this.setState( command.state ); }, this); }, onMenu : function() { var isEnabled = plugin.isScaytEnabled( editor ); editor.getMenuItem( 'scaytToggle' ).label = lang[ isEnabled ? 'disable' : 'enable' ]; var uiTabs = plugin.getUiTabs( editor ); return { scaytToggle : CKEDITOR.TRISTATE_OFF, scaytOptions : isEnabled && uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, scaytLangs : isEnabled && uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, scaytDict : isEnabled && uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, scaytAbout : isEnabled && uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED }; } }); // If the "contextmenu" plugin is loaded, register the listeners. if ( editor.contextMenu && editor.addMenuItems ) { editor.contextMenu.addListener( function( element, selection ) { if ( !plugin.isScaytEnabled( editor ) || selection.getRanges()[ 0 ].checkReadOnly() ) return null; var scayt_control = plugin.getScayt( editor ), node = scayt_control.getScaytNode(); if ( !node ) return null; var word = scayt_control.getWord( node ); if ( !word ) return null; var sLang = scayt_control.getLang(), _r = {}, items_suggestion = window.scayt.getSuggestion( word, sLang ); if ( !items_suggestion || !items_suggestion.length ) return null; // Remove unused commands and menuitems for ( var m in moreSuggestions ) { delete editor._.menuItems[ m ]; delete editor._.commands[ m ]; } for ( m in mainSuggestions ) { delete editor._.menuItems[ m ]; delete editor._.commands[ m ]; } moreSuggestions = {}; // Reset items. mainSuggestions = {}; var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on'; var moreSuggestionsUnableAdded = false; var maxSuggestions = editor.config.scayt_maxSuggestions; ( typeof maxSuggestions != 'number' ) && ( maxSuggestions = 5 ); !maxSuggestions && ( maxSuggestions = items_suggestion.length ); var contextCommands = editor.config.scayt_contextCommands || 'all'; contextCommands = contextCommands.split( '|' ); for ( var i = 0, l = items_suggestion.length; i < l; i += 1 ) { var commandName = 'scayt_suggestion_' + items_suggestion[i].replace( ' ', '_' ); var exec = ( function( el, s ) { return { exec: function() { scayt_control.replace( el, s ); } }; })( node, items_suggestion[i] ); if ( i < maxSuggestions ) { addButtonCommand( editor, 'button_' + commandName, items_suggestion[i], commandName, exec, 'scayt_suggest', i + 1 ); _r[ commandName ] = CKEDITOR.TRISTATE_OFF; mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF; } else if ( moreSuggestionsUnable == 'on' ) { addButtonCommand( editor, 'button_' + commandName, items_suggestion[i], commandName, exec, 'scayt_moresuggest', i + 1 ); moreSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF; moreSuggestionsUnableAdded = true; } } if ( moreSuggestionsUnableAdded ) { // Register the More suggestions group; editor.addMenuItem( 'scayt_moresuggest', { label : lang.moreSuggestions, group : 'scayt_moresuggest', order : 10, getItems : function() { return moreSuggestions; } }); mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF; } if ( in_array( 'all', contextCommands ) || in_array( 'ignore', contextCommands) ) { var ignore_command = { exec: function(){ scayt_control.ignore( node ); } }; addButtonCommand( editor, 'ignore', lang.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 ); mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF; } if ( in_array( 'all', contextCommands ) || in_array( 'ignoreall', contextCommands ) ) { var ignore_all_command = { exec: function(){ scayt_control.ignoreAll( node ); } }; addButtonCommand(editor, 'ignore_all', lang.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2); mainSuggestions['scayt_ignore_all'] = CKEDITOR.TRISTATE_OFF; } if ( in_array( 'all', contextCommands ) || in_array( 'add', contextCommands ) ) { var addword_command = { exec: function(){ window.scayt.addWordToUserDictionary( node ); } }; addButtonCommand(editor, 'add_word', lang.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3); mainSuggestions['scayt_add_word'] = CKEDITOR.TRISTATE_OFF; } if ( scayt_control.fireOnContextMenu ) scayt_control.fireOnContextMenu( editor ); return mainSuggestions; }); } var showInitialState = function() { editor.removeListener( 'showScaytState', showInitialState ); if ( !CKEDITOR.env.opera && !CKEDITOR.env.air ) command.setState( plugin.isScaytEnabled( editor ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); else command.setState( CKEDITOR.TRISTATE_DISABLED ); }; editor.on( 'showScaytState', showInitialState ); if ( CKEDITOR.env.opera || CKEDITOR.env.air ) { editor.on( 'instanceReady', function() { showInitialState(); }); } // Start plugin if ( editor.config.scayt_autoStartup ) { editor.on( 'instanceReady', function() { plugin.loadEngine( editor ); }); } }, afterInit : function( editor ) { // Prevent word marker line from displaying in elements path and been removed when cleaning format. (#3570) (#4125) var elementsPathFilters, scaytFilter = function( element ) { if ( element.hasAttribute( 'data-scaytid' ) ) return false; }; if ( editor._.elementsPath && ( elementsPathFilters = editor._.elementsPath.filters ) ) elementsPathFilters.push( scaytFilter ); editor.addRemoveFormatFilter && editor.addRemoveFormatFilter( scaytFilter ); } }); })(); /** * If enabled (set to <code>true</code>), turns on SCAYT automatically * after loading the editor. * @name CKEDITOR.config.scayt_autoStartup * @type Boolean * @default <code>false</code> * @example * config.scayt_autoStartup = true; */ /** * Defines the number of SCAYT suggestions to show in the main context menu. * Possible values are: * <ul> * <li><code>0</code> (zero) &ndash; All suggestions are displayed in the main context menu.</li> * <li>Positive number &ndash; The maximum number of suggestions to show in the context * menu. Other entries will be shown in the "More Suggestions" sub-menu.</li> * <li>Negative number &ndash; No suggestions are shown in the main context menu. All * entries will be listed in the the "Suggestions" sub-menu.</li> * </ul> * @name CKEDITOR.config.scayt_maxSuggestions * @type Number * @default <code>5</code> * @example * // Display only three suggestions in the main context menu. * config.scayt_maxSuggestions = 3; * @example * // Do not show the suggestions directly. * config.scayt_maxSuggestions = -1; */ /** * Sets the customer ID for SCAYT. Required for migration from free, * ad-supported version to paid, ad-free version. * @name CKEDITOR.config.scayt_customerid * @type String * @default <code>''</code> * @example * // Load SCAYT using my customer ID. * config.scayt_customerid = 'your-encrypted-customer-id'; */ /** * Enables/disables the "More Suggestions" sub-menu in the context menu. * Possible values are <code>on</code> and <code>off</code>. * @name CKEDITOR.config.scayt_moreSuggestions * @type String * @default <code>'on'</code> * @example * // Disables the "More Suggestions" sub-menu. * config.scayt_moreSuggestions = 'off'; */ /** * Customizes the display of SCAYT context menu commands ("Add Word", "Ignore" * and "Ignore All"). This must be a string with one or more of the following * words separated by a pipe character ("|"): * <ul> * <li><code>off</code> &ndash; disables all options.</li> * <li><code>all</code> &ndash; enables all options.</li> * <li><code>ignore</code> &ndash; enables the "Ignore" option.</li> * <li><code>ignoreall</code> &ndash; enables the "Ignore All" option.</li> * <li><code>add</code> &ndash; enables the "Add Word" option.</li> * </ul> * @name CKEDITOR.config.scayt_contextCommands * @type String * @default <code>'all'</code> * @example * // Show only "Add Word" and "Ignore All" in the context menu. * config.scayt_contextCommands = 'add|ignoreall'; */ /** * Sets the default spell checking language for SCAYT. Possible values are: * <code>en_US</code>, <code>en_GB</code>, <code>pt_BR</code>, <code>da_DK</code>, * <code>nl_NL</code>, <code>en_CA</code>, <code>fi_FI</code>, <code>fr_FR</code>, * <code>fr_CA</code>, <code>de_DE</code>, <code>el_GR</code>, <code>it_IT</code>, * <code>nb_NO</code>, <code>pt_PT</code>, <code>es_ES</code>, <code>sv_SE</code>. * @name CKEDITOR.config.scayt_sLang * @type String * @default <code>'en_US'</code> * @example * // Sets SCAYT to German. * config.scayt_sLang = 'de_DE'; */ /** * Sets the visibility of particular tabs in the SCAYT dialog window and toolbar * button. This setting must contain a <code>1</code> (enabled) or <code>0</code> * (disabled) value for each of the following entries, in this precise order, * separated by a comma (","): "Options", "Languages", and "Dictionary". * @name CKEDITOR.config.scayt_uiTabs * @type String * @default <code>'1,1,1'</code> * @example * // Hides the "Languages" tab. * config.scayt_uiTabs = '1,0,1'; */ /** * Sets the URL to SCAYT core. Required to switch to the licensed version of SCAYT application. * Further details available at * <a href="http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck"> * http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck</a>. * @name CKEDITOR.config.scayt_srcUrl * @type String * @default <code>''</code> * @example * config.scayt_srcUrl = "http://my-host/spellcheck/lf/scayt/scayt.js"; */ /** * Links SCAYT to custom dictionaries. This is a string containing dictionary IDs * separared by commas (","). Available only for the licensed version. * Further details at * <a href="http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed"> * http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed</a>. * @name CKEDITOR.config.scayt_customDictionaryIds * @type String * @default <code>''</code> * @example * config.scayt_customDictionaryIds = '3021,3456,3478"'; */ /** * Makes it possible to activate a custom dictionary in SCAYT. The user * dictionary name must be used. Available only for the licensed version. * @name CKEDITOR.config.scayt_userDictionaryName * @type String * @default <code>''</code> * @example * config.scayt_userDictionaryName = 'MyDictionary'; */ /** * Defines the order SCAYT context menu items by groups. * This must be a string with one or more of the following * words separated by a pipe character ("|"): * <ul> * <li><code>suggest</code> &ndash; main suggestion word list,</li> * <li><code>moresuggest</code> &ndash; more suggestions word list,</li> * <li><code>control</code> &ndash; SCAYT commands, such as "Ignore" and "Add Word".</li> * </ul> * * @name CKEDITOR.config.scayt_contextMenuItemsOrder * @type String * @default <code>'suggest|moresuggest|control'</code> * @example * config.scayt_contextMenuItemsOrder = 'moresuggest|control|suggest'; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/scayt/plugin.js
JavaScript
asf20
29,975
a { text-decoration:none; padding: 2px 4px 4px 6px; display : block; border-width: 1px; border-style: solid; margin : 0px; } a.cke_scayt_toogle:hover, a.cke_scayt_toogle:focus, a.cke_scayt_toogle:active { border-color: #316ac5; background-color: #dff1ff; color : #000; cursor: pointer; margin : 0px; } a.cke_scayt_toogle { color : #316ac5; border-color: #fff; } .scayt_enabled a.cke_scayt_item { color : #316ac5; border-color: #fff; margin : 0px; } .scayt_disabled a.cke_scayt_item { color : gray; border-color : #fff; } .scayt_enabled a.cke_scayt_item:hover, .scayt_enabled a.cke_scayt_item:focus, .scayt_enabled a.cke_scayt_item:active { border-color: #316ac5; background-color: #dff1ff; color : #000; cursor: pointer; } .scayt_disabled a.cke_scayt_item:hover, .scayt_disabled a.cke_scayt_item:focus, .scayt_disabled a.cke_scayt_item:active { border-color: gray; background-color: #dff1ff; color : gray; cursor: no-drop; } .cke_scayt_set_on, .cke_scayt_set_off { display: none; } .scayt_enabled .cke_scayt_set_on { display: none; } .scayt_disabled .cke_scayt_set_on { display: inline; } .scayt_disabled .cke_scayt_set_off { display: none; } .scayt_enabled .cke_scayt_set_off { display: inline; }
zysms
trunk/zysms/include/ckeditor/_source/plugins/scayt/dialogs/toolbar.css
CSS
asf20
1,302
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) { var firstLoad = true, captions, doc = CKEDITOR.document, editorName = editor.name, tags = CKEDITOR.plugins.scayt.getUiTabs( editor ), i, contents = [], userDicActive = 0, dic_buttons = [ // [0] contains buttons for creating "dic_create_" + editorName + ",dic_restore_" + editorName, // [1] contains buton for manipulation "dic_rename_" + editorName + ",dic_delete_" + editorName ], optionsIds = [ 'mixedCase', 'mixedWithDigits', 'allCaps', 'ignoreDomainNames' ]; // common operations function getBOMAllOptions() { if (typeof document.forms["optionsbar_" + editorName] != "undefined") return document.forms["optionsbar_" + editorName]["options"]; return []; } function getBOMAllLangs() { if (typeof document.forms["languagesbar_" + editorName] != "undefined") return document.forms["languagesbar_" + editorName]["scayt_lang"]; return []; } function setCheckedValue( radioObj, newValue ) { if ( !radioObj ) return; var radioLength = radioObj.length; if ( radioLength == undefined ) { radioObj.checked = radioObj.value == newValue.toString(); return; } for ( var i = 0; i < radioLength; i++ ) { radioObj[i].checked = false; if ( radioObj[i].value == newValue.toString() ) radioObj[i].checked = true; } } var lang = editor.lang.scayt; var tags_contents = [ { id : 'options', label : lang.optionsTab, elements : [ { type : 'html', id : 'options', html : '<form name="optionsbar_' + editorName + '"><div class="inner_options">' + ' <div class="messagebox"></div>' + ' <div style="display:none;">' + ' <input type="checkbox" name="options" id="allCaps_' + editorName + '" />' + ' <label for="allCaps" id="label_allCaps_' + editorName + '"></label>' + ' </div>' + ' <div style="display:none;">' + ' <input name="options" type="checkbox" id="ignoreDomainNames_' + editorName + '" />' + ' <label for="ignoreDomainNames" id="label_ignoreDomainNames_' + editorName + '"></label>' + ' </div>' + ' <div style="display:none;">' + ' <input name="options" type="checkbox" id="mixedCase_' + editorName + '" />' + ' <label for="mixedCase" id="label_mixedCase_' + editorName + '"></label>' + ' </div>' + ' <div style="display:none;">' + ' <input name="options" type="checkbox" id="mixedWithDigits_' + editorName + '" />' + ' <label for="mixedWithDigits" id="label_mixedWithDigits_' + editorName + '"></label>' + ' </div>' + '</div></form>' } ] }, { id : 'langs', label : lang.languagesTab, elements : [ { type : 'html', id : 'langs', html : '<form name="languagesbar_' + editorName + '"><div class="inner_langs">' + ' <div class="messagebox"></div> ' + ' <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol_' + editorName + '" ></div>' + ' <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol_' + editorName + '"></div>' + '</div></form>' } ] }, { id : 'dictionaries', label : lang.dictionariesTab, elements : [ { type : 'html', style: '', id : 'dictionaries', html : '<form name="dictionarybar_' + editorName + '"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">' + ' <div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message_' + editorName + '"> </div>' + ' <div style="margin:5px auto; width:80%;white-space:normal;"> ' + ' <span class="cke_dialog_ui_labeled_label" >Dictionary name</span><br>'+ ' <span class="cke_dialog_ui_labeled_content" >'+ ' <div class="cke_dialog_ui_input_text">'+ ' <input id="dic_name_' + editorName + '" type="text" class="cke_dialog_ui_input_text"/>'+ ' </div></span></div>'+ ' <div style="margin:5px auto; width:80%;white-space:normal;">'+ ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create_' + editorName + '">'+ ' </a>' + ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete_' + editorName + '">'+ ' </a>' + ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename_' + editorName + '">'+ ' </a>' + ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore_' + editorName + '">'+ ' </a>' + ' </div>' + ' <div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info_' + editorName + '"></div>' + '</div></form>' } ] }, { id : 'about', label : lang.aboutTab, elements : [ { type : 'html', id : 'about', style : 'margin: 5px 5px;', html : '<div id="scayt_about_' + editorName + '"></div>' } ] } ]; var dialogDefiniton = { title : lang.title, minWidth : 360, minHeight : 220, onShow : function() { var dialog = this; dialog.data = editor.fire( 'scaytDialog', {} ); dialog.options = dialog.data.scayt_control.option(); dialog.chosed_lang = dialog.sLang = dialog.data.scayt_control.sLang; if ( !dialog.data || !dialog.data.scayt || !dialog.data.scayt_control ) { alert( 'Error loading application service' ); dialog.hide(); return; } var stop = 0; if ( firstLoad ) { dialog.data.scayt.getCaption( editor.langCode || 'en', function( caps ) { if ( stop++ > 0 ) // Once only return; captions = caps; init_with_captions.apply( dialog ); reload.apply( dialog ); firstLoad = false; }); } else reload.apply( dialog ); dialog.selectPage( dialog.data.tab ); }, onOk : function() { var scayt_control = this.data.scayt_control; scayt_control.option( this.options ); // Setup language if it was changed. var csLang = this.chosed_lang; scayt_control.setLang( csLang ); scayt_control.refresh(); }, onCancel: function() { var o = getBOMAllOptions(); for ( var i in o ) o[i].checked = false; setCheckedValue( getBOMAllLangs(), "" ); }, contents : contents }; var scayt_control = CKEDITOR.plugins.scayt.getScayt( editor ); for ( i = 0; i < tags.length; i++ ) { if ( tags[ i ] == 1 ) contents[ contents.length ] = tags_contents[ i ]; } if ( tags[2] == 1 ) userDicActive = 1; var init_with_captions = function() { var dialog = this, lang_list = dialog.data.scayt.getLangList(), buttonCaptions = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ], buttonIds = [], langList = [], labels = optionsIds, i; // Add buttons titles if ( userDicActive ) { for ( i = 0; i < buttonCaptions.length; i++ ) { buttonIds[ i ] = buttonCaptions[ i ] + "_" + editorName; doc.getById( buttonIds[ i ] ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + buttonCaptions[ i ]] +'</span>' ); } doc.getById( 'dic_info_' + editorName ).setHtml( captions[ 'dic_info' ] ); } // Fill options and dictionary labels. if ( tags[0] == 1 ) { for ( i in labels ) { var labelCaption = 'label_' + labels[ i ], labelId = labelCaption + '_' + editorName, labelElement = doc.getById( labelId ); if ( 'undefined' != typeof labelElement && 'undefined' != typeof captions[ labelCaption ] && 'undefined' != typeof dialog.options[labels[ i ]] ) { labelElement.setHtml( captions[ labelCaption ] ); var labelParent = labelElement.getParent(); labelParent.$.style.display = "block"; } } } var about = '<p><img src="' + window.scayt.getAboutInfo().logoURL + '" /></p>' + '<p>' + captions[ 'version' ] + window.scayt.getAboutInfo().version.toString() + '</p>' + '<p>' + captions[ 'about_throwt_copy' ] + '</p>'; doc.getById( 'scayt_about_' + editorName ).setHtml( about ); // Create languages tab. var createOption = function( option, list ) { var label = doc.createElement( 'label' ); label.setAttribute( 'for', 'cke_option' + option ); label.setHtml( list[ option ] ); if ( dialog.sLang == option ) // Current. dialog.chosed_lang = option; var div = doc.createElement( 'div' ); var radio = CKEDITOR.dom.element.createFromHtml( '<input id="cke_option' + option + '" type="radio" ' + ( dialog.sLang == option ? 'checked="checked"' : '' ) + ' value="' + option + '" name="scayt_lang" />' ); radio.on( 'click', function() { this.$.checked = true; dialog.chosed_lang = option; }); div.append( radio ); div.append( label ); return { lang : list[ option ], code : option, radio : div }; }; if ( tags[1] ==1 ) { for ( i in lang_list.rtl ) langList[ langList.length ] = createOption( i, lang_list.ltr ); for ( i in lang_list.ltr ) langList[ langList.length ] = createOption( i, lang_list.ltr ); langList.sort( function( lang1, lang2 ) { return ( lang2.lang > lang1.lang ) ? -1 : 1 ; }); var fieldL = doc.getById( 'scayt_lcol_' + editorName ), fieldR = doc.getById( 'scayt_rcol_' + editorName ); for ( i=0; i < langList.length; i++ ) { var field = ( i < langList.length / 2 ) ? fieldL : fieldR; field.append( langList[ i ].radio ); } } // user dictionary handlers var dic = {}; dic.dic_create = function( el, dic_name , dic_buttons ) { // comma separated button's ids include repeats if exists var all_buttons = dic_buttons[0] + ',' + dic_buttons[1]; var err_massage = captions["err_dic_create"]; var suc_massage = captions["succ_dic_create"]; window.scayt.createUserDictionary( dic_name, function( arg ) { hide_dic_buttons ( all_buttons ); display_dic_buttons ( dic_buttons[1] ); suc_massage = suc_massage.replace("%s" , arg.dname ); dic_success_message (suc_massage); }, function( arg ) { err_massage = err_massage.replace("%s" ,arg.dname ); dic_error_message ( err_massage + "( "+ (arg.message || "") +")"); }); }; dic.dic_rename = function( el, dic_name ) { // // try to rename dictionary var err_massage = captions["err_dic_rename"] || ""; var suc_massage = captions["succ_dic_rename"] || ""; window.scayt.renameUserDictionary( dic_name, function( arg ) { suc_massage = suc_massage.replace("%s" , arg.dname ); set_dic_name( dic_name ); dic_success_message ( suc_massage ); }, function( arg ) { err_massage = err_massage.replace("%s" , arg.dname ); set_dic_name( dic_name ); dic_error_message( err_massage + "( " + ( arg.message || "" ) + " )" ); }); }; dic.dic_delete = function( el, dic_name , dic_buttons ) { var all_buttons = dic_buttons[0] + ',' + dic_buttons[1]; var err_massage = captions["err_dic_delete"]; var suc_massage = captions["succ_dic_delete"]; // try to delete dictionary window.scayt.deleteUserDictionary( function( arg ) { suc_massage = suc_massage.replace("%s" , arg.dname ); hide_dic_buttons ( all_buttons ); display_dic_buttons ( dic_buttons[0] ); set_dic_name( "" ); // empty input field dic_success_message( suc_massage ); }, function( arg ) { err_massage = err_massage.replace("%s" , arg.dname ); dic_error_message(err_massage); }); }; dic.dic_restore = dialog.dic_restore || function( el, dic_name , dic_buttons ) { // try to restore existing dictionary var all_buttons = dic_buttons[0] + ',' + dic_buttons[1]; var err_massage = captions["err_dic_restore"]; var suc_massage = captions["succ_dic_restore"]; window.scayt.restoreUserDictionary(dic_name, function( arg ) { suc_massage = suc_massage.replace("%s" , arg.dname ); hide_dic_buttons ( all_buttons ); display_dic_buttons(dic_buttons[1]); dic_success_message( suc_massage ); }, function( arg ) { err_massage = err_massage.replace("%s" , arg.dname ); dic_error_message( err_massage ); }); }; function onDicButtonClick( ev ) { var dic_name = doc.getById('dic_name_' + editorName).getValue(); if ( !dic_name ) { dic_error_message(" Dictionary name should not be empty. "); return false; } try{ var el = ev.data.getTarget().getParent(); var id = /(dic_\w+)_[\w\d]+/.exec(el.getId())[1]; dic[ id ].apply( null, [ el, dic_name, dic_buttons ] ); } catch(err) { dic_error_message(" Dictionary error. "); } return true; } // ** bind event listeners var arr_buttons = ( dic_buttons[0] + ',' + dic_buttons[1] ).split( ',' ), l; for ( i = 0, l = arr_buttons.length ; i < l ; i += 1 ) { var dic_button = doc.getById(arr_buttons[i]); if ( dic_button ) dic_button.on( 'click', onDicButtonClick, this ); } }; var reload = function() { var dialog = this; // for enabled options tab if ( tags[0] == 1 ){ var opto = getBOMAllOptions(); // Animate options. for ( var k=0,l = opto.length; k<l;k++ ) { var i = opto[k].id; var checkbox = doc.getById( i ); if ( checkbox ) { opto[k].checked = false; //alert (opto[k].removeAttribute) if ( dialog.options[ i.split("_")[0] ] == 1 ) { opto[k].checked = true; } // Bind events. Do it only once. if ( firstLoad ) { checkbox.on( 'click', function() { dialog.options[ this.getId().split("_")[0] ] = this.$.checked ? 1 : 0 ; }); } } } } //for enabled languages tab if ( tags[1] == 1 ) { var domLang = doc.getById("cke_option" + dialog.sLang); setCheckedValue( domLang.$,dialog.sLang ); } // * user dictionary if ( userDicActive ) { window.scayt.getNameUserDictionary( function( o ) { var dic_name = o.dname; hide_dic_buttons( dic_buttons[0] + ',' + dic_buttons[1] ); if ( dic_name ) { doc.getById( 'dic_name_' + editorName ).setValue(dic_name); display_dic_buttons( dic_buttons[1] ); } else display_dic_buttons( dic_buttons[0] ); }, function() { doc.getById( 'dic_name_' + editorName ).setValue(""); }); dic_success_message(""); } }; function dic_error_message( m ) { doc.getById('dic_message_' + editorName).setHtml('<span style="color:red;">' + m + '</span>' ); } function dic_success_message( m ) { doc.getById('dic_message_' + editorName).setHtml('<span style="color:blue;">' + m + '</span>') ; } function display_dic_buttons( sIds ) { sIds = String( sIds ); var aIds = sIds.split(','); for ( var i=0, l = aIds.length; i < l ; i+=1) doc.getById( aIds[i] ).$.style.display = "inline"; } function hide_dic_buttons( sIds ) { sIds = String( sIds ); var aIds = sIds.split(','); for ( var i = 0, l = aIds.length; i < l ; i += 1 ) doc.getById( aIds[i] ).$.style.display = "none"; } function set_dic_name( dic_name ) { doc.getById('dic_name_' + editorName).$.value= dic_name; } return dialogDefiniton; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/scayt/dialogs/options.js
JavaScript
asf20
16,191
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'listblock', { requires : [ 'panel' ], onLoad : function() { CKEDITOR.ui.panel.prototype.addListBlock = function( name, definition ) { return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), definition ) ); }; CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass( { base : CKEDITOR.ui.panel.block, $ : function( blockHolder, blockDefinition ) { blockDefinition = blockDefinition || {}; var attribs = blockDefinition.attributes || ( blockDefinition.attributes = {} ); ( this.multiSelect = !!blockDefinition.multiSelect ) && ( attribs[ 'aria-multiselectable' ] = true ); // Provide default role of 'listbox'. !attribs.role && ( attribs.role = 'listbox' ); // Call the base contructor. this.base.apply( this, arguments ); var keys = this.keys; keys[ 40 ] = 'next'; // ARROW-DOWN keys[ 9 ] = 'next'; // TAB keys[ 38 ] = 'prev'; // ARROW-UP keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB keys[ 32 ] = CKEDITOR.env.ie ? 'mouseup' : 'click'; // SPACE CKEDITOR.env.ie && ( keys[ 13 ] = 'mouseup' ); // Manage ENTER, since onclick is blocked in IE (#8041). this._.pendingHtml = []; this._.items = {}; this._.groups = {}; }, _ : { close : function() { if ( this._.started ) { this._.pendingHtml.push( '</ul>' ); delete this._.started; } }, getClick : function() { if ( !this._.click ) { this._.click = CKEDITOR.tools.addFunction( function( value ) { var marked = true; if ( this.multiSelect ) marked = this.toggle( value ); else this.mark( value ); if ( this.onClick ) this.onClick( value, marked ); }, this ); } return this._.click; } }, proto : { add : function( value, html, title ) { var pendingHtml = this._.pendingHtml, id = CKEDITOR.tools.getNextId(); if ( !this._.started ) { pendingHtml.push( '<ul role="presentation" class=cke_panel_list>' ); this._.started = 1; this._.size = this._.size || 0; } this._.items[ value ] = id; pendingHtml.push( '<li id=', id, ' class=cke_panel_listItem role=presentation>' + '<a id="', id, '_option" _cke_focus=1 hidefocus=true' + ' title="', title || value, '"' + ' href="javascript:void(\'', value, '\')" ' + ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188 '="CKEDITOR.tools.callFunction(', this._.getClick(), ',\'', value, '\'); return false;"', ' role="option"' + ' aria-posinset="' + ++this._.size + '">', html || value, '</a>' + '</li>' ); }, startGroup : function( title ) { this._.close(); var id = CKEDITOR.tools.getNextId(); this._.groups[ title ] = id; this._.pendingHtml.push( '<h1 role="presentation" id=', id, ' class=cke_panel_grouptitle>', title, '</h1>' ); }, commit : function() { this._.close(); this.element.appendHtml( this._.pendingHtml.join( '' ) ); var items = this._.items, doc = this.element.getDocument(); for ( var value in items ) doc.getById( items[ value ] + '_option' ).setAttribute( 'aria-setsize', this._.size ); delete this._.size; this._.pendingHtml = []; }, toggle : function( value ) { var isMarked = this.isMarked( value ); if ( isMarked ) this.unmark( value ); else this.mark( value ); return !isMarked; }, hideGroup : function( groupTitle ) { var group = this.element.getDocument().getById( this._.groups[ groupTitle ] ), list = group && group.getNext(); if ( group ) { group.setStyle( 'display', 'none' ); if ( list && list.getName() == 'ul' ) list.setStyle( 'display', 'none' ); } }, hideItem : function( value ) { this.element.getDocument().getById( this._.items[ value ] ).setStyle( 'display', 'none' ); }, showAll : function() { var items = this._.items, groups = this._.groups, doc = this.element.getDocument(); for ( var value in items ) { doc.getById( items[ value ] ).setStyle( 'display', '' ); } for ( var title in groups ) { var group = doc.getById( groups[ title ] ), list = group.getNext(); group.setStyle( 'display', '' ); if ( list && list.getName() == 'ul' ) list.setStyle( 'display', '' ); } }, mark : function( value ) { if ( !this.multiSelect ) this.unmarkAll(); var itemId = this._.items[ value ], item = this.element.getDocument().getById( itemId ); item.addClass( 'cke_selected' ); this.element.getDocument().getById( itemId + '_option' ).setAttribute( 'aria-selected', true ); this.onMark && this.onMark( item ); }, unmark : function( value ) { var doc = this.element.getDocument(), itemId = this._.items[ value ], item = doc.getById( itemId ); item.removeClass( 'cke_selected' ); doc.getById( itemId + '_option' ).removeAttribute( 'aria-selected' ); this.onUnmark && this.onUnmark( item ); }, unmarkAll : function() { var items = this._.items, doc = this.element.getDocument(); for ( var value in items ) { var itemId = items[ value ]; doc.getById( itemId ).removeClass( 'cke_selected' ); doc.getById( itemId + '_option' ).removeAttribute( 'aria-selected' ); } this.onUnmark && this.onUnmark(); }, isMarked : function( value ) { return this.element.getDocument().getById( this._.items[ value ] ).hasClass( 'cke_selected' ); }, focus : function( value ) { this._.focusIndex = -1; if ( value ) { var selected = this.element.getDocument().getById( this._.items[ value ] ).getFirst(); var links = this.element.getElementsByTag( 'a' ), link, i = -1; while ( ( link = links.getItem( ++i ) ) ) { if ( link.equals( selected ) ) { this._.focusIndex = i; break; } } setTimeout( function() { selected.focus(); }, 0 ); } } } }); } });
zysms
trunk/zysms/include/ckeditor/_source/plugins/listblock/plugin.js
JavaScript
asf20
7,031
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Paste as plain text plugin */ (function() { // The pastetext command definition. var pasteTextCmd = { exec : function( editor ) { var clipboardText = CKEDITOR.tools.tryThese( function() { var clipboardText = window.clipboardData.getData( 'Text' ); if ( !clipboardText ) throw 0; return clipboardText; } // Any other approach that's working... ); if ( !clipboardText ) // Clipboard access privilege is not granted. { editor.openDialog( 'pastetext' ); return false; } else editor.fire( 'paste', { 'text' : clipboardText } ); return true; } }; // Register the plugin. CKEDITOR.plugins.add( 'pastetext', { init : function( editor ) { var commandName = 'pastetext', command = editor.addCommand( commandName, pasteTextCmd ); editor.ui.addButton( 'PasteText', { label : editor.lang.pasteText.button, command : commandName }); CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/pastetext.js' ) ); if ( editor.config.forcePasteAsPlainText ) { // Intercept the default pasting process. editor.on( 'beforeCommandExec', function ( evt ) { var mode = evt.data.commandData; // Do NOT overwrite if HTML format is explicitly requested. if ( evt.data.name == 'paste' && mode != 'html' ) { editor.execCommand( 'pastetext' ); evt.cancel(); } }, null, null, 0 ); editor.on( 'beforePaste', function( evt ) { evt.data.mode = 'text'; }); } editor.on( 'pasteState', function( evt ) { editor.getCommand( 'pastetext' ).setState( evt.data ); }); }, requires : [ 'clipboard' ] }); })(); /** * Whether to force all pasting operations to insert on plain text into the * editor, loosing any formatting information possibly available in the source * text. * <strong>Note:</strong> paste from word is not affected by this configuration. * @name CKEDITOR.config.forcePasteAsPlainText * @type Boolean * @default false * @example * config.forcePasteAsPlainText = true; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/pastetext/plugin.js
JavaScript
asf20
2,362
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { CKEDITOR.dialog.add( 'pastetext', function( editor ) { return { title : editor.lang.pasteText.title, minWidth : CKEDITOR.env.ie && CKEDITOR.env.quirks ? 368 : 350, minHeight : 240, onShow : function(){ this.setupContent(); }, onOk : function(){ this.commitContent(); }, contents : [ { label : editor.lang.common.generalTab, id : 'general', elements : [ { type : 'html', id : 'pasteMsg', html : '<div style="white-space:normal;width:340px;">' + editor.lang.clipboard.pasteMsg + '</div>' }, { type : 'textarea', id : 'content', className : 'cke_pastetext', onLoad : function() { var label = this.getDialog().getContentElement( 'general', 'pasteMsg' ).getElement(), input = this.getElement().getElementsByTag( 'textarea' ).getItem( 0 ); input.setAttribute( 'aria-labelledby', label.$.id ); input.setStyle( 'direction', editor.config.contentsLangDirection ); }, focus : function() { this.getElement().focus(); }, setup : function() { this.setValue( '' ); }, commit : function() { var value = this.getValue(); setTimeout( function() { editor.fire( 'paste', { 'text' : value } ); }, 0 ); } } ] } ] }; }); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/pastetext/dialogs/pastetext.js
JavaScript
asf20
1,697
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var pxUnit = CKEDITOR.tools.cssLength, needsIEHacks = CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.quirks || CKEDITOR.env.version < 7 ); function getWidth( el ) { return CKEDITOR.env.ie ? el.$.clientWidth : parseInt( el.getComputedStyle( 'width' ), 10 ); } function getBorderWidth( element, side ) { var computed = element.getComputedStyle( 'border-' + side + '-width' ), borderMap = { thin: '0px', medium: '1px', thick: '2px' }; if ( computed.indexOf( 'px' ) < 0 ) { // look up keywords if ( computed in borderMap && element.getComputedStyle( 'border-style' ) != 'none' ) computed = borderMap[ computed ]; else computed = 0; } return parseInt( computed, 10 ); } // Gets the table row that contains the most columns. function getMasterPillarRow( table ) { var $rows = table.$.rows, maxCells = 0, cellsCount, $elected, $tr; for ( var i = 0, len = $rows.length ; i < len; i++ ) { $tr = $rows[ i ]; cellsCount = $tr.cells.length; if ( cellsCount > maxCells ) { maxCells = cellsCount; $elected = $tr; } } return $elected; } function buildTableColumnPillars( table ) { var pillars = [], pillarIndex = -1, rtl = ( table.getComputedStyle( 'direction' ) == 'rtl' ); // Get the raw row element that cointains the most columns. var $tr = getMasterPillarRow( table ); // Get the tbody element and position, which will be used to set the // top and bottom boundaries. var tbody = new CKEDITOR.dom.element( table.$.tBodies[ 0 ] ), tbodyPosition = tbody.getDocumentPosition(); // Loop thorugh all cells, building pillars after each one of them. for ( var i = 0, len = $tr.cells.length ; i < len ; i++ ) { // Both the current cell and the successive one will be used in the // pillar size calculation. var td = new CKEDITOR.dom.element( $tr.cells[ i ] ), nextTd = $tr.cells[ i + 1 ] && new CKEDITOR.dom.element( $tr.cells[ i + 1 ] ); pillarIndex += td.$.colSpan || 1; // Calculate the pillar boundary positions. var pillarLeft, pillarRight, pillarWidth; var x = td.getDocumentPosition().x; // Calculate positions based on the current cell. rtl ? pillarRight = x + getBorderWidth( td, 'left' ) : pillarLeft = x + td.$.offsetWidth - getBorderWidth( td, 'right' ); // Calculate positions based on the next cell, if available. if ( nextTd ) { x = nextTd.getDocumentPosition().x; rtl ? pillarLeft = x + nextTd.$.offsetWidth - getBorderWidth( nextTd, 'right' ) : pillarRight = x + getBorderWidth( nextTd, 'left' ); } // Otherwise calculate positions based on the table (for last cell). else { x = table.getDocumentPosition().x; rtl ? pillarLeft = x : pillarRight = x + table.$.offsetWidth; } pillarWidth = Math.max( pillarRight - pillarLeft, 3 ); // The pillar should reflects exactly the shape of the hovered // column border line. pillars.push( { table : table, index : pillarIndex, x : pillarLeft, y : tbodyPosition.y, width : pillarWidth, height : tbody.$.offsetHeight, rtl : rtl } ); } return pillars; } function getPillarAtPosition( pillars, positionX ) { for ( var i = 0, len = pillars.length ; i < len ; i++ ) { var pillar = pillars[ i ]; if ( positionX >= pillar.x && positionX <= ( pillar.x + pillar.width ) ) return pillar; } return null; } function cancel( evt ) { ( evt.data || evt ).preventDefault(); } function columnResizer( editor ) { var pillar, document, resizer, isResizing, startOffset, currentShift; var leftSideCells, rightSideCells, leftShiftBoundary, rightShiftBoundary; function detach() { pillar = null; currentShift = 0; isResizing = 0; document.removeListener( 'mouseup', onMouseUp ); resizer.removeListener( 'mousedown', onMouseDown ); resizer.removeListener( 'mousemove', onMouseMove ); document.getBody().setStyle( 'cursor', 'auto' ); // Hide the resizer (remove it on IE7 - #5890). needsIEHacks ? resizer.remove() : resizer.hide(); } function resizeStart() { // Before starting to resize, figure out which cells to change // and the boundaries of this resizing shift. var columnIndex = pillar.index, map = CKEDITOR.tools.buildTableMap( pillar.table ), leftColumnCells = [], rightColumnCells = [], leftMinSize = Number.MAX_VALUE, rightMinSize = leftMinSize, rtl = pillar.rtl; for ( var i = 0, len = map.length ; i < len ; i++ ) { var row = map[ i ], leftCell = row[ columnIndex + ( rtl ? 1 : 0 ) ], rightCell = row[ columnIndex + ( rtl ? 0 : 1 ) ]; leftCell = leftCell && new CKEDITOR.dom.element( leftCell ); rightCell = rightCell && new CKEDITOR.dom.element( rightCell ); if ( !leftCell || !rightCell || !leftCell.equals( rightCell ) ) { leftCell && ( leftMinSize = Math.min( leftMinSize, getWidth( leftCell ) ) ); rightCell && ( rightMinSize = Math.min( rightMinSize, getWidth( rightCell ) ) ); leftColumnCells.push( leftCell ); rightColumnCells.push( rightCell ); } } // Cache the list of cells to be resized. leftSideCells = leftColumnCells; rightSideCells = rightColumnCells; // Cache the resize limit boundaries. leftShiftBoundary = pillar.x - leftMinSize; rightShiftBoundary = pillar.x + rightMinSize; resizer.setOpacity( 0.5 ); startOffset = parseInt( resizer.getStyle( 'left' ), 10 ); currentShift = 0; isResizing = 1; resizer.on( 'mousemove', onMouseMove ); // Prevent the native drag behavior otherwise 'mousemove' won't fire. document.on( 'dragstart', cancel ); } function resizeEnd() { isResizing = 0; resizer.setOpacity( 0 ); currentShift && resizeColumn(); var table = pillar.table; setTimeout( function () { table.removeCustomData( '_cke_table_pillars' ); }, 0 ); document.removeListener( 'dragstart', cancel ); } function resizeColumn() { var rtl = pillar.rtl, cellsCount = rtl ? rightSideCells.length : leftSideCells.length; // Perform the actual resize to table cells, only for those by side of the pillar. for ( var i = 0 ; i < cellsCount ; i++ ) { var leftCell = leftSideCells[ i ], rightCell = rightSideCells[ i ], table = pillar.table; // Defer the resizing to avoid any interference among cells. CKEDITOR.tools.setTimeout( function( leftCell, leftOldWidth, rightCell, rightOldWidth, tableWidth, sizeShift ) { leftCell && leftCell.setStyle( 'width', pxUnit( Math.max( leftOldWidth + sizeShift, 0 ) ) ); rightCell && rightCell.setStyle( 'width', pxUnit( Math.max( rightOldWidth - sizeShift, 0 ) ) ); // If we're in the last cell, we need to resize the table as well if ( tableWidth ) table.setStyle( 'width', pxUnit( tableWidth + sizeShift * ( rtl ? -1 : 1 ) ) ); } , 0, this, [ leftCell, leftCell && getWidth( leftCell ), rightCell, rightCell && getWidth( rightCell ), ( !leftCell || !rightCell ) && ( getWidth( table ) + getBorderWidth( table, 'left' ) + getBorderWidth( table, 'right' ) ), currentShift ] ); } } function onMouseDown( evt ) { cancel( evt ); resizeStart(); document.on( 'mouseup', onMouseUp, this ); } function onMouseUp( evt ) { evt.removeListener(); resizeEnd(); } function onMouseMove( evt ) { move( evt.data.$.clientX ); } document = editor.document; resizer = CKEDITOR.dom.element.createFromHtml( '<div data-cke-temp=1 contenteditable=false unselectable=on '+ 'style="position:absolute;cursor:col-resize;filter:alpha(opacity=0);opacity:0;' + 'padding:0;background-color:#004;background-image:none;border:0px none;z-index:10"></div>', document ); // Except on IE6/7 (#5890), place the resizer after body to prevent it // from being editable. if ( !needsIEHacks ) document.getDocumentElement().append( resizer ); this.attachTo = function( targetPillar ) { // Accept only one pillar at a time. if ( isResizing ) return; // On IE6/7, we append the resizer everytime we need it. (#5890) if ( needsIEHacks ) { document.getBody().append( resizer ); currentShift = 0; } pillar = targetPillar; resizer.setStyles( { width: pxUnit( targetPillar.width ), height : pxUnit( targetPillar.height ), left : pxUnit( targetPillar.x ), top : pxUnit( targetPillar.y ) }); // In IE6/7, it's not possible to have custom cursors for floating // elements in an editable document. Show the resizer in that case, // to give the user a visual clue. needsIEHacks && resizer.setOpacity( 0.25 ); resizer.on( 'mousedown', onMouseDown, this ); document.getBody().setStyle( 'cursor', 'col-resize' ); // Display the resizer to receive events but don't show it, // only change the cursor to resizable shape. resizer.show(); }; var move = this.move = function( posX ) { if ( !pillar ) return 0; if ( !isResizing && ( posX < pillar.x || posX > ( pillar.x + pillar.width ) ) ) { detach(); return 0; } var resizerNewPosition = posX - Math.round( resizer.$.offsetWidth / 2 ); if ( isResizing ) { if ( resizerNewPosition == leftShiftBoundary || resizerNewPosition == rightShiftBoundary ) return 1; resizerNewPosition = Math.max( resizerNewPosition, leftShiftBoundary ); resizerNewPosition = Math.min( resizerNewPosition, rightShiftBoundary ); currentShift = resizerNewPosition - startOffset; } resizer.setStyle( 'left', pxUnit( resizerNewPosition ) ); return 1; }; } function clearPillarsCache( evt ) { var target = evt.data.getTarget(); if ( evt.name == 'mouseout' ) { // Bypass interal mouse move. if ( !target.is ( 'table' ) ) return; var dest = new CKEDITOR.dom.element( evt.data.$.relatedTarget || evt.data.$.toElement ); while( dest && dest.$ && !dest.equals( target ) && !dest.is( 'body' ) ) dest = dest.getParent(); if ( !dest || dest.equals( target ) ) return; } target.getAscendant( 'table', 1 ).removeCustomData( '_cke_table_pillars' ); evt.removeListener(); } CKEDITOR.plugins.add( 'tableresize', { requires : [ 'tabletools' ], init : function( editor ) { editor.on( 'contentDom', function() { var resizer; editor.document.getBody().on( 'mousemove', function( evt ) { evt = evt.data; // If we're already attached to a pillar, simply move the // resizer. if ( resizer && resizer.move( evt.$.clientX ) ) { cancel( evt ); return; } // Considering table, tr, td, tbody but nothing else. var target = evt.getTarget(), table, pillars; if ( !target.is( 'table' ) && !target.getAscendant( 'tbody', 1 ) ) return; table = target.getAscendant( 'table', 1 ); if ( !( pillars = table.getCustomData( '_cke_table_pillars' ) ) ) { // Cache table pillars calculation result. table.setCustomData( '_cke_table_pillars', ( pillars = buildTableColumnPillars( table ) ) ); table.on( 'mouseout', clearPillarsCache ); table.on( 'mousedown', clearPillarsCache ); } var pillar = getPillarAtPosition( pillars, evt.$.clientX ); if ( pillar ) { !resizer && ( resizer = new columnResizer( editor ) ); resizer.attachTo( pillar ); } }); }); } }); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/tableresize/plugin.js
JavaScript
asf20
12,197
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'resize', { init : function( editor ) { var config = editor.config; // Resize in the same direction of chrome, // which is identical to dir of editor element. (#6614) var resizeDir = editor.element.getDirection( 1 ); !config.resize_dir && ( config.resize_dir = 'both' ); ( config.resize_maxWidth == undefined ) && ( config.resize_maxWidth = 3000 ); ( config.resize_maxHeight == undefined ) && ( config.resize_maxHeight = 3000 ); ( config.resize_minWidth == undefined ) && ( config.resize_minWidth = 750 ); ( config.resize_minHeight == undefined ) && ( config.resize_minHeight = 250 ); if ( config.resize_enabled !== false ) { var container = null, origin, startSize, resizeHorizontal = ( config.resize_dir == 'both' || config.resize_dir == 'horizontal' ) && ( config.resize_minWidth != config.resize_maxWidth ), resizeVertical = ( config.resize_dir == 'both' || config.resize_dir == 'vertical' ) && ( config.resize_minHeight != config.resize_maxHeight ); function dragHandler( evt ) { var dx = evt.data.$.screenX - origin.x, dy = evt.data.$.screenY - origin.y, width = startSize.width, height = startSize.height, internalWidth = width + dx * ( resizeDir == 'rtl' ? -1 : 1 ), internalHeight = height + dy; if ( resizeHorizontal ) width = Math.max( config.resize_minWidth, Math.min( internalWidth, config.resize_maxWidth ) ); if ( resizeVertical ) height = Math.max( config.resize_minHeight, Math.min( internalHeight, config.resize_maxHeight ) ); editor.resize( width, height ); } function dragEndHandler ( evt ) { CKEDITOR.document.removeListener( 'mousemove', dragHandler ); CKEDITOR.document.removeListener( 'mouseup', dragEndHandler ); if ( editor.document ) { editor.document.removeListener( 'mousemove', dragHandler ); editor.document.removeListener( 'mouseup', dragEndHandler ); } } var mouseDownFn = CKEDITOR.tools.addFunction( function( $event ) { if ( !container ) container = editor.getResizable(); startSize = { width : container.$.offsetWidth || 0, height : container.$.offsetHeight || 0 }; origin = { x : $event.screenX, y : $event.screenY }; config.resize_minWidth > startSize.width && ( config.resize_minWidth = startSize.width ); config.resize_minHeight > startSize.height && ( config.resize_minHeight = startSize.height ); CKEDITOR.document.on( 'mousemove', dragHandler ); CKEDITOR.document.on( 'mouseup', dragEndHandler ); if ( editor.document ) { editor.document.on( 'mousemove', dragHandler ); editor.document.on( 'mouseup', dragEndHandler ); } }); editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( mouseDownFn ); } ); editor.on( 'themeSpace', function( event ) { if ( event.data.space == 'bottom' ) { var direction = ''; if ( resizeHorizontal && !resizeVertical ) direction = ' cke_resizer_horizontal'; if ( !resizeHorizontal && resizeVertical ) direction = ' cke_resizer_vertical'; var resizerHtml = '<div' + ' class="cke_resizer' + direction + ' cke_resizer_' + resizeDir + '"' + ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' + ' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event)"' + '></div>'; // Always sticks the corner of botttom space. resizeDir == 'ltr' && direction == 'ltr' ? event.data.html += resizerHtml : event.data.html = resizerHtml + event.data.html; } }, editor, null, 100 ); } } } ); /** * The minimum editor width, in pixels, when resizing the editor interface by using the resize handle. * Note: It falls back to editor's actual width if it is smaller than the default value. * @name CKEDITOR.config.resize_minWidth * @type Number * @default 750 * @example * config.resize_minWidth = 500; */ /** * The minimum editor height, in pixels, when resizing the editor interface by using the resize handle. * Note: It falls back to editor's actual height if it is smaller than the default value. * @name CKEDITOR.config.resize_minHeight * @type Number * @default 250 * @example * config.resize_minHeight = 600; */ /** * The maximum editor width, in pixels, when resizing the editor interface by using the resize handle. * @name CKEDITOR.config.resize_maxWidth * @type Number * @default 3000 * @example * config.resize_maxWidth = 750; */ /** * The maximum editor height, in pixels, when resizing the editor interface by using the resize handle. * @name CKEDITOR.config.resize_maxHeight * @type Number * @default 3000 * @example * config.resize_maxHeight = 600; */ /** * Whether to enable the resizing feature. If this feature is disabled, the resize handle will not be visible. * @name CKEDITOR.config.resize_enabled * @type Boolean * @default true * @example * config.resize_enabled = false; */ /** * The dimensions for which the editor resizing is enabled. Possible values * are <code>both</code>, <code>vertical</code>, and <code>horizontal</code>. * @name CKEDITOR.config.resize_dir * @type String * @default 'both' * @since 3.3 * @example * config.resize_dir = 'vertical'; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/resize/plugin.js
JavaScript
asf20
5,642
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "show border" plugin. The command display visible outline * border line around all table elements if table doesn't have a none-zero 'border' attribute specified. */ (function() { var showBorderClassName = 'cke_show_border', cssStyleText, cssTemplate = // TODO: For IE6, we don't have child selector support, // where nested table cells could be incorrect. ( CKEDITOR.env.ie6Compat ? [ '.%1 table.%2,', '.%1 table.%2 td, .%1 table.%2 th', '{', 'border : #d3d3d3 1px dotted', '}' ] : [ '.%1 table.%2,', '.%1 table.%2 > tr > td, .%1 table.%2 > tr > th,', '.%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,', '.%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,', '.%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th', '{', 'border : #d3d3d3 1px dotted', '}' ] ).join( '' ); cssStyleText = cssTemplate.replace( /%2/g, showBorderClassName ).replace( /%1/g, 'cke_show_borders ' ); var commandDefinition = { preserveState : true, editorFocus : false, readOnly: 1, exec : function ( editor ) { this.toggleState(); this.refresh( editor ); }, refresh : function( editor ) { if ( editor.document ) { var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass'; editor.document.getBody()[ funcName ]( 'cke_show_borders' ); } } }; CKEDITOR.plugins.add( 'showborders', { requires : [ 'wysiwygarea' ], modes : { 'wysiwyg' : 1 }, init : function( editor ) { var command = editor.addCommand( 'showborders', commandDefinition ); command.canUndo = false; if ( editor.config.startupShowBorders !== false ) command.setState( CKEDITOR.TRISTATE_ON ); editor.addCss( cssStyleText ); // Refresh the command on setData. editor.on( 'mode', function() { if ( command.state != CKEDITOR.TRISTATE_DISABLED ) command.refresh( editor ); }, null, null, 100 ); // Refresh the command on wysiwyg frame reloads. editor.on( 'contentDom', function() { if ( command.state != CKEDITOR.TRISTATE_DISABLED ) command.refresh( editor ); }); editor.on( 'removeFormatCleanup', function( evt ) { var element = evt.data; if ( editor.getCommand( 'showborders' ).state == CKEDITOR.TRISTATE_ON && element.is( 'table' ) && ( !element.hasAttribute( 'border' ) || parseInt( element.getAttribute( 'border' ), 10 ) <= 0 ) ) element.addClass( showBorderClassName ); }); }, afterInit : function( editor ) { var dataProcessor = editor.dataProcessor, dataFilter = dataProcessor && dataProcessor.dataFilter, htmlFilter = dataProcessor && dataProcessor.htmlFilter; if ( dataFilter ) { dataFilter.addRules( { elements : { 'table' : function( element ) { var attributes = element.attributes, cssClass = attributes[ 'class' ], border = parseInt( attributes.border, 10 ); if ( ( !border || border <= 0 ) && ( !cssClass || cssClass.indexOf( showBorderClassName ) == -1 ) ) attributes[ 'class' ] = ( cssClass || '' ) + ' ' + showBorderClassName; } } } ); } if ( htmlFilter ) { htmlFilter.addRules( { elements : { 'table' : function( table ) { var attributes = table.attributes, cssClass = attributes[ 'class' ]; cssClass && ( attributes[ 'class' ] = cssClass.replace( showBorderClassName, '' ) .replace( /\s{2}/, ' ' ) .replace( /^\s+|\s+$/, '' ) ); } } } ); } } }); // Table dialog must be aware of it. CKEDITOR.on( 'dialogDefinition', function( ev ) { var dialogName = ev.data.name; if ( dialogName == 'table' || dialogName == 'tableProperties' ) { var dialogDefinition = ev.data.definition, infoTab = dialogDefinition.getContents( 'info' ), borderField = infoTab.get( 'txtBorder' ), originalCommit = borderField.commit; borderField.commit = CKEDITOR.tools.override( originalCommit, function( org ) { return function( data, selectedTable ) { org.apply( this, arguments ); var value = parseInt( this.getValue(), 10 ); selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName ); }; } ); var advTab = dialogDefinition.getContents( 'advanced' ), classField = advTab && advTab.get( 'advCSSClasses' ); if ( classField ) { classField.setup = CKEDITOR.tools.override( classField.setup, function( originalSetup ) { return function() { originalSetup.apply( this, arguments ); this.setValue( this.getValue().replace( /cke_show_border/, '' ) ); }; }); classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit ) { return function( data, element ) { originalCommit.apply( this, arguments ); if ( !parseInt( element.getAttribute( 'border' ), 10 ) ) element.addClass( 'cke_show_border' ); }; }); } } }); } )(); /** * Whether to automatically enable the "show borders" command when the editor loads. * (ShowBorders in FCKeditor) * @name CKEDITOR.config.startupShowBorders * @type Boolean * @default true * @example * config.startupShowBorders = false; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/showborders/plugin.js
JavaScript
asf20
5,800
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { // Base HTML entities. var htmlbase = 'nbsp,gt,lt,amp'; var entities = // Latin-1 Entities 'quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laquo,' + 'not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,' + 'cedil,sup1,ordm,raquo,frac14,frac12,frac34,iquest,times,divide,' + // Symbols 'fnof,bull,hellip,prime,Prime,oline,frasl,weierp,image,real,trade,' + 'alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr,rArr,dArr,hArr,' + 'forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowast,' + 'radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,' + 'equiv,le,ge,sub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,' + 'rceil,lfloor,rfloor,lang,rang,loz,spades,clubs,hearts,diams,' + // Other Special Characters 'circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndash,mdash,lsquo,' + 'rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,' + 'euro'; // Latin Letters Entities var latin = 'Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacute,' + 'Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,' + 'Otilde,Ouml,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,' + 'agrave,aacute,acirc,atilde,auml,aring,aelig,ccedil,egrave,eacute,' + 'ecirc,euml,igrave,iacute,icirc,iuml,eth,ntilde,ograve,oacute,ocirc,' + 'otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn,yuml,' + 'OElig,oelig,Scaron,scaron,Yuml'; // Greek Letters Entities. var greek = 'Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,' + 'Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,' + 'beta,gamma,delta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,' + 'omicron,pi,rho,sigmaf,sigma,tau,upsilon,phi,chi,psi,omega,thetasym,' + 'upsih,piv'; /** * Create a mapping table between one character and its entity form from a list of entity names. * @param reverse {Boolean} Whether to create a reverse map from the entity string form to an actual character. */ function buildTable( entities, reverse ) { var table = {}, regex = []; // Entities that the browsers DOM don't transform to the final char // automatically. var specialTable = { nbsp : '\u00A0', // IE | FF shy : '\u00AD', // IE gt : '\u003E', // IE | FF | -- | Opera lt : '\u003C', // IE | FF | Safari | Opera amp : '\u0026' // ALL }; entities = entities.replace( /\b(nbsp|shy|gt|lt|amp)(?:,|$)/g, function( match, entity ) { var org = reverse ? '&' + entity + ';' : specialTable[ entity ], result = reverse ? specialTable[ entity ] : '&' + entity + ';'; table[ org ] = result; regex.push( org ); return ''; }); if ( !reverse && entities ) { // Transforms the entities string into an array. entities = entities.split( ',' ); // Put all entities inside a DOM element, transforming them to their // final chars. var div = document.createElement( 'div' ), chars; div.innerHTML = '&' + entities.join( ';&' ) + ';'; chars = div.innerHTML; div = null; // Add all chars to the table. for ( var i = 0 ; i < chars.length ; i++ ) { var charAt = chars.charAt( i ); table[ charAt ] = '&' + entities[ i ] + ';'; regex.push( charAt ); } } table.regex = regex.join( reverse ? '|' : '' ); return table; } CKEDITOR.plugins.add( 'entities', { afterInit : function( editor ) { var config = editor.config; var dataProcessor = editor.dataProcessor, htmlFilter = dataProcessor && dataProcessor.htmlFilter; if ( htmlFilter ) { // Mandatory HTML base entities. var selectedEntities = ''; if ( config.basicEntities !== false ) selectedEntities += htmlbase; if ( config.entities ) { selectedEntities += ',' + entities; if ( config.entities_latin ) selectedEntities += ',' + latin; if ( config.entities_greek ) selectedEntities += ',' + greek; if ( config.entities_additional ) selectedEntities += ',' + config.entities_additional; } var entitiesTable = buildTable( selectedEntities ); // Create the Regex used to find entities in the text, leave it matches nothing if entities are empty. var entitiesRegex = entitiesTable.regex ? '[' + entitiesTable.regex + ']' : 'a^'; delete entitiesTable.regex; if ( config.entities && config.entities_processNumerical ) entitiesRegex = '[^ -~]|' + entitiesRegex ; entitiesRegex = new RegExp( entitiesRegex, 'g' ); function getEntity( character ) { return config.entities_processNumerical == 'force' || !entitiesTable[ character ] ? '&#' + character.charCodeAt(0) + ';' : entitiesTable[ character ]; } // Decode entities that the browsers has transformed // at first place. var baseEntitiesTable = buildTable( [ htmlbase, 'shy' ].join( ',' ) , true ), baseEntitiesRegex = new RegExp( baseEntitiesTable.regex, 'g' ); function getChar( character ) { return baseEntitiesTable[ character ]; } htmlFilter.addRules( { text : function( text ) { return text.replace( baseEntitiesRegex, getChar ) .replace( entitiesRegex, getEntity ); } }); } } }); })(); /** * Whether to escape basic HTML entities in the document, including: * <ul> * <li><code>nbsp</code></li> * <li><code>gt</code></li> * <li><code>lt</code></li> * <li><code>amp</code></li> * </ul> * <strong>Note:</strong> It should not be subject to change unless when outputting a non-HTML data format like BBCode. * @type Boolean * @default <code>true</code> * @example * config.basicEntities = false; */ CKEDITOR.config.basicEntities = true; /** * Whether to use HTML entities in the output. * @name CKEDITOR.config.entities * @type Boolean * @default <code>true</code> * @example * config.entities = false; */ CKEDITOR.config.entities = true; /** * Whether to convert some Latin characters (Latin alphabet No&#46; 1, ISO 8859-1) * to HTML entities. The list of entities can be found in the * <a href="http://www.w3.org/TR/html4/sgml/entities.html#h-24.2.1">W3C HTML 4.01 Specification, section 24.2.1</a>. * @name CKEDITOR.config.entities_latin * @type Boolean * @default <code>true</code> * @example * config.entities_latin = false; */ CKEDITOR.config.entities_latin = true; /** * Whether to convert some symbols, mathematical symbols, and Greek letters to * HTML entities. This may be more relevant for users typing text written in Greek. * The list of entities can be found in the * <a href="http://www.w3.org/TR/html4/sgml/entities.html#h-24.3.1">W3C HTML 4.01 Specification, section 24.3.1</a>. * @name CKEDITOR.config.entities_greek * @type Boolean * @default <code>true</code> * @example * config.entities_greek = false; */ CKEDITOR.config.entities_greek = true; /** * Whether to convert all remaining characters not included in the ASCII * character table to their relative decimal numeric representation of HTML entity. * When set to <code>force</code>, it will convert all entities into this format. * For example the phrase "This is Chinese: &#27721;&#35821;." is output * as "This is Chinese: &amp;#27721;&amp;#35821;." * @name CKEDITOR.config.entities_processNumerical * @type Boolean|String * @default <code>false</code> * @example * config.entities_processNumerical = true; * config.entities_processNumerical = 'force'; //Converts from "&nbsp;" into "&#160;"; */ /** * A comma separated list of additional entities to be used. Entity names * or numbers must be used in a form that excludes the "&amp;" prefix and the ";" ending. * @name CKEDITOR.config.entities_additional * @default <code>'#39'</code> (The single quote (') character.) * @type String * @example * config.entities_additional = '#1049'; // Adds Cyrillic capital letter Short I (&#1049;). */ CKEDITOR.config.entities_additional = '#39';
zysms
trunk/zysms/include/ckeditor/_source/plugins/entities/plugin.js
JavaScript
asf20
8,375
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'docprops', { init : function( editor ) { var cmd = new CKEDITOR.dialogCommand( 'docProps' ); // Only applicable on full page mode. cmd.modes = { wysiwyg : editor.config.fullPage }; editor.addCommand( 'docProps', cmd ); CKEDITOR.dialog.add( 'docProps', this.path + 'dialogs/docprops.js' ); editor.ui.addButton( 'DocProps', { label : editor.lang.docprops.label, command : 'docProps' }); } });
zysms
trunk/zysms/include/ckeditor/_source/plugins/docprops/plugin.js
JavaScript
asf20
611
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'docProps', function( editor ) { var lang = editor.lang.docprops, langCommon = editor.lang.common, metaHash = {}; function getDialogValue( dialogName, callback ) { var onOk = function() { releaseHandlers( this ); callback( this, this._.parentDialog ); }; var releaseHandlers = function( dialog ) { dialog.removeListener( 'ok', onOk ); dialog.removeListener( 'cancel', releaseHandlers ); }; var bindToDialog = function( dialog ) { dialog.on( 'ok', onOk ); dialog.on( 'cancel', releaseHandlers ); }; editor.execCommand( dialogName ); if ( editor._.storedDialogs.colordialog ) bindToDialog( editor._.storedDialogs.colordialog ); else { CKEDITOR.on( 'dialogDefinition', function( e ) { if ( e.data.name != dialogName ) return; var definition = e.data.definition; e.removeListener(); definition.onLoad = CKEDITOR.tools.override( definition.onLoad, function( orginal ) { return function() { bindToDialog( this ); definition.onLoad = orginal; if ( typeof orginal == 'function' ) orginal.call( this ); }; }); }); } } function handleOther() { var dialog = this.getDialog(), other = dialog.getContentElement( 'general', this.id + 'Other' ); if ( !other ) return; if ( this.getValue() == 'other' ) { other.getInputElement().removeAttribute( 'readOnly' ); other.focus(); other.getElement().removeClass( 'cke_disabled' ); } else { other.getInputElement().setAttribute( 'readOnly', true ); other.getElement().addClass( 'cke_disabled' ); } } function commitMeta( name, isHttp, value ) { return function( doc, html, head ) { var hash = metaHash, val = typeof value != 'undefined' ? value : this.getValue(); if ( !val && ( name in hash ) ) hash[ name ].remove(); else if ( val && ( name in hash ) ) hash[ name ].setAttribute( 'content', val ); else if ( val ) { var meta = new CKEDITOR.dom.element( 'meta', editor.document ); meta.setAttribute( isHttp ? 'http-equiv' : 'name', name ); meta.setAttribute( 'content', val ); head.append( meta ); } }; } function setupMeta( name, ret ) { return function() { var hash = metaHash, result = ( name in hash ) ? hash[ name ].getAttribute( 'content' ) || '' : ''; if ( ret ) return result; this.setValue( result ); return null; }; } function commitMargin( name ) { return function( doc, html, head, body ) { body.removeAttribute( 'margin' + name ); var val = this.getValue(); if ( val !== '' ) body.setStyle( 'margin-' + name, CKEDITOR.tools.cssLength( val ) ); else body.removeStyle( 'margin-' + name ); }; } function createMetaHash( doc ) { var hash = {}, metas = doc.getElementsByTag( 'meta' ), count = metas.count(); for ( var i = 0; i < count; i++ ) { var meta = metas.getItem( i ); hash[ meta.getAttribute( meta.hasAttribute( 'http-equiv' ) ? 'http-equiv' : 'name' ).toLowerCase() ] = meta; } return hash; } // We cannot just remove the style from the element, as it might be affected from non-inline stylesheets. // To get the proper result, we should manually set the inline style to its default value. function resetStyle( element, prop, resetVal ) { element.removeStyle( prop ); if ( element.getComputedStyle( prop ) != resetVal ) element.setStyle( prop, resetVal ); } // Utilty to shorten the creation of color fields in the dialog. var colorField = function( id, label, fieldProps ) { return { type : 'hbox', padding : 0, widths : [ '60%', '40%' ], children : [ CKEDITOR.tools.extend( { type : 'text', id : id, label : lang[ label ] }, fieldProps || {}, 1 ), { type : 'button', id : id + 'Choose', label : lang.chooseColor, className : 'colorChooser', onClick : function() { var self = this; getDialogValue( 'colordialog', function( colorDialog ) { var dialog = self.getDialog(); dialog.getContentElement( dialog._.currentTabId, id ).setValue( colorDialog.getContentElement( 'picker', 'selectedColor' ).getValue() ); }); } } ] }; }; var previewSrc = 'javascript:' + 'void((function(){' + encodeURIComponent( 'document.open();' + ( CKEDITOR.env.isCustomDomain() ? 'document.domain=\'' + document.domain + '\';' : '' ) + 'document.write( \'<html style="background-color: #ffffff; height: 100%"><head></head><body style="width: 100%; height: 100%; margin: 0px">' + lang.previewHtml + '</body></html>\' );' + 'document.close();' ) + '})())'; return { title : lang.title, minHeight: 330, minWidth: 500, onShow : function() { var doc = editor.document, html = doc.getElementsByTag( 'html' ).getItem( 0 ), head = doc.getHead(), body = doc.getBody(); metaHash = createMetaHash( doc ); this.setupContent( doc, html, head, body ); }, onHide : function() { metaHash = {}; }, onOk : function() { var doc = editor.document, html = doc.getElementsByTag( 'html' ).getItem( 0 ), head = doc.getHead(), body = doc.getBody(); this.commitContent( doc, html, head, body ); }, contents : [ { id : 'general', label : langCommon.generalTab, elements : [ { type : 'text', id : 'title', label : lang.docTitle, setup : function( doc ) { this.setValue( doc.getElementsByTag( 'title' ).getItem( 0 ).data( 'cke-title' ) ); }, commit : function( doc, html, head, body, isPreview ) { if ( isPreview ) return; doc.getElementsByTag( 'title' ).getItem( 0 ).data( 'cke-title', this.getValue() ); } }, { type : 'hbox', children : [ { type : 'select', id : 'dir', label : langCommon.langDir, style : 'width: 100%', items : [ [ langCommon.notSet , '' ], [ langCommon.langDirLtr, 'ltr' ], [ langCommon.langDirRtl, 'rtl' ] ], setup : function( doc, html, head, body ) { this.setValue( body.getDirection() || '' ); }, commit : function( doc, html, head, body ) { var val = this.getValue(); if ( val ) body.setAttribute( 'dir', val ); else body.removeAttribute( 'dir' ); body.removeStyle( 'direction' ); } }, { type : 'text', id : 'langCode', label : langCommon.langCode, setup : function( doc, html ) { this.setValue( html.getAttribute( 'xml:lang' ) || html.getAttribute( 'lang' ) || '' ); }, commit : function( doc, html, head, body, isPreview ) { if ( isPreview ) return; var val = this.getValue(); if ( val ) html.setAttributes( { 'xml:lang' : val, lang : val } ); else html.removeAttributes( { 'xml:lang' : 1, lang : 1 } ); } } ] }, { type : 'hbox', children : [ { type : 'select', id : 'charset', label : lang.charset, style : 'width: 100%', items : [ [ langCommon.notSet, '' ], [ lang.charsetASCII, 'us-ascii' ], [ lang.charsetCE, 'iso-8859-2' ], [ lang.charsetCT, 'big5' ], [ lang.charsetCR, 'iso-8859-5' ], [ lang.charsetGR, 'iso-8859-7' ], [ lang.charsetJP, 'iso-2022-jp' ], [ lang.charsetKR, 'iso-2022-kr' ], [ lang.charsetTR, 'iso-8859-9' ], [ lang.charsetUN, 'utf-8' ], [ lang.charsetWE, 'iso-8859-1' ], [ lang.other, 'other' ] ], 'default' : '', onChange : function() { this.getDialog().selectedCharset = this.getValue() != 'other' ? this.getValue() : ''; handleOther.call( this ); }, setup : function() { this.metaCharset = ( 'charset' in metaHash ); var func = setupMeta( this.metaCharset ? 'charset' : 'content-type', 1, 1 ), val = func.call( this ); !this.metaCharset && val.match( /charset=[^=]+$/ ) && ( val = val.substring( val.indexOf( '=' ) + 1 ) ); if ( val ) { this.setValue( val.toLowerCase() ); if ( !this.getValue() ) { this.setValue( 'other' ); var other = this.getDialog().getContentElement( 'general', 'charsetOther' ); other && other.setValue( val ); } this.getDialog().selectedCharset = val; } handleOther.call( this ); }, commit : function( doc, html, head, body, isPreview ) { if ( isPreview ) return; var value = this.getValue(), other = this.getDialog().getContentElement( 'general', 'charsetOther' ); value == 'other' && ( value = other ? other.getValue() : '' ); value && !this.metaCharset && ( value = ( metaHash[ 'content-type' ] ? metaHash[ 'content-type' ].getAttribute( 'content' ).split( ';' )[0] : 'text/html' ) + '; charset=' + value ); var func = commitMeta( this.metaCharset ? 'charset' : 'content-type', 1, value ); func.call( this, doc, html, head ); } }, { type : 'text', id : 'charsetOther', label : lang.charsetOther, onChange : function(){ this.getDialog().selectedCharset = this.getValue(); } } ] }, { type : 'hbox', children : [ { type : 'select', id : 'docType', label : lang.docType, style : 'width: 100%', items : [ [ langCommon.notSet , '' ], [ 'XHTML 1.1', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' ], [ 'XHTML 1.0 Transitional', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' ], [ 'XHTML 1.0 Strict', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ], [ 'XHTML 1.0 Frameset', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' ], [ 'HTML 5', '<!DOCTYPE html>' ], [ 'HTML 4.01 Transitional', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' ], [ 'HTML 4.01 Strict', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' ], [ 'HTML 4.01 Frameset', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">' ], [ 'HTML 3.2', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' ], [ 'HTML 2.0', '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' ], [ lang.other, 'other' ] ], onChange : handleOther, setup : function() { if ( editor.docType ) { this.setValue( editor.docType ); if ( !this.getValue() ) { this.setValue( 'other' ); var other = this.getDialog().getContentElement( 'general', 'docTypeOther' ); other && other.setValue( editor.docType ); } } handleOther.call( this ); }, commit : function( doc, html, head, body, isPreview ) { if ( isPreview ) return; var value = this.getValue(), other = this.getDialog().getContentElement( 'general', 'docTypeOther' ); editor.docType = value == 'other' ? ( other ? other.getValue() : '' ) : value; } }, { type : 'text', id : 'docTypeOther', label : lang.docTypeOther } ] }, { type : 'checkbox', id : 'xhtmlDec', label : lang.xhtmlDec, setup : function() { this.setValue( !!editor.xmlDeclaration ); }, commit : function( doc, html, head, body, isPreview ) { if ( isPreview ) return; if ( this.getValue() ) { editor.xmlDeclaration = '<?xml version="1.0" encoding="' + ( this.getDialog().selectedCharset || 'utf-8' )+ '"?>' ; html.setAttribute( 'xmlns', 'http://www.w3.org/1999/xhtml' ); } else { editor.xmlDeclaration = ''; html.removeAttribute( 'xmlns' ); } } } ] }, { id : 'design', label : lang.design, elements : [ { type : 'hbox', widths : [ '60%', '40%' ], children : [ { type : 'vbox', children : [ colorField( 'txtColor', 'txtColor', { setup : function( doc, html, head, body ) { this.setValue( body.getComputedStyle( 'color' ) ); }, commit : function( doc, html, head, body, isPreview ) { if ( this.isChanged() || isPreview ) { body.removeAttribute( 'text' ); var val = this.getValue(); if ( val ) body.setStyle( 'color', val ); else body.removeStyle( 'color' ); } } }), colorField( 'bgColor', 'bgColor', { setup : function( doc, html, head, body ) { var val = body.getComputedStyle( 'background-color' ) || ''; this.setValue( val == 'transparent' ? '' : val ); }, commit : function( doc, html, head, body, isPreview ) { if ( this.isChanged() || isPreview ) { body.removeAttribute( 'bgcolor' ); var val = this.getValue(); if ( val ) body.setStyle( 'background-color', val ); else resetStyle( body, 'background-color', 'transparent' ); } } }), { type : 'hbox', widths : [ '60%', '40%' ], padding : 1, children : [ { type : 'text', id : 'bgImage', label : lang.bgImage, setup : function( doc, html, head, body ) { var val = body.getComputedStyle( 'background-image' ) || ''; if ( val == 'none' ) val = ''; else { val = val.replace( /url\(\s*(["']?)\s*([^\)]*)\s*\1\s*\)/i, function( match, quote, url ) { return url; }); } this.setValue( val ); }, commit : function( doc, html, head, body ) { body.removeAttribute( 'background' ); var val = this.getValue(); if ( val ) body.setStyle( 'background-image', 'url(' + val + ')' ); else resetStyle( body, 'background-image', 'none' ); } }, { type : 'button', id : 'bgImageChoose', label : langCommon.browseServer, style : 'display:inline-block;margin-top:10px;', hidden : true, filebrowser : 'design:bgImage' } ] }, { type : 'checkbox', id : 'bgFixed', label : lang.bgFixed, setup : function( doc, html, head, body ) { this.setValue( body.getComputedStyle( 'background-attachment' ) == 'fixed' ); }, commit : function( doc, html, head, body ) { if ( this.getValue() ) body.setStyle( 'background-attachment', 'fixed' ); else resetStyle( body, 'background-attachment', 'scroll' ); } } ] }, { type : 'vbox', children : [ { type : 'html', id : 'marginTitle', html : '<div style="text-align: center; margin: 0px auto; font-weight: bold">' + lang.margin + '</div>' }, { type : 'text', id : 'marginTop', label : lang.marginTop, style : 'width: 80px; text-align: center', align : 'center', inputStyle : 'text-align: center', setup : function( doc, html, head, body ) { this.setValue( body.getStyle( 'margin-top' ) || body.getAttribute( 'margintop' ) || '' ); }, commit : commitMargin( 'top' ) }, { type : 'hbox', children : [ { type : 'text', id : 'marginLeft', label : lang.marginLeft, style : 'width: 80px; text-align: center', align : 'center', inputStyle : 'text-align: center', setup : function( doc, html, head, body ) { this.setValue( body.getStyle( 'margin-left' ) || body.getAttribute( 'marginleft' ) || '' ); }, commit : commitMargin( 'left' ) }, { type : 'text', id : 'marginRight', label : lang.marginRight, style : 'width: 80px; text-align: center', align : 'center', inputStyle : 'text-align: center', setup : function( doc, html, head, body ) { this.setValue( body.getStyle( 'margin-right' ) || body.getAttribute( 'marginright' ) || '' ); }, commit : commitMargin( 'right' ) } ] }, { type : 'text', id : 'marginBottom', label : lang.marginBottom, style : 'width: 80px; text-align: center', align : 'center', inputStyle : 'text-align: center', setup : function( doc, html, head, body ) { this.setValue( body.getStyle( 'margin-bottom' ) || body.getAttribute( 'marginbottom' ) || '' ); }, commit : commitMargin( 'bottom' ) } ] } ] } ] }, { id : 'meta', label : lang.meta, elements : [ { type : 'textarea', id : 'metaKeywords', label : lang.metaKeywords, setup : setupMeta( 'keywords' ), commit : commitMeta( 'keywords' ) }, { type : 'textarea', id : 'metaDescription', label : lang.metaDescription, setup : setupMeta( 'description' ), commit : commitMeta( 'description' ) }, { type : 'text', id : 'metaAuthor', label : lang.metaAuthor, setup : setupMeta( 'author' ), commit : commitMeta( 'author' ) }, { type : 'text', id : 'metaCopyright', label : lang.metaCopyright, setup : setupMeta( 'copyright' ), commit : commitMeta( 'copyright' ) } ] }, { id : 'preview', label : langCommon.preview, elements : [ { type : 'html', id : 'previewHtml', html : '<iframe src="' + previewSrc + '" style="width: 100%; height: 310px" hidefocus="true" frameborder="0" ' + 'id="cke_docProps_preview_iframe"></iframe>', onLoad : function() { this.getDialog().on( 'selectPage', function( ev ) { if ( ev.data.page == 'preview' ) { var self = this; setTimeout( function() { var doc = CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getFrameDocument(), html = doc.getElementsByTag( 'html' ).getItem( 0 ), head = doc.getHead(), body = doc.getBody(); self.commitContent( doc, html, head, body, 1 ); }, 50 ); } }); CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getAscendant( 'table' ).setStyle( 'height', '100%' ); } } ] } ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/docprops/dialogs/docprops.js
JavaScript
asf20
20,837
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview Plugin definition for the a11yhelp, which provides a dialog * with accessibility related help. */ (function() { var pluginName = 'a11yhelp', commandName = 'a11yHelp'; CKEDITOR.plugins.add( pluginName, { // List of available localizations. availableLangs : { en:1, he:1 }, init : function( editor ) { var plugin = this; editor.addCommand( commandName, { exec : function() { var langCode = editor.langCode; langCode = plugin.availableLangs[ langCode ] ? langCode : 'en'; CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( plugin.path + 'lang/' + langCode + '.js' ), function() { CKEDITOR.tools.extend( editor.lang, plugin.langEntries[ langCode ] ); editor.openDialog( commandName ); }); }, modes : { wysiwyg:1, source:1 }, readOnly : 1, canUndo : false }); CKEDITOR.dialog.add( commandName, this.path + 'dialogs/a11yhelp.js' ); } }); })();
zysms
trunk/zysms/include/ckeditor/_source/plugins/a11yhelp/plugin.js
JavaScript
asf20
1,187
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'a11yhelp', 'en', { accessibilityHelp : { title : 'Accessibility Instructions', contents : 'Help Contents. To close this dialog press ESC.', legend : [ { name : 'General', items : [ { name : 'Editor Toolbar', legend: 'Press ${toolbarFocus} to navigate to the toolbar. ' + 'Move to the next and previous toolbar group with TAB and SHIFT-TAB. ' + 'Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. ' + 'Press SPACE or ENTER to activate the toolbar button.' }, { name : 'Editor Dialog', legend : 'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. ' + 'For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. ' + 'Then move to next tab with TAB OR RIGTH ARROW. ' + 'Move to previous tab with SHIFT + TAB or LEFT ARROW. ' + 'Press SPACE or ENTER to select the tab page.' }, { name : 'Editor Context Menu', legend : 'Press ${contextMenu} or APPLICATION KEY to open context-menu. ' + 'Then move to next menu option with TAB or DOWN ARROW. ' + 'Move to previous option with SHIFT+TAB or UP ARROW. ' + 'Press SPACE or ENTER to select the menu option. ' + 'Open sub-menu of current option wtih SPACE or ENTER or RIGHT ARROW. ' + 'Go back to parent menu item with ESC or LEFT ARROW. ' + 'Close context menu with ESC.' }, { name : 'Editor List Box', legend : 'Inside a list-box, move to next list item with TAB OR DOWN ARROW. ' + 'Move to previous list item with SHIFT + TAB or UP ARROW. ' + 'Press SPACE or ENTER to select the list option. ' + 'Press ESC to close the list-box.' }, { name : 'Editor Element Path Bar', legend : 'Press ${elementsPathFocus} to navigate to the elements path bar. ' + 'Move to next element button with TAB or RIGHT ARROW. ' + 'Move to previous button with SHIFT+TAB or LEFT ARROW. ' + 'Press SPACE or ENTER to select the element in editor.' } ] }, { name : 'Commands', items : [ { name : ' Undo command', legend : 'Press ${undo}' }, { name : ' Redo command', legend : 'Press ${redo}' }, { name : ' Bold command', legend : 'Press ${bold}' }, { name : ' Italic command', legend : 'Press ${italic}' }, { name : ' Underline command', legend : 'Press ${underline}' }, { name : ' Link command', legend : 'Press ${link}' }, { name : ' Toolbar Collapse command', legend : 'Press ${toolbarCollapse}' }, { name : ' Accessibility Help', legend : 'Press ${a11yHelp}' } ] } ] } });
zysms
trunk/zysms/include/ckeditor/_source/plugins/a11yhelp/lang/en.js
JavaScript
asf20
3,415
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'a11yhelp', 'he', { accessibilityHelp : { title : 'הוראות נגישות', contents : 'הוראות נגישות. לסגירה לחץ אסקייפ (ESC).', legend : [ { name : 'כללי', items : [ { name : 'סרגל הכלים', legend: 'לחץ על ${toolbarFocus} כדי לנווט לסרגל הכלים. ' + 'עבור לכפתור הבא עם מקש הטאב (TAB) או חץ שמאלי. ' + 'עבור לכפתור הקודם עם מקש השיפט (SHIFT) + טאב (TAB) או חץ ימני. ' + 'לחץ רווח או אנטר (ENTER) כדי להפעיל את הכפתור הנבחר.' }, { name : 'דיאלוגים (חלונות תשאול)', legend : 'בתוך דיאלוג, לחץ טאב (TAB) כדי לנווט לשדה הבא, לחץ שיפט (SHIFT) + טאב (TAB) כדי לנווט לשדה הקודם, לחץ אנטר (ENTER) כדי לשלוח את הדיאלוג, לחץ אסקייפ (ESC) כדי לבטל. ' + 'בתוך דיאלוגים בעלי מספר טאבים (לשוניות), לחץ אלט (ALT) + F10 כדי לנווט לשורת הטאבים. ' + 'נווט לטאב הבא עם טאב (TAB) או חץ שמאלי. ' + 'עבור לטאב הקודם עם שיפט (SHIFT) + טאב (TAB) או חץ שמאלי. ' + 'לחץ רווח או אנטר (ENTER) כדי להיכנס לטאב.' }, { name : 'תפריט ההקשר (Context Menu)', legend : 'לחץ ${contextMenu} או APPLICATION KEYכדי לפתוח את תפריט ההקשר. ' + 'עבור לאפשרות הבאה עם טאב (TAB) או חץ למטה. ' + 'עבור לאפשרות הקודמת עם שיפט (SHIFT) + טאב (TAB) או חץ למעלה. ' + 'לחץ רווח או אנטר (ENTER) כדי לבחור את האפשרות. ' + 'פתח את תת התפריט (Sub-menu) של האפשרות הנוכחית עם רווח או אנטר (ENTER) או חץ שמאלי. ' + 'חזור לתפריט האב עם אסקייפ (ESC) או חץ שמאלי. ' + 'סגור את תפריט ההקשר עם אסקייפ (ESC).' }, { name : 'תפריטים צפים (List boxes)', legend : 'בתוך תפריט צף, עבור לפריט הבא עם טאב (TAB) או חץ למטה. ' + 'עבור לתפריט הקודם עם שיפט (SHIFT) + טאב (TAB) or חץ עליון. ' + 'Press SPACE or ENTER to select the list option. ' + 'Press ESC to close the list-box.' }, { name : 'עץ אלמנטים (Elements Path)', legend : 'לחץ ${elementsPathFocus} כדי לנווט לעץ האלמנטים. ' + 'עבור לפריט הבא עם טאב (TAB) או חץ ימני. ' + 'עבור לפריט הקודם עם שיפט (SHIFT) + טאב (TAB) או חץ שמאלי. ' + 'לחץ רווח או אנטר (ENTER) כדי לבחור את האלמנט בעורך.' } ] }, { name : 'פקודות', items : [ { name : ' ביטול צעד אחרון', legend : 'לחץ ${undo}' }, { name : ' חזרה על צעד אחרון', legend : 'לחץ ${redo}' }, { name : ' הדגשה', legend : 'לחץ ${bold}' }, { name : ' הטייה', legend : 'לחץ ${italic}' }, { name : ' הוספת קו תחתון', legend : 'לחץ ${underline}' }, { name : ' הוספת לינק', legend : 'לחץ ${link}' }, { name : ' כיווץ סרגל הכלים', legend : 'לחץ ${toolbarCollapse}' }, { name : ' הוראות נגישות', legend : 'לחץ ${a11yHelp}' } ] } ] } }); /* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'a11yhelp', 'he', { accessibilityHelp : { title : 'הוראות נגישות', contents : 'הוראות נגישות. לסגירה לחץ אסקייפ (ESC).', legend : [ { name : 'כללי', items : [ { name : 'סרגל הכלים', legend: 'לחץ על ${toolbarFocus} כדי לנווט לסרגל הכלים. ' + 'עבור לכפתור הבא עם מקש הטאב (TAB) או חץ שמאלי. ' + 'עבור לכפתור הקודם עם מקש השיפט (SHIFT) + טאב (TAB) או חץ ימני. ' + 'לחץ רווח או אנטר (ENTER) כדי להפעיל את הכפתור הנבחר.' }, { name : 'דיאלוגים (חלונות תשאול)', legend : 'בתוך דיאלוג, לחץ טאב (TAB) כדי לנווט לשדה הבא, לחץ שיפט (SHIFT) + טאב (TAB) כדי לנווט לשדה הקודם, לחץ אנטר (ENTER) כדי לשלוח את הדיאלוג, לחץ אסקייפ (ESC) כדי לבטל. ' + 'בתוך דיאלוגים בעלי מספר טאבים (לשוניות), לחץ אלט (ALT) + F10 כדי לנווט לשורת הטאבים. ' + 'נווט לטאב הבא עם טאב (TAB) או חץ שמאלי. ' + 'עבור לטאב הקודם עם שיפט (SHIFT) + טאב (TAB) או חץ שמאלי. ' + 'לחץ רווח או אנטר (ENTER) כדי להיכנס לטאב.' }, { name : 'תפריט ההקשר (Context Menu)', legend : 'לחץ ${contextMenu} או APPLICATION KEYכדי לפתוח את תפריט ההקשר. ' + 'עבור לאפשרות הבאה עם טאב (TAB) או חץ למטה. ' + 'עבור לאפשרות הקודמת עם שיפט (SHIFT) + טאב (TAB) או חץ למעלה. ' + 'לחץ רווח או אנטר (ENTER) כדי לבחור את האפשרות. ' + 'פתח את תת התפריט (Sub-menu) של האפשרות הנוכחית עם רווח או אנטר (ENTER) או חץ שמאלי. ' + 'חזור לתפריט האב עם אסקייפ (ESC) או חץ שמאלי. ' + 'סגור את תפריט ההקשר עם אסקייפ (ESC).' }, { name : 'תפריטים צפים (List boxes)', legend : 'בתוך תפריט צף, עבור לפריט הבא עם טאב (TAB) או חץ למטה. ' + 'עבור לתפריט הקודם עם שיפט (SHIFT) + טאב (TAB) or חץ עליון. ' + 'Press SPACE or ENTER to select the list option. ' + 'Press ESC to close the list-box.' }, { name : 'עץ אלמנטים (Elements Path)', legend : 'לחץ ${elementsPathFocus} כדי לנווט לעץ האלמנטים. ' + 'עבור לפריט הבא עם טאב (TAB) או חץ ימני. ' + 'עבור לפריט הקודם עם שיפט (SHIFT) + טאב (TAB) או חץ שמאלי. ' + 'לחץ רווח או אנטר (ENTER) כדי לבחור את האלמנט בעורך.' } ] }, { name : 'פקודות', items : [ { name : ' ביטול צעד אחרון', legend : 'לחץ ${undo}' }, { name : ' חזרה על צעד אחרון', legend : 'לחץ ${redo}' }, { name : ' הדגשה', legend : 'לחץ ${bold}' }, { name : ' הטייה', legend : 'לחץ ${italic}' }, { name : ' הוספת קו תחתון', legend : 'לחץ ${underline}' }, { name : ' הוספת לינק', legend : 'לחץ ${link}' }, { name : ' כיווץ סרגל הכלים', legend : 'לחץ ${toolbarCollapse}' }, { name : ' הוראות נגישות', legend : 'לחץ ${a11yHelp}' } ] } ] } });
zysms
trunk/zysms/include/ckeditor/_source/plugins/a11yhelp/lang/he.js
JavaScript
asf20
8,571
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) { var lang = editor.lang.accessibilityHelp, id = CKEDITOR.tools.getNextId(); // CharCode <-> KeyChar. var keyMap = { 8 : "BACKSPACE", 9 : "TAB" , 13 : "ENTER" , 16 : "SHIFT" , 17 : "CTRL" , 18 : "ALT" , 19 : "PAUSE" , 20 : "CAPSLOCK" , 27 : "ESCAPE" , 33 : "PAGE UP" , 34 : "PAGE DOWN" , 35 : "END" , 36 : "HOME" , 37 : "LEFT ARROW" , 38 : "UP ARROW" , 39 : "RIGHT ARROW" , 40 : "DOWN ARROW" , 45 : "INSERT" , 46 : "DELETE" , 91 : "LEFT WINDOW KEY" , 92 : "RIGHT WINDOW KEY" , 93 : "SELECT KEY" , 96 : "NUMPAD 0" , 97 : "NUMPAD 1" , 98 : "NUMPAD 2" , 99 : "NUMPAD 3" , 100 : "NUMPAD 4" , 101 : "NUMPAD 5" , 102 : "NUMPAD 6" , 103 : "NUMPAD 7" , 104 : "NUMPAD 8" , 105 : "NUMPAD 9" , 106 : "MULTIPLY" , 107 : "ADD" , 109 : "SUBTRACT" , 110 : "DECIMAL POINT" , 111 : "DIVIDE" , 112 : "F1" , 113 : "F2" , 114 : "F3" , 115 : "F4" , 116 : "F5" , 117 : "F6" , 118 : "F7" , 119 : "F8" , 120 : "F9" , 121 : "F10" , 122 : "F11" , 123 : "F12" , 144 : "NUM LOCK" , 145 : "SCROLL LOCK" , 186 : "SEMI-COLON" , 187 : "EQUAL SIGN" , 188 : "COMMA" , 189 : "DASH" , 190 : "PERIOD" , 191 : "FORWARD SLASH" , 192 : "GRAVE ACCENT" , 219 : "OPEN BRACKET" , 220 : "BACK SLASH" , 221 : "CLOSE BRAKET" , 222 : "SINGLE QUOTE" }; // Modifier keys override. keyMap[ CKEDITOR.ALT ] = 'ALT'; keyMap[ CKEDITOR.SHIFT ] = 'SHIFT'; keyMap[ CKEDITOR.CTRL ] = 'CTRL'; // Sort in desc. var modifiers = [ CKEDITOR.ALT, CKEDITOR.SHIFT, CKEDITOR.CTRL ]; function representKeyStroke( keystroke ) { var quotient, modifier, presentation = []; for ( var i = 0; i < modifiers.length; i++ ) { modifier = modifiers[ i ]; quotient = keystroke / modifiers[ i ]; if ( quotient > 1 && quotient <= 2 ) { keystroke -= modifier; presentation.push( keyMap[ modifier ] ); } } presentation.push( keyMap[ keystroke ] || String.fromCharCode( keystroke ) ); return presentation.join( '+' ); } var variablesPattern = /\$\{(.*?)\}/g; function replaceVariables( match, name ) { var keystrokes = editor.config.keystrokes, definition, length = keystrokes.length; for ( var i = 0; i < length; i++ ) { definition = keystrokes[ i ]; if ( definition[ 1 ] == name ) break; } return representKeyStroke( definition[ 0 ] ); } // Create the help list directly from lang file entries. function buildHelpContents() { var pageTpl = '<div class="cke_accessibility_legend" role="document" aria-labelledby="' + id + '_arialbl" tabIndex="-1">%1</div>' + '<span id="' + id + '_arialbl" class="cke_voice_label">' + lang.contents + ' </span>', sectionTpl = '<h1>%1</h1><dl>%2</dl>', itemTpl = '<dt>%1</dt><dd>%2</dd>'; var pageHtml = [], sections = lang.legend, sectionLength = sections.length; for ( var i = 0; i < sectionLength; i++ ) { var section = sections[ i ], sectionHtml = [], items = section.items, itemsLength = items.length; for ( var j = 0; j < itemsLength; j++ ) { var item = items[ j ], itemHtml; itemHtml = itemTpl.replace( '%1', item.name ). replace( '%2', item.legend.replace( variablesPattern, replaceVariables ) ); sectionHtml.push( itemHtml ); } pageHtml.push( sectionTpl.replace( '%1', section.name ).replace( '%2', sectionHtml.join( '' ) ) ); } return pageTpl.replace( '%1', pageHtml.join( '' ) ); } return { title : lang.title, minWidth : 600, minHeight : 400, contents : [ { id : 'info', label : editor.lang.common.generalTab, expand : true, elements : [ { type : 'html', id : 'legends', style : 'white-space:normal;', focus : function() {}, html : buildHelpContents() + '<style type="text/css">' + '.cke_accessibility_legend' + '{' + 'width:600px;' + 'height:400px;' + 'padding-right:5px;' + 'overflow-y:auto;' + 'overflow-x:hidden;' + '}' + // Some adjustments are to be done for IE6 and Quirks to work "properly" (#5757) '.cke_browser_quirks .cke_accessibility_legend,' + '.cke_browser_ie6 .cke_accessibility_legend' + '{' + 'height:390px' + '}' + // Override non-wrapping white-space rule in reset css. '.cke_accessibility_legend *' + '{' + 'white-space:normal;' + '}' + '.cke_accessibility_legend h1' + '{' + 'font-size: 20px;' + 'border-bottom: 1px solid #AAA;' + 'margin: 5px 0px 15px;' + '}' + '.cke_accessibility_legend dl' + '{' + 'margin-left: 5px;' + '}' + '.cke_accessibility_legend dt' + '{' + 'font-size: 13px;' + 'font-weight: bold;' + '}' + '.cke_accessibility_legend dd' + '{' + 'margin:10px' + '}' + '</style>' } ] } ], buttons : [ CKEDITOR.dialog.cancelButton ] }; });
zysms
trunk/zysms/include/ckeditor/_source/plugins/a11yhelp/dialogs/a11yhelp.js
JavaScript
asf20
5,456
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'richcombo', { requires : [ 'floatpanel', 'listblock', 'button' ], beforeInit : function( editor ) { editor.ui.addHandler( CKEDITOR.UI_RICHCOMBO, CKEDITOR.ui.richCombo.handler ); } }); /** * Button UI element. * @constant * @example */ CKEDITOR.UI_RICHCOMBO = 'richcombo'; CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( { $ : function( definition ) { // Copy all definition properties to this object. CKEDITOR.tools.extend( this, definition, // Set defaults. { title : definition.label, modes : { wysiwyg : 1 } }); // We don't want the panel definition in this object. var panelDefinition = this.panel || {}; delete this.panel; this.id = CKEDITOR.tools.getNextNumber(); this.document = ( panelDefinition && panelDefinition.parent && panelDefinition.parent.getDocument() ) || CKEDITOR.document; panelDefinition.className = ( panelDefinition.className || '' ) + ' cke_rcombopanel'; panelDefinition.block = { multiSelect : panelDefinition.multiSelect, attributes : panelDefinition.attributes }; this._ = { panelDefinition : panelDefinition, items : {}, state : CKEDITOR.TRISTATE_OFF }; }, statics : { handler : { create : function( definition ) { return new CKEDITOR.ui.richCombo( definition ); } } }, proto : { renderHtml : function( editor ) { var output = []; this.render( editor, output ); return output.join( '' ); }, /** * Renders the combo. * @param {CKEDITOR.editor} editor The editor instance which this button is * to be used by. * @param {Array} output The output array to which append the HTML relative * to this button. * @example */ render : function( editor, output ) { var env = CKEDITOR.env; var id = 'cke_' + this.id; var clickFn = CKEDITOR.tools.addFunction( function( $element ) { var _ = this._; if ( _.state == CKEDITOR.TRISTATE_DISABLED ) return; this.createPanel( editor ); if ( _.on ) { _.panel.hide(); return; } this.commit(); var value = this.getValue(); if ( value ) _.list.mark( value ); else _.list.unmarkAll(); _.panel.showBlock( this.id, new CKEDITOR.dom.element( $element ), 4 ); }, this ); var instance = { id : id, combo : this, focus : function() { var element = CKEDITOR.document.getById( id ).getChild( 1 ); element.focus(); }, clickFn : clickFn }; function updateState() { var state = this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state ); this.setValue( '' ); } editor.on( 'mode', updateState, this ); // If this combo is sensitive to readOnly state, update it accordingly. !this.readOnly && editor.on( 'readOnly', updateState, this); var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ) { ev = new CKEDITOR.dom.event( ev ); var keystroke = ev.getKeystroke(); switch ( keystroke ) { case 13 : // ENTER case 32 : // SPACE case 40 : // ARROW-DOWN // Show panel CKEDITOR.tools.callFunction( clickFn, element ); break; default : // Delegate the default behavior to toolbar button key handling. instance.onkey( instance, keystroke ); } // Avoid subsequent focus grab on editor document. ev.preventDefault(); }); var focusFn = CKEDITOR.tools.addFunction( function() { instance.onfocus && instance.onfocus(); } ); // For clean up instance.keyDownFn = keyDownFn; output.push( '<span class="cke_rcombo" role="presentation">', '<span id=', id ); if ( this.className ) output.push( ' class="', this.className, ' cke_off"'); output.push( ' role="presentation">', '<span id="' + id+ '_label" class=cke_label>', this.label, '</span>', '<a hidefocus=true title="', this.title, '" tabindex="-1"', env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(\'' + this.label + '\')"', ' role="button" aria-labelledby="', id , '_label" aria-describedby="', id, '_text" aria-haspopup="true"' ); // Some browsers don't cancel key events in the keydown but in the // keypress. // TODO: Check if really needed for Gecko+Mac. if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) { output.push( ' onkeypress="return false;"' ); } // With Firefox, we need to force it to redraw, otherwise it // will remain in the focus state. if ( CKEDITOR.env.gecko ) { output.push( ' onblur="this.style.cssText = this.style.cssText;"' ); } output.push( ' onkeydown="CKEDITOR.tools.callFunction( ', keyDownFn, ', event, this );"' + ' onfocus="return CKEDITOR.tools.callFunction(', focusFn, ', event);" ' + ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188 '="CKEDITOR.tools.callFunction(', clickFn, ', this); return false;">' + '<span>' + '<span id="' + id + '_text" class="cke_text cke_inline_label">' + this.label + '</span>' + '</span>' + '<span class=cke_openbutton><span class=cke_icon>' + ( CKEDITOR.env.hc ? '&#9660;' : CKEDITOR.env.air ? '&nbsp;' : '' ) + '</span></span>' + // BLACK DOWN-POINTING TRIANGLE '</a>' + '</span>' + '</span>' ); if ( this.onRender ) this.onRender(); return instance; }, createPanel : function( editor ) { if ( this._.panel ) return; var panelDefinition = this._.panelDefinition, panelBlockDefinition = this._.panelDefinition.block, panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(), panel = new CKEDITOR.ui.floatPanel( editor, panelParentElement, panelDefinition ), list = panel.addListBlock( this.id, panelBlockDefinition ), me = this; panel.onShow = function() { if ( me.className ) this.element.getFirst().addClass( me.className + '_panel' ); me.setState( CKEDITOR.TRISTATE_ON ); list.focus( !me.multiSelect && me.getValue() ); me._.on = 1; if ( me.onOpen ) me.onOpen(); }; panel.onHide = function( preventOnClose ) { if ( me.className ) this.element.getFirst().removeClass( me.className + '_panel' ); me.setState( me.modes && me.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); me._.on = 0; if ( !preventOnClose && me.onClose ) me.onClose(); }; panel.onEscape = function() { panel.hide(); }; list.onClick = function( value, marked ) { // Move the focus to the main windows, otherwise it will stay // into the floating panel, even if invisible, and Safari and // Opera will go a bit crazy. me.document.getWindow().focus(); if ( me.onClick ) me.onClick.call( me, value, marked ); if ( marked ) me.setValue( value, me._.items[ value ] ); else me.setValue( '' ); panel.hide( false ); }; this._.panel = panel; this._.list = list; panel.getBlock( this.id ).onHide = function() { me._.on = 0; me.setState( CKEDITOR.TRISTATE_OFF ); }; if ( this.init ) this.init(); }, setValue : function( value, text ) { this._.value = value; var textElement = this.document.getById( 'cke_' + this.id + '_text' ); if ( textElement ) { if ( !( value || text ) ) { text = this.label; textElement.addClass( 'cke_inline_label' ); } else textElement.removeClass( 'cke_inline_label' ); textElement.setHtml( typeof text != 'undefined' ? text : value ); } }, getValue : function() { return this._.value || ''; }, unmarkAll : function() { this._.list.unmarkAll(); }, mark : function( value ) { this._.list.mark( value ); }, hideItem : function( value ) { this._.list.hideItem( value ); }, hideGroup : function( groupTitle ) { this._.list.hideGroup( groupTitle ); }, showAll : function() { this._.list.showAll(); }, add : function( value, html, text ) { this._.items[ value ] = text || value; this._.list.add( value, html, text ); }, startGroup : function( title ) { this._.list.startGroup( title ); }, commit : function() { if ( !this._.committed ) { this._.list.commit(); this._.committed = 1; CKEDITOR.ui.fire( 'ready', this ); } this._.committed = 1; }, setState : function( state ) { if ( this._.state == state ) return; this.document.getById( 'cke_' + this.id ).setState( state ); this._.state = state; } } }); CKEDITOR.ui.prototype.addRichCombo = function( name, definition ) { this.add( name, CKEDITOR.UI_RICHCOMBO, definition ); };
zysms
trunk/zysms/include/ckeditor/_source/plugins/richcombo/plugin.js
JavaScript
asf20
9,471
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Print Plugin */ CKEDITOR.plugins.add( 'print', { init : function( editor ) { var pluginName = 'print'; // Register the command. var command = editor.addCommand( pluginName, CKEDITOR.plugins.print ); // Register the toolbar button. editor.ui.addButton( 'Print', { label : editor.lang.print, command : pluginName }); } } ); CKEDITOR.plugins.print = { exec : function( editor ) { if ( CKEDITOR.env.opera ) return; else if ( CKEDITOR.env.gecko ) editor.window.$.print(); else editor.document.$.execCommand( "Print" ); }, canUndo : false, readOnly : 1, modes : { wysiwyg : !( CKEDITOR.env.opera ) } // It is imposible to print the inner document in Opera. };
zysms
trunk/zysms/include/ckeditor/_source/plugins/print/plugin.js
JavaScript
asf20
912
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.colordialog = { init : function( editor ) { editor.addCommand( 'colordialog', new CKEDITOR.dialogCommand( 'colordialog' ) ); CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' ); } }; CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog );
zysms
trunk/zysms/include/ckeditor/_source/plugins/colordialog/plugin.js
JavaScript
asf20
464
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'colordialog', function( editor ) { // Define some shorthands. var $el = CKEDITOR.dom.element, $doc = CKEDITOR.document, $tools = CKEDITOR.tools, lang = editor.lang.colordialog; // Reference the dialog. var dialog; var spacer = { type : 'html', html : '&nbsp;' }; function clearSelected() { $doc.getById( selHiColorId ).removeStyle( 'background-color' ); dialog.getContentElement( 'picker', 'selectedColor' ).setValue( '' ); } function updateSelected( evt ) { if ( ! ( evt instanceof CKEDITOR.dom.event ) ) evt = new CKEDITOR.dom.event( evt ); var target = evt.getTarget(), color; if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color ); } function updateHighlight( event ) { if ( ! ( event instanceof CKEDITOR.dom.event ) ) event = event.data; var target = event.getTarget(), color; if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) { $doc.getById( hicolorId ).setStyle( 'background-color', color ); $doc.getById( hicolorTextId ).setHtml( color ); } } function clearHighlight() { $doc.getById( hicolorId ).removeStyle( 'background-color' ); $doc.getById( hicolorTextId ).setHtml( '&nbsp;' ); } var onMouseout = $tools.addFunction( clearHighlight ), onClick = updateSelected, onClickHandler = CKEDITOR.tools.addFunction( onClick ), onFocus = updateHighlight, onBlur = clearHighlight; var onKeydownHandler = CKEDITOR.tools.addFunction( function( ev ) { ev = new CKEDITOR.dom.event( ev ); var element = ev.getTarget(); var relative, nodeToMove; var keystroke = ev.getKeystroke(), rtl = editor.lang.dir == 'rtl'; switch ( keystroke ) { // UP-ARROW case 38 : // relative is TR if ( ( relative = element.getParent().getParent().getPrevious() ) ) { nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] ); nodeToMove.focus(); onBlur( ev, element ); onFocus( ev, nodeToMove ); } ev.preventDefault(); break; // DOWN-ARROW case 40 : // relative is TR if ( ( relative = element.getParent().getParent().getNext() ) ) { nodeToMove = relative.getChild( [ element.getParent().getIndex(), 0 ] ); if ( nodeToMove && nodeToMove.type == 1 ) { nodeToMove.focus(); onBlur( ev, element ); onFocus( ev, nodeToMove ); } } ev.preventDefault(); break; // SPACE // ENTER is already handled as onClick case 32 : onClick( ev ); ev.preventDefault(); break; // RIGHT-ARROW case rtl ? 37 : 39 : // relative is TD if ( ( relative = element.getParent().getNext() ) ) { nodeToMove = relative.getChild( 0 ); if ( nodeToMove.type == 1 ) { nodeToMove.focus(); onBlur( ev, element ); onFocus( ev, nodeToMove ); ev.preventDefault( true ); } else onBlur( null, element ); } // relative is TR else if ( ( relative = element.getParent().getParent().getNext() ) ) { nodeToMove = relative.getChild( [ 0, 0 ] ); if ( nodeToMove && nodeToMove.type == 1 ) { nodeToMove.focus(); onBlur( ev, element ); onFocus( ev, nodeToMove ); ev.preventDefault( true ); } else onBlur( null, element ); } break; // LEFT-ARROW case rtl ? 39 : 37 : // relative is TD if ( ( relative = element.getParent().getPrevious() ) ) { nodeToMove = relative.getChild( 0 ); nodeToMove.focus(); onBlur( ev, element ); onFocus( ev, nodeToMove ); ev.preventDefault( true ); } // relative is TR else if ( ( relative = element.getParent().getParent().getPrevious() ) ) { nodeToMove = relative.getLast().getChild( 0 ); nodeToMove.focus(); onBlur( ev, element ); onFocus( ev, nodeToMove ); ev.preventDefault( true ); } else onBlur( null, element ); break; default : // Do not stop not handled events. return; } }); function createColorTable() { // Create the base colors array. var aColors = [ '00', '33', '66', '99', 'cc', 'ff' ]; // This function combines two ranges of three values from the color array into a row. function appendColorRow( rangeA, rangeB ) { for ( var i = rangeA ; i < rangeA + 3 ; i++ ) { var row = table.$.insertRow( -1 ); for ( var j = rangeB ; j < rangeB + 3 ; j++ ) { for ( var n = 0 ; n < 6 ; n++ ) { appendColorCell( row, '#' + aColors[j] + aColors[n] + aColors[i] ); } } } } // This function create a single color cell in the color table. function appendColorCell( targetRow, color ) { var cell = new $el( targetRow.insertCell( -1 ) ); cell.setAttribute( 'class', 'ColorCell' ); cell.setStyle( 'background-color', color ); cell.setStyle( 'width', '15px' ); cell.setStyle( 'height', '15px' ); var index = cell.$.cellIndex + 1 + 18 * targetRow.rowIndex; cell.append( CKEDITOR.dom.element.createFromHtml( '<a href="javascript: void(0);" role="option"' + ' aria-posinset="' + index + '"' + ' aria-setsize="' + 13 * 18 + '"' + ' style="cursor: pointer;display:block;width:100%;height:100% " title="'+ CKEDITOR.tools.htmlEncode( color )+ '"' + ' onkeydown="CKEDITOR.tools.callFunction( ' + onKeydownHandler + ', event, this )"' + ' onclick="CKEDITOR.tools.callFunction(' + onClickHandler + ', event, this ); return false;"' + ' tabindex="-1"><span class="cke_voice_label">' + color + '</span>&nbsp;</a>', CKEDITOR.document ) ); } appendColorRow( 0, 0 ); appendColorRow( 3, 0 ); appendColorRow( 0, 3 ); appendColorRow( 3, 3 ); // Create the last row. var oRow = table.$.insertRow(-1) ; // Create the gray scale colors cells. for ( var n = 0 ; n < 6 ; n++ ) { appendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ; } // Fill the row with black cells. for ( var i = 0 ; i < 12 ; i++ ) { appendColorCell( oRow, '#000000' ) ; } } var table = new $el( 'table' ); createColorTable(); var html = table.getHtml(); var numbering = function( id ) { return CKEDITOR.tools.getNextId() + '_' + id; }, hicolorId = numbering( 'hicolor' ), hicolorTextId = numbering( 'hicolortext' ), selHiColorId = numbering( 'selhicolor' ), tableLabelId = numbering( 'color_table_label' ); return { title : lang.title, minWidth : 360, minHeight : 220, onLoad : function() { // Update reference. dialog = this; }, contents : [ { id : 'picker', label : lang.title, accessKey : 'I', elements : [ { type : 'hbox', padding : 0, widths : [ '70%', '10%', '30%' ], children : [ { type : 'html', html : '<table role="listbox" aria-labelledby="' + tableLabelId + '" onmouseout="CKEDITOR.tools.callFunction( ' + onMouseout + ' );">' + ( !CKEDITOR.env.webkit ? html : '' ) + '</table><span id="' + tableLabelId + '" class="cke_voice_label">' + lang.options +'</span>', onLoad : function() { var table = CKEDITOR.document.getById( this.domId ); table.on( 'mouseover', updateHighlight ); // In WebKit, the table content must be inserted after this event call (#6150) CKEDITOR.env.webkit && table.setHtml( html ); }, focus: function() { var firstColor = this.getElement().getElementsByTag( 'a' ).getItem( 0 ); firstColor.focus(); } }, spacer, { type : 'vbox', padding : 0, widths : [ '70%', '5%', '25%' ], children : [ { type : 'html', html : '<span>' + lang.highlight +'</span>\ <div id="' + hicolorId + '" style="border: 1px solid; height: 74px; width: 74px;"></div>\ <div id="' + hicolorTextId + '">&nbsp;</div><span>' + lang.selected + '</span>\ <div id="' + selHiColorId + '" style="border: 1px solid; height: 20px; width: 74px;"></div>' }, { type : 'text', label : lang.selected, labelStyle: 'display:none', id : 'selectedColor', style : 'width: 74px', onChange : function() { // Try to update color preview with new value. If fails, then set it no none. try { $doc.getById( selHiColorId ).setStyle( 'background-color', this.getValue() ); } catch ( e ) { clearSelected(); } } }, spacer, { type : 'button', id : 'clear', style : 'margin-top: 5px', label : lang.clear, onClick : clearSelected } ] } ] } ] } ] }; } );
zysms
trunk/zysms/include/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js
JavaScript
asf20
9,757
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Justify commands. */ (function() { function getState( editor, path ) { var firstBlock = path.block || path.blockLimit; if ( !firstBlock || firstBlock.getName() == 'body' ) return CKEDITOR.TRISTATE_OFF; return ( getAlignment( firstBlock, editor.config.useComputedState ) == this.value ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF; } function getAlignment( element, useComputedState ) { useComputedState = useComputedState === undefined || useComputedState; var align; if ( useComputedState ) align = element.getComputedStyle( 'text-align' ); else { while ( !element.hasAttribute || !( element.hasAttribute( 'align' ) || element.getStyle( 'text-align' ) ) ) { var parent = element.getParent(); if ( !parent ) break; element = parent; } align = element.getStyle( 'text-align' ) || element.getAttribute( 'align' ) || ''; } align && ( align = align.replace( /-moz-|-webkit-|start|auto/i, '' ) ); !align && useComputedState && ( align = element.getComputedStyle( 'direction' ) == 'rtl' ? 'right' : 'left' ); return align; } function onSelectionChange( evt ) { if ( evt.editor.readOnly ) return; var command = evt.editor.getCommand( this.name ); command.state = getState.call( this, evt.editor, evt.data.path ); command.fire( 'state' ); } function justifyCommand( editor, name, value ) { this.name = name; this.value = value; var classes = editor.config.justifyClasses; if ( classes ) { switch ( value ) { case 'left' : this.cssClassName = classes[0]; break; case 'center' : this.cssClassName = classes[1]; break; case 'right' : this.cssClassName = classes[2]; break; case 'justify' : this.cssClassName = classes[3]; break; } this.cssClassRegex = new RegExp( '(?:^|\\s+)(?:' + classes.join( '|' ) + ')(?=$|\\s)' ); } } function onDirChanged( e ) { var editor = e.editor; var range = new CKEDITOR.dom.range( editor.document ); range.setStartBefore( e.data.node ); range.setEndAfter( e.data.node ); var walker = new CKEDITOR.dom.walker( range ), node; while ( ( node = walker.next() ) ) { if ( node.type == CKEDITOR.NODE_ELEMENT ) { // A child with the defined dir is to be ignored. if ( !node.equals( e.data.node ) && node.getDirection() ) { range.setStartAfter( node ); walker = new CKEDITOR.dom.walker( range ); continue; } // Switch the alignment. var classes = editor.config.justifyClasses; if ( classes ) { // The left align class. if ( node.hasClass( classes[ 0 ] ) ) { node.removeClass( classes[ 0 ] ); node.addClass( classes[ 2 ] ); } // The right align class. else if ( node.hasClass( classes[ 2 ] ) ) { node.removeClass( classes[ 2 ] ); node.addClass( classes[ 0 ] ); } } // Always switch CSS margins. var style = 'text-align'; var align = node.getStyle( style ); if ( align == 'left' ) node.setStyle( style, 'right' ); else if ( align == 'right' ) node.setStyle( style, 'left' ); } } } justifyCommand.prototype = { exec : function( editor ) { var selection = editor.getSelection(), enterMode = editor.config.enterMode; if ( !selection ) return; var bookmarks = selection.createBookmarks(), ranges = selection.getRanges( true ); var cssClassName = this.cssClassName, iterator, block; var useComputedState = editor.config.useComputedState; useComputedState = useComputedState === undefined || useComputedState; for ( var i = ranges.length - 1 ; i >= 0 ; i-- ) { iterator = ranges[ i ].createIterator(); iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR; while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) ) { block.removeAttribute( 'align' ); block.removeStyle( 'text-align' ); // Remove any of the alignment classes from the className. var className = cssClassName && ( block.$.className = CKEDITOR.tools.ltrim( block.$.className.replace( this.cssClassRegex, '' ) ) ); var apply = ( this.state == CKEDITOR.TRISTATE_OFF ) && ( !useComputedState || ( getAlignment( block, true ) != this.value ) ); if ( cssClassName ) { // Append the desired class name. if ( apply ) block.addClass( cssClassName ); else if ( !className ) block.removeAttribute( 'class' ); } else if ( apply ) block.setStyle( 'text-align', this.value ); } } editor.focus(); editor.forceNextSelectionCheck(); selection.selectBookmarks( bookmarks ); } }; CKEDITOR.plugins.add( 'justify', { init : function( editor ) { var left = new justifyCommand( editor, 'justifyleft', 'left' ), center = new justifyCommand( editor, 'justifycenter', 'center' ), right = new justifyCommand( editor, 'justifyright', 'right' ), justify = new justifyCommand( editor, 'justifyblock', 'justify' ); editor.addCommand( 'justifyleft', left ); editor.addCommand( 'justifycenter', center ); editor.addCommand( 'justifyright', right ); editor.addCommand( 'justifyblock', justify ); editor.ui.addButton( 'JustifyLeft', { label : editor.lang.justify.left, command : 'justifyleft' } ); editor.ui.addButton( 'JustifyCenter', { label : editor.lang.justify.center, command : 'justifycenter' } ); editor.ui.addButton( 'JustifyRight', { label : editor.lang.justify.right, command : 'justifyright' } ); editor.ui.addButton( 'JustifyBlock', { label : editor.lang.justify.block, command : 'justifyblock' } ); editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, left ) ); editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, right ) ); editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, center ) ); editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, justify ) ); editor.on( 'dirChanged', onDirChanged ); }, requires : [ 'domiterator' ] }); })(); /** * List of classes to use for aligning the contents. If it's null, no classes will be used * and instead the corresponding CSS values will be used. The array should contain 4 members, in the following order: left, center, right, justify. * @name CKEDITOR.config.justifyClasses * @type Array * @default null * @example * // Use the classes 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify' * config.justifyClasses = [ 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify' ]; */
zysms
trunk/zysms/include/ckeditor/_source/plugins/justify/plugin.js
JavaScript
asf20
7,113
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @name CKEDITOR.theme * @class */ CKEDITOR.themes.add( 'default', (function() { var hiddenSkins = {}; function checkSharedSpace( editor, spaceName ) { var container, element; // Try to retrieve the target element from the sharedSpaces settings. element = editor.config.sharedSpaces; element = element && element[ spaceName ]; element = element && CKEDITOR.document.getById( element ); // If the element is available, we'll then create the container for // the space. if ( element ) { // Creates an HTML structure that reproduces the editor class hierarchy. var html = '<span class="cke_shared "' + ' dir="'+ editor.lang.dir + '"' + '>' + '<span class="' + editor.skinClass + ' ' + editor.id + ' cke_editor_' + editor.name + '">' + '<span class="' + CKEDITOR.env.cssClass + '">' + '<span class="cke_wrapper cke_' + editor.lang.dir + '">' + '<span class="cke_editor">' + '<div class="cke_' + spaceName + '">' + '</div></span></span></span></span></span>'; var mainContainer = element.append( CKEDITOR.dom.element.createFromHtml( html, element.getDocument() ) ); // Only the first container starts visible. Others get hidden. if ( element.getCustomData( 'cke_hasshared' ) ) mainContainer.hide(); else element.setCustomData( 'cke_hasshared', 1 ); // Get the deeper inner <div>. container = mainContainer.getChild( [0,0,0,0] ); // Save a reference to the shared space container. !editor.sharedSpaces && ( editor.sharedSpaces = {} ); editor.sharedSpaces[ spaceName ] = container; // When the editor gets focus, we show the space container, hiding others. editor.on( 'focus', function() { for ( var i = 0, sibling, children = element.getChildren() ; ( sibling = children.getItem( i ) ) ; i++ ) { if ( sibling.type == CKEDITOR.NODE_ELEMENT && !sibling.equals( mainContainer ) && sibling.hasClass( 'cke_shared' ) ) { sibling.hide(); } } mainContainer.show(); }); editor.on( 'destroy', function() { mainContainer.remove(); }); } return container; } return /** @lends CKEDITOR.theme */ { build : function( editor, themePath ) { var name = editor.name, element = editor.element, elementMode = editor.elementMode; if ( !element || elementMode == CKEDITOR.ELEMENT_MODE_NONE ) return; if ( elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) element.hide(); // Get the HTML for the predefined spaces. var topHtml = editor.fire( 'themeSpace', { space : 'top', html : '' } ).html; var contentsHtml = editor.fire( 'themeSpace', { space : 'contents', html : '' } ).html; var bottomHtml = editor.fireOnce( 'themeSpace', { space : 'bottom', html : '' } ).html; var height = contentsHtml && editor.config.height; var tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0; // The editor height is considered only if the contents space got filled. if ( !contentsHtml ) height = 'auto'; else if ( !isNaN( height ) ) height += 'px'; var style = ''; var width = editor.config.width; if ( width ) { if ( !isNaN( width ) ) width += 'px'; style += "width: " + width + ";"; } var sharedTop = topHtml && checkSharedSpace( editor, 'top' ), sharedBottoms = checkSharedSpace( editor, 'bottom' ); sharedTop && ( sharedTop.setHtml( topHtml ) , topHtml = '' ); sharedBottoms && ( sharedBottoms.setHtml( bottomHtml ), bottomHtml = '' ); var hideSkin = '<style>.' + editor.skinClass + '{visibility:hidden;}</style>'; if ( hiddenSkins[ editor.skinClass ] ) hideSkin = ''; else hiddenSkins[ editor.skinClass ] = 1; var container = CKEDITOR.dom.element.createFromHtml( [ '<span' + ' id="cke_', name, '"' + ' class="', editor.skinClass, ' ', editor.id, ' cke_editor_', name, '"' + ' dir="', editor.lang.dir, '"' + ' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' + ' lang="', editor.langCode, '"' + ( CKEDITOR.env.webkit? ' tabindex="' + tabIndex + '"' : '' ) + ' role="application"' + ' aria-labelledby="cke_', name, '_arialbl"' + ( style ? ' style="' + style + '"' : '' ) + '>' + '<span id="cke_', name, '_arialbl" class="cke_voice_label">' + editor.lang.editor + '</span>' + '<span class="' , CKEDITOR.env.cssClass, '" role="presentation">' + '<span class="cke_wrapper cke_', editor.lang.dir, '" role="presentation">' + '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody>' + '<tr', topHtml ? '' : ' style="display:none"', ' role="presentation"><td id="cke_top_' , name, '" class="cke_top" role="presentation">' , topHtml , '</td></tr>' + '<tr', contentsHtml ? '' : ' style="display:none"', ' role="presentation"><td id="cke_contents_', name, '" class="cke_contents" style="height:', height, '" role="presentation">', contentsHtml, '</td></tr>' + '<tr', bottomHtml ? '' : ' style="display:none"', ' role="presentation"><td id="cke_bottom_' , name, '" class="cke_bottom" role="presentation">' , bottomHtml , '</td></tr>' + '</tbody></table>' + //Hide the container when loading skins, later restored by skin css. hideSkin + '</span>' + '</span>' + '</span>' ].join( '' ) ); container.getChild( [1, 0, 0, 0, 0] ).unselectable(); container.getChild( [1, 0, 0, 0, 2] ).unselectable(); if ( elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) container.insertAfter( element ); else element.append( container ); /** * The DOM element that holds the main editor interface. * @name CKEDITOR.editor.prototype.container * @type CKEDITOR.dom.element * @example * var editor = CKEDITOR.instances.editor1; * alert( <b>editor.container</b>.getName() ); "span" */ editor.container = container; // Disable browser context menu for editor's chrome. container.disableContextMenu(); // Use a class to indicate that the current selection is in different direction than the UI. editor.on( 'contentDirChanged', function( evt ) { var func = ( editor.lang.dir != evt.data ? 'add' : 'remove' ) + 'Class'; container.getChild( 1 )[ func ]( 'cke_mixed_dir_content' ); // Put the mixed direction class on the respective element also for shared spaces. var toolbarSpace = this.sharedSpaces && this.sharedSpaces[ this.config.toolbarLocation ]; toolbarSpace && toolbarSpace.getParent().getParent()[ func ]( 'cke_mixed_dir_content' ); }); editor.fireOnce( 'themeLoaded' ); editor.fireOnce( 'uiReady' ); }, buildDialog : function( editor ) { var baseIdNumber = CKEDITOR.tools.getNextNumber(); var element = CKEDITOR.dom.element.createFromHtml( [ '<div class="', editor.id, '_dialog cke_editor_', editor.name.replace('.', '\\.'), '_dialog cke_skin_', editor.skinName, '" dir="', editor.lang.dir, '"' + ' lang="', editor.langCode, '"' + ' role="dialog"' + ' aria-labelledby="%title#"' + '>' + '<table class="cke_dialog', ' ' + CKEDITOR.env.cssClass, ' cke_', editor.lang.dir, '" style="position:absolute" role="presentation">' + '<tr><td role="presentation">' + '<div class="%body" role="presentation">' + '<div id="%title#" class="%title" role="presentation"></div>' + '<a id="%close_button#" class="%close_button" href="javascript:void(0)" title="' + editor.lang.common.close+'" role="button"><span class="cke_label">X</span></a>' + '<div id="%tabs#" class="%tabs" role="tablist"></div>' + '<table class="%contents" role="presentation">' + '<tr>' + '<td id="%contents#" class="%contents" role="presentation"></td>' + '</tr>' + '<tr>' + '<td id="%footer#" class="%footer" role="presentation"></td>' + '</tr>' + '</table>' + '</div>' + '<div id="%tl#" class="%tl"></div>' + '<div id="%tc#" class="%tc"></div>' + '<div id="%tr#" class="%tr"></div>' + '<div id="%ml#" class="%ml"></div>' + '<div id="%mr#" class="%mr"></div>' + '<div id="%bl#" class="%bl"></div>' + '<div id="%bc#" class="%bc"></div>' + '<div id="%br#" class="%br"></div>' + '</td></tr>' + '</table>', //Hide the container when loading skins, later restored by skin css. ( CKEDITOR.env.ie ? '' : '<style>.cke_dialog{visibility:hidden;}</style>' ), '</div>' ].join( '' ) .replace( /#/g, '_' + baseIdNumber ) .replace( /%/g, 'cke_dialog_' ) ); var body = element.getChild( [ 0, 0, 0, 0, 0 ] ), title = body.getChild( 0 ), close = body.getChild( 1 ); // IFrame shim for dialog that masks activeX in IE. (#7619) if ( CKEDITOR.env.ie && !CKEDITOR.env.ie6Compat ) { var isCustomDomain = CKEDITOR.env.isCustomDomain(), src = 'javascript:void(function(){' + encodeURIComponent( 'document.open();' + ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + 'document.close();' ) + '}())', iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' + ' frameBorder="0"' + ' class="cke_iframe_shim"' + ' src="' + src + '"' + ' tabIndex="-1"' + '></iframe>' ); iframe.appendTo( body.getParent() ); } // Make the Title and Close Button unselectable. title.unselectable(); close.unselectable(); return { element : element, parts : { dialog : element.getChild( 0 ), title : title, close : close, tabs : body.getChild( 2 ), contents : body.getChild( [ 3, 0, 0, 0 ] ), footer : body.getChild( [ 3, 0, 1, 0 ] ) } }; }, destroy : function( editor ) { var container = editor.container, element = editor.element; if ( container ) { container.clearCustomData(); container.remove(); } if ( element ) { element.clearCustomData(); editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.show(); delete editor.element; } } }; })() ); /** * Returns the DOM element that represents a theme space. The default theme defines * three spaces, namely "top", "contents" and "bottom", representing the main * blocks that compose the editor interface. * @param {String} spaceName The space name. * @returns {CKEDITOR.dom.element} The element that represents the space. * @example * // Hide the bottom space in the UI. * var bottom = editor.getThemeSpace( 'bottom' ); * bottom.setStyle( 'display', 'none' ); */ CKEDITOR.editor.prototype.getThemeSpace = function( spaceName ) { var spacePrefix = 'cke_' + spaceName; var space = this._[ spacePrefix ] || ( this._[ spacePrefix ] = CKEDITOR.document.getById( spacePrefix + '_' + this.name ) ); return space; }; /** * Resizes the editor interface. * @param {Number|String} width The new width. It can be an pixels integer or a * CSS size value. * @param {Number|String} height The new height. It can be an pixels integer or * a CSS size value. * @param {Boolean} [isContentHeight] Indicates that the provided height is to * be applied to the editor contents space, not to the entire editor * interface. Defaults to false. * @param {Boolean} [resizeInner] Indicates that the first inner interface * element must receive the size, not the outer element. The default theme * defines the interface inside a pair of span elements * (&lt;span&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;). By default the * first span element receives the sizes. If this parameter is set to * true, the second span is sized instead. * @example * editor.resize( 900, 300 ); * @example * editor.resize( '100%', 450, true ); */ CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, resizeInner ) { var container = this.container, contents = CKEDITOR.document.getById( 'cke_contents_' + this.name ), contentsFrame = CKEDITOR.env.webkit && this.document && this.document.getWindow().$.frameElement, outer = resizeInner ? container.getChild( 1 ) : container; // Set as border box width. (#5353) outer.setSize( 'width', width, true ); // WebKit needs to refresh the iframe size to avoid rendering issues. (1/2) (#8348) contentsFrame && ( contentsFrame.style.width = '1%' ); // Get the height delta between the outer table and the content area. // If we're setting the content area's height, then we don't need the delta. var delta = isContentHeight ? 0 : ( outer.$.offsetHeight || 0 ) - ( contents.$.clientHeight || 0 ); contents.setStyle( 'height', Math.max( height - delta, 0 ) + 'px' ); // WebKit needs to refresh the iframe size to avoid rendering issues. (2/2) (#8348) contentsFrame && ( contentsFrame.style.width = '100%' ); // Emit a resize event. this.fire( 'resize' ); }; /** * Gets the element that can be freely used to check the editor size. This method * is mainly used by the resize plugin, which adds a UI handle that can be used * to resize the editor. * @param {Boolean} forContents Whether to return the "contents" part of the theme instead of the container. * @returns {CKEDITOR.dom.element} The resizable element. * @example */ CKEDITOR.editor.prototype.getResizable = function( forContents ) { return forContents ? CKEDITOR.document.getById( 'cke_contents_' + this.name ) : this.container; }; /** * Makes it possible to place some of the editor UI blocks, like the toolbar * and the elements path, into any element in the page. * The elements used to hold the UI blocks can be shared among several editor * instances. In that case, only the blocks of the active editor instance will * display. * @name CKEDITOR.config.sharedSpaces * @type Object * @default undefined * @example * // Place the toolbar inside the element with ID "someElementId" and the * // elements path into the element with ID "anotherId". * config.sharedSpaces = * { * top : 'someElementId', * bottom : 'anotherId' * }; * @example * // Place the toolbar inside the element with ID "someElementId". The * // elements path will remain attached to the editor UI. * config.sharedSpaces = * { * top : 'someElementId' * }; */ /** * Fired after the editor instance is resized through * the {@link CKEDITOR.editor.prototype.resize} method. * @name CKEDITOR.editor#resize * @event */
zysms
trunk/zysms/include/ckeditor/_source/themes/default/theme.js
JavaScript
asf20
15,021
<?php /* * Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ /*! \mainpage CKEditor - PHP server side intergation * \section intro_sec CKEditor * Visit <a href="http://ckeditor.com">CKEditor web site</a> to find more information about the editor. * \section install_sec Installation * \subsection step1 Include ckeditor.php in your PHP web site. * @code * <?php * include("ckeditor/ckeditor.php"); * ?> * @endcode * \subsection step2 Create CKEditor class instance and use one of available methods to insert CKEditor. * @code * <?php * $CKEditor = new CKEditor(); * echo $CKEditor->textarea("field1", "<p>Initial value.</p>"); * ?> * @endcode */ if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) ) include_once( 'ckeditor_php4.php' ) ; else include_once( 'ckeditor_php5.php' ) ;
zysms
trunk/zysms/include/ckeditor/ckeditor.php
PHP
asf20
962
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ body { /* Font */ font-family: Arial, Verdana, sans-serif; font-size: 12px; /* Text color */ color: #222; /* Remove the background color to make it transparent */ background-color: #fff; } ol,ul,dl { /* IE7: reset rtl list margin. (#7334) */ *margin-right:0px; /* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/ padding:0 40px; }
zysms
trunk/zysms/include/ckeditor/contents.css
CSS
asf20
559
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ // Compressed version of core/ckeditor_base.js. See original for instructions. /*jsl:ignore*/ if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.2',revision:'7275',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})(); /*jsl:end*/ // Uncomment the following line to have a new timestamp generated for each // request, having clear cache load of the editor code. // CKEDITOR.timestamp = ( new Date() ).valueOf(); if ( CKEDITOR.loader ) CKEDITOR.loader.load( 'core/ckeditor' ); else { // Set the script name to be loaded by the loader. CKEDITOR._autoLoad = 'core/ckeditor'; // Include the loader script. if ( document.body && (!document.readyState || document.readyState == 'complete') ) { var script = document.createElement( 'script' ); script.type = 'text/javascript'; script.src = CKEDITOR.getUrl( '_source/core/loader.js' ); document.body.appendChild( script ); } else { document.write( '<script type="text/javascript" src="' + CKEDITOR.getUrl( '_source/core/loader.js' ) + '"></script>' ); } }
zysms
trunk/zysms/include/ckeditor/ckeditor_source.js
JavaScript
asf20
1,908
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- == BEGIN TEXT ONLY VERSION == Software License Agreement ========================== CKEditor - The text editor for Internet - http://ckeditor.com Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.org/licenses/gpl.html (See Appendix A) - GNU Lesser General Public License Version 2.1 or later (the "LGPL") http://www.gnu.org/licenses/lgpl.html (See Appendix B) - Mozilla Public License Version 1.1 or later (the "MPL") http://www.mozilla.org/MPL/MPL-1.1.html (See Appendix C) You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "legal.txt" in your version of this software, indicating your license choice. Sources of Intellectual Property Included in CKEditor ===================================================== Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission. Trademarks ========== CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. Appendix A: The GPL License =========================== GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software-to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix B: The LGPL License ============================ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software-to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages-typically libraries-of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix C: The MPL License =========================== MOZILLA PUBLIC LICENSE Version 1.1 =============== 1. Definitions. 1.0.1. "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5. "Executable" means Covered Code in any form other than Source Code. 1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8. "License" means this document. 1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12. "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1. The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2. Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1. Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2. Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3. Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4. Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5. Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6. Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. 3.7. Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1. New Versions. Netscape Communications Corporation ("Netscape") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2. Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Netscape. No one other than Netscape has the right to modify the terms applicable to Covered Code created under this License. 6.3. Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2. If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the NPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. EXHIBIT A -Mozilla Public License. ``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is ______________________________________. The Initial Developer of the Original Code is ________________________. Portions created by ______________________ are Copyright (C) ______ _______________________. All Rights Reserved. Contributor(s): ______________________________________. Alternatively, the contents of this file may be used under the terms of the _____ license (the "[___] License"), in which case the provisions of [______] License are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the [___] License. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the [___] License." [NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] == END TEXT ONLY VERSION == --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>License - CKEditor</title> </head> <body> <h1> Software License Agreement </h1> <p> <strong>CKEditor&trade;</strong> - The text editor for Internet&trade; - <a href="http://ckeditor.com"> http://ckeditor.com</a><br /> Copyright &copy; 2003-2011, <a href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> <p> Licensed under the terms of any of the following licenses at your choice: </p> <ul> <li><a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a> Version 2 or later (the "GPL");</li> <li><a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a> Version 2.1 or later (the "LGPL");</li> <li><a href="http://www.mozilla.org/MPL/MPL-1.1.html">Mozilla Public License</a> Version 1.1 or later (the "MPL").</li> </ul> <p> You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "LEGAL" in your version of this software, indicating your license choice. In any case, your choice will not restrict any recipient of your version of this software to use, reproduce, modify and distribute this software under any of the above licenses. </p> <h2> Sources of Intellectual Property Included in CKEditor </h2> <p> Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission. </p> <p> <a href="http://developer.yahoo.com/yui/yuitest/">YUI Test</a>: At _source/tests/yuitest.js can be found part of the source code of YUI, which is licensed under the terms of the <a href="http://developer.yahoo.com/yui/license.txt">BSD License</a>. YUI is Copyright &copy; 2008, Yahoo! Inc. </p> <h2> Trademarks </h2> <p> CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. </p> </body> </html>
zysms
trunk/zysms/include/ckeditor/LICENSE.html
HTML
asf20
70,729
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Installation Guide - CKEditor</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> h3 { border-bottom: 1px solid #AAAAAA; } pre { background-color: #F9F9F9; border: 1px dashed #2F6FAB; padding: 1em; line-height: 1.1em; } #footer hr { margin: 10px 0 15px 0; height: 1px; border: solid 1px gray; border-bottom: none; } #footer p { margin: 0 10px 10px 10px; float: left; } #footer #copy { float: right; } </style> </head> <body> <h1> CKEditor Installation Guide</h1> <h3> What&#39;s CKEditor?</h3> <p> CKEditor is a text editor to be used inside web pages. It&#39;s not a replacement for desktop text editors like Word or OpenOffice, but a component to be used as part of web applications and web sites.</p> <h3> Installation</h3> <p> Installing CKEditor is an easy task. Just follow these simple steps:</p> <ol> <li><strong>Download</strong> the latest version of the editor from our web site: <a href="http://ckeditor.com">http://ckeditor.com</a>. You should have already completed this step, but be sure you have the very latest version.</li> <li><strong>Extract</strong> (decompress) the downloaded file into the root of your web site.</li> </ol> <p> <strong>Note:</strong> CKEditor is by default installed in the &quot;ckeditor&quot; folder. You can place the files in whichever you want though.</p> <h3> Checking Your Installation </h3> <p> The editor comes with a few sample pages that can be used to verify that installation proceeded properly. Take a look at the <a href="_samples">_samples</a> directory.</p> <p> To test your installation, just call the following page at your web site:</p> <pre> http://&lt;your site&gt;/&lt;CKEditor installation path&gt;/_samples/index.html For example: http://www.example.com/ckeditor/_samples/index.html</pre> <h3> Documentation</h3> <p> The full editor documentation is available online at the following address:<br /> <a href="http://docs.cksource.com/ckeditor">http://docs.cksource.com/ckeditor</a></p> <div id="footer"> <hr /> <p> CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/INSTALL.html
HTML
asf20
2,859
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; // 设置宽高 config.width = 560; config.height = 100; //设置基础功能 config.toolbar = 'Basic'; };
zysms
trunk/zysms/include/ckeditor/config.js
JavaScript
asf20
465
<% ' ' Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. ' For licensing, see LICENSE.html or http://ckeditor.com/license ' Shared variable for all instances ("static") dim CKEDITOR_initComplete dim CKEDITOR_returnedEvents '' ' \brief CKEditor class that can be used to create editor ' instances in ASP pages on server side. ' @see http://ckeditor.com ' ' Sample usage: ' @code ' editor = new CKEditor ' editor.editor "editor1", "<p>Initial value.</p>", empty, empty ' @endcode Class CKEditor '' ' The version of %CKEditor. private version '' ' A constant string unique for each release of %CKEditor. private mTimeStamp '' ' URL to the %CKEditor installation directory (absolute or relative to document root). ' If not set, CKEditor will try to guess it's path. ' ' Example usage: ' @code ' editor.basePath = "/ckeditor/" ' @endcode Public basePath '' ' A boolean variable indicating whether CKEditor has been initialized. ' Set it to true only if you have already included ' &lt;script&gt; tag loading ckeditor.js in your website. Public initialized '' ' Boolean variable indicating whether created code should be printed out or returned by a function. ' ' Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function. ' @code ' editor = new CKEditor ' editor.returnOutput = true ' code = editor.editor("editor1", "<p>Initial value.</p>", empty, empty) ' response.write "<p>Editor 1:</p>" ' response.write code ' @endcode Public returnOutput '' ' A Dictionary with textarea attributes. ' ' When %CKEditor is created with the editor() method, a HTML &lt;textarea&gt; element is created, ' it will be displayed to anyone with JavaScript disabled or with incompatible browser. public textareaAttributes '' ' A string indicating the creation date of %CKEditor. ' Do not change it unless you want to force browsers to not use previously cached version of %CKEditor. public timestamp '' ' A dictionary that holds the instance configuration. private oInstanceConfig '' ' A dictionary that holds the configuration for all the instances. private oAllInstancesConfig '' ' A dictionary that holds event listeners for the instance. private oInstanceEvents '' ' A dictionary that holds event listeners for all the instances. private oAllInstancesEvents '' ' A Dictionary that holds global event listeners (CKEDITOR object) private oGlobalEvents Private Sub Class_Initialize() version = "3.6.2" timeStamp = "B8DJ5M3" mTimeStamp = "B8DJ5M3" Set oInstanceConfig = CreateObject("Scripting.Dictionary") Set oAllInstancesConfig = CreateObject("Scripting.Dictionary") Set oInstanceEvents = CreateObject("Scripting.Dictionary") Set oAllInstancesEvents = CreateObject("Scripting.Dictionary") Set oGlobalEvents = CreateObject("Scripting.Dictionary") Set textareaAttributes = CreateObject("Scripting.Dictionary") textareaAttributes.Add "rows", 8 textareaAttributes.Add "cols", 60 End Sub '' ' Creates a %CKEditor instance. ' In incompatible browsers %CKEditor will downgrade to plain HTML &lt;textarea&gt; element. ' ' @param name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element). ' @param value (string) Initial value. ' ' Example usage: ' @code ' set editor = New CKEditor ' editor.editor "field1", "<p>Initial value.</p>" ' @endcode ' ' Advanced example: ' @code ' set editor = new CKEditor ' set config = CreateObject("Scripting.Dictionary") ' config.Add "toolbar", Array( _ ' Array( "Source", "-", "Bold", "Italic", "Underline", "Strike" ), _ ' Array( "Image", "Link", "Unlink", "Anchor" ) _ ' ) ' set events = CreateObject("Scripting.Dictionary") ' events.Add "instanceReady", "function (evt) { alert('Loaded second editor: ' + evt.editor.name );}" ' editor.editor "field1", "<p>Initial value.</p>", config, events ' @endcode ' public function editor(name, value) dim attr, out, js, customConfig, extraConfig dim attribute attr = "" for each attribute in textareaAttributes attr = attr & " " & attribute & "=""" & replace( textareaAttributes( attribute ), """", "&quot" ) & """" next out = "<textarea name=""" & name & """" & attr & ">" & Server.HtmlEncode(value) & "</textarea>" & vbcrlf if not(initialized) then out = out & init() end if set customConfig = configSettings() js = returnGlobalEvents() extraConfig = (new JSON)( empty, customConfig, false ) if extraConfig<>"" then extraConfig = ", " & extraConfig js = js & "CKEDITOR.replace('" & name & "'" & extraConfig & ");" out = out & script(js) if not(returnOutput) then response.write out out = "" end if editor = out oInstanceConfig.RemoveAll oInstanceEvents.RemoveAll end function '' ' Replaces a &lt;textarea&gt; with a %CKEditor instance. ' ' @param id (string) The id or name of textarea element. ' ' Example 1: adding %CKEditor to &lt;textarea name="article"&gt;&lt;/textarea&gt; element: ' @code ' set editor = New CKEditor ' editor.replace "article" ' @endcode ' public function replaceInstance(id) dim out, js, customConfig, extraConfig out = "" if not(initialized) then out = out & init() end if set customConfig = configSettings() js = returnGlobalEvents() extraConfig = (new JSON)( empty, customConfig, false ) if extraConfig<>"" then extraConfig = ", " & extraConfig js = js & "CKEDITOR.replace('" & id & "'" & extraConfig & ");" out = out & script(js) if not(returnOutput) then response.write out out = "" end if replaceInstance = out oInstanceConfig.RemoveAll oInstanceEvents.RemoveAll end function '' ' Replace all &lt;textarea&gt; elements available in the document with editor instances. ' ' @param className (string) If set, replace all textareas with class className in the page. ' ' Example 1: replace all &lt;textarea&gt; elements in the page. ' @code ' editor = new CKEditor ' editor.replaceAll empty ' @endcode ' ' Example 2: replace all &lt;textarea class="myClassName"&gt; elements in the page. ' @code ' editor = new CKEditor ' editor.replaceAll 'myClassName' ' @endcode ' function replaceAll(className) dim out, js, customConfig out = "" if not(initialized) then out = out & init() end if set customConfig = configSettings() js = returnGlobalEvents() if (customConfig.Count=0) then if (isEmpty(className)) then js = js & "CKEDITOR.replaceAll();" else js = js & "CKEDITOR.replaceAll('" & className & "');" end if else js = js & "CKEDITOR.replaceAll( function(textarea, config) {\n" if not(isEmpty(className)) then js = js & " var classRegex = new RegExp('(?:^| )' + '" & className & "' + '(?:$| )');\n" js = js & " if (!classRegex.test(textarea.className))\n" js = js & " return false;\n" end if js = js & " CKEDITOR.tools.extend(config, " & (new JSON)( empty, customConfig, false ) & ", true);" js = js & "} );" end if out = out & script(js) if not(returnOutput) then response.write out out = "" end if replaceAll = out oInstanceConfig.RemoveAll oInstanceEvents.RemoveAll end function '' ' A Dictionary that holds the %CKEditor configuration for all instances ' For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html ' ' Example usage: ' @code ' editor.config("height") = 400 ' // Use @@ at the beggining of a string to ouput it without surrounding quotes. ' editor.config("width") = "@@screen.width * 0.8" ' @endcode Public Property Let Config( configKey, configValue ) oAllInstancesConfig.Add configKey, configValue End Property '' ' Configuration options for the next instance ' Public Property Let instanceConfig( configKey, configValue ) oInstanceConfig.Add configKey, configValue End Property '' ' Adds event listener. ' Events are fired by %CKEditor in various situations. ' ' @param eventName (string) Event name. ' @param javascriptCode (string) Javascript anonymous function or function name. ' ' Example usage: ' @code ' editor.addEventHandler "instanceReady", "function (ev) { " & _ ' " alert('Loaded: ' + ev.editor.name); " & _ ' "}" ' @endcode ' public sub addEventHandler(eventName, javascriptCode) if not(oAllInstancesEvents.Exists( eventName ) ) then oAllInstancesEvents.Add eventName, Array() end if dim listeners, size listeners = oAllInstancesEvents( eventName ) size = ubound(listeners) + 1 redim preserve listeners(size) listeners(size) = javascriptCode oAllInstancesEvents( eventName ) = listeners ' '' Avoid duplicates. fixme... ' if (!in_array($javascriptCode, $this->_events[$event])) { ' $this->_events[$event][] = $javascriptCode; ' } end sub '' ' Clear registered event handlers. ' Note: this function will have no effect on already created editor instances. ' ' @param eventName (string) Event name, if set to 'empty' all event handlers will be removed. ' public sub clearEventHandlers( eventName ) if not(isEmpty( eventName )) then oAllInstancesEvents.Remove eventName else oAllInstancesEvents.RemoveAll end if end sub '' ' Adds event listener only for the next instance. ' Events are fired by %CKEditor in various situations. ' ' @param eventName (string) Event name. ' @param javascriptCode (string) Javascript anonymous function or function name. ' ' Example usage: ' @code ' editor.addInstanceEventHandler "instanceReady", "function (ev) { " & _ ' " alert('Loaded: ' + ev.editor.name); " & _ ' "}" ' @endcode ' public sub addInstanceEventHandler(eventName, javascriptCode) if not(oInstanceEvents.Exists( eventName ) ) then oInstanceEvents.Add eventName, Array() end if dim listeners, size listeners = oInstanceEvents( eventName ) size = ubound(listeners) + 1 redim preserve listeners(size) listeners(size) = javascriptCode oInstanceEvents( eventName ) = listeners ' '' Avoid duplicates. fixme... ' if (!in_array($javascriptCode, $this->_events[$event])) { ' $this->_events[$event][] = $javascriptCode; ' } end sub '' ' Clear registered event handlers. ' Note: this function will have no effect on already created editor instances. ' ' @param eventName (string) Event name, if set to 'empty' all event handlers will be removed. ' public sub clearInstanceEventHandlers( eventName ) if not(isEmpty( eventName )) then oInstanceEvents.Remove eventName else oInstanceEvents.RemoveAll end if end sub '' ' Adds global event listener. ' ' @param event (string) Event name. ' @param javascriptCode (string) Javascript anonymous function or function name. ' ' Example usage: ' @code ' editor.addGlobalEventHandler "dialogDefinition", "function (ev) { " & _ ' " alert('Loading dialog: ' + ev.data.name); " & _ ' "}" ' @endcode ' public sub addGlobalEventHandler( eventName, javascriptCode) if not(oGlobalEvents.Exists( eventName ) ) then oGlobalEvents.Add eventName, Array() end if dim listeners, size listeners = oGlobalEvents( eventName ) size = ubound(listeners) + 1 redim preserve listeners(size) listeners(size) = javascriptCode oGlobalEvents( eventName ) = listeners ' // Avoid duplicates. ' if (!in_array($javascriptCode, $this->_globalEvents[$event])) { ' $this->_globalEvents[$event][] = $javascriptCode; ' } end sub '' ' Clear registered global event handlers. ' Note: this function will have no effect if the event handler has been already printed/returned. ' ' @param eventName (string) Event name, if set to 'empty' all event handlers will be removed . ' public sub clearGlobalEventHandlers( eventName ) if not(isEmpty( eventName )) then oGlobalEvents.Remove eventName else oGlobalEvents.RemoveAll end if end sub '' ' Prints javascript code. ' ' @param string js ' private function script(js) script = "<script type=""text/javascript"">" & _ "//<![CDATA[" & vbcrlf & _ js & vbcrlf & _ "//]]>" & _ "</script>" & vbcrlf end function '' ' Returns the configuration array (global and instance specific settings are merged into one array). ' ' @param instanceConfig (Dictionary) The specific configurations to apply to editor instance. ' @param instanceEvents (Dictionary) Event listeners for editor instance. ' private function configSettings() dim mergedConfig, mergedEvents set mergedConfig = cloneDictionary(oAllInstancesConfig) set mergedEvents = cloneDictionary(oAllInstancesEvents) if not(isEmpty(oInstanceConfig)) then set mergedConfig = mergeDictionary(mergedConfig, oInstanceConfig) end if if not(isEmpty(oInstanceEvents)) then for each eventName in oInstanceEvents code = oInstanceEvents( eventName ) if not(mergedEvents.Exists( eventName)) then mergedEvents.Add eventName, code else dim listeners, size listeners = mergedEvents( eventName ) size = ubound(listeners) if isArray( code ) then addedCount = ubound(code) redim preserve listeners( size + addedCount + 1 ) for i = 0 to addedCount listeners(size + i + 1) = code (i) next else size = size + 1 redim preserve listeners(size) listeners(size) = code end if mergedEvents( eventName ) = listeners end if next end if dim i, eventName, handlers, configON, ub, code if mergedEvents.Count>0 then if mergedConfig.Exists( "on" ) then set configON = mergedConfig.items( "on" ) else set configON = CreateObject("Scripting.Dictionary") mergedConfig.Add "on", configOn end if for each eventName in mergedEvents handlers = mergedEvents( eventName ) code = "" if isArray(handlers) then uB = ubound(handlers) if (uB = 0) then code = handlers(0) else code = "function (ev) {" for i=0 to uB code = code & "(" & handlers(i) & ")(ev);" next code = code & "}" end if else code = handlers end if ' Using @@ at the beggining to signal JSON that we don't want this quoted. configON.Add eventName, "@@" & code next ' set mergedConfig.Item("on") = configOn end if set configSettings = mergedConfig end function '' ' Returns a copy of a scripting.dictionary object ' private function cloneDictionary( base ) dim newOne, tmpKey Set newOne = CreateObject("Scripting.Dictionary") for each tmpKey in base newOne.Add tmpKey , base( tmpKey ) next set cloneDictionary = newOne end function '' ' Combines two scripting.dictionary objects ' The base object isn't modified, and extra gets all the properties in base ' private function mergeDictionary(base, extra) dim newOne, tmpKey for each tmpKey in base if not(extra.Exists( tmpKey )) then extra.Add tmpKey, base( tmpKey ) end if next set mergeDictionary = extra end function '' ' Return global event handlers. ' private function returnGlobalEvents() dim out, eventName, handlers dim handlersForEvent, handler, code, i out = "" if (isempty(CKEDITOR_returnedEvents)) then set CKEDITOR_returnedEvents = CreateObject("Scripting.Dictionary") end if for each eventName in oGlobalEvents handlers = oGlobalEvents( eventName ) if not(CKEDITOR_returnedEvents.Exists(eventName)) then CKEDITOR_returnedEvents.Add eventName, CreateObject("Scripting.Dictionary") end if set handlersForEvent = CKEDITOR_returnedEvents.Item( eventName ) ' handlersForEvent is another dictionary ' and handlers is an array for i = 0 to ubound(handlers) code = handlers( i ) ' Return only new events if not(handlersForEvent.Exists( code )) then if (out <> "") then out = out & vbcrlf out = out & "CKEDITOR.on('" & eventName & "', " & code & ");" handlersForEvent.Add code, code end if next next returnGlobalEvents = out end function '' ' Initializes CKEditor (executed only once). ' private function init() dim out, args, path, extraCode, file out = "" if (CKEDITOR_initComplete) then init = "" exit function end if if (initialized) then CKEDITOR_initComplete = true init = "" exit function end if args = "" path = ckeditorPath() if (timestamp <> "") and (timestamp <> "%" & "TIMESTAMP%") then args = "?t=" & timestamp end if ' Skip relative paths... if (instr(path, "..") <> 0) then out = out & script("window.CKEDITOR_BASEPATH='" & path & "';") end if out = out & "<scr" & "ipt type=""text/javascript"" src=""" & path & ckeditorFileName() & args & """></scr" & "ipt>" & vbcrlf extraCode = "" if (timestamp <> mTimeStamp) then extraCode = extraCode & "CKEDITOR.timestamp = '" & timestamp & "';" end if if (extraCode <> "") then out = out & script(extraCode) end if CKEDITOR_initComplete = true initialized = true init = out end function private function ckeditorFileName() ckeditorFileName = "ckeditor.js" end function '' ' Return path to ckeditor.js. ' private function ckeditorPath() if (basePath <> "") then ckeditorPath = basePath else ' In classic ASP we can't get the location of this included script ckeditorPath = "/ckeditor/" end if ' Try to check if that folder contains the CKEditor files: ' If it's a full URL avoid checking it as it might point to an external server. if (instr(ckeditorPath, "://") <> 0) then exit function dim filename, oFSO, exists filename = server.mapPath(basePath & ckeditorFileName()) set oFSO = Server.CreateObject("Scripting.FileSystemObject") exists = oFSO.FileExists(filename) set oFSO = nothing if not(exists) then response.clear response.write "<h1>CKEditor path validation failed</h1>" response.write "<p>The path &quot;" & ckeditorPath & "&quot; doesn't include the CKEditor main file (" & ckeditorFileName() & ")</p>" response.write "<p>Please, verify that you have set it correctly and/or adjust the 'basePath' property</p>" response.write "<p>Checked for physical file: &quot;" & filename & "&quot;</p>" response.end end if end function End Class ' URL: http://www.webdevbros.net/2007/04/26/generate-json-from-asp-datatypes/ '************************************************************************************************************** '' @CLASSTITLE: JSON '' @CREATOR: Michal Gabrukiewicz (gabru at grafix.at), Michael Rebec '' @CONTRIBUTORS: - Cliff Pruitt (opensource at crayoncowboy.com) '' - Sylvain Lafontaine '' - Jef Housein '' - Jeremy Brown '' @CREATEDON: 2007-04-26 12:46 '' @CDESCRIPTION: Comes up with functionality for JSON (http://json.org) to use within ASP. '' Correct escaping of characters, generating JSON Grammer out of ASP datatypes and structures '' Some examples (all use the <em>toJSON()</em> method but as it is the class' default method it can be left out): '' <code> '' <% '' 'simple number '' output = (new JSON)("myNum", 2, false) '' 'generates {"myNum": 2} '' '' 'array with different datatypes '' output = (new JSON)("anArray", array(2, "x", null), true) '' 'generates "anArray": [2, "x", null] '' '(note: the last parameter was true, thus no surrounding brackets in the result) '' % > '' </code> '' @REQUIRES: - '' @OPTIONEXPLICIT: yes '' @VERSION: 1.5.1 '************************************************************************************************************** class JSON 'private members private output, innerCall '********************************************************************************************************** '* constructor '********************************************************************************************************** public sub class_initialize() newGeneration() end sub '****************************************************************************************** '' @SDESCRIPTION: STATIC! takes a given string and makes it JSON valid '' @DESCRIPTION: all characters which needs to be escaped are beeing replaced by their '' unicode representation according to the '' RFC4627#2.5 - http://www.ietf.org/rfc/rfc4627.txt?number=4627 '' @PARAM: val [string]: value which should be escaped '' @RETURN: [string] JSON valid string '****************************************************************************************** public function escape(val) dim cDoubleQuote, cRevSolidus, cSolidus cDoubleQuote = &h22 cRevSolidus = &h5C cSolidus = &h2F dim i, currentDigit for i = 1 to (len(val)) currentDigit = mid(val, i, 1) if ascw(currentDigit) > &h00 and ascw(currentDigit) < &h1F then currentDigit = escapequence(currentDigit) elseif ascw(currentDigit) >= &hC280 and ascw(currentDigit) <= &hC2BF then currentDigit = "\u00" + right(padLeft(hex(ascw(currentDigit) - &hC200), 2, 0), 2) elseif ascw(currentDigit) >= &hC380 and ascw(currentDigit) <= &hC3BF then currentDigit = "\u00" + right(padLeft(hex(ascw(currentDigit) - &hC2C0), 2, 0), 2) else select case ascw(currentDigit) case cDoubleQuote: currentDigit = escapequence(currentDigit) case cRevSolidus: currentDigit = escapequence(currentDigit) case cSolidus: currentDigit = escapequence(currentDigit) end select end if escape = escape & currentDigit next end function '****************************************************************************************************************** '' @SDESCRIPTION: generates a representation of a name value pair in JSON grammer '' @DESCRIPTION: It generates a name value pair which is represented as <em>{"name": value}</em> in JSON. '' the generation is fully recursive. Thus the value can also be a complex datatype (array in dictionary, etc.) e.g. '' <code> '' <% '' set j = new JSON '' j.toJSON "n", array(RS, dict, false), false '' j.toJSON "n", array(array(), 2, true), false '' % > '' </code> '' @PARAM: name [string]: name of the value (accessible with javascript afterwards). leave empty to get just the value '' @PARAM: val [variant], [int], [float], [array], [object], [dictionary]: value which needs '' to be generated. Conversation of the data types is as follows:<br> '' - <strong>ASP datatype -> JavaScript datatype</strong> '' - NOTHING, NULL -> null '' - INT, DOUBLE -> number '' - STRING -> string '' - BOOLEAN -> bool '' - ARRAY -> array '' - DICTIONARY -> Represents it as name value pairs. Each key is accessible as property afterwards. json will look like <code>"name": {"key1": "some value", "key2": "other value"}</code> '' - <em>multidimensional array</em> -> Generates a 1-dimensional array (flat) with all values of the multidimensional array '' - <em>request</em> object -> every property and collection (cookies, form, querystring, etc) of the asp request object is exposed as an item of a dictionary. Property names are <strong>lowercase</strong>. e.g. <em>servervariables</em>. '' - OBJECT -> name of the type (if unknown type) or all its properties (if class implements <em>reflect()</em> method) '' Implement a <strong>reflect()</strong> function if you want your custom classes to be recognized. The function must return '' a dictionary where the key holds the property name and the value its value. Example of a reflect function within a User class which has firstname and lastname properties '' <code> '' <% '' function reflect() '' . set reflect = server.createObject("scripting.dictionary") '' . reflect.add "firstname", firstname '' . reflect.add "lastname", lastname '' end function '' % > '' </code> '' Example of how to generate a JSON representation of the asp request object and access the <em>HTTP_HOST</em> server variable in JavaScript: '' <code> '' <script>alert(<%= (new JSON)(empty, request, false) % >.servervariables.HTTP_HOST);</script> '' </code> '' @PARAM: nested [bool]: indicates if the name value pair is already nested within another? if yes then the <em>{}</em> are left out. '' @RETURN: [string] returns a JSON representation of the given name value pair '****************************************************************************************************************** public default function toJSON(name, val, nested) if not nested and not isEmpty(name) then write("{") if not isEmpty(name) then write("""" & escape(name) & """: ") generateValue(val) if not nested and not isEmpty(name) then write("}") toJSON = output if innerCall = 0 then newGeneration() end function '****************************************************************************************************************** '* generate '****************************************************************************************************************** private function generateValue(val) if isNull(val) then write("null") elseif isArray(val) then generateArray(val) elseif isObject(val) then dim tName : tName = typename(val) if val is nothing then write("null") elseif tName = "Dictionary" or tName = "IRequestDictionary" then generateDictionary(val) elseif tName = "IRequest" then set req = server.createObject("scripting.dictionary") req.add "clientcertificate", val.ClientCertificate req.add "cookies", val.cookies req.add "form", val.form req.add "querystring", val.queryString req.add "servervariables", val.serverVariables req.add "totalbytes", val.totalBytes generateDictionary(req) elseif tName = "IStringList" then if val.count = 1 then toJSON empty, val(1), true else generateArray(val) end if else generateObject(val) end if else 'bool dim varTyp varTyp = varType(val) if varTyp = 11 then if val then write("true") else write("false") 'int, long, byte elseif varTyp = 2 or varTyp = 3 or varTyp = 17 or varTyp = 19 then write(cLng(val)) 'single, double, currency elseif varTyp = 4 or varTyp = 5 or varTyp = 6 or varTyp = 14 then write(replace(cDbl(val), ",", ".")) else ' Using @@ at the beggining to signal JSON that we don't want this quoted. if left(val, 2) = "@@" then write( mid( val, 3 ) ) else write("""" & escape(val & "") & """") end if end if end if generateValue = output end function '****************************************************************************************************************** '* generateArray '****************************************************************************************************************** private sub generateArray(val) dim item, i write("[") i = 0 'the for each allows us to support also multi dimensional arrays for each item in val if i > 0 then write(",") generateValue(item) i = i + 1 next write("]") end sub '****************************************************************************************************************** '* generateDictionary '****************************************************************************************************************** private sub generateDictionary(val) innerCall = innerCall + 1 if val.count = 0 then toJSON empty, null, true exit sub end if dim key, i write("{") i = 0 for each key in val if i > 0 then write(",") toJSON key, val(key), true i = i + 1 next write("}") innerCall = innerCall - 1 end sub '****************************************************************************************************************** '* generateObject '****************************************************************************************************************** private sub generateObject(val) dim props on error resume next set props = val.reflect() if err = 0 then on error goto 0 innerCall = innerCall + 1 toJSON empty, props, true innerCall = innerCall - 1 else on error goto 0 write("""" & escape(typename(val)) & """") end if end sub '****************************************************************************************************************** '* newGeneration '****************************************************************************************************************** private sub newGeneration() output = empty innerCall = 0 end sub '****************************************************************************************** '* JsonEscapeSquence '****************************************************************************************** private function escapequence(digit) escapequence = "\u00" + right(padLeft(hex(ascw(digit)), 2, 0), 2) end function '****************************************************************************************** '* padLeft '****************************************************************************************** private function padLeft(value, totalLength, paddingChar) padLeft = right(clone(paddingChar, totalLength) & value, totalLength) end function '****************************************************************************************** '* clone '****************************************************************************************** private function clone(byVal str, n) dim i for i = 1 to n : clone = clone & str : next end function '****************************************************************************************** '* write '****************************************************************************************** private sub write(val) output = output & val end sub end class %>
zysms
trunk/zysms/include/ckeditor/ckeditor.asp
Classic ASP
asf20
30,817
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','en',{placeholder:{title:'Placeholder Properties',toolbar:'Create Placeholder',text:'Placeholder Text',edit:'Edit Placeholder',textMissing:'The placeholder must contain text.'}});
zysms
trunk/zysms/include/ckeditor/plugins/placeholder/lang/en.js
JavaScript
asf20
374
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','he',{placeholder:{title:'מאפייני שומר מקום',toolbar:'צור שומר מקום',text:'תוכן שומר המקום',edit:'ערוך שומר מקום',textMissing:'שומר המקום חייב להכיל טקסט.'}});
zysms
trunk/zysms/include/ckeditor/plugins/placeholder/lang/he.js
JavaScript
asf20
427
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','en',{uicolor:{title:'UI Color Picker',preview:'Live preview',config:'Paste this string into your config.js file',predefined:'Predefined color sets'}});
zysms
trunk/zysms/include/ckeditor/plugins/uicolor/lang/en.js
JavaScript
asf20
343
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','he',{uicolor:{title:'בחירת צבע ממשק משתמש',preview:'תצוגה מקדימה',config:'הדבק את הטקסט הבא לתוך הקובץ config.js',predefined:'קבוצות צבעים מוגדרות מראש'}});
zysms
trunk/zysms/include/ckeditor/plugins/uicolor/lang/he.js
JavaScript
asf20
421
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','en',{devTools:{title:'Element Information',dialogName:'Dialog window name',tabName:'Tab name',elementId:'Element ID',elementType:'Element type'}});
zysms
trunk/zysms/include/ckeditor/plugins/devtools/lang/en.js
JavaScript
asf20
340
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */
zysms
trunk/zysms/include/ckeditor/plugins/dialog/dialogDefinition.js
JavaScript
asf20
152
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function doLoadScript( url ) { if ( !url ) return false ; var s = document.createElement( "script" ) ; s.type = "text/javascript" ; s.src = url ; document.getElementsByTagName( "head" )[ 0 ].appendChild( s ) ; return true ; } var opener; function tryLoad() { opener = window.parent; // get access to global parameters var oParams = window.opener.oldFramesetPageParams; // make frameset rows string prepare var sFramesetRows = ( parseInt( oParams.firstframeh, 10 ) || '30') + ",*," + ( parseInt( oParams.thirdframeh, 10 ) || '150' ) + ',0' ; document.getElementById( 'itFrameset' ).rows = sFramesetRows ; // dynamic including init frames and crossdomain transport code // from config sproxy_js_frameset url var addScriptUrl = oParams.sproxy_js_frameset ; doLoadScript( addScriptUrl ) ; } </script> </head> <frameset id="itFrameset" onload="tryLoad();" border="0" rows="30,*,*,0"> <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="2" src="" name="navbar"></frame> <frame scrolling="auto" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="0" src="" name="mid"></frame> <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="bot"></frame> <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="spellsuggestall"></frame> </frameset> </html>
zysms
trunk/zysms/include/ckeditor/plugins/wsc/dialogs/tmpFrameset.html
HTML
asf20
1,935
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function gup( name ) { name = name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) ; var regexS = '[\\?&]' + name + '=([^&#]*)' ; var regex = new RegExp( regexS ) ; var results = regex.exec( window.location.href ) ; if ( results ) return results[ 1 ] ; else return '' ; } var interval; function sendData2Master() { var destination = window.parent.parent ; try { if ( destination.XDTMaster ) { var t = destination.XDTMaster.read( [ gup( 'cmd' ), gup( 'data' ) ] ) ; window.clearInterval( interval ) ; } } catch (e) {} } function onLoad() { interval = window.setInterval( sendData2Master, 100 ); } </script> </head> <body onload="onLoad()"><p></p></body> </html>
zysms
trunk/zysms/include/ckeditor/plugins/wsc/dialogs/ciframe.html
HTML
asf20
1,120
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add('docprops',{init:function(a){var b=new CKEDITOR.dialogCommand('docProps');b.modes={wysiwyg:a.config.fullPage};a.addCommand('docProps',b);CKEDITOR.dialog.add('docProps',this.path+'dialogs/docprops.js');a.ui.addButton('DocProps',{label:a.lang.docprops.label,command:'docProps'});}});
zysms
trunk/zysms/include/ckeditor/plugins/docprops/plugin.js
JavaScript
asf20
458
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Changelog &mdash; CKEditor</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> #footer hr { margin: 10px 0 15px 0; height: 1px; border: solid 1px gray; border-bottom: none; } #footer p { margin: 0 10px 10px 10px; float: left; } #footer #copy { float: right; } </style> </head> <body> <h1> CKEditor Changelog </h1> <h3> CKEditor 3.6.2</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/6089">#6089</a> : The editor is now enabled on iOS 5 (iPad and iPhone).</li> <li><a href="http://dev.ckeditor.com/ticket/6089">#7354</a> : It is now possible to exit from blockquotes by using the <em>Enter</em> key on empty paragraphs.</li> <li><a href="http://dev.ckeditor.com/ticket/7931">#7931</a> : The <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#event:mode">mode</a></code> event now carries the previous editor mode.</li> <li><a href="http://dev.ckeditor.com/ticket/6161">#6161</a> : New <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoGrow_onStartup">autoGrow_onStartup</a></code> configuration option.</li> <li><a href="http://dev.ckeditor.com/ticket/8052">#8052</a> : <code>autogrow</code> is now available as an editor <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#execCommand">command</a>.</li> <li><a href="http://dev.ckeditor.com/ticket/3457">#3457</a> : It is now possible to edit the contents of <code>&lt;textarea&gt;</code> elements through the dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/8242">#8242</a> : The "&raquo;" character is now added to the Special Character dialog window.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/8171">#8171</a>, <a href="http://dev.ckeditor.com/ticket/8172">#8172</a> : Updated links to WebSpellChecker.net.</li> <li><a href="http://dev.ckeditor.com/ticket/8155">#8155</a> : Tooltips in the Special Character dialog window corrected.</li> <li><a href="http://dev.ckeditor.com/ticket/8163">#8163</a> : The name of the <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.filebrowserWindowFeatures">filebrowserWindowFeatures</a></code> configuration setting corrected to match the documented name.</li> <li><a href="http://dev.ckeditor.com/ticket/8124">#8124</a> : The Style fields in Advanced dialog window tabs are now validated according to CSS style attribute syntax.</li> <li><a href="http://dev.ckeditor.com/ticket/8025">#8025</a> : The checkboxes in the Find and Replace dialog window are now part of a fieldset.</li> <li><a href="http://dev.ckeditor.com/ticket/7943">#7943</a> : CSS conflict no longer appears when the page styles set the <code>float</code> property of <code>label</code> elements.</li> <li><a href="http://dev.ckeditor.com/ticket/8016">#8016</a> : [WebKit] Flash content is not visible when previewing content.</li> <li><a href="http://dev.ckeditor.com/ticket/6908">#6908</a> : Text color should always be applied to the linked text.</li> <li><a href="http://dev.ckeditor.com/ticket/7619">#7619</a> : [IE] IFrame shim now consolidates the editor dialog window to avoid having it masked by embedded objects.</li> <li><a href="http://dev.ckeditor.com/ticket/7900">#7900</a> : [FF] Copy/Paste operations for table cells no longer break the Table Properties dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/7243">#7243</a> : Inline JavaScript events may become corrupted.</li> <li><a href="http://dev.ckeditor.com/ticket/7448">#7448</a> : List creation in RTL blocks is wrongly merged with the above LTR block.</li> <li><a href="http://dev.ckeditor.com/ticket/6957">#6957</a> : Highlighting of searched terms does not reach read-only blocks.</li> <li><a href="http://dev.ckeditor.com/ticket/7948">#7948</a> : Tooltips with information about correct length units are now displayed for the Width/Height fields of the Table Properties dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/6212">#6212</a> : [WebKit] Editor resize may scroll the host page.</li> <li><a href="http://dev.ckeditor.com/ticket/6540">#6540</a> : [Safari] Editor loses focus on resizing.</li> <li><a href="http://dev.ckeditor.com/ticket/7908">#7908</a> : [IE] Unlink command is sometimes missing from the context menu of a link.</li> <li><a href="http://dev.ckeditor.com/ticket/8159">#8159</a> : Editor fails to load if the browser has no default language set.</li> <li><a href="http://dev.ckeditor.com/ticket/7490">#7490</a> : [IE] Block format leaks to the next unselected line when <code>enterMode</code> is set to <code>BR</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/8087">#8087</a> : Indenting list items may add redundant text direction attributes.</li> <li><a href="http://dev.ckeditor.com/ticket/6200">#6200</a> : Add styling for certain dialog window element types that miss focus outline (like checkbox).</li> <li><a href="http://dev.ckeditor.com/ticket/7894">#7894</a> : Fault tolerance when parsing a malformed link.</li> <li><a href="http://dev.ckeditor.com/ticket/8049">#8049</a> : Bullets/Numbers are invisible for list items with LTR text direction.</li> <li><a href="http://dev.ckeditor.com/ticket/8222">#8222</a> : [IE] Incorrect selection locking after opening a dialog window in some cases.</li> <li><a href="http://dev.ckeditor.com/ticket/7002">#7002</a> : [IE] Undo operation when a table is selected results in an error.</li> <li><a href="http://dev.ckeditor.com/ticket/8232">#8232</a> : [IE] Unable to apply inline style that starts at the end of a link text.</li> <li><a href="http://dev.ckeditor.com/ticket/7153">#7153</a> : Fail to load the source version of the editor after the window is loaded.</li> <li><a href="http://dev.ckeditor.com/ticket/8246">#8246</a> : Bad editing performance on certain document contents.</li> <li><a href="http://dev.ckeditor.com/ticket/7912">#7912</a> : Cursor trapped in an invisible element after pressing the <em>Enter</em> key.</li> <li><a href="http://dev.ckeditor.com/ticket/7645">#7645</a> : Full list or table deletion with the <em>Backspace/Delete</em> key.</li> <li><a href="http://dev.ckeditor.com/ticket/8050">#8050</a> : AutoGrow feature better fits the content styles.</li> <li><a href="http://dev.ckeditor.com/ticket/8349">#8349</a> : [IE9] Larger toolbar top offset on HTML5 pages.</li> <li><a href="http://dev.ckeditor.com/ticket/8352">#8352</a> : [IE9] Toolbar wrapping is incorrect.</li> <li><a href="http://dev.ckeditor.com/ticket/8080">#8080</a> : JavaScript error when inserting a new table row.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/8263">#8263</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/8238">#8238</a> : Estonian;</li> <li><a href="http://dev.ckeditor.com/ticket/8193">#8193</a> : Finnish;</li> <li>German;</li> <li>Hebrew;</li> <li><a href="http://dev.ckeditor.com/ticket/8179">#8179</a> : Hungarian;</li> <li><a href="http://dev.ckeditor.com/ticket/8128">#8128</a> : Italian;</li> <li><a href="http://dev.ckeditor.com/ticket/8371">#8371</a> : Lithuanian;</li> <li><a href="http://dev.ckeditor.com/ticket/8126">#8126</a>, <a href="http://dev.ckeditor.com/ticket/8256">#8256</a> : Norwegian (Bokmal and Nynorsk);</li> <li><a href="http://dev.ckeditor.com/ticket/8356">#8356</a> : Persian;</li> <li>Polish;</li> <li>Portuguese (Brazil);</li> <li><a href="http://dev.ckeditor.com/ticket/8151">#8151</a>, <a href="http://dev.ckeditor.com/ticket/8298">#8298</a> : Russian;</li> <li>Spanish;</li> </ul></li> </ul> <h3> CKEditor 3.6.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4556">#4556</a> : Initial support for HTML5 elements.</li> <li><a href="http://dev.ckeditor.com/ticket/6492">#6492</a> : The Find/Replace dialog window will now be populated with text selected in the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/7323">#7323</a> : New <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.uiElement.html#align">align</a></code> property in dialog window UI elements for field alignment.</li> <li><a href="http://dev.ckeditor.com/ticket/6462">#6462</a> : A wider range of CSS length units (like pt and percentage) are now supported in related dialog window fields.</li> <li><a href="http://dev.ckeditor.com/ticket/7911">#7911</a> : New Remove Anchor option is now available in the context menu.</li> <li><a href="http://dev.ckeditor.com/ticket/7387">#7387</a> : Allow <code>styleDefinition</code> to be applied to a set of elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4345">#4345</a> : A new <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#event:langLoaded">langLoaded</a></code> event added to <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html">CKEDITOR.editor</a></code> in order to make it possible to perform "by code" language updates.</li> <li><a href="http://dev.ckeditor.com/ticket/7959">#7959</a> : The cursor will now blink in the first cell after a table is inserted.</li> <li><a href="http://dev.ckeditor.com/ticket/7885">#7885</a> : New <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#removeMenuItem">editor::removeMenuItem</a></code> API for removing plugin context menu items introduced.</li> <li><a href="http://dev.ckeditor.com/ticket/7991">#7991</a> : Introduce the <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.labeledElement.html#controlStyle">controlStyle</a></code> and <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.labeledElement.html#inputStyle">inputStyle</a></code> definitions to allow fine-grained controlling of dialog window element styles.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/7914">#7914</a> : <strong>ATTENTION!</strong> The signature for the <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">setReadOnly()</a></code> function has been changed, reversing the meaning of the parameter to be passed to it. Please make sure to update your code when upgrading.</li> <li><a href="http://dev.ckeditor.com/ticket/7657">#7657</a> : Wrong margin mirroring when creating a list from RTL paragraphs.</li> <li><a href="http://dev.ckeditor.com/ticket/7620">#7620</a> : A glitch in list pasting from Microsoft Word caused by broken child references when filtering.</li> <li><a href="http://dev.ckeditor.com/ticket/7811">#7811</a> : [IE] Deleting table row throws a JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/6962">#6962</a> : Changed the <code>CKEDITOR.CTRL</code>, <code>CKEDITOR.SHIFT</code> and <code>CKEDITOR.ALT</code> constant values to avoid collision with any possible Unicode character.</li> <li><a href="http://dev.ckeditor.com/ticket/6263">#6263</a> : Some table cell context menu options may be incorrectly disabled.</li> <li><a href="http://dev.ckeditor.com/ticket/6247">#6247</a> : Focus is not restored properly after a drop-down menu is closed.</li> <li><a href="http://dev.ckeditor.com/ticket/7334">#7334</a> : [IE7] Indentation style does not apply to RTL lists.</li> <li><a href="http://dev.ckeditor.com/ticket/6845">#6845</a> : Spaces inside the URL field in the Link dialog window will now be removed.</li> <li><a href="http://dev.ckeditor.com/ticket/7840">#7840</a> : [IE] Opening the Table Properties dialog window via the context menu causes a JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/7733">#7733</a> : Flash movies inserted with the Flash Properties dialog window are not displaying properly when injected into the page.</li> <li><a href="http://dev.ckeditor.com/ticket/7837">#7837</a> : [IE&lt;8] Inserting a page break results in an error.</li> <li><a href="http://dev.ckeditor.com/ticket/7804">#7804</a> : The HTML5 <a href="http://www.w3.org/TR/html-markup/wbr.html"><code>wbr</code></a> tag is now recognized by the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/7867">#7867</a> : The file browser for the background image in the Document Properties plugin dialog window does not work.</li> <li><a href="http://dev.ckeditor.com/ticket/7130">#7130</a> : The column resizer gripping area is invading adjacent table cells.</li> <li><a href="http://dev.ckeditor.com/ticket/7844">#7844</a> : [FF] Calling <code>setData()</code> on a hidden editor caused editor not to display.</li> <li><a href="http://dev.ckeditor.com/ticket/7860">#7860</a> : The BBCode plugin was stripping BBCode tags that were not implemented in the plugin, but from now on they will be handled as simple text.</li> <li><a href="http://dev.ckeditor.com/ticket/7321">#7321</a> : [IE6] Contents inside the RTL fields in dialog windows are overflowing.</li> <li><a href="http://dev.ckeditor.com/ticket/7323">#7323</a> : [IE Quirks] Some fields are not centered in the dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/5955">#5955</a> : Editor accessibility issue with JAWS when a drop-down menu is placed as the first item in the toolbar.</li> <li><a href="http://dev.ckeditor.com/ticket/6671">#6671</a> : [FF] Selection of an item from the Styles drop-down list is not refreshed after the style is removed.</li> <li><a href="http://dev.ckeditor.com/ticket/7879">#7879</a> : The Style and Height/Width fields of the Table Properties dialog window are not synchronized.</li> <li><a href="http://dev.ckeditor.com/ticket/7581">#7581</a> : [IE] The <em>Enter</em> key pressed at the end of a list item containing the <code>start</code> attribute crashes the browser.</li> <li><a href="http://dev.ckeditor.com/ticket/7266">#7266</a> : Dialog window fields that did not pass validation are now ARIA-compatible with <code>aria-invalid</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/7742">#7742</a> : [WebKit] Indentation, alignment, and language direction are not applied on an empty document without the editor being in focus.</li> <li><a href="http://dev.ckeditor.com/ticket/7801">#7801</a> : [Opera] Pasted paragraphs now split partially selected blocks.</li> <li><a href="http://dev.ckeditor.com/ticket/6663">#6663</a> : Table caption that contains rich text is corrupted after an edit done with the Table Properties dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/7893">#7893</a> : [WebKit, Opera, IE&lt;8] It is impossible to link to anchors in the document.</li> <li><a href="http://dev.ckeditor.com/ticket/7637">#7637</a> : Cursor position might in some cases cause problems after inserting a page break.</li> <li><a href="http://dev.ckeditor.com/ticket/5314">#5314</a> : The <code>aria-selected</code> attribute is not removed when toolbar drop-down menu items are deselected.</li> <li><a href="http://dev.ckeditor.com/ticket/7749">#7749</a> : Small check introduced to avoid issues with custom data processors and the <code>insertHtml</code> function.</li> <li><a href="http://dev.ckeditor.com/ticket/7269">#7269</a> : [WebKit] Paste from Word is including the full <code>file://</code> URL path for anchor links.</li> <li><a href="http://dev.ckeditor.com/ticket/7584">#7584</a> : Start number of the List dialog window now works with numbered list items.</li> <li><a href="http://dev.ckeditor.com/ticket/6975">#6975</a> : [IE6, IE7] A definition list crashes Internet Explorer on HTML output.</li> <li><a href="http://dev.ckeditor.com/ticket/7841">#7841</a> : Deleting a column with a cell deleted in one of the rows does not work.</li> <li><a href="http://dev.ckeditor.com/ticket/7944">#7944</a> : The <em>Enter</em> key should not split or create new paragraphs inside caption elements.</li> <li><a href="http://dev.ckeditor.com/ticket/7639">#7639</a> : [IE9] Browser might crash when an object is selected in the document.</li> <li><a href="http://dev.ckeditor.com/ticket/7847">#7847</a> : [IE8] Inserting an image with non-secure source in a HTTPS page breaks the dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/7953">#7953</a> : [IE] Text selection lost after the browser context menu is opened.</li> <li><a href="http://dev.ckeditor.com/ticket/5239">#5239</a> : Inconsistent focus behavior after closing a toolbar drop-down menu.</li> <li><a href="http://dev.ckeditor.com/ticket/6470">#6470</a> : The Start attribute of a Numbered List is rendered incorrectly if the field is left empty.</li> <li><a href="http://dev.ckeditor.com/ticket/7324">#7324</a> : [IE6 Quirks] Context menus are not displayed correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/7566">#7566</a> : BiDi: Increasing indentation of a list item changes the language direction.</li> <li><a href="http://dev.ckeditor.com/ticket/7839">#7839</a> : [IE] Pasting multi-level numbered lists from Microsoft Word does not work properly.</li> <li><a href="http://dev.ckeditor.com/ticket/188">#188</a> : [IE] Object selection was making the toolbar inactive in some situations.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/7834">#7834</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/7869">#7869</a>, <a href="http://dev.ckeditor.com/ticket/7869">#7999</a> : Welsh;</li> <li>Polish;</li> <li>Hebrew;</li> <li>German</li> </ul></li> </ul> <h3> CKEditor 3.6</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/7044">#7044</a> : New BBCode sample plugin that makes the editor output (one dialect of) BBCode format.</li> <li><a href="http://dev.ckeditor.com/ticket/5647">#5647</a> : Accessibility enhancements to the structure of the toolbar.</li> <li><a href="http://dev.ckeditor.com/ticket/5647">#5647</a> : The Kama skin now presents separators for the toolbar items, making it easier to group buttons and have a cleaner layout.</li> <li><a href="http://dev.ckeditor.com/ticket/5647">#5647</a> : Usability enhancements to keyboard navigation on the toolbar. The <em>Tab</em> key is now used to jump between toolbar groups, while the <em>Arrow</em> keys can be used to cycle within the group. The new <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.toolbarGroupCycling">toolbarGroupCycling</a></code> setting can be used to change the <em>Arrow</em> keys behavior.</li> <li><a href="http://dev.ckeditor.com/ticket/1376">#1376</a> : It is now possible to put the editor in the "read-only" state, so that the users would not be able to introduce changes to the contents. Check out the new <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">CKEDITOR.editor::setReadOnly</a></code> method, the <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#readOnly">CKEDITOR.editor::readOnly</a></code> property, the <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#event:readOnly">CKEDITOR.editor::readOnly</a></code> event, and the <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.readOnly">readOnly</a></code> setting.</li> <li><a href="http://dev.ckeditor.com/ticket/3582">#3582</a> : New presentation of anchor elements in the WYSIWYG mode.</li> <li><a href="http://dev.ckeditor.com/ticket/6737">#6737</a> : The Format drop-down list will now display the preview of its contents exactly as defined in their style configurations.</li> <li><a href="http://dev.ckeditor.com/ticket/6654">#6654</a> : A new <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoParagraph">autoParagraph</a></code> configuration setting is added to disable the auto paragraphing feature.</li> <li><a href="http://dev.ckeditor.com/ticket/901">#901</a> : New Stylesheet Parser (<code>stylesheetparser</code>) plugin that fills the Styles drop-down list based on the CSS classes available for the content. Check the new sample to learn how to use it.</li> <li><a href="http://dev.ckeditor.com/ticket/2988">#2988</a> : New Document Properties (<code>docprops</code>) plugin that sets the metadata of the page in the Full Page mode.</li> <li><a href="http://dev.ckeditor.com/ticket/7240">#7240</a> : New Developer Tools (<code>devtools</code>) plugin that shows information about dialog window UI elements to allow for easier customization.</li> <li><a href="http://dev.ckeditor.com/ticket/6841">#6841</a> : Pressing the <em>Enter</em> key at the end of a pre-formatted block will now exit from it.</li> <li><a href="http://dev.ckeditor.com/ticket/6850">#6850</a> : The About CKEditor dialog window now contains a link to CKEditor User's Guide.</li> <li><a href="http://dev.ckeditor.com/ticket/5745">#5745</a> : Extra configuration options for the <code>iframeDialog</code> can now be passed.</li> <li><a href="http://dev.ckeditor.com/ticket/6589">#6589</a> : The <code>onDialogEvent</code> function will now be used automatically in the <code>iframeDialog</code> contents if no callback is used on creation.</li> <li><a href="http://dev.ckeditor.com/ticket/7757">#7757</a> : Georgian localization added.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/6774">#6774</a> : Internal styles are not included in the <code>contents.css</code> sample.</li> <li><a href="http://dev.ckeditor.com/ticket/6521">#6521</a> : Added sample for the TableResize plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/6664">#6664</a> : Page break is sometimes merged into block-level elements.</li> <li><a href="http://dev.ckeditor.com/ticket/7594">#7594</a> : Toolbar keyboard navigation is not possible after recreating the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/6657">#6657</a> : Allow to style the entire dialog window field when the input element is disabled.</li> <li>Updated the following language files:<ul> <li>Hebrew;</li> <li>Polish;</li> </ul></li> </ul> <h3> CKEditor 3.5.4</h3> <p> Fixed issues:</p> <ul> <li>Added protection against XSS attacks in PHP samples when displaying element names.</li> <li><a href="http://dev.ckeditor.com/ticket/7347">#7347</a> : The <em>Enter</em> key will no longer be caught by the dialog window covering the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/6718">#6718</a> : Paste from Word command overrides the Force Paste as Plain Text configuration.</li> <li><a href="http://dev.ckeditor.com/ticket/6629">#6629</a> : Padding body is no longer needed when the last block is pre-formatted.</li> <li><a href="http://dev.ckeditor.com/ticket/4844">#4844</a> : [IE] Dialog windows fail to load if there are too many editor instances on the page.</li> <li><a href="http://dev.ckeditor.com/ticket/5788">#5788</a> : HTML parser trims empty spaces following <code>&lt;br&gt;</code> elements.</li> <li><a href="http://dev.ckeditor.com/ticket/7513">#7513</a> : Invalid markup could cause the editor to hang.</li> <li><a href="http://dev.ckeditor.com/ticket/6109">#6109</a> : Paste and Paste as Plain Text dialog windows now use the standard <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#commitContent">commitContent</a></code> and <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#setupContent">setupContent</a></code> methods.</li> <li><a href="http://dev.ckeditor.com/ticket/7588">#7588</a> : The editor code now has a protection system to avoid issues when including <code>ckeditor.js</code> more than once in the page.</li> <li><a href="http://dev.ckeditor.com/ticket/7322">#7322</a> : Text font plugin now recognizes font family names that contain quotes.</li> <li><a href="http://dev.ckeditor.com/ticket/7540">#7540</a> : Paste from Word introduces wrong spaces.</li> <li><a href="http://dev.ckeditor.com/ticket/7697">#7697</a> : Successive calls of the <code>replace()</code> method did not work after SCAYT context menu initialization.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/7647">#7647</a> : Slovak;</li> </ul></li> </ul> <h3> CKEditor 3.5.3</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4890">#4890</a> : Added the possibility to edit the <code>rel</code> attribute for links.</li> <li><a href="http://dev.ckeditor.com/ticket/7004">#7004</a> : Allow loading plugin translations even if they are not present in the plugin definition.</li> <li><a href="http://dev.ckeditor.com/ticket/7315">#7315</a> : Firing the <code>resize</code> event on dialog window instances is now possible.</li> <li><a href="http://dev.ckeditor.com/ticket/7259">#7259</a> : Dialog window definition allows to specify initial <code>width</code> and <code>height</code> values.</li> <li><a href="http://dev.ckeditor.com/ticket/7131">#7131</a> : List item numbering is now supported on pasting from Microsoft Word.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/1272">#1272</a> : [WebKit] It is now possible to apply styles to collapsed selections in Safari and Chrome.</li> <li><a href="http://dev.ckeditor.com/ticket/7054">#7054</a> : The tooltips for special characters are now lowercased, making them more readable.</li> <li><a href="http://dev.ckeditor.com/ticket/7102">#7102</a> : "Replace DIV" sample did not work when double-clicking inside the formatted text.</li> <li><a href="http://dev.ckeditor.com/ticket/7088">#7088</a> : Loading of plugins failed on new instances of the editor after the Insert Special Character dialog window was used.</li> <li><a href="http://dev.ckeditor.com/ticket/6215">#6215</a> : Removal of inline styles now also removes overrides.</li> <li><a href="http://dev.ckeditor.com/ticket/6144">#6144</a> : Rich text drop-down lists have wrong height when toolbar is wrapped.</li> <li><a href="http://dev.ckeditor.com/ticket/6387">#6387</a> : AutoGrow may cause an error when editor instance is destroyed too quickly after a height change.</li> <li><a href="http://dev.ckeditor.com/ticket/6901">#6901</a> : Mixed direction content was not properly respected in a shared toolbar setting.</li> <li><a href="http://dev.ckeditor.com/ticket/4809">#4809</a> : Table-related tags are output in wrong order.</li> <li><a href="http://dev.ckeditor.com/ticket/7092">#7092</a> : Corrupted toolbar button state for inline style after switching to Source.</li> <li><a href="http://dev.ckeditor.com/ticket/6921">#6921</a> : Pasted text marked by SCAYT in one language is not re-checked if another spellchecking language is selected in the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/6614">#6614</a> : Enhancement of the resize handle in RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/5924">#5924</a> : Flash plugin now recognizes Flash content without an <code>embed</code> tag.</li> <li><a href="http://dev.ckeditor.com/ticket/4475">#4475</a> : Protected source in attributes and inline CSS text is not handled correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/6984">#6984</a> : [FF] Trailing line breaks are lost in <code>ENTER_BR</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/6987">#6987</a> : [IE] Text selection lost when calling <code>editor::insertHtml</code> from a dialog window in some situations.</li> <li><a href="http://dev.ckeditor.com/ticket/6865">#6865</a> : BiDi mirroring does not work when a text direction change is done through a dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/6966">#6966</a> : [IE] Unintended paragraph is created in an empty document in <code>enterMode</code> set for <code>BR</code> and <code>DIV</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/7084">#7084</a> : SCAYT dialog window is now working properly with more than one editor instance in a page.</li> <li><a href="http://dev.ckeditor.com/ticket/6662">#6662</a> : [FF] List structure pasting error caused by a regression from FF3.5.x is now fixed.</li> <li><a href="http://dev.ckeditor.com/ticket/7300">#7300</a> : Link dialog window now loads numeric values correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/7330">#7330</a> : New list items no longer inherit the <code>value</code> attribute from their sibling.</li> <li><a href="http://dev.ckeditor.com/ticket/7293">#7293</a> : The "Automatic" color button is now presented correctly without focus inside the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/7018">#7018</a> : [IE] Toolbar drop-down lists did not have a border around them.</li> <li><a href="http://dev.ckeditor.com/ticket/7073">#7073</a> : Image dialog window no longer allows zero height and width value to be entered.</li> <li><a href="http://dev.ckeditor.com/ticket/7316">#7316</a> : [FF] Clicking on "Paste" button incorrectly breaks the line at the cursor position.</li> <li><a href="http://dev.ckeditor.com/ticket/6751">#6751</a> : Inline whitespaces are incorrectly stripped when pasting from Word.</li> <li><a href="http://dev.ckeditor.com/ticket/6236">#6236</a> : [IE] Fixing malformed nested list structure which was introduced by the <em>Backspace</em> key.</li> <li><a href="http://dev.ckeditor.com/ticket/6649">#6649</a> : [IE] Selection of the full table sometimes does not work.</li> <li><a href="http://dev.ckeditor.com/ticket/6946">#6946</a> : HTML parser is now able to fix orphan list items.</li> <li><a href="http://dev.ckeditor.com/ticket/6861">#6861</a> : Indenting a list item should retain the text direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6938">#6938</a> : Outdenting a list item should retain the text direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6849">#6849</a> : Correct <em>Enter</em> key behavior on list item.</li> <li><a href="http://dev.ckeditor.com/ticket/7113">#7113</a> : [WebKit] Undesired document scroll on click after scrolling.</li> <li><a href="http://dev.ckeditor.com/ticket/6491">#6491</a> : Undesired Image dialog window dimension lock reset on URL change.</li> <li><a href="http://dev.ckeditor.com/ticket/7284">#7284</a> : [FF Quirks] Maximize now works correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/6609">#6609</a> : [IE9] Browser in high contrast mode is not properly detected.</li> <li><a href="http://dev.ckeditor.com/ticket/7222">#7222</a> : [WebKit] Impossible to apply a single style to a collapsed selection without giving the editor focus.</li> <li><a href="http://dev.ckeditor.com/ticket/7180">#7180</a> : [IE9] When using Kama skin and RTL layout dialog window buttons were not being displayed correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/7182">#7182</a> : [IE9] When using Office2003/v2 skin and RTL layout dialog window shadows were corrupted.</li> <li><a href="http://dev.ckeditor.com/ticket/6913">#6913</a> : Invalid escape sequence (<code>\b</code>) was used in the PHP integration.</li> <li><a href="http://dev.ckeditor.com/ticket/5757">#5757</a> : [IE6] Text was not wrapping in the accessibility instructions dialog window.</li> <li><a href="http://dev.ckeditor.com/changeset/6604">[6604]</a> : <code>Xml.js</code> and <code>Ajax.js</code> are now available as plugins ('xml' and 'ajax').</li> <li><a href="http://dev.ckeditor.com/ticket/7304">#7304</a> : Microsoft Word cleanup function is not always invoked when clicking on the "Paste From Word" button.</li> <li><a href="http://dev.ckeditor.com/ticket/6658">#6658</a> : [IE] Pasting text from Microsoft Word with one or more tabs between list items was failing.</li> <li><a href="http://dev.ckeditor.com/ticket/7433">#7433</a> : [IE9] <code>ENTER_BR</code> at the end of a block breaks due to an IE9 regression.</li> <li><a href="http://dev.ckeditor.com/ticket/7432">#7432</a> : [WebKit] Unable to create a new list in an empty document.</li> <li><a href="http://dev.ckeditor.com/ticket/4880">#4880</a> : CKEditor changes tag style inside HTML comment with <code>cke_protected</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/7023">#7023</a> : [IE] JavaScript error when a Selection Field is inserted into a page.</li> <li><a href="http://dev.ckeditor.com/ticket/7034">#7034</a> : Inserting special characters into styled text.</li> <li><a href="http://dev.ckeditor.com/ticket/7132">#7132</a> : Paste toolbar buttons are becoming disabled.</li> <li><a href="http://dev.ckeditor.com/ticket/7138">#7138</a> : The <code>api.html</code> sample in Opera does not work as expected.</li> <li><a href="http://dev.ckeditor.com/ticket/7160">#7160</a> : Cannot paste the form element on top of the page.</li> <li><a href="http://dev.ckeditor.com/ticket/7171">#7171</a> : Double-clicking an image in non-editable content opens the editing dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/7455">#7455</a> : Extra line break is added automatically to the preformatted element.</li> <li><a href="http://dev.ckeditor.com/ticket/7467">#7467</a> : [Firefox] Extra <code>br</code> element is added in a nested list.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/7124">#7124</a> : Czech;</li> <li><a href="http://dev.ckeditor.com/ticket/7126">#7126</a> : French;</li> <li><a href="http://dev.ckeditor.com/ticket/7140">#7140</a> : Catalan;</li> <li><a href="http://dev.ckeditor.com/ticket/7215">#7215</a> : Faroese;</li> <li><a href="http://dev.ckeditor.com/ticket/7177">#7177</a> : Finnish;</li> <li><a href="http://dev.ckeditor.com/ticket/7163">#7163</a> : Norwegian (no and nb);</li> <li><a href="http://dev.ckeditor.com/ticket/7219">#7219</a> : Swedish;</li> <li><a href="http://dev.ckeditor.com/ticket/7183">#7183</a> : Afrikaans;</li> <li>Hebrew;</li> <li>Spanish;</li> <li>Polish;</li> <li>German;</li> </ul></li> </ul> <h3> CKEditor 3.5.2</h3> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/7168">#7168</a> : [IE9] Destroying an editor instance throws an error.</li> <li><a href="http://dev.ckeditor.com/ticket/7169">#7169</a> : [IE9] Menu item has incorrect height.</li> <li><a href="http://dev.ckeditor.com/ticket/7178">#7178</a> : [IE9] Read-only attributes do not work in IE9.</li> <li><a href="http://dev.ckeditor.com/ticket/7181">#7181</a> : [IE9] Toolbar items are not aligned in v2 and Office2003 skins.</li> <li><a href="http://dev.ckeditor.com/ticket/7174">#7174</a> : [IE9] Elements path does not load correctly when the editor is switched back from Source to WYSIWYG.</li> </ul> <h3> CKEditor 3.5.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/6107">#6107</a> : It is now possible to remove block styles using Styles and Paragraph Format drop-down lists.</li> <li><a href="http://dev.ckeditor.com/ticket/5590">#5590</a> : Remove Format command works in collapsed selections.</li> <li><a href="http://dev.ckeditor.com/ticket/5755">#5755</a> : The <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.dialog_buttonsOrder">dialog_buttonsOrder</a></code> option now works in Internet Explorer.</li> <li><a href="http://dev.ckeditor.com/ticket/6869">#6869</a> : The <code>data-cke-nostyle</code> attribute (which was introduced for escaping the element from been influenced by the style system since 3.5) is deprecated in favor of the new <code>data-nostyle</code> attribute.</li> <li>Revised sample pages with code examples and clarifications.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5855">#5855</a> : Updating a link multiple times generates wrong <code>href</code> attribute.</li> <li><a href="http://dev.ckeditor.com/ticket/6166">#6166</a> : Error on Maximize command, when the toolbar button is not shown.</li> <li><a href="http://dev.ckeditor.com/ticket/6607">#6607</a> : Table cell "merge down" and "merge right" commands work only once.</li> <li><a href="http://dev.ckeditor.com/ticket/6228">#6228</a> : Merge down does not work, throwing a JavasSript error.</li> <li><a href="http://dev.ckeditor.com/ticket/6625">#6625</a> : BIDI: Mixed LTR/RTL direction causes incorrect behavior.</li> <li><a href="http://dev.ckeditor.com/ticket/6881">#6881</a> : IFrame capitalization is now consistent throughout labels.</li> <li><a href="http://dev.ckeditor.com/ticket/6686">#6686</a> : BIDI: [FF] When we apply explicit language direction to a numbered/bulleted list, the corresponding language direction toolbar icon is not highlighted.</li> <li><a href="http://dev.ckeditor.com/ticket/6566">#6566</a> : It is now possible to exit a blockquote using <code>ENTER_BR</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/6868">#6868</a> : Partial (invalid) list structure crashes the editor on load.</li> <li><a href="http://dev.ckeditor.com/ticket/6804">#6804</a> : Buggy behavior when editing the <code>legend</code> element inside a <code>fieldset</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/6724">#6724</a> : [IE7] Nested list display bug on empty list item.</li> <li><a href="http://dev.ckeditor.com/ticket/6715">#6715</a> : List items do not create paragraphs after the list placed in a table cell is removed.</li> <li><a href="http://dev.ckeditor.com/ticket/6695">#6695</a> : [Webkit] Display bug after the editor is restored from the full screen mode.</li> <li><a href="http://dev.ckeditor.com/ticket/6661">#6661</a> : [IE] Pre-formatted style does not preserve applied text direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6655">#6655</a> : Using the editor resize grip causes small visual offsets.</li> <li><a href="http://dev.ckeditor.com/ticket/6604">#6604</a> : The <code>div</code> element should be used as a formatting block in <code>ENTER_BR</code>.</li> <li><a href="http://dev.ckeditor.com/ticket/6249">#6249</a> : BIDI: List item bullets are off viewport with RTL text direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6610">#6610</a> : BIDI: <code>ENTER_BR</code> change direction in one line out of multiple.</li> <li><a href="http://dev.ckeditor.com/ticket/6872">#6872</a> : [IE] Link target field is not populated properly when no target is set.</li> <li><a href="http://dev.ckeditor.com/ticket/6880">#6880</a> : Samples: Added a user-friendly message for users on servers without PHP support.</li> <li><a href="http://dev.ckeditor.com/ticket/6628">#6628</a> : Setting <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode">config.enterMode</a></code> from PHP fails.</li> <li><a href="http://dev.ckeditor.com/ticket/6278">#6278</a> : Comments were moved above the <code>br</code> tags.</li> <li><a href="http://dev.ckeditor.com/ticket/6687">#6687</a> : Empty tag should be removed in inline-style format.</li> <li><a href="http://dev.ckeditor.com/ticket/6645">#6645</a> : Allow to configure whether &quot; (double quotes) characters should be encoded in the contents.</li> <li><a href="http://dev.ckeditor.com/ticket/6336">#6336</a> : IE: (double)clicking an <code>input type="submit"</code> button submitted the form.</li> <li><a href="http://dev.ckeditor.com/ticket/6646">#6646</a> : Context menu was not working for text inputs present in the initial content.</li> <li><a href="http://dev.ckeditor.com/ticket/6641">#6641</a> : Copying and pasting links inside the editor was not working.</li> <li><a href="http://dev.ckeditor.com/ticket/4208">#4208</a> : The <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.disableObjectResizing">disableObjectResizing</a></code> setting now works in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/6242">#6242</a> : [IE] Editing existing links with <code>href</code> of a relative path mangles containing text.</li> <li><a href="http://dev.ckeditor.com/ticket/5930">#5930</a> : [IE] Style definitions are no longer lowercased.</li> <li><a href="http://dev.ckeditor.com/ticket/5361">#5361</a> : Preview window's title should reflect the title tag in full page mode.</li> <li><a href="http://dev.ckeditor.com/ticket/5522">#5522</a> : [IE] In versions &lt; 8 or compatibility mode, <code>type="text"</code> was missing in text fields.</li> <li><a href="http://dev.ckeditor.com/ticket/6126">#6126</a> : [IE] Avoid problems if there are two buttons named "submit".</li> <li><a href="http://dev.ckeditor.com/ticket/6791">#6791</a> : [IE7] Editor did not show up when the name of a replaced textarea matched the name of a <code>meta</code> tag in the page.</li> <li><a href="http://dev.ckeditor.com/ticket/5684">#5684</a> : [FF] When <code><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.forcePasteAsPlainText">forcePasteAsPlainText</a></code> is used, the cursor disappears after paste.</li> <li><a href="http://dev.ckeditor.com/ticket/6390">#6390</a> : Prevent toolbar dialog window buttons from being clicked twice.</li> <li><a href="http://dev.ckeditor.com/ticket/6684">#6684</a> : [Webkit] Toolbar buttons are not wrapping correctly when the editor is displayed inside a table.</li> <li><a href="http://dev.ckeditor.com/ticket/6703">#6703</a> : [IE] editor <code>focus</code> event not fired in an instance, when a dialog window closes.</li> <li><a href="http://dev.ckeditor.com/ticket/6873">#6873</a> : Difficult to drag the resize grip of the spell checker dialog window.</li> <li><a href="http://dev.ckeditor.com/ticket/6896">#6896</a> : [Webkit] Unable to paste into source area when the editor is maximized.</li> <li><a href="http://dev.ckeditor.com/ticket/6020">#6020</a> : The state of the Cut, Copy, and Paste toolbar now matches the state of the context menu buttons.</li> <li><a href="http://dev.ckeditor.com/ticket/5256">#5256</a> : JavaScript error thrown when percent (%) sign is used in image URL.</li> <li><a href="http://dev.ckeditor.com/ticket/6577">#6577</a> : [FF] Selection error when an element containing the editor instance is hidden.</li> <li><a href="http://dev.ckeditor.com/ticket/5500">#5500</a> : [IE] <code>value</code> attribute of text input dialog window field was missing.</li> <li><a href="http://dev.ckeditor.com/ticket/6665">#6665</a> : [IE] <code>name</code> field of Link dialog window was missing.</li> <li><a href="http://dev.ckeditor.com/ticket/6639">#6639</a> : Line-breaks inside pasted list item from Microsoft Word break the list structure.</li> <li><a href="http://dev.ckeditor.com/ticket/6909">#6909</a> : [IE] GIF icons of toolbar button from custom plugins are not diplayed in zoom level 100%.</li> <li><a href="http://dev.ckeditor.com/ticket/6860">#6860</a> : [FF] Double-clicking the placeholder element in order to open a Placeholder dialog window throws a JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/6630">#6630</a> : Empty <code>pre</code> elements are output differently in various browsers.</li> <li><a href="http://dev.ckeditor.com/ticket/6568">#6568</a> : Insert table row/column does not work with spanning.</li> <li><a href="http://dev.ckeditor.com/ticket/6735">#6735</a> : Inaccurate read-only selection detection.</li> <li><a href="http://dev.ckeditor.com/ticket/6728">#6728</a> : BIDI: Change direction does not work with list nested inside a blockquote.</li> <li><a href="http://dev.ckeditor.com/ticket/6432">#6432</a> : Inserting a table in place of a fully selected list results in a JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/6438">#6438</a> : [IE] Performance enhancement when typing inside an element with many child nodes.</li> <li><a href="http://dev.ckeditor.com/ticket/6970">#6970</a> : [IE] Dialog window shadows were presented inaccurately.</li> <li><a href="http://dev.ckeditor.com/ticket/6672">#6672</a> : [IE] Unnecessary <code>br</code> element is no longer inserted after a form.</li> <li><a href="http://dev.ckeditor.com/ticket/7087">#7087</a> : [FF] Sometimes it was not possible to move cursor out of link at the end of block.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/6981">#6981</a> : English (GB);</li> <li><a href="http://dev.ckeditor.com/ticket/6991">#6991</a> : Finnish;</li> <li><a href="http://dev.ckeditor.com/ticket/6357">#6357</a> : French;</li> <li><a href="http://dev.ckeditor.com/ticket/7055">#7055</a> : Polish;</li> <li><a href="http://dev.ckeditor.com/ticket/7068">#7068</a> : German;</li> </ul></li> </ul> <h3> CKEditor 3.5</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4090">#4090</a> : Full Adobe AIR support.</li> <li><a href="http://dev.ckeditor.com/ticket/5084">#5084</a> : Dialog windows are now resizable with a grip located in the footer.</li> <li><a href="http://dev.ckeditor.com/ticket/5755">#5755</a> : Introduced the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.dialog_buttonsOrder">dialog_buttonsOrder</a> setting, making it possible to control the buttons order.</li> <li><a href="http://dev.ckeditor.com/ticket/4648">#4648</a> : Added the new iFrame plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/6010">#6010</a> : The Automatic option of the font/background color panel now represents the real color.</li> <li><a href="http://dev.ckeditor.com/ticket/5654">#5654</a> : New "placeholder" plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/6334">#6334</a> : CKEditor now uses <a href="http://www.w3.org/TR/2010/WD-html5-20101019/elements.html#embedding-custom-non-visible-data-with-the-data-attributes">HTML5's data-* attributes</a> for its internal attributes.</li> <li><a href="http://dev.ckeditor.com/ticket/6103">#6103</a> : It's now possible to control the styling of inline read-only elements with the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.disableReadonlyStyling">disableReadonlyStyling</a> setting. It's also possible to avoid inline-styling any element by setting its "data-cke-nostyle" attribute to "1".</li> <li><a href="http://dev.ckeditor.com/ticket/5404">#5404</a> : <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.fillEmptyBlocks">fillEmptyBlocks</a> configuration option of v2 is now available.</li> <li><a href="http://dev.ckeditor.com/ticket/5367">#5367</a> : New <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertText">CKEDITOR.editor#insertText</a> method (check api.html sample page for usages) is now provided to insert plain text into editor.</li> <li><a href="http://dev.ckeditor.com/ticket/5367">#5915</a> : New <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.removeDialogTabs">removeDialogTabs</a> configuration option to hide certain dialog tabs.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4821">#4821</a> : Icons in the toolbar were distorted with IE and zoom != 100%.</li> <li><a href="http://dev.ckeditor.com/ticket/5587">#5587</a> : Visual improvements in dialogs, reinforce field label on separate line.</li> <li><a href="http://dev.ckeditor.com/ticket/4652">#4652</a> : Now it's able to disable editor context menu by simply removing the "contextmenu" plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/5599">#5599</a> : Labels of "specialchar" dialog are now translated.</li> <li><a href="http://dev.ckeditor.com/ticket/6419">#6419</a> : [IE] List creation by merging problem.</li> <li><a href="http://dev.ckeditor.com/ticket/6502">#6502</a> : Removed IE6 image preloading, which was used to defect the duplicate request of background images.</li> <li><a href="http://dev.ckeditor.com/ticket/6822">#6822</a> : Added labels to fake objects.</li> <li><a href="http://dev.ckeditor.com/ticket/6898">#6898</a> : [IE6] Toolbar icons becomes invisible in RTL.</li> <li>Updated the following language files:<ul> <li>Hebrew</li> </ul></li> </ul> <h3> CKEditor 3.4.3</h3> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/6554">#6554</a> : [Webkit] cannot type after inserting Page Break.</li> <li><a href="http://dev.ckeditor.com/ticket/6569">#6569</a> : Indentation now complies with text direction of the only item.</li> <li><a href="http://dev.ckeditor.com/ticket/6579">#6579</a> : The jQuery adapter was not working properly and was turned on in incompatible environments.</li> <li><a href="http://dev.ckeditor.com/ticket/6644">#6644</a> : Restrict <code>onmousedown</code> handler to the toolbar area.</li> <li><a href="http://dev.ckeditor.com/ticket/6656">#6656</a> : Panelbutton's buttons became active when clicking on Source.</li> <li><a href="http://dev.ckeditor.com/ticket/6248">#6248</a> : Whitespaces (<code>nbsp</code> elements) were incorrectly added into empty table cells and list items.</li> <li><a href="http://dev.ckeditor.com/ticket/6575">#6575</a> : Tabs disappearing in Link dialog window after a specific sequence of actions.</li> <li><a href="http://dev.ckeditor.com/ticket/6510">#6510</a> : Margin mirroring does not respect style configuration.</li> <li><a href="http://dev.ckeditor.com/ticket/6471">#6471</a> : BIDI: Pressing Decrease Indent in an RTL bulleted list causes incorrect behaviour.</li> <li><a href="http://dev.ckeditor.com/ticket/6479">#6479</a> : BIDI: Language direction is not being preserved when pressing Enter after a Paragraph Format was applied.</li> <li><a href="http://dev.ckeditor.com/ticket/6670">#6670</a> : BIDI: Indent &amp; List icons are not reversed when we apply RTL direction to a paragraph with any of Paragraph Formatting options.</li> <li><a href="http://dev.ckeditor.com/ticket/6640">#6640</a> : Floating panels are now being closed when switching modes.</li> <li><a href="http://dev.ckeditor.com/ticket/4790">#4790</a> : Remove list with multiple items in <code>enterBr</code> doesnot preserve line breaks.</li> <li><a href="http://dev.ckeditor.com/ticket/6297">#6297</a> : Floated inline elements are not taking part in behavior of blocks anymore.</li> <li><a href="http://dev.ckeditor.com/ticket/6171">#6171</a> : [Firefox] Opening rich content drop-down list scrolls host page to the top when editor has a vertical scrollbar.</li> <li><a href="http://dev.ckeditor.com/ticket/6330">#6330</a> : List markers from MS Word with Roman numbering are not preserved.</li> <li><a href="http://dev.ckeditor.com/ticket/6720">#6720</a> : Attribute protection might detect wrong elements.</li> <li><a href="http://dev.ckeditor.com/ticket/6580">#6580</a> : [IE9] Flash dialog window does not get filled up.</li> <li><a href="http://dev.ckeditor.com/ticket/6447">#6447</a> : Decreasing indentation of a list with <code>indentClasses</code> config does not work.</li> <li><a href="http://dev.ckeditor.com/ticket/5894">#5894</a> : Adding custom buttons at the bottom of a dialog window does not cause it to expand to include its contents.</li> <li><a href="http://dev.ckeditor.com/ticket/6513">#6513</a> : Wrong ARIA attributes created on list options of Styles drop-down list.</li> <li><a href="http://dev.ckeditor.com/ticket/6150">#6150</a> : [Safari] Color dialog window was broken.</li> <li><a href="http://dev.ckeditor.com/ticket/6747">#6747</a> : Full screen layout issue caused by page element focus outside editor.</li> <li><a href="http://dev.ckeditor.com/ticket/6779">#6779</a> : Clicking the <code>body</code> element on elements path turns the selection on and off immediately.</li> <li><a href="http://dev.ckeditor.com/ticket/6781">#6781</a> : [IE7] Dialog windows are broken with RTL, Office 2003 and v2 skins.</li> <li><a href="http://dev.ckeditor.com/ticket/6798">#6798</a> : [IE7] Dialog window buttons disappearing in RTL after dragging.</li> <li><a href="http://dev.ckeditor.com/ticket/6806">#6806</a> : [IE7] Dialog window buttons invisible on focus.</li> <li><a href="http://dev.ckeditor.com/ticket/6588">#6588</a> : Copy and paste adds <code>&lt;span&gt;</code> if SCAYT is enabled.</li> <li><a href="http://dev.ckeditor.com/ticket/6673">#6673</a> : IE Target combo for Image Link shown as blank even when we select <code>&lt;not set&gt;</code> as an option.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/6756">#6756</a> : Hungarian;</li> <li><a href="http://dev.ckeditor.com/ticket/6794">#6794</a> : Japanese;</li> </ul></li> </ul> <h3> CKEditor 3.4.2</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5024">#5024</a> : Added a sample that shows how to output HTML that is valid for Flash.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5237">#5237</a> : English text in dialogs' title was flipped when using RTL language (office2003 and v2 skins).</li> <li><a href="http://dev.ckeditor.com/ticket/6289">#6289</a> : Deleting nested table removed the parent cell.</li> <li><a href="http://dev.ckeditor.com/ticket/6341">#6341</a> : The editor contents now have the text cursor.</li> <li><a href="http://dev.ckeditor.com/ticket/6153">#6153</a> : Chrome: tab focus is wrong.</li> <li><a href="http://dev.ckeditor.com/ticket/6261">#6261</a> : Focus and infinite loop between multiple editors.</li> <li><a href="http://dev.ckeditor.com/ticket/6170">#6170</a> : Dedicated class names are removed from floating panels when opening another panel.</li> <li><a href="http://dev.ckeditor.com/ticket/6339">#6339</a> : Autogrow plugin now doesn't work on maximized editors.</li> <li><a href="http://dev.ckeditor.com/ticket/6237">#6237</a> : BIDI: Applying same language direction to all paragraphs not working.</li> <li><a href="http://dev.ckeditor.com/ticket/6353">#6353</a> : [IE] Resize was broken with office2003 and v2 skins.</li> <li><a href="http://dev.ckeditor.com/ticket/6375">#6375</a> : Avoiding errors when hiding the editor after the blur event.</li> <li><a href="http://dev.ckeditor.com/ticket/6133">#6133</a> : Styled paragraphs result on buggy list creation.</li> <li><a href="http://dev.ckeditor.com/ticket/5074">#5074</a> : Link target is not removed when changing to popup.</li> <li><a href="http://dev.ckeditor.com/ticket/6408">#6408</a> : [IE] Autogrow now works correctly on Quirks.</li> <li><a href="http://dev.ckeditor.com/ticket/6420">#6420</a> : [IE] The table properties dialog now correctly retrieves the caption text.</li> <li><a href="http://dev.ckeditor.com/ticket/6141">#6141</a> : It was impossible to outdent a list when indentOffset was set to 0.</li> <li><a href="http://dev.ckeditor.com/ticket/6377">#6377</a> : FF width and height are not shown for smiley in Image properties dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5399">#5399</a> : Lists pasted from Word do not maintain their nesting.</li> <li><a href="http://dev.ckeditor.com/ticket/6225">#6225</a> : [FF] Cannot transform several lines to list with enterMode BR.</li> <li><a href="http://dev.ckeditor.com/ticket/6467">#6467</a> : [FF] It is now possible to disable the plugin command on "mode" event.</li> <li><a href="http://dev.ckeditor.com/ticket/6461">#6461</a> : Attributes are now being kept when changing block formatting.</li> <li><a href="http://dev.ckeditor.com/ticket/6226">#6226</a> : BIDI: Language direction applied to a Paragraph is removed when we apply one of Paragraph formatting options.</li> <li><a href="http://dev.ckeditor.com/ticket/5395">#5395</a> : [Opera] Native context menu incorrectly opened after Opera 10.2.</li> <li><a href="http://dev.ckeditor.com/ticket/6444">#6444</a> : [Opera] Close panels and dialogs don't return focus to wysiwyg frame.</li> <li><a href="http://dev.ckeditor.com/ticket/6332">#6332</a> : IE: V2 skin bottom dialog's border broken.</li> <li><a href="http://dev.ckeditor.com/ticket/5646">#5646</a> : Parser incorrectly removes inline element when there's only one comment node enclosed.</li> <li><a href="http://dev.ckeditor.com/ticket/6189">#6189</a> : Minor code size reduction.</li> <li><a href="http://dev.ckeditor.com/ticket/5045">#5045</a> : uiColor behaved wrong if multiple editors were used with period in their names.</li> <li><a href="http://dev.ckeditor.com/ticket/5766">#5766</a> : Config entry "ignoreEmptyParagraph" should only remove one single empty paragraph in document.</li> <li><a href="http://dev.ckeditor.com/ticket/5931">#5931</a> : Unable to apply inline style because of nested elements with same style name.</li> <li><a href="http://dev.ckeditor.com/ticket/6083">#6083</a> : Dialog close sometimes cause collapsed editor selection before the insertion.</li> <li><a href="http://dev.ckeditor.com/ticket/6253">#6253</a> : BIDI: creating a Numbered/Bulleted list causing improper behavior on bidi.</li> <li><a href="http://dev.ckeditor.com/ticket/4023">#4023</a> : [Opera] Maximize plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/6403">#6403</a> : [Opera] Font name options are not correctly marked in dropdown list.</li> <li><a href="http://dev.ckeditor.com/ticket/4534">#4534</a> : [Opera] Arrow key to navigate through combo list has side effects of window scrolling.</li> <li><a href="http://dev.ckeditor.com/ticket/6534">#6534</a> : [Opera] Menu key brings up both CKEditor and browser context menu.</li> <li><a href="http://dev.ckeditor.com/ticket/6534">#6534</a> : [Opera] Menu key brings up both CKEditor and browser context menu.</li> <li><a href="http://dev.ckeditor.com/ticket/6416">#6416</a> : [IE9] Unable to make text selection with mouse in source area.</li> <li><a href="http://dev.ckeditor.com/ticket/6417">#6417</a> : [IE9] Context menu opens at the upper-left corner always.</li> <li><a href="http://dev.ckeditor.com/ticket/6501">#6501</a> : [IE9] Context menu item layout is broken.</li> <li><a href="http://dev.ckeditor.com/ticket/6099">#6099</a> : BIDI: when we apply explicit language direction to Numbered/Bulleted List the corresponding BIDI Tool bar icon is not highlighted in the Toolbar.</li> <li><a href="http://dev.ckeditor.com/ticket/6100">#6100</a> : BIDI: when we change Table language direction indentation of text in Table cells is not applied correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/6376">#6376</a> : BIDI: buttons should not toggle the base language direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6235">#6235</a> : BIDI: Applying direction to multi-paragraph selection within a div.</li> <li><a href="http://dev.ckeditor.com/ticket/6187">#6187</a> : [IE6] Multi-instance loading produces 404s on background images.</li> <li><a href="http://dev.ckeditor.com/ticket/5446">#5446</a> : Setting config.filebrowserImageBrowseUrl results in displaying also Browser Server on links.</li> <li><a href="http://dev.ckeditor.com/ticket/5626">#5626</a> : CKeditor 3.2.1 : html content attached makes ckeditor crash the browser FF/IE.</li> <li><a href="http://dev.ckeditor.com/ticket/6508">#6508</a> : BiDi: Margin mirroring logic doesn't honor CSS direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6043">#6043</a> : BIDI: When we apply RTL direction to a right aligned Paragraph, Paragraph is not moved to the left &amp; Alignment of Paragraph is not changed.</li> <li><a href="http://dev.ckeditor.com/ticket/6485">#6485</a> : BIDI: When direction is applied on partial selected list, the style is been incorrectly applied to the entire list.</li> <li><a href="http://dev.ckeditor.com/ticket/6087">#6087</a> : Cursor of input fields in dialog isn't visible in RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/5595">#5595</a> : Extra leading spaces added in preformatted block.</li> <li><a href="http://dev.ckeditor.com/ticket/6094">#6094</a> : Match full word option doesn't stop on block boundaries.</li> <li><a href="http://dev.ckeditor.com/ticket/5730">#5730</a> : [Safari] Continual pastes (holding paste key) breaks document contents.</li> <li><a href="http://dev.ckeditor.com/ticket/5850">#5850</a> : [IE] Inline style misbehaviors at the beginning of numbered/bulleted list.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/6427">#6427</a> : Ukrainian;</li> <li><a href="http://dev.ckeditor.com/ticket/6464">#6464</a> : Finnish;</li> <li>Hebrew;</li> </ul></li> </ul> <h3> CKEditor 3.4.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5308">#5308</a> : Introduced the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.filebrowserWindowFeatures">filebrowserWindowFeatures</a> setting, making it possible to have custom window features in the file browser window.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/6027">#6027</a> : Modifying Table Properties by selecting more than one cell caused issues.</li> <li><a href="http://dev.ckeditor.com/ticket/6146">#6146</a> : IE: Floating panels were being opened in the wrong place in RTL pages with horizontal scrollbars.</li> <li><a href="http://dev.ckeditor.com/ticket/6055">#6055</a> : The timestamp is now added only once to each loaded file.</li> <li><a href="http://dev.ckeditor.com/ticket/6097">#6097</a> : The bookmarks now use the right name.</li> <li><a href="http://dev.ckeditor.com/ticket/5717">#5717</a> : Removed the scayt_contextMenuOntop setting and the SCAYT context menu options are always on top.</li> <li><a href="http://dev.ckeditor.com/ticket/5956">#5956</a> : [FF] It was impossible to create an editor inside an hidden container.</li> <li><a href="http://dev.ckeditor.com/ticket/5753">#5753</a> : It was impossible to have a default value for the name field in the select dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/6041">#6041</a> : BIDI: Direction of Increase Indent &amp; Decrease Indent icons are not reversed after changing Lang direction to RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/6138">#6138</a> : List indentation is not working.</li> <li><a href="http://dev.ckeditor.com/ticket/5649">#5649</a> : Image dialog too wide when many styles are set.</li> <li><a href="http://dev.ckeditor.com/ticket/5715">#5715</a> : Cell color picker dialog returns focus to document.</li> <li><a href="http://dev.ckeditor.com/ticket/6108">#6108</a> : Fixed div style.</li> <li><a href="http://dev.ckeditor.com/ticket/5336">#5336</a> : Remove object style.</li> <li><a href="http://dev.ckeditor.com/ticket/6155">#6155</a> : [[FF]] Modifying Table Header Properties by selecting first Row, causing several issues.</li> <li><a href="http://dev.ckeditor.com/ticket/6163">#6163</a> : Focus not going to Tabs in Image dialog when we went to Edit the Image.</li> <li><a href="http://dev.ckeditor.com/ticket/6177">#6177</a> : IE we can't start Numbered/Bulleted list on a Empty page.</li> <li><a href="http://dev.ckeditor.com/ticket/6034">#6034</a> : Horizontal Alignment applied to Table cell is not updated correctly in the Toolbar.</li> <li><a href="http://dev.ckeditor.com/ticket/6112">#6112</a> : BIDI: Alignment set to text in Table cell is not shown in the Tool bar when we press Enter to start a new Paragraph.</li> <li><a href="http://dev.ckeditor.com/ticket/6117">#6117</a> : BIDI: Language direction is changing when we come out of Numbered/Bulleted list.</li> <li><a href="http://dev.ckeditor.com/ticket/6182">#6182</a> : Language Direction field on the Advanced tab of Table Properties dialog has a fixed pixel width.</li> <li><a href="http://dev.ckeditor.com/ticket/5487">#5487</a> : Fullpage writer problem with line-break.</li> <li><a href="http://dev.ckeditor.com/ticket/6197">#6197</a> : The CKEDITOR.loader base path auto-detection was not working with the _source folder.</li> <li><a href="http://dev.ckeditor.com/ticket/6240">#6240</a> : Font Names &amp; Font Sizes should be shown Left Align even for RTL Languages.</li> <li><a href="http://dev.ckeditor.com/ticket/5975">#5975</a> : Page-break should have proper Alt Text instead of Unknown object. so that JAWS reads it properly.</li> <li><a href="http://dev.ckeditor.com/ticket/6255">#6255</a> : Inserting a page break as the first node triggered an error.</li> <li><a href="http://dev.ckeditor.com/ticket/6188">#6188</a> : [IE7] Automatic color button had the wrong cursor.</li> <li><a href="http://dev.ckeditor.com/ticket/6129">#6129</a> : The show blocks' labels are now shown in the right for RTL languages.</li> <li><a href="http://dev.ckeditor.com/ticket/5421">#5421</a> : &amp;shy; entity not converted when config.entities=false.</li> <li><a href="http://dev.ckeditor.com/ticket/5769">#5769</a> : xhtml code generation problem &amp;nbsp; instead of &amp;#160; (htmlentities, entities,entities_additional,..., configuration).</li> <li><a href="http://dev.ckeditor.com/ticket/4472">#4472</a> : [FF3] Browser window scrolls to loaded CKEditor.</li> <li><a href="http://dev.ckeditor.com/ticket/6230">#6230</a> : Fixed invalid parameter count for setTimeout function call.</li> <li><a href="http://dev.ckeditor.com/ticket/5335">#5335</a> : Several lines' formatted data will be merged to one line when we apply Numbers/Bullets.</li> <li><a href="http://dev.ckeditor.com/ticket/5353">#5353</a> : wrong width of editor after resize() called in Firefox 3.6.</li> <li><a href="http://dev.ckeditor.com/ticket/5778">#5778</a> : [IE] Unwanted scroll on first mouse right-click.</li> <li><a href="http://dev.ckeditor.com/ticket/5218">#5218</a> : [FF] Copy/paste of an image from same domain changed URL to relative URL.</li> <li><a href="http://dev.ckeditor.com/ticket/6265">#6265</a> : Popup window properties were visible in the link dialog's target tab when nothing was selected.</li> <li><a href="http://dev.ckeditor.com/ticket/6075">#6075</a> : [FF] Newly created links didn't fill in information on edit.</li> <li><a href="http://dev.ckeditor.com/ticket/6183">#6183</a> : The toolbar panels options sometimes had the contents' link color.</li> <li><a href="http://dev.ckeditor.com/ticket/6192">#6192</a> : [WebKit] Inserting smileys was not working because of editor focus issues.</li> <li><a href="http://dev.ckeditor.com/ticket/6178">#6178</a> : [WebKit] Inserting elements by code was failing if the editor didn't receive the focus first.</li> <li><a href="http://dev.ckeditor.com/ticket/6179">#6179</a> : [WebKit] The Image dialog was not working if the editor didn't receive the focus first.</li> <li><a href="http://dev.ckeditor.com/ticket/4657">#4657</a> : [Opera] Styles where not working with collapsed selections.</li> <li><a href="http://dev.ckeditor.com/ticket/5839">#5839</a> : "Insert row after" was removing the ids of the elements from the clicked row.</li> <li><a href="http://dev.ckeditor.com/ticket/6315">#6315</a> : DIV plugin TT #2885 regression.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/6246">#6246</a> : Chinese Simplified;</li> <li><a href="http://dev.ckeditor.com/ticket/6256">#6256</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/6271">#6271</a> : English;</li> </ul></li> </ul> <h3> CKEditor 3.4</h3> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/6118">#6118</a> : Initial focus is now set to the tabs in the table properties dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/6135">#6135</a> : The dialogadvtab plugin now uses the correct label.</li> <li><a href="http://dev.ckeditor.com/ticket/6125">#6125</a> : Focus was lost after applying commands in Opera.</li> <li><a href="http://dev.ckeditor.com/ticket/6137">#6137</a> : The table dialog was missing the default width value on second opening.</li> </ul> <h3> CKEditor 3.4 Beta</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5909">#5909</a> : New BiDi feature, making it possible to switch the base language direction of block elements.</li> <li><a href="http://dev.ckeditor.com/ticket/5268">#5268</a> : Introducing the "tableresize" plugin, which makes it possible to resize tables columns by mouse drag. It's not enabled by default, so it must be enabled in the configurations file.</li> <li><a href="http://dev.ckeditor.com/ticket/979">#979</a> : New <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enableTabKeyTools">enableTabKeyTools</a> configuration to allow using the TAB key to navigate through table cells.</li> <li><a href="http://dev.ckeditor.com/ticket/4606">#4606</a> : Introduce the "autogrow" plugin, which makes the editor resize automatically, based on the contents size.</li> <li><a href="http://dev.ckeditor.com/ticket/5737">#5737</a> : Added support for the <a href="http://www.w3.org/TR/html5/editing.html#contenteditable">HTML5 contenteditable attribute</a>, making it possible to define read only regions into the editor contents.</li> <li><a href="http://dev.ckeditor.com/ticket/5418">#5418</a> : New "Advanced" tab introduced on the Table Properties dialog. It's based on the new dialogadvtab plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/6082">#6082</a> : Introduced the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.useComputedState">useComputedState</a> setting, making it possible to control whether toolbar features, like alignment and direction, should reflect the "computed" selection states, even when the effective feature value is not applied.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5911">#5911</a> : BiDi: List items should support and retain correct base language direction</li> <li><a href="http://dev.ckeditor.com/ticket/5689">#5689</a> : Make it possible to run CKEditor inside of Firefox chrome.</li> <li><a href="http://dev.ckeditor.com/ticket/6042">#6042</a> : It wasn't possible to align a paragraph with the dir attribute to the opposite direction.</li> <li><a href="http://dev.ckeditor.com/ticket/6058">#6058</a> : Fixed a small style glitch with file upload fields in IE+Quirks.</li> </ul> <h3> CKEditor 3.3.2</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5882">#5882</a> : Introduce the dialog#selectPage event, replicating the OnDialogTabChange feature available in FCKeditor 2.</li> <li><a href="http://dev.ckeditor.com/ticket/5927">#5927</a> : The native controls in ui.dialog.elements can be styled with the controlStyle definition.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/1644">#1644</a> : Removed references to cursor:hand in the stylesheets.</li> <li><a href="http://dev.ckeditor.com/ticket/5411">#5411</a> : Anchor, hidden fields and Page-Break objects can no longer be resized.</li> <li><a href="http://dev.ckeditor.com/ticket/5456">#5456</a> : Initial focus incorect in api_dialog sample page.</li> <li><a href="http://dev.ckeditor.com/ticket/5628">#5628</a> : Incorrect &lt;pre&gt; siblings merging.</li> <li><a href="http://dev.ckeditor.com/ticket/5829">#5829</a> : Adding validation for start number field in list style dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5845">#5845</a> : Context menu on empty list item loses selection.</li> <li><a href="http://dev.ckeditor.com/ticket/5860">#5860</a> : [IE] &gt; in attribute values are incorrectly escaped.</li> <li><a href="http://dev.ckeditor.com/ticket/5905">#5905</a> : SCAYT is not any more enabled by default.</li> <li><a href="http://dev.ckeditor.com/ticket/5736">#5736</a> : Improved the text generated for mailto: links if no text was selected.</li> <li><a href="http://dev.ckeditor.com/ticket/4779">#4779</a> : Adjust resize_minWidth and resize_minHeight if smaller than actual dimensions.</li> <li><a href="http://dev.ckeditor.com/ticket/5687">#5687</a> : Navigation through colors is now compatible with RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/4615">#4615</a> : [IE] Text fields are no longer disrupted in dialog with RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/5887">#5887</a> : The number of columns in the smileys table is now configurable via the smiley_columns setting.</li> <li><a href="http://dev.ckeditor.com/ticket/5100">#5100</a> : It was possible to drag&amp;drop some elements like context menu items or dropdown entries.</li> <li><a href="http://dev.ckeditor.com/ticket/5933">#5933</a> : Text color and background color panels don't have scrollbars anymore under office2003 and v2 skins.</li> <li><a href="http://dev.ckeditor.com/ticket/5943">#5943</a> : An error is no longer generated when using percent or pixel values in the image dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5951">#5951</a> : Avoid problems with security systems due to the usage of UniversalXPConnect.</li> <li><a href="http://dev.ckeditor.com/ticket/5441">#5441</a> : Avoid errors if the editor instance is removed from the DOM before calling its destroy() method.</li> <li><a href="http://dev.ckeditor.com/ticket/4997">#4997</a> : Provide better access to the native input in the ui.dialog.file element.</li> <li><a href="http://dev.ckeditor.com/ticket/5914">#5914</a> : Modified the Smileys dialog to make active only the images and not their borders.</li> <li><a href="http://dev.ckeditor.com/ticket/5565">#5565</a> : The scrollbar does not behaves erratically when opening a rich combo in RTL page.</li> <li><a href="http://dev.ckeditor.com/ticket/5843">#5843</a> : In CKEditor 3.3: When we set the focus in the 'instanceReady' event, FF3.6 is giving js error.</li> <li><a href="http://dev.ckeditor.com/ticket/5902">#5902</a> : paste and pastetext dialogs cannot be skinned easily.</li> <li><a href="http://dev.ckeditor.com/ticket/5959">#5959</a> : Dialog auto focus does not check for hidden tabs.</li> <li><a href="http://dev.ckeditor.com/ticket/5415">#5415</a> : Undo not working when we change the Table Properties for the table on a saved page.</li> <li><a href="http://dev.ckeditor.com/ticket/5435">#5435</a> : IE: we can't start Numbered/Bulleted list in Tables by Clicking on Insert/Remove Numbers/Bullets Icon.</li> <li><a href="http://dev.ckeditor.com/ticket/5832">#5832</a> : The JQuery adapter sample is not working properly with SSL.</li> <li><a href="http://dev.ckeditor.com/ticket/5728">#5728</a> : Text field &amp; Upload Button in Upload Tab of Image Properties dialog are not shown Properly in Arabic.</li> <li><a href="http://dev.ckeditor.com/ticket/5436">#5436</a> : IE: Cursor goes to next Table Cell after we insert a Smiley in the Table Cell.</li> <li><a href="http://dev.ckeditor.com/ticket/5580">#5580</a> : Maximize does not work properly in the Office 2003 and V2 skins.</li> <li><a href="http://dev.ckeditor.com/ticket/5495">#5495</a> : The link dialog was breaking the undo system on some situations.</li> <li><a href="http://dev.ckeditor.com/ticket/5775">#5775</a> : Required field's label to contain a CSS class to allow it to be styled differently.</li> <li><a href="http://dev.ckeditor.com/ticket/5999">#5999</a> : Table dialog rows and columns fields are now marked as required.</li> <li><a href="http://dev.ckeditor.com/ticket/5693">#5693</a> : baseHref detection in the flash dialog now works correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/5690">#5690</a> : Table cell's width attribute is now respected properly.</li> <li><a href="http://dev.ckeditor.com/ticket/5819">#5819</a> : Introducing the new removeFormatCleanup event and making sure remove format doesn't break the showborder plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/5558">#5558</a> : After pasting on WebKit based browsers the editor now scrolls to the end of the pasted content.</li> <li><a href="http://dev.ckeditor.com/ticket/5799">#5799</a> : Correct plugin dependencies for the liststyle plugin with contextMenu and dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5436">#5436</a> : IE: The cursor was moving to the wrong position when inserting inline elements at the end of cells on tables.</li> <li><a href="http://dev.ckeditor.com/ticket/5984">#5984</a> : Firefox: CTRL+HOME was creating an unwanted empty paragraph at the start of the document.</li> <li><a href="http://dev.ckeditor.com/ticket/5634">#5634</a> : IE: It was needed to click twice in the editor to make it editable on some situations.</li> <li><a href="http://dev.ckeditor.com/ticket/5338">#5338</a> : Pasting from Open Office could lead on error.</li> <li><a href="http://dev.ckeditor.com/ticket/5224">#5224</a> : Some invalid markup could break the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/5455">#5455</a> : It was not possible to remove formatting from pasted content on specific cases.</li> <li><a href="http://dev.ckeditor.com/ticket/5735">#5735</a> : IE: The editor was having focus issues when the previous selection got hidden by scroll operations.</li> <li><a href="http://dev.ckeditor.com/ticket/5563">#5563</a> : Firefox: The disableObjectResizing and disableNativeTableHandles settings stopped working.</li> <li><a href="http://dev.ckeditor.com/ticket/5781">#5781</a> : Firefox: Editing was not possible in an empty document.</li> <li><a href="http://dev.ckeditor.com/ticket/5293">#5293</a> : Firefox: Unwanted BR tags were being left in the editor output when it should be empty.</li> <li><a href="http://dev.ckeditor.com/ticket/5280">#5280</a> : IE: Scrollbars where reacting improperly when clicking in the bar space.</li> <li><a href="http://dev.ckeditor.com/ticket/5840">#5840</a> : Some dialog access keys are conflicting with "Ctrl + A", select all text behavior on text input.</li> <li><a href="http://dev.ckeditor.com/ticket/6059">#6059</a> : Changing list type didn't preserve the list's attributes.</li> <li><a href="http://dev.ckeditor.com/ticket/5193">#5193</a> : In Firefox, the element path options had the text cursor instead of the arrow.</li> <li><a href="http://dev.ckeditor.com/ticket/6073">#6073</a> : The list context menu was showing the wrong option when in a mixed list hierarchy.</li> <li><a href="http://dev.ckeditor.com/ticket/6074">#6074</a> : The Insert Table Column command was duplicating the selected column cells ids.</li> <li><a href="http://dev.ckeditor.com/ticket/6066">#6066</a> : The toolbar combos had the text cursor instead of the arrow.</li> <li><a href="http://dev.ckeditor.com/ticket/6062">#6062</a> : The toolbar buttons had the text cursor instead of the arrow.</li> <li><a href="http://dev.ckeditor.com/ticket/6068">#6068</a> : [IE7] A few labels were hidden in a RTL language.</li> <li><a href="http://dev.ckeditor.com/ticket/6000">#6000</a> : Safari and Chrome where scrolling the contents to the top when moving the focus to the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/6090">#6090</a> : IE: Textarea with selection inside causes Link dialog issues.</li> <li><a href="http://dev.ckeditor.com/ticket/5079">#5079</a> : Page break in lists move to above the list when you switch from WYSIWYG to HTML mode and back.</li> <li>Updated the following language files:<ul> <li>Chinese Simplified;</li> <li>Hebrew;</li> <li><a href="http://dev.ckeditor.com/ticket/5962">#5962</a> : German;</li> <li><a href="http://dev.ckeditor.com/ticket/5645">#5645</a> : Portuguese;</li> <li><a href="http://dev.ckeditor.com/ticket/5797">#5797</a> : Turkish;</li> </ul></li> </ul> <h3> CKEditor 3.3.1</h3> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5780">#5780</a> : Text selection lost when opening some of the dialogs.</li> <li><a href="http://dev.ckeditor.com/ticket/5787">#5787</a> : Liststyle plugin wasn't packaged into the core (CKEDITOR.resourceManager.load exception).</li> <li><a href="http://dev.ckeditor.com/ticket/5637">#5637</a> : Fix wrong nesting that generated "&lt;head&gt; must be a child of &lt;html&gt;" warning in Webkit.</li> <li><a href="http://dev.ckeditor.com/ticket/5790">#5790</a> : Internal only attributes output on fullpage &lt;html&gt; tag.</li> <li><a href="http://dev.ckeditor.com/ticket/5761">#5761</a> : [IE] Color dialog matrix buttons are barely clickable in quirks mode.</li> <li><a href="http://dev.ckeditor.com/ticket/5759">#5759</a> : [IE] Clicking on the scrollbar and then on the host page causes error.</li> <li><a href="http://dev.ckeditor.com/ticket/5772">#5772</a> : List style dialog is missing tab page ids.</li> <li><a href="http://dev.ckeditor.com/ticket/5782">#5782</a> : [FF] Wysiwyg mode is broken by 'display' style changes on editor's parent DOM tree.</li> <li><a href="http://dev.ckeditor.com/ticket/5801">#5801</a> : [IE] contentEditable="false" doesn't apply in effect on inline-elements.</li> <li><a href="http://dev.ckeditor.com/ticket/5794">#5794</a> : Empty find matching twice results in JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/5732">#5732</a> : If it isn't possible to connect to the SCAYT servers the dialogs might hang in Firefox. Fix for Firefox&gt;=3.6.</li> <li><a href="http://dev.ckeditor.com/ticket/5807">#5807</a> : [FF2] New page command results in uneditable document.</li> <li><a href="http://dev.ckeditor.com/ticket/5807">#5807</a> : [FF2] SCAYT plugin is disabled in Firefox2 due to selection interference.</li> <li><a href="http://dev.ckeditor.com/ticket/5772">#5772</a> : [IE] Some numbered list style types are not supported by IE6/7 and causes JavaScript error.</li> </ul> <h3> CKEditor 3.3</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/635">#635</a> : The properties dialog will now open when double clicking on objects.</li> <li><a href="http://dev.ckeditor.com/ticket/3893">#3893</a> : It's now possible to indent/outdent lists when selecting the first list item.</li> <li><a href="http://dev.ckeditor.com/ticket/4968">#4968</a> : The <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.contentsLangDirection">contentsLangDirection</a> setting now has a default value 'ui' which inherit language direction from the editor UI language.</li> <li><a href="http://dev.ckeditor.com/ticket/4649">#4649</a> : The color picker dialog is now accessible.</li> <li><a href="http://dev.ckeditor.com/ticket/3593">#3593</a> : The editing area is now enabled by contentEditable="true" instead of designMode="on" to allow creating uneditable content elements in all browsers.</li> <li><a href="http://dev.ckeditor.com/ticket/4056">#4056</a> : Hidden fields will now be displayed as fake element just like in FCKeditor 2.</li> </ul> <h3> CKEditor 3.2.2</h3> <p> New features:</p> <ul> <li>The SCAYT spell checker is now enabled by default through the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.scayt_autoStartup">autoStartup</a> setting.</li> <li><a href="http://dev.ckeditor.com/ticket/5631">#5631</a> : The SCAYT context menu options can now be reorganized through the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.scayt_contextMenuItemsOrder">scayt_contextMenuItemsOrder</a> setting.</li> <li><a href="http://dev.ckeditor.com/ticket/4231">#4231</a> : Introducing the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.resize_dir">resize_dir setting</a>, to be able to restrict manual resizing of the editor to only one direction (horizontal/vertical).</li> <li><a href="http://dev.ckeditor.com/ticket/5479">#5479</a> : Introducing the classic ASP integration files and samples.</li> <li><a href="http://dev.ckeditor.com/ticket/5024">#5024</a> : Added samples (<a href="http://nightly.ckeditor.com/latest/ckeditor/_samples/output_html.html">HTML</a> and <a href="http://nightly.ckeditor.com/latest/ckeditor/_samples/output_xhtml.html">XHTML</a>) to show how to output HTML using fonts and other attributes instead of styles.</li> <li><a href="http://dev.ckeditor.com/ticket/4358">#4358</a> : Introduced the List Properties dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5485">#5485</a> : Adding the <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.contentsLanguage">contentsLanguage</a> configuration option to be able to set the language for the editor contents.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5330">#5330</a> : Corrected detection of CTRL and META keys in Macs for the context menu.</li> <li><a href="http://dev.ckeditor.com/ticket/5434">#5434</a> : Fixed access denied issues with IE when accessing web sites through IPv6 IP addresses.</li> <li><a href="http://dev.ckeditor.com/ticket/4476">#4476</a> : [IE] Inaccessible empty list item contains sub list.</li> <li><a href="http://dev.ckeditor.com/ticket/4881">#4881</a> : [IE] Selection range broken because of cutting a single control type element from it.</li> <li><a href="http://dev.ckeditor.com/ticket/5505">#5505</a> : Image dialog throw JavaScript error when click close dialog before preview area is loading.</li> <li><a href="http://dev.ckeditor.com/ticket/5144">#5144</a> : [Chrome] Paste in Webkit sometimes leaves extra 'div' element.</li> <li><a href="http://dev.ckeditor.com/ticket/5021">#5021</a> : [Firefox] Typing in empty document start from second line when <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode">enterMode</a> = CKEDITOR.ENTER_BR.</li> <li><a href="http://dev.ckeditor.com/ticket/5416">#5416</a> : [IE] Delete table throws a error when <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode">enterMode</a> = CKEDITOR.ENTER_BR.</li> <li><a href="http://dev.ckeditor.com/ticket/4459">#4459</a> : [IE] Select element is penetrating the maximized editor in IE6.</li> <li><a href="http://dev.ckeditor.com/ticket/5559">#5559</a> : [IE] The first call to <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setData">setData</a> is affected by iframe cache when loading the wysiwyg mode.</li> <li><a href="http://dev.ckeditor.com/ticket/5567">#5567</a> : [IE] Remove inline styles in some case doesn't join identical siblings.</li> <li><a href="http://dev.ckeditor.com/ticket/5450">#5450</a> : [FireFox] Press ENTER on 'replace' button result wrong.</li> <li><a href="http://dev.ckeditor.com/ticket/5121">#5121</a> : Recognizes the &lt;br /&gt; tag as a separator when apply block styles and <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode">enterMode</a> = CKEDITOR.ENTER_BR.</li> <li><a href="http://dev.ckeditor.com/ticket/5575">#5575</a> : <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.replaceAll">CKEDITOR.replaceAll</a> should consider all kind of white spaces between class names.</li> <li><a href="http://dev.ckeditor.com/ticket/5582">#5582</a> : Prevent the default behavior when click the 'x' button to close dialog box.</li> <li><a href="http://dev.ckeditor.com/ticket/5584">#5584</a> : ENTER key with <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.forceEnterMode">forceEnterMode</a> turns on doesn't inherit current block attributes.</li> <li><a href="http://dev.ckeditor.com/ticket/4797">#4797</a> : [Opera] Press ENTER key in dialog fields to close throws JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/5578">#5578</a> : Add flash fake element align property when switch mode (source to wysiwyg).</li> <li><a href="http://dev.ckeditor.com/ticket/5577">#5577</a> : Update delete column behavior when choose multiple cells in the same column.</li> <li><a href="http://dev.ckeditor.com/ticket/5512">#5512</a> : Open context menu with SHIFT+F10 doesn't get correct editor selection.</li> <li><a href="http://dev.ckeditor.com/ticket/5433">#5433</a> : English protocol text directions in Link dialog are not incorrect in 'rtl' UI languages.</li> <li><a href="http://dev.ckeditor.com/ticket/5553">#5553</a> : Paste dialog clipboard area text direction is incorrect for 'rtl' content languages.</li> <li><a href="http://dev.ckeditor.com/ticket/4734">#4734</a> : Font size resets when font name is changed in an empty numbered list.</li> <li><a href="http://dev.ckeditor.com/ticket/5237">#5237</a> : English text in dialogs' title is flipped when using RTL language.</li> <li><a href="http://dev.ckeditor.com/ticket/3257">#3257</a> : Create list doesn't keep blocks as headings.</li> <li><a href="http://dev.ckeditor.com/ticket/5111">#5111</a> : [Firefox] JAWS doesn't respect PC cursor mode (application role) on toolbar.</li> <li><a href="http://dev.ckeditor.com/ticket/5530">#5530</a> : Page break for printing can't be removed with undo.</li> <li><a href="http://dev.ckeditor.com/ticket/5381">#5381</a> : Unable to place cursor between two paragraphs in body.</li> <li><a href="http://dev.ckeditor.com/ticket/5568">#5568</a> : [IE6/7] Selecting a entire table cell changes the original range.</li> <li><a href="http://dev.ckeditor.com/ticket/5623">#5623</a> : [Firefox] Apply style that edges another inline style result incorrect.</li> <li><a href="http://dev.ckeditor.com/ticket/5586">#5586</a> : [Firefox] Maximize the second editor ruins full screen mode.</li> <li><a href="http://dev.ckeditor.com/ticket/5617">#5617</a> : HTML filter system does not allow two 'text' filter rules.</li> <li><a href="http://dev.ckeditor.com/ticket/5663">#5663</a> : General memory clean up after destroying last instance.</li> <li><a href="http://dev.ckeditor.com/ticket/5461">#5461</a> : [IE] Fix Paste from Word dialog doesn't accept imput problem.</li> <li><a href="http://dev.ckeditor.com/ticket/5676">#5676</a> : Make color buttons use RRGGBB instead of RGB for better compatibility with IE.</li> <li><a href="http://dev.ckeditor.com/ticket/4948">#4948</a> : [Safari] Select the first/last cell of table to open context menu may lead to undetected table.</li> <li><a href="http://dev.ckeditor.com/ticket/5591">#5591</a> : [Firefox] Select a list item makes selected element broken.</li> <li><a href="http://dev.ckeditor.com/ticket/5667">#5667</a> : Pasting in a RTL page content causes shows up the horizontal scrollbar.</li> <li><a href="http://dev.ckeditor.com/ticket/5688">#5688</a> : Duplicate ids are used in dialog definition.</li> <li><a href="http://dev.ckeditor.com/ticket/5719">#5719</a> : [IE] 'change' dialog event should not be triggered when dialog is already closed.</li> <li><a href="http://dev.ckeditor.com/ticket/5747">#5747</a> : [IE] Error thrown when IE input field editing mode is turned on.</li> <li><a href="http://dev.ckeditor.com/ticket/5516">#5516</a> : IE8: Toolbar buttons have higher bottom padding.</li> <li><a href="http://dev.ckeditor.com/ticket/5402">#5402</a> : SHIFT-ENTER could now be used to exit from preformat block.</li> <li>SCAYT plugin related:<ul> <li><a href="http://dev.ckeditor.com/ticket/4836">#4836</a> : Using SCAYT result in fragile elements when applying inline styles.</li> <li><a href="http://dev.ckeditor.com/ticket/5425">#5425</a> : [Opera] Disable SCAYT plugin for Opera browser.</li> <li><a href="http://dev.ckeditor.com/ticket/5632">#5632</a> : SCAYT word marker is not visible on text with background-color set.</li> <li><a href="http://dev.ckeditor.com/ticket/4125">#4125</a> : Remove Format command incorrectly removes SCAYT word markers.</li> <li><a href="http://dev.ckeditor.com/ticket/5671">#5671</a> : SCAYT bootstrap script could be added multiple times unnecessarily.</li> <li><a href="http://dev.ckeditor.com/ticket/5573">#5573</a> : SCAYT move cursor position after insert element into marked word text.</li> <li><a href="http://dev.ckeditor.com/ticket/5546">#5546</a> : SCAYT interferes with undo/redo commands.</li> <li><a href="http://dev.ckeditor.com/ticket/5570">#5570</a> : [IE] First enabling SCAYT blind cursor in editor.</li> <li><a href="http://dev.ckeditor.com/ticket/5741">#5741</a> : Enable SCAYT cause error in multiple editor instances.</li> <li><a href="http://dev.ckeditor.com/ticket/5744">#5744</a> : Remove editor with SCAYT enabled in source mode throws error.</li> </ul></li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/5432">#5432</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/5619">#5619</a> : Finnish;</li> <li><a href="http://dev.ckeditor.com/ticket/5515">#5515</a> : Hebrew;</li> <li><a href="http://dev.ckeditor.com/ticket/5588">#5588</a> : Turkish;</li> </ul></li> </ul> <h3> CKEditor 3.2.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4478">#4478</a> : Enable the SelectAll command in source mode.</li> <li><a href="http://dev.ckeditor.com/ticket/5150">#5150</a> : Allow names in the CKEDITOR.config.colorButton_colors setting.</li> <li><a href="http://dev.ckeditor.com/ticket/4810">#4810</a> : Adding configuration option for image dialog preview area filling text.</li> <li><a href="http://dev.ckeditor.com/ticket/536">#536</a> : Object style now could be applied on any parent element of current selection.</li> <li><a href="http://dev.ckeditor.com/ticket/5290">#5290</a> : Unified stylesSet loading removing dependencies from the styles combo. Now the configuration entry is named 'config.stylesSet' instead of config.stylesCombo_stylesSet and the default location is under the 'styles' plugin instead of 'stylescombo'.</li> <li><a href="http://dev.ckeditor.com/ticket/5352">#5352</a> : Allow to define the stylesSet array in the config object for the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/5302">#5302</a> : Adding config option "forceEnterMode".</li> <li><a href="http://dev.ckeditor.com/ticket/5216">#5216</a> : Extend CKEDITOR.appendTo to allow a data parameter for the initial value.</li> <li><a href="http://dev.ckeditor.com/ticket/5024">#5024</a> : Added sample to show how to output XHTML and avoid deprecated tags.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5152">#5152</a> : Indentation using class attribute doesn't work properly.</li> <li><a href="http://dev.ckeditor.com/ticket/4682">#4682</a> : It wasn't possible to edit block elements in IE that had styles like width, height or float.</li> <li><a href="http://dev.ckeditor.com/ticket/4750">#4750</a> : Correcting default order of buttons layout in dialogs on Mac.</li> <li><a href="http://dev.ckeditor.com/ticket/4932">#4932</a> : Fixed collapse button not clickable on simple toolbar.</li> <li><a href="http://dev.ckeditor.com/ticket/5228">#5228</a> : Link dialog is automatically changes protocol when URLs that starts with '?'.</li> <li><a href="http://dev.ckeditor.com/ticket/4877">#4877</a> : Fixed CKEditor displays source code in one long line (IE quirks mode + office2003 skin).</li> <li><a href="http://dev.ckeditor.com/ticket/5132">#5132</a> : Apply inline style leaks into sibling words which are seperated spaces.</li> <li><a href="http://dev.ckeditor.com/ticket/3599">#3599</a> : Background color style on sized text displayed as narrow band behind.</li> <li><a href="http://dev.ckeditor.com/ticket/4661">#4661</a> : Translation missing in link dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5240">#5240</a> : Flash alignment property is not presented visually on fake element.</li> <li><a href="http://dev.ckeditor.com/ticket/4910">#4910</a> : Pasting in IE scrolls document to the end.</li> <li><a href="http://dev.ckeditor.com/ticket/5041">#5041</a> : Table summary attribute can't be removed with dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5124">#5124</a> : All inline styles cannot be applied on empty spaces.</li> <li><a href="http://dev.ckeditor.com/ticket/3570">#3570</a> : SCAYT marker shouldn't appear inside elements path bar.</li> <li><a href="http://dev.ckeditor.com/ticket/4553">#4553</a> : Dirty check result incorrect when editor document is empty.</li> <li><a href="http://dev.ckeditor.com/ticket/4555">#4555</a> : Unreleased memory when editor is created and destroyed.</li> <li><a href="http://dev.ckeditor.com/ticket/5118">#5118</a> : Arrow keys navigation in RTL languages is incorrect.</li> <li><a href="http://dev.ckeditor.com/ticket/4721">#4721</a> : Remove attribute 'value' of checkbox in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/5278">#5278</a> : IE: Add validation to check for bad window names of popup window.</li> <li><a href="http://dev.ckeditor.com/ticket/5171">#5171</a> : Dialogs contains lists don't have proper voice labels.</li> <li><a href="http://dev.ckeditor.com/ticket/4791">#4791</a> : Can't place cursor inside a form that end with a checkbox/radio.</li> <li><a href="http://dev.ckeditor.com/ticket/4479">#4479</a> : StylesCombo doesn't reflect the selection state until it's first opened.</li> <li><a href="http://dev.ckeditor.com/ticket/4717">#4717</a> : 'Unlink' and 'Outdent' command buttons should be disabled on editor startup.</li> <li><a href="http://dev.ckeditor.com/ticket/5119">#5119</a> : Disabled command buttons are not being properly styled when focused.</li> <li><a href="http://dev.ckeditor.com/ticket/5307">#5307</a> : Hide dialog page cause problem when there's two tab pages remain.</li> <li><a href="http://dev.ckeditor.com/ticket/5343">#5343</a> : Active list item ARIA role is wrongly placed.</li> <li><a href="http://dev.ckeditor.com/ticket/3599">#3599</a> : Background color style applying to text with font size style has been narrowly rendered.</li> <li><a href="http://dev.ckeditor.com/ticket/4711">#4711</a> : Line break character inside preformatted text makes it unable to type text at the end of previous line.</li> <li><a href="http://dev.ckeditor.com/ticket/4829">#4829</a> : [IE] Apply style from combo has wrong result on manually created selection.</li> <li><a href="http://dev.ckeditor.com/ticket/4830">#4830</a> : Retrieving selected element isn't always right, especially selecting using keyboard (SHIFT+ARROW).</li> <li><a href="http://dev.ckeditor.com/ticket/5128">#5128</a> : Element attribute inside preformatted text is corrupted when converting to other blocks.</li> <li><a href="http://dev.ckeditor.com/ticket/5190">#5190</a> : Template list entry shouldn't gain initial focus open templates list dialog opens.</li> <li><a href="http://dev.ckeditor.com/ticket/5238">#5238</a> : Menu button doesn't display arrow icon in high-contrast mode.</li> <li><a href="http://dev.ckeditor.com/ticket/3576">#3576</a> : Non-attributed element of the same name with the applied style is incorrectly removed.</li> <li><a href="http://dev.ckeditor.com/ticket/5221">#5221</a> : Insert table into empty document cause JavaScript error thrown.</li> <li><a href="http://dev.ckeditor.com/ticket/5242">#5242</a> : Apply 'automatic' color option of text color incorrectly removes background-color style.</li> <li><a href="http://dev.ckeditor.com/ticket/4719">#4719</a> : IE does not escape attribute values properly.</li> <li><a href="http://dev.ckeditor.com/ticket/5170">#5170</a> : Firefox does not insert text into styled element properly.</li> <li><a href="http://dev.ckeditor.com/ticket/4026">#4026</a> : Office2003 skin has no toolbar button borders in High Contrast in IE7.</li> <li><a href="http://dev.ckeditor.com/ticket/4348">#4348</a> : There should have exception thrown when 'CKEDITOR_BASEPATH' couldn't be figured out automatically.</li> <li><a href="http://dev.ckeditor.com/ticket/5364">#5364</a> : Focus may not be put into dialog correctly when dialog skin file is loading slow.</li> <li><a href="http://dev.ckeditor.com/ticket/4016">#4016</a> : Justify the layout of forms select dialog in Chrome and IE7.</li> <li><a href="http://dev.ckeditor.com/ticket/5373">#5373</a> : Variable 'pathBlockElements' defines wrong items in CKEDITOR.dom.elementPath.</li> <li><a href="http://dev.ckeditor.com/ticket/5082">#5082</a> : Ctrl key should be described as Cmd key on Mac.</li> <li><a href="http://dev.ckeditor.com/ticket/5182">#5182</a> : Context menu is not been announced correctly by ATs.</li> <li><a href="http://dev.ckeditor.com/ticket/4898">#4898</a> : Can't navigate outside table under the last paragraph of document.</li> <li><a href="http://dev.ckeditor.com/ticket/4950">#4950</a> : List commands could compromise list item attribute and styles.</li> <li><a href="http://dev.ckeditor.com/ticket/5018">#5018</a> : Find result highlighting remove normal font color styles unintentionally.</li> <li><a href="http://dev.ckeditor.com/ticket/5376">#5376</a> : Unable to exit list from within a empty block under list item.</li> <li><a href="http://dev.ckeditor.com/ticket/5145">#5145</a> : Various SCAYT fixes.</li> <li><a href="http://dev.ckeditor.com/ticket/5319">#5319</a> : Match whole word doesn't work anymore after replacement has happened.</li> <li><a href="http://dev.ckeditor.com/ticket/5363">#5363</a> : 'title' attribute now presents on all editor iframes.</li> <li><a href="http://dev.ckeditor.com/ticket/5374">#5374</a> : Unable to toggle inline style when the selection starts at the linefeed of the previous paragraph.</li> <li><a href="http://dev.ckeditor.com/ticket/4513">#4513</a> : Selected link element is not always correctly detected when using keyboard arrows to perform such selection.</li> <li><a href="http://dev.ckeditor.com/ticket/5372">#5372</a> : Newly created sub list should inherit nothing from the original (parent) list, except the list type.</li> <li><a href="http://dev.ckeditor.com/ticket/5274">#5274</a> : [IE6] Templates preview image is displayed in wrong size.</li> <li><a href="http://dev.ckeditor.com/ticket/5292">#5292</a> : Preview in font size and family doesn't work with custom styles.</li> <li><a href="http://dev.ckeditor.com/ticket/5396">#5396</a> : Selection is lost when use cell properties dialog to change cell type to header.</li> <li><a href="http://dev.ckeditor.com/ticket/4082">#4082</a> : [IE+Quirks] Preview text in the image dialog is not wrapping.</li> <li><a href="http://dev.ckeditor.com/ticket/4197">#4197</a> : Fixing format combo don't hide when editor blur on Safari.</li> <li><a href="http://dev.ckeditor.com/ticket/5401">#5401</a> : The context menu break layout with Office2003 and V2 skin on IE quirks mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4825">#4825</a> : Fixing browser context menu is opened when clicking right mouse button twice.</li> <li><a href="http://dev.ckeditor.com/ticket/5356">#5356</a> : The SCAYT dialog had issues with Prototype enabled pages.</li> <li><a href="http://dev.ckeditor.com/ticket/5266">#5266</a> : SCAYT was disturbing the rendering of TH elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4688">#4688</a> : SCAYT was interfering on checkDirty.</li> <li><a href="http://dev.ckeditor.com/ticket/5429">#5429</a> : High Contrast mode was being mistakenly detected when loading the editor through Dojo's xhrGet.</li> <li><a href="http://dev.ckeditor.com/ticket/5221">#5221</a> : Range is mangled when making collapsed selection in an empty paragraph.</li> <li><a href="http://dev.ckeditor.com/ticket/5261">#5261</a> : Config option 'scayt_autoStartup' slow down editor loading.</li> <li><a href="http://dev.ckeditor.com/ticket/3846">#3846</a> : Google Chrome - No Img properties after inserting.</li> <li><a href="http://dev.ckeditor.com/ticket/5465">#5465</a> : ShiftEnter=DIV doesn't respect list item when pressing ENTER at end of list item.</li> <li><a href="http://dev.ckeditor.com/ticket/5454">#5454</a> : After replaced success, the popup window couldn't be closed and a js error occured.</li> <li><a href="http://dev.ckeditor.com/ticket/4784">#4784</a> : Incorrect cursor position after delete table cells.</li> <li><a href="http://dev.ckeditor.com/ticket/5149">#5149</a> : [FF] Cursor disappears after maximize when the editor has focus.</li> <li><a href="http://dev.ckeditor.com/ticket/5220">#5220</a> : DTD now shows tolerance to &lt;style&gt; appear inside content.</li> <li><a href="http://dev.ckeditor.com/ticket/5440">#5440</a> : Mobile browsers (iPhone, Android...) are marked as incompatible as they don't support editing features.</li> <li><a href="http://dev.ckeditor.com/ticket/5504">#5504</a> : [IE6/7] 'Paste' dialog will always get opened even when user allows the clipboard access dialog when using 'Paste' button.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/5326">#5326</a> : Catalan;</li> <li><a href="http://dev.ckeditor.com/ticket/5370">#5370</a> : Faroese;</li> <li><a href="http://dev.ckeditor.com/ticket/5392">#5392</a> : Finnish;</li> <li><a href="http://dev.ckeditor.com/ticket/4580">#4580</a> : Hungarian;</li> <li><a href="http://dev.ckeditor.com/ticket/5301">#5301</a> : Norwegian;</li> </ul></li> </ul> <h3> CKEditor 3.2</h3> <p> New features:</p> <ul> <li>Several accessibility enhancements:<ul> <li><a href="http://dev.ckeditor.com/ticket/4502">#4502</a> : The editor accessibility is now totally based on <a href="http://www.w3.org/WAI/intro/aria">WAI-ARIA</a>.</li> <li><a href="http://dev.ckeditor.com/ticket/5015">#5015</a> : Adding accessibility help dialog plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/5014">#5014</a> : Keyboard navigation compliance with screen reader suggested keys.</li> <li><a href="http://dev.ckeditor.com/ticket/4595">#4595</a> : Better accessibility in the Templates dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/3389">#3389</a> : Esc/Arrow Key now works for closing sub menu.</li> </ul></li> <li><a href="http://dev.ckeditor.com/ticket/4973">#4973</a> : The Style field in the Div Container dialog is now loading the styles defined in the default styleset used by the Styles toolbar combo.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/5049">#5049</a> : Form Field list command in JAWS incorrectly lists extra fields.</li> <li><a href="http://dev.ckeditor.com/ticket/5008">#5008</a> : Lock/Unlock ratio buttons in the Image dialog was poorly designed in High Contrast mode.</li> <li><a href="http://dev.ckeditor.com/ticket/3980">#3980</a> : All labels in dialogs now use &lt;label&gt; instead of &lt;div&gt;.</li> <li><a href="http://dev.ckeditor.com/ticket/5213">#5213</a> : Reorganization of some entries in the language files to make it more consistent.</li> <li><a href="http://dev.ckeditor.com/ticket/5199">#5199</a> : In IE, single row toolbars didn't have the bottom padding.</li> </ul> <h3> CKEditor 3.1.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4399">#4399</a> : Improved support for external file browsers by allowing executing a callback function.</li> <li><a href="http://dev.ckeditor.com/ticket/4612">#4612</a> : The text of links is now updated if it matches the URL to which it points to.</li> <li><a href="http://dev.ckeditor.com/ticket/4936">#4936</a> : New localization support for the Welsh language.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4272">#4272</a> : Kama skin toolbar was broken in IE+Quirks+RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/4987">#4987</a> : Changed the url which is called by the Browser Server button in the Link tab of Image Properties dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/5030">#5030</a> : The CKEDITOR.timestamp wasn't been appended to the skin.js file.</li> <li><a href="http://dev.ckeditor.com/ticket/4993">#4993</a> : Removed the float style from images when the user selects 'not set' for alignment.</li> <li><a href="http://dev.ckeditor.com/ticket/4944">#4944</a> : Fixed a bug where nested list structures with inconsequent levels were not being pasted correctly from MS Word.</li> <li><a href="http://dev.ckeditor.com/ticket/4637">#4637</a> : Table cells' 'nowrap' attribute was not being loaded by the cell property dialog. Thanks to pomu0325.</li> <li><a href="http://dev.ckeditor.com/ticket/4724">#4724</a> : Using the mouse to insert a link in IE might create incorrect results.</li> <li><a href="http://dev.ckeditor.com/ticket/4640">#4640</a> : Small optimizations for the fileBrowser plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/4583">#4583</a> : The "Target Frame Name" field is now visible when target is set to 'frame' only.</li> <li><a href="http://dev.ckeditor.com/ticket/4863">#4863</a> : Fixing iframedialog's height doesn't stretch to 100% (except IE Quirks).</li> <li><a href="http://dev.ckeditor.com/ticket/4964">#4964</a> : The BACKSPACE key positioning was not correct in some cases with Firefox.</li> <li><a href="http://dev.ckeditor.com/ticket/4980">#4980</a> : Setting border, vspace and hspace of images to zero was not working.</li> <li><a href="http://dev.ckeditor.com/ticket/4773">#4773</a> : The fileBrowser plugin was overwriting onClick functions eventually defined on fileButton elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4731">#4731</a> : The clipboard plugin was missing a reference to the dialog plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/5051">#5051</a> : The about plugin was missing a reference to the dialog plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/5146">#5146</a> : The wsc plugin was missing a reference to the dialog plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/4632">#4632</a> : The print command will now properly break on the insertion point of page break for printing.</li> <li><a href="http://dev.ckeditor.com/ticket/4862">#4862</a> : The English (United Kingdom) language file has been renamed to en-gb.js.</li> <li><a href="http://dev.ckeditor.com/ticket/4618">#4618</a> : Selecting an emoticon or the lock and reset buttons in the image dialog fired the onBeforeUnload event in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/4678">#4678</a> : It was not possible to set tables' width to empty value.</li> <li><a href="http://dev.ckeditor.com/ticket/5012">#5012</a> : Fixed dependency issues with the menu plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/5040">#5040</a> : The editor will not properly ignore font related settings that have extra item separators (semi-colons).</li> <li><a href="http://dev.ckeditor.com/ticket/4046">#4046</a> : Justify should respect config.enterMode = CKEDITOR.ENTER_BR.</li> <li><a href="http://dev.ckeditor.com/ticket/4622">#4622</a> : Inserting tables multiple times was corrupting the undo system.</li> <li><a href="http://dev.ckeditor.com/ticket/4647">#4647</a> : [IE] Selection on an element within positioned container is lost after open context-menu then click one menu item.</li> <li><a href="http://dev.ckeditor.com/ticket/4683">#4683</a> : Double-quote character in attribute values was not escaped in the editor output.</li> <li><a href="http://dev.ckeditor.com/ticket/4762">#4762</a> : [IE] Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor in source mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4772">#4772</a> : Text color was not being applied properly on links.</li> <li><a href="http://dev.ckeditor.com/ticket/4795">#4795</a> : [IE] Press 'Del' key on horizontal line or table result in error.</li> <li><a href="http://dev.ckeditor.com/ticket/4824">#4824</a> : [IE] &lt;br/&gt; at the very first table cell breaks the editor selection.</li> <li><a href="http://dev.ckeditor.com/ticket/4851">#4851</a> : [IE] Delete table rows with context-menu may cause error.</li> <li><a href="http://dev.ckeditor.com/ticket/4951">#4951</a> : Replacing text with empty string was throwing errors.</li> <li><a href="http://dev.ckeditor.com/ticket/4963">#4963</a> : Link dialog was not opening properly for e-mail type links.</li> <li><a href="http://dev.ckeditor.com/ticket/5043">#5043</a> : Removed the possibility of having an unwanted script tag being outputted with the editor contents.</li> <li><a href="http://dev.ckeditor.com/ticket/3678">#3678</a> : There were issues when editing links inside floating divs with IE.</li> <li><a href="http://dev.ckeditor.com/ticket/4763">#4763</a> : Pressing ENTER key with text selected was not deleting the text in some situations.</li> <li><a href="http://dev.ckeditor.com/ticket/5096">#5096</a> : Simple ampersand attribute value doesn't work for more than one occurrence.</li> <li><a href="http://dev.ckeditor.com/ticket/3494">#3494</a> : Context menu is too narrow in some translations.</li> <li><a href="http://dev.ckeditor.com/ticket/5005">#5005</a> : Fixed HTML errors in PHP samples.</li> <li><a href="http://dev.ckeditor.com/ticket/5123">#5123</a> : Fixed broken XHTML in User Interface Languages sample.</li> <li><a href="http://dev.ckeditor.com/ticket/4893">#4893</a> : Editor now understands table cell inline styles.</li> <li><a href="http://dev.ckeditor.com/ticket/4611">#4611</a> : Selection around &lt;select&gt; in editor doesn't cause error anymore.</li> <li><a href="http://dev.ckeditor.com/ticket/4886">#4886</a> : Extra BR tags were being created in the output HTML.</li> <li><a href="http://dev.ckeditor.com/ticket/4933">#4933</a> : Empty tags with BR were being left in the DOM.</li> <li><a href="http://dev.ckeditor.com/ticket/5127">#5127</a> : There were errors when removing dialog definition pages through code.</li> <li><a href="http://dev.ckeditor.com/ticket/4767">#4767</a> : CKEditor was not working when ckeditor_source.js is loaded in the &lt;body&gt; .</li> <li><a href="http://dev.ckeditor.com/ticket/5062">#5062</a> : Avoided security warning message when loading the wysiwyg area in IE6 under HTTPS.</li> <li><a href="http://dev.ckeditor.com/ticket/5135">#5135</a> : The TAB key will now behave properly when in Source mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4988">#4988</a> : It wasn't possible to use forcePasteAsPlainText with Safari on Mac.</li> <li><a href="http://dev.ckeditor.com/ticket/5095">#5095</a> : Safari on Mac deleted the current selection in the editor when Edit menu was clicked.</li> <li><a href="http://dev.ckeditor.com/ticket/5140">#5140</a> : In High Contrast mode, arrows were now been displayed for menus with submenus.</li> <li><a href="http://dev.ckeditor.com/ticket/5163">#5163</a> : The undo system was not working on some specific cases.</li> <li><a href="http://dev.ckeditor.com/ticket/5162">#5162</a> : The ajax sample was throwing errors when loading data.</li> <li><a href="http://dev.ckeditor.com/ticket/4999">#4999</a> : The Template dialog was not generating an undo snapshot.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/5006">#5006</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/5039">#5039</a> : Finnish;</li> <li><a href="http://dev.ckeditor.com/ticket/5148">#5148</a> : Hebrew;</li> <li><a href="http://dev.ckeditor.com/ticket/5071">#5071</a> : Russian;</li> <li><a href="http://dev.ckeditor.com/ticket/5147">#5147</a> : Spanish;</li> </ul></li> </ul> <h3> CKEditor 3.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4067">#4067</a> : Introduced the full page editing support (from &lt;html&gt; to &lt;/html&gt;).</li> <li><a href="http://dev.ckeditor.com/ticket/4228">#4228</a> : Introduced the Shared Spaces feature.</li> <li><a href="http://dev.ckeditor.com/ticket/4379">#4379</a> : Introduced the new powerful pasting system and word cleanup procedure, including enhancements to the paste as plain text feature.</li> <li><a href="http://dev.ckeditor.com/ticket/2872">#2872</a> : Introduced the new native PHP API, the first standardized server side support.</li> <li><a href="http://dev.ckeditor.com/ticket/4210">#4210</a> : Added CKEditor plugin for jQuery.</li> <li><a href="http://dev.ckeditor.com/ticket/2885">#2885</a> : Added 'div' dialog and corresponding context menu options.</li> <li><a href="http://dev.ckeditor.com/ticket/4574">#4574</a> : Added the table merging tools and corresponding context menu options.</li> <li><a href="http://dev.ckeditor.com/ticket/4340">#4340</a> : Added the email protection option for link dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4463">#4463</a> : Added inline CSS support in all places where custom stylesheet could apply.</li> <li><a href="http://dev.ckeditor.com/ticket/3881">#3881</a> : Added color dialog for 'more color' option in color buttons.</li> <li><a href="http://dev.ckeditor.com/ticket/4341">#4341</a> : Added the 'showborder' plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/4549">#4549</a> : Make the anti-cache query string configurable.</li> <li><a href="http://dev.ckeditor.com/ticket/4708">#4708</a> : Added the 'htmlEncodeOutput' config option.</li> <li><a href="http://dev.ckeditor.com/ticket/4342">#4342</a> : Introduced the bodyId and bodyClass settings to specify the id and class. to be used in the editing area at runtime.</li> <li><a href="http://dev.ckeditor.com/ticket/3401">#3401</a> : Introduced the baseHref setting so it's possible to set the URL to be used to resolve absolute and relative URLs in the contents.</li> <li><a href="http://dev.ckeditor.com/ticket/4729">#4729</a> : Added support to fake elements for comments.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4707">#4707</a> : Fixed invalid link is requested in image preview.</li> <li><a href="http://dev.ckeditor.com/ticket/4461">#4461</a> : Fixed toolbar separator line along side combo enlarging the toolbar height.</li> <li><a href="http://dev.ckeditor.com/ticket/4596">#4596</a> : Fixed image re-size lock buttons aren't accessible in high-contrast mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4676">#4676</a> : Fixed editing tables using table properties dialog overwrites original style values.</li> <li><a href="http://dev.ckeditor.com/ticket/4714">#4714</a> : Fixed IE6 JavaScript error when editing flash by commit 'Flash' dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/3905">#3905</a> : Fixed 'wysiwyg' mode causes unauthenticated content warnings over SSL in FF 3.5.</li> <li><a href="http://dev.ckeditor.com/ticket/4768">#4768</a> : Fixed open context menu in IE throws js error when focus is not inside document.</li> <li><a href="http://dev.ckeditor.com/ticket/4822">#4822</a> : Fixed applying 'Headers' to existing table does not work in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/4855">#4855</a> : Fixed toolbar doesn't wrap well for 'v2' skin in all browsers.</li> <li><a href="http://dev.ckeditor.com/ticket/4882">#4882</a> : Fixed auto detect paste from MS-Word is not working for Safari.</li> <li><a href="http://dev.ckeditor.com/ticket/4882">#4882</a> : Fixed unexpected margin style left behind on content cleaning up from MS-Word.</li> <li><a href="http://dev.ckeditor.com/ticket/4896">#4896</a> : Fixed paste nested list from MS-Word with measurement units set to cm is broken.</li> <li><a href="http://dev.ckeditor.com/ticket/4899">#4899</a> : Fixed unable to undo pre-formatted style.</li> <li><a href="http://dev.ckeditor.com/ticket/4900">#4900</a> : Fixed ratio-lock inconsistent between browsers.</li> <li><a href="http://dev.ckeditor.com/ticket/4901">#4901</a> : Fixed unable to edit any link with popup window's features in Firefox.</li> <li><a href="http://dev.ckeditor.com/ticket/4904">#4904</a> : Fixed when paste happen from dialog, it always throw JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/4905">#4905</a> : Fixed paste plain text result incorrect when content from dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4889">#4889</a> : Fixed unable to undo 'New Page' command after typing inside editor.</li> <li><a href="http://dev.ckeditor.com/ticket/4892">#4892</a> : Fixed table alignment style is not properly represented by the wrapping div.</li> <li><a href="http://dev.ckeditor.com/ticket/4918">#4918</a> : Fixed switching mode when maximized is showing background page contents.</li> </ul> <h3> CKEditor 3.0.2</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4343">#4343</a> : Added the configuration option &#39;browserContextMenuOnCtrl&#39; so it&#39;s possible to enable the default browser context menu by holding the CTRL key.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4552">#4552</a> : Fixed float panel doesn't show up since editor instanced been destroyed once.</li> <li><a href="http://dev.ckeditor.com/ticket/3918">#3918</a> : Fixed fake object is editable with Image dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4053">#4053</a> : Fixed 'Form Properties' missing from context menu when selection collapsed inside form.</li> <li><a href="http://dev.ckeditor.com/ticket/4401">#4401</a> : Fixed customized by removing 'upload' tab page from 'Link dialog' cause JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/4477">#4477</a> : Adding missing tag names in object style elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4567">#4567</a> : Fixed IE throw error when pressing BACKSPACE in source mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4573">#4573</a> : Fixed 'IgnoreEmptyPargraph' config doesn't work with the config 'entities' is set to 'false'.</li> <li><a href="http://dev.ckeditor.com/ticket/4614">#4614</a> : Fixed attribute protection fails because of line-break.</li> <li><a href="http://dev.ckeditor.com/ticket/4546">#4546</a> : Fixed UIColor plugin doesn't work when editor id contains CSS selector preserved keywords.</li> <li><a href="http://dev.ckeditor.com/ticket/4609">#4609</a> : Fixed flash object is lost when loading data from outside editor.</li> <li><a href="http://dev.ckeditor.com/ticket/4625">#4625</a> : Fixed editor stays visible in a div with style 'visibility:hidden'.</li> <li><a href="http://dev.ckeditor.com/ticket/4621">#4621</a> : Fixed clicking below table caused an empty table been generated.</li> <li><a href="http://dev.ckeditor.com/ticket/3373">#3373</a> : Fixed empty context menu when there's no menu item at all.</li> <li><a href="http://dev.ckeditor.com/ticket/4473">#4473</a> : Fixed setting rules on the same element tag name throws error.</li> <li><a href="http://dev.ckeditor.com/ticket/4514">#4514</a> : Fixed press 'Back' button breaks wysiwyg editing mode is Firefox.</li> <li><a href="http://dev.ckeditor.com/ticket/4542">#4542</a> : Fixed unable to access buttons using tab key in Safari and Opera.</li> <li><a href="http://dev.ckeditor.com/ticket/4577">#4577</a> : Fixed relative link url is broken after opening 'Link' dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4597">#4597</a> : Fixed custom style with same attribute name but different attribute value doesn't work.</li> <li><a href="http://dev.ckeditor.com/ticket/4651">#4651</a> : Fixed 'Deleted' and 'Inserted' text style is not rendering in wysiwyg mode and is wrong is source mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4654">#4654</a> : Fixed 'CKEDITOR.config.font_defaultLabel(fontSize_defaultLabel)' is not working.</li> <li><a href="http://dev.ckeditor.com/ticket/3950">#3950</a> : Fixed table column insertion incorrect when selecting empty cell area.</li> <li><a href="http://dev.ckeditor.com/ticket/3912">#3912</a> : Fixed UIColor not working in IE when page has more than 30+ editors.</li> <li><a href="http://dev.ckeditor.com/ticket/4031">#4031</a> : Fixed mouse cursor on toolbar combo has more than 3 shapes.</li> <li><a href="http://dev.ckeditor.com/ticket/4041">#4041</a> : Fixed open context menu on multiple cells to remove them result in only one removed.</li> <li><a href="http://dev.ckeditor.com/ticket/4185">#4185</a> : Fixed resize handler effect doesn't affect flash object on output.</li> <li><a href="http://dev.ckeditor.com/ticket/4196">#4196</a> : Fixed 'Remove Numbered/Bulleted List' on nested list doesn't work well on nested list.</li> <li><a href="http://dev.ckeditor.com/ticket/4200">#4200</a> : Fixed unable to insert 'password' type filed with attributes.</li> <li><a href="http://dev.ckeditor.com/ticket/4530">#4530</a> : Fixed context menu couldn't open in Opera.</li> <li><a href="http://dev.ckeditor.com/ticket/4536">#4536</a> : Fixed keyboard navigation doesn't work at all in IE quirks mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4584">#4584</a> : Fixed updated link Target field is not updating when updating to certain values.</li> <li><a href="http://dev.ckeditor.com/ticket/4603">#4603</a> : Fixed unable to disable submenu items in contextmenu.</li> <li><a href="http://dev.ckeditor.com/ticket/4672">#4672</a> : Fixed unable to redo the insertion of horizontal line.</li> <li><a href="http://dev.ckeditor.com/ticket/4677">#4677</a> : Fixed 'Tab' key is trapped by hidden dialog elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4073">#4073</a> : Fixed insert template with replace option could result in empty document.</li> <li><a href="http://dev.ckeditor.com/ticket/4455">#4455</a> : Fixed unable to start editing when image inside document not loaded.</li> <li><a href="http://dev.ckeditor.com/ticket/4517">#4517</a> : Fixed 'dialog_backgroundCoverColor' doesn't work on IE6.</li> <li><a href="http://dev.ckeditor.com/ticket/3165">#3165</a> : Fixed enter key in empty list item before nested one result in collapsed line.</li> <li><a href="http://dev.ckeditor.com/ticket/4527">#4527</a> : Fixed checkbox generate invalid 'checked' attribute.</li> <li><a href="http://dev.ckeditor.com/ticket/1659">#1659</a> : Fixed unable to click below content to start editing in IE with 'config.docType' setting to standard compliant.</li> <li><a href="http://dev.ckeditor.com/ticket/3933">#3933</a> : Fixed extra &lt;br&gt; left at the end of document when the last element is a table.</li> <li><a href="http://dev.ckeditor.com/ticket/4736">#4736</a> : Fixed PAGE UP and PAGE DOWN keys in standards mode are not working.</li> <li><a href="http://dev.ckeditor.com/ticket/4725">#4725</a> : Fixed hitting 'enter' before html comment node produces a JavaScript error.</li> <li><a href="http://dev.ckeditor.com/ticket/4522">#4522</a> : Fixed unable to redo when typing after insert an image with relative url.</li> <li><a href="http://dev.ckeditor.com/ticket/4594">#4594</a> : Fixed context menu goes off-screen when mouse is at right had side of screen.</li> <li><a href="http://dev.ckeditor.com/ticket/4673">#4673</a> : Fixed undo not available straight away if shift key is used to enter first character.</li> <li><a href="http://dev.ckeditor.com/ticket/4690">#4690</a> : Fixed the parsing of nested inline elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4450">#4450</a> : Fixed selecting multiple table cells before apply justify commands generates spurious paragraph in Firefox.</li> <li><a href="http://dev.ckeditor.com/ticket/4733">#4733</a> : Fixed dialog opening sometimes hang up Firefox and Safari.</li> <li><a href="http://dev.ckeditor.com/ticket/4498">#4498</a> : Fixed toolbar collapse button missing tooltip.</li> <li><a href="http://dev.ckeditor.com/ticket/4738">#4738</a> : Fixed inserting table inside bold/italic/underline generates error on ENTER_BR mode.</li> <li><a href="http://dev.ckeditor.com/ticket/4246">#4246</a> : Fixed avoid XHTML deprecated attributes for image styling.</li> <li><a href="http://dev.ckeditor.com/ticket/4543">#4543</a> : Fixed unable to move cursor between table and hr.</li> <li><a href="http://dev.ckeditor.com/ticket/4764">#4764</a> : Fixed wrong exception message when CKEDITOR.editor.append() to non-existing elements.</li> <li><a href="http://dev.ckeditor.com/ticket/4521">#4521</a> : Fixed dialog layout in IE6/7 may have scroll-bar and other weird effects.</li> <li><a href="http://dev.ckeditor.com/ticket/4709">#4709</a> : Fixed inconsistent scroll-bar behavior on IE.</li> <li><a href="http://dev.ckeditor.com/ticket/4776">#4776</a> : Fixed preview page failed to open when relative URl contains in document.</li> <li><a href="http://dev.ckeditor.com/ticket/4812">#4812</a> : Fixed 'Esc' key not working on dialogs in Opera.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/4346">#4346</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/4837">#4837</a> : Finnish;</li> <li><a href="http://dev.ckeditor.com/ticket/4371">#4371</a> : Hebrew;</li> <li><a href="http://dev.ckeditor.com/ticket/4371">#4607</a> <a href="http://dev.ckeditor.com/ticket/4713">#4713</a> : Japanese;</li> <li><a href="http://dev.ckeditor.com/ticket/4660">#4660</a> : Norwegian.</li> </ul></li> </ul> <h3> CKEditor 3.0.1</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/4219">#4219</a> : Added fallback mechanism for config.language.</li> <li><a href="http://dev.ckeditor.com/ticket/4194">#4194</a> : Added support for using multiple css style sheets within the editor.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/3898">#3898</a> : Added validation for URL value in Image dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/3528">#3528</a> : Fixed Context Menu issue when triggered using Shift+F10.</li> <li><a href="http://dev.ckeditor.com/ticket/4028">#4028</a> : Maximize control's tool tip was wrong once it is maximized.</li> <li><a href="http://dev.ckeditor.com/ticket/4237">#4237</a> : Toolbar is chopped off in Safari browser 3.x.</li> <li><a href="http://dev.ckeditor.com/ticket/4241">#4241</a> : Float panels are left on screen while editor is destroyed.</li> <li><a href="http://dev.ckeditor.com/ticket/4274">#4274</a> : Double click event is incorrect handled in 'divreplace' sample.</li> <li><a href="http://dev.ckeditor.com/ticket/4354">#4354</a> : Fixed TAB key on toolbar to not focus disabled buttons.</li> <li><a href="http://dev.ckeditor.com/ticket/3856">#3856</a> : Fixed focus and blur events in source view mode.</li> <li><a href="http://dev.ckeditor.com/ticket/3438">#3438</a> : Floating panels are off by (-1px, 0px) in RTL mode.</li> <li><a href="http://dev.ckeditor.com/ticket/3370">#3370</a> : Refactored use of CKEDITOR.env.isCustomDomain().</li> <li><a href="http://dev.ckeditor.com/ticket/4230">#4230</a> : HC detection caused js error.</li> <li><a href="http://dev.ckeditor.com/ticket/3978">#3978</a> : Fixed setStyle float on IE7 strict.</li> <li><a href="http://dev.ckeditor.com/ticket/4262">#4262</a> : Tab and Shift+Tab was not working to cycle through CTRL+SHIFT+F10 context menu in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/3633">#3633</a> : Default context menu isn't disabled in toolbar, status bar, panels...</li> <li><a href="http://dev.ckeditor.com/ticket/3897">#3897</a> : Now there is no image previews when the URL is empty in image dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4048">#4048</a> : Context submenu was lacking uiColor.</li> <li><a href="http://dev.ckeditor.com/ticket/3568">#3568</a> : Dialogs now select all text when tabbing to text inputs.</li> <li><a href="http://dev.ckeditor.com/ticket/3727">#3727</a> : Cell Properties dialog was missing color selection option.</li> <li><a href="http://dev.ckeditor.com/ticket/3517">#3517</a> : Fixed "Match cyclic" field in Find &amp; Replace dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4368">#4368</a> : borderColor table cell attribute haven't worked for none-IE</li> <li><a href="http://dev.ckeditor.com/ticket/4203">#4203</a> : In IE quirks mode + toolbar collapsed + source mode editing block height was incorrect.</li> <li><a href="http://dev.ckeditor.com/ticket/4387">#4387</a> : Fixed: right clicking in Kama skin can lead to a javascript error.</li> <li><a href="http://dev.ckeditor.com/ticket/4397">#4397</a> : Wysiwyg mode caused the host page scroll.</li> <li><a href="http://dev.ckeditor.com/ticket/4385">#4385</a> : Fixed editor's auto adjusting on DOM structure were confusing the dirty checking mechanism.</li> <li><a href="http://dev.ckeditor.com/ticket/4397">#4397</a> : Fixed regression of [3816] where turn on design mode was causing Firefox3 to scroll the host page.</li> <li><a href="http://dev.ckeditor.com/ticket/4254">#4254</a> : Added basic API sample.</li> <li><a href="http://dev.ckeditor.com/ticket/4107">#4107</a> : Normalize css font-family style text for correct comparision.</li> <li><a href="http://dev.ckeditor.com/ticket/3664">#3664</a> : Insert block element in empty editor document should not create new paragraph.</li> <li><a href="http://dev.ckeditor.com/ticket/4037">#4037</a> : 'id' attribute is missing with Flash dialog advanced page.</li> <li><a href="http://dev.ckeditor.com/ticket/4047">#4047</a> : Delete selected control type element when 'Backspace' is pressed on it.</li> <li><a href="http://dev.ckeditor.com/ticket/4191">#4191</a> : Fixed: dialog changes confirmation on image dialog appeared even when no changes have been made.</li> <li><a href="http://dev.ckeditor.com/ticket/4351">#4351</a> : Dash and dot could appear in attribute names.</li> <li><a href="http://dev.ckeditor.com/ticket/4355">#4355</a> : 'maximize' and 'showblock' commands shouldn't take editor focus.</li> <li><a href="http://dev.ckeditor.com/ticket/4504">#4504</a> : Fixed 'Enter'/'Esc' key is not working on dialog button.</li> <li><a href="http://dev.ckeditor.com/ticket/4245">#4245</a> : 'Strange Template' now come with a style attribute for width.</li> <li><a href="http://dev.ckeditor.com/ticket/4512">#4512</a> : Fixed styles plugin incorrectly adding semicolons to style text.</li> <li><a href="http://dev.ckeditor.com/ticket/3855">#3855</a> : Fixed loading unminified _source files when ckeditor_source.js is used.</li> <li><a href="http://dev.ckeditor.com/ticket/3717">#3717</a> : Dialog settings defaults can now be overridden in-page through the CKEDITOR.config object.</li> <li><a href="http://dev.ckeditor.com/ticket/4481">#4481</a> : The 'stylesCombo_stylesSet' configuration entry didn't work for full URLs.</li> <li><a href="http://dev.ckeditor.com/ticket/4480">#4480</a> : Fixed scope attribute in th.</li> <li><a href="http://dev.ckeditor.com/ticket/4467">#4467</a> : Fixed bug to use custom icon in context menus. Thanks to george.</li> <li><a href="http://dev.ckeditor.com/ticket/4190">#4190</a> : Fixed select field dialog layout in Safari.</li> <li><a href="http://dev.ckeditor.com/ticket/4518">#4518</a> : Fixed unable to open dialog without editor focus in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/4519">#4519</a> : Fixed maximize without editor focus throw error in IE.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/3947">#3947</a> : Arabic;</li> <li><a href="http://dev.ckeditor.com/ticket/4466">#4466</a> : Czech;</li> <li><a href="http://dev.ckeditor.com/ticket/4363">#4363</a> : Danish;</li> <li><a href="http://dev.ckeditor.com/ticket/4346">#4346</a> : Dutch;</li> <li><a href="http://dev.ckeditor.com/ticket/4371">#4371</a> <a href="http://dev.ckeditor.com/ticket/4456">#4456</a> : Hebrew;</li> <li><a href="http://dev.ckeditor.com/ticket/4382">#4382</a> : Polish.</li> </ul></li> </ul> <h3> CKEditor 3.0</h3> <p> New features:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/3188">#3188</a> : Introduce &lt;pre&gt; formatting feature when converting from other blocks.</li> <li><a href="http://dev.ckeditor.com/ticket/4445">#4445</a> : editor::setData now support an optional callback parameter.</li> </ul> <p> Fixed issues:</p> <ul> <li><a href="http://dev.ckeditor.com/ticket/2856">#2856</a> : Fixed problem with inches in Paste From Word plugin.</li> <li><a href="http://dev.ckeditor.com/ticket/3929">#3929</a> : Using Paste dialog, the text is pasted into current selection</li> <li><a href="http://dev.ckeditor.com/ticket/3920">#3920</a> : Mouse cursor over characters in Special Character dialog now is correct</li> <li><a href="http://dev.ckeditor.com/ticket/3882">#3882</a> : Fixed an issue with PasteFromWord dialog in which default values was ignored</li> <li><a href="http://dev.ckeditor.com/ticket/3859">#3859</a> : Fixed Flash dialog layout in Webkit</li> <li><a href="http://dev.ckeditor.com/ticket/3852">#3852</a> : Disabled textarea resizing in dialogs</li> <li><a href="http://dev.ckeditor.com/ticket/3831">#3831</a> : The attempt to remove the contextmenu plugin will not anymore break the editor</li> <li><a href="http://dev.ckeditor.com/ticket/3781">#3781</a> : Colorbutton is now disabled in 'source' mode</li> <li><a href="http://dev.ckeditor.com/ticket/3848">#3848</a> : Fixed an issue with Webkit in witch elements in the Image and Link dialogs had wrong dimensions.</li> <li><a href="http://dev.ckeditor.com/ticket/3808">#3808</a> : Fixed UI Color Picker dialog size in example page.</li> <li><a href="http://dev.ckeditor.com/ticket/3658">#3658</a> : Editor had horizontal scrollbar in IE6.</li> <li><a href="http://dev.ckeditor.com/ticket/3819">#3819</a> : The cursor was not visible when applying style to collapsed selections in Firefox 2.</li> <li><a href="http://dev.ckeditor.com/ticket/3809">#3809</a> : Fixed beam cursor when mouse cursor is over text-only buttons in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/3815">#3815</a> : Fixed an issue with the form dialog in which the "enctype" attribute is outputted as "encoding".</li> <li><a href="http://dev.ckeditor.com/ticket/3785">#3785</a> : Fixed an issue in CKEDITOR.tools.htmlEncode() which incorrectly outputs &amp;nbsp; in IE8.</li> <li><a href="http://dev.ckeditor.com/ticket/3820">#3820</a> : Fixed an issue in bullet list command in which a list created at the bottom of another gets merged to the top. </li> <li><a href="http://dev.ckeditor.com/ticket/3830">#3830</a> : Table cell properties dialog doesn't apply to all selected cells.</li> <li><a href="http://dev.ckeditor.com/ticket/3835">#3835</a> : Element path is not refreshed after click on 'newpage'; and safari is not putting focus on document also. </li> <li><a href="http://dev.ckeditor.com/ticket/3821">#3821</a> : Fixed an issue with JAWS in which toolbar items are read inconsistently between virtual cursor modes.</li> <li><a href="http://dev.ckeditor.com/ticket/3789">#3789</a> : The &quot;src&quot; attribute was getting duplicated in some situations.</li> <li><a href="http://dev.ckeditor.com/ticket/3591">#3591</a> : Protecting flash related elements including '&lt;object&gt;', '&lt;embed&gt;' and '&lt;param&gt;'. </li> <li><a href="http://dev.ckeditor.com/ticket/3759">#3759</a> : Fixed CKEDITOR.dom.element::scrollIntoView logic bug which scroll even element is inside viewport. </li> <li><a href="http://dev.ckeditor.com/ticket/3773">#3773</a> : Fixed remove list will merge lines. </li> <li><a href="http://dev.ckeditor.com/ticket/3829">#3829</a> : Fixed remove empty link on output data.</li> <li><a href="http://dev.ckeditor.com/ticket/3730">#3730</a> : Indent is performing on the whole block instead of selected lines in enterMode = BR.</li> <li><a href="http://dev.ckeditor.com/ticket/3844">#3844</a> : Fixed UndoManager register keydown on obsoleted document</li> <li><a href="http://dev.ckeditor.com/ticket/3805">#3805</a> : Enabled SCAYT plugin for IE.</li> <li><a href="http://dev.ckeditor.com/ticket/3834">#3834</a> : Context menu on table caption was incorrect.</li> <li><a href="http://dev.ckeditor.com/ticket/3812">#3812</a> : Fixed an issue in which the editor may show up empty or uneditable in IE7, 8 and Firefox 3.</li> <li><a href="http://dev.ckeditor.com/ticket/3825">#3825</a> : Fixed JS error when opening spellingcheck.</li> <li><a href="http://dev.ckeditor.com/ticket/3862">#3862</a> : Fixed html parser infinite loop on certain malformed source code.</li> <li><a href="http://dev.ckeditor.com/ticket/3639">#3639</a> : Button size was inconsistent.</li> <li><a href="http://dev.ckeditor.com/ticket/3874">#3874</a> : Paste as plain text in Safari loosing lines.</li> <li><a href="http://dev.ckeditor.com/ticket/3849">#3849</a> : Fixed IE8 crashes when applying lists and indenting.</li> <li><a href="http://dev.ckeditor.com/ticket/3876">#3876</a> : Changed dialog checkbox and radio labels to explicit labels.</li> <li><a href="http://dev.ckeditor.com/ticket/3843">#3843</a> : Fixed context submenu position in IE 6 &amp; 7 RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/3864">#3864</a> : [FF]Document is not editable after inserting element on a fresh page.</li> <li><a href="http://dev.ckeditor.com/ticket/3883">#3883</a> : Fixed removing inline style logic incorrect on Firefox2.</li> <li><a href="http://dev.ckeditor.com/ticket/3884">#3884</a> : Empty "href" attribute was duplicated on output data.</li> <li><a href="http://dev.ckeditor.com/ticket/3858">#3858</a> : Fixed the issue where toolbars break up in IE6 and IE7 after the browser is resized.</li> <li><a href="http://dev.ckeditor.com/ticket/3868">#3868</a> : [chrome] SCAYT toolbar options was in reversed order.</li> <li><a href="http://dev.ckeditor.com/ticket/3875">#3875</a> : Fixed an issue in Safari where table row/column/cell menus are not useable when table cells are selected.</li> <li><a href="http://dev.ckeditor.com/ticket/3896">#3896</a> : The editing area was flashing when switching forth and back to source view.</li> <li><a href="http://dev.ckeditor.com/ticket/3894">#3894</a> : Fixed an issue where editor failed to initialize when using the on-demand loading way.</li> <li><a href="http://dev.ckeditor.com/ticket/3903">#3903</a> : Color button plugin doesn't read config entry from editor instance correctly.</li> <li><a href="http://dev.ckeditor.com/ticket/3801">#3801</a> : Comments at the start of the document was lost in IE.</li> <li><a href="http://dev.ckeditor.com/ticket/3871">#3871</a> : Unable to redo when undos to the front of snapshots stack.</li> <li><a href="http://dev.ckeditor.com/ticket/3909">#3909</a> : Move focus from editor into a text input control is broken.</li> <li><a href="http://dev.ckeditor.com/ticket/3870">#3870</a> : The empty paragraph desappears when hitting ENTER after &quot;New Page&quot;.</li> <li><a href="http://dev.ckeditor.com/ticket/3887">#3887</a> : Fixed an issue in which the create list command may leak outside of a selected table cell and into the rest of document.</li> <li><a href="http://dev.ckeditor.com/ticket/3916">#3916</a> : Fixed maximize does not enlarge editor width when width is set.</li> <li><a href="http://dev.ckeditor.com/ticket/3879">#3879</a> : [webkit] Color button panel had incorrect size on first open.</li> <li><a href="http://dev.ckeditor.com/ticket/3839">#3839</a> : Update Scayt plugin to reflect the latest change from SpellChecker.net.</li> <li><a href="http://dev.ckeditor.com/ticket/3742">#3742</a> : Fixed wrong dialog layout for dialogs without tab bar in IE RTL mode .</li> <li><a href="http://dev.ckeditor.com/ticket/3671">#3671</a> : Fixed body fixing should be applied to the real type under fake elements.</li> <li><a href="http://dev.ckeditor.com/ticket/3836">#3836</a> : Fixed remove list in enterMode=BR will merge sibling text to one line.</li> <li><a href="http://dev.ckeditor.com/ticket/3949">#3949</a> : Fixed enterKey within pre-formatted text introduce wrong line-break.</li> <li><a href="http://dev.ckeditor.com/ticket/3878">#3878</a> : Whenever possible, dialogs will not present scrollbars if the content is too big for its standard size.</li> <li><a href="http://dev.ckeditor.com/ticket/3782">#3782</a> : Remove empty list in table cell result in collapsed cell.</li> <li>Updated the following language files:<ul> <li><a href="http://dev.ckeditor.com/ticket/4183">#4183</a> : Basque;</li> <li><a href="http://dev.ckeditor.com/ticket/3837">#3837</a> : Brazilian Portuguese;</li> <li><a href="http://dev.ckeditor.com/ticket/4171">#4171</a> : Catalan;</li> <li><a href="http://dev.ckeditor.com/ticket/4115">#4115</a> : Chinese (Simplified);</li> <li><a href="http://dev.ckeditor.com/ticket/4179">#4179</a> : Chinese (Traditional);</li> <li><a href="http://dev.ckeditor.com/ticket/4102">#4102</a> : Croatian;</li> <li><a href="http://dev.ckeditor.com/ticket/4105">#4105</a> : French;</li> <li><a href="http://dev.ckeditor.com/ticket/4104">#4104</a> : German;</li> <li><a href="http://dev.ckeditor.com/ticket/4116">#4116</a> : Italian;</li> <li><a href="http://dev.ckeditor.com/ticket/4091">#4091</a> : Japanese;</li> <li><a href="http://dev.ckeditor.com/ticket/4120">#4120</a> : Polish;</li> <li><a href="http://dev.ckeditor.com/ticket/3987">#3987</a> : Spanish;</li> <li><a href="http://dev.ckeditor.com/ticket/4089">#4089</a> : Ukrainian;</li> <li><a href="http://dev.ckeditor.com/ticket/4166">#4166</a> : Vietnamese.</li> </ul></li> <li><a href="http://dev.ckeditor.com/ticket/3984">#3984</a> : [IE]The pre-formatted style is generating error.</li> <li><a href="http://dev.ckeditor.com/ticket/3946">#3946</a> : Fixed unable to hide contextmenu.</li> <li><a href="http://dev.ckeditor.com/ticket/3956">#3956</a> : Fixed About dialog in Source Mode for IE.</li> <li><a href="http://dev.ckeditor.com/ticket/3953">#3953</a> : Fixed keystroke for close Paste dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/3951">#3951</a> : Reset size and lock ratio options were not accessible in Image dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/3921">#3921</a> : Fixed Container scroll issue on IE7.</li> <li><a href="http://dev.ckeditor.com/ticket/3940">#3940</a> : Fixed list operation doesn't stop at table.</li> <li><a href="http://dev.ckeditor.com/ticket/3891">#3891</a> : [IE] Fixed 'automatic' font color doesn't work.</li> <li><a href="http://dev.ckeditor.com/ticket/3972">#3972</a> : Fixed unable to remove a single empty list in document in Firefox with enterMode=BR.</li> <li><a href="http://dev.ckeditor.com/ticket/3973">#3973</a> : Fixed list creation error at the end of document.</li> <li><a href="http://dev.ckeditor.com/ticket/3959">#3959</a> : Pasting styled text from word result in content lost.</li> <li><a href="http://dev.ckeditor.com/ticket/3793">#3793</a> : Combined images into sprites.</li> <li><a href="http://dev.ckeditor.com/ticket/3783">#3783</a> : Fixed indenting command in table cells create collapsed paragraph.</li> <li><a href="http://dev.ckeditor.com/ticket/3968">#3968</a> : About dialog layout was broken with IE+Standards+RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/3991">#3991</a> : In IE quirks, text was not visible in v2 and office2003 skins.</li> <li><a href="http://dev.ckeditor.com/ticket/3983">#3983</a> : In IE, we&#39;ll now silently ignore wrong toolbar definition settings which have extra commas being left around.</li> <li>Fixed the following test cases:<ul> <li><a href="http://dev.ckeditor.com/ticket/3992">#3992</a> : core/ckeditor2.html</li> <li><a href="http://dev.ckeditor.com/ticket/4138">#4138</a> : core/plugins.html</li> <li><a href="http://dev.ckeditor.com/ticket/3801">#3801</a> : plugins/htmldataprocessor/htmldataprocessor.html</li> </ul></li> <li><a href="http://dev.ckeditor.com/ticket/3989">#3989</a> : Host page horizontal scrolling a lot when on having righ-to-left direction.</li> <li><a href="http://dev.ckeditor.com/ticket/4001">#4001</a> : Create link around existing image result incorrect.</li> <li><a href="http://dev.ckeditor.com/ticket/3988">#3988</a> : Destroy editor on form submit event cause error.</li> <li><a href="http://dev.ckeditor.com/ticket/3994">#3994</a> : Insert horizontal line at end of document cause error.</li> <li><a href="http://dev.ckeditor.com/ticket/4074">#4074</a> : Indent error with 'indentClasses' config specified.</li> <li><a href="http://dev.ckeditor.com/ticket/4057">#4057</a> : Fixed anchor is lost after switch between editing modes.</li> <li><a href="http://dev.ckeditor.com/ticket/3644">#3644</a> : Image dialog was missin radio lock.</li> <li><a href="http://dev.ckeditor.com/ticket/4014">#4014</a> : Firefox2 had no dialog button backgrounds.</li> <li><a href="http://dev.ckeditor.com/ticket/4018">#4018</a> : Firefox2 had no richcombo text visible.</li> <li><a href="http://dev.ckeditor.com/ticket/4035">#4035</a> : [IE6] Paste dialog size was too small.</li> <li><a href="http://dev.ckeditor.com/ticket/4049">#4049</a> : Kama skin was too wide with config.width.</li> <li>The following released files now doesn't require the _source folder<ul> <li><a href="http://dev.ckeditor.com/ticket/4086">#4086</a> : _samples/ui_languages.html</li> <li><a href="http://dev.ckeditor.com/ticket/4093">#4093</a> : _tests/core/dom/document.html</li> <li><a href="http://dev.ckeditor.com/ticket/4094">#4094</a> : Smiley plugin file</li> <li><a href="http://dev.ckeditor.com/ticket/4097">#4097</a> : No undo/redo support for fontColor and backgroundColor buttons.</li> </ul></li> <li><a href="http://dev.ckeditor.com/ticket/4085">#4085</a> : Paste and Paste from Word dialogs were not well styled in IE+RTL.</li> <li><a href="http://dev.ckeditor.com/ticket/3982">#3982</a> : Fixed enterKey on empty list item result in weird dom structure.</li> <li><a href="http://dev.ckeditor.com/ticket/4101">#4101</a> : Now it is possible to close dialog before gets focus.</li> <li><a href="http://dev.ckeditor.com/ticket/4075">#4075</a> : [IE6/7]Fixed apply custom inline style with "class" attribute failed.</li> <li><a href="http://dev.ckeditor.com/ticket/4087">#4087</a> : [Firefox]Fixed extra blocks created on create list when full document selected.</li> <li><a href="http://dev.ckeditor.com/ticket/4097">#4097</a> : No undo/redo support for fontColor and backgroundColor buttons.</li> <li><a href="http://dev.ckeditor.com/ticket/4111">#4111</a> : Fixed apply block style after inline style applied on full document error.</li> <li><a href="http://dev.ckeditor.com/ticket/3622">#3622</a> : Fixed shift enter with selection not deleting highlighted text.</li> <li><a href="http://dev.ckeditor.com/ticket/4092">#4092</a> : [IE6] Close button was missing for dialog without multiple tabs.</li> <li><a href="http://dev.ckeditor.com/ticket/4003">#4003</a> : Markup on the image dialog was disrupted when removing the border input.</li> <li><a href="http://dev.ckeditor.com/ticket/4096">#4096</a> : Editor content area was pushed down in IE RTL quirks.</li> <li><a href="http://dev.ckeditor.com/ticket/4112">#4112</a> : [FF] Paste dialog had scrollbars in quirks.</li> <li><a href="http://dev.ckeditor.com/ticket/4118">#4118</a> : Dialog dragging was occasionally behaving strangely .</li> <li><a href="http://dev.ckeditor.com/ticket/4077">#4077</a> : The toolbar combos were rendering incorrectly in some languages, like Chinese.</li> <li><a href="http://dev.ckeditor.com/ticket/3622">#3622</a> : The toolbar in the v2 skin was wrapping improperly in some languages.</li> <li><a href="http://dev.ckeditor.com/ticket/4119">#4119</a> : Unable to edit image link with image dialog.</li> <li><a href="http://dev.ckeditor.com/ticket/4117">#4117</a> : Fixed dialog error when transforming image into button.</li> <li><a href="http://dev.ckeditor.com/ticket/4058">#4058</a> : [FF] wysiwyg mode is sometimes not been activated.</li> <li><a href="http://dev.ckeditor.com/ticket/4114">#4114</a> : [IE] RTE + IE6/IE7 Quirks = dialog mispositoned.</li> <li><a href="http://dev.ckeditor.com/ticket/4123">#4123</a> : Some dialog buttons were broken in IE7 quirks.</li> <li><a href="http://dev.ckeditor.com/ticket/4122">#4122</a> : [IE] The image dialog was being rendered improperly when loading an image with long URL.</li> <li><a href="http://dev.ckeditor.com/ticket/4144">#4144</a> : Fixed the white-spaces at the end of &lt;pre&gt; is incorrectly removed.</li> <li><a href="http://dev.ckeditor.com/ticket/4143">#4143</a> : Fixed element id is lost when extracting contents from the range.</li> <li><a href="http://dev.ckeditor.com/ticket/4007">#4007</a> : [IE] Source area overflow from editor chrome.</li> <li><a href="http://dev.ckeditor.com/ticket/4145">#4145</a> : Fixed the on demand (&quot;basic&quot;) loading model of the editor.</li> <li><a href="http://dev.ckeditor.com/ticket/4139">#4139</a> : Fixed list plugin regression of [3903].</li> <li><a href="http://dev.ckeditor.com/ticket/4147">#4147</a> : Unify style text normalization logic when comparing styles.</li> <li><a href="http://dev.ckeditor.com/ticket/4150">#4150</a> : Fixed enlarge list result incorrect at the inner boundary of block.</li> <li><a href="http://dev.ckeditor.com/ticket/4164">#4164</a> : Now it is possible to paste text in Source mode even if forcePasteAsPlainText = true.</li> <li><a href="http://dev.ckeditor.com/ticket/4129">#4129</a> : [FF]Unable to remove list with Ctrl-A.</li> <li><a href="http://dev.ckeditor.com/ticket/4172">#4172</a> : [Safari] The trailing &lt;br&gt; was not been always added to blank lines ending with &amp;nbsp;.</li> <li><a href="http://dev.ckeditor.com/ticket/4178">#4178</a> : It&#39;s now possible to copy and paste Flash content among different editor instances.</li> <li><a href="http://dev.ckeditor.com/ticket/4193">#4193</a> : Automatic font color produced empty span on Firefox 3.5.</li> <li><a href="http://dev.ckeditor.com/ticket/4186">#4186</a> : [FF] Fixed First open float panel cause host page scrollbar blinking.</li> <li><a href="http://dev.ckeditor.com/ticket/4227">#4227</a> : Fixed destroy editor instance created on textarea which is not within form cause error.</li> <li><a href="http://dev.ckeditor.com/ticket/4240">#4240</a> : Fixed editor name containing hyphen break editor completely.</li> <li><a href="http://dev.ckeditor.com/ticket/3828">#3828</a> : Malformed nested list is now corrected by the parser.</li> </ul> <h3> CKEditor 3.0 RC</h3> <p> Changelog starts at this release.</p> <div id="footer"> <hr /> <p> CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/CHANGES.html
HTML
asf20
157,640
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ // Compressed version of core/ckeditor_base.js. See original for instructions. /*jsl:ignore*/ if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.2',revision:'7275',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})(); /*jsl:end*/ // Uncomment the following line to have a new timestamp generated for each // request, having clear cache load of the editor code. // CKEDITOR.timestamp = ( new Date() ).valueOf(); // Set the script name to be loaded by the loader. CKEDITOR._autoLoad = 'core/ckeditor_basic'; // Include the loader script. document.write( '<script type="text/javascript" src="' + CKEDITOR.getUrl( '_source/core/loader.js' ) + '"></script>' );
zysms
trunk/zysms/include/ckeditor/ckeditor_basic_source.js
JavaScript
asf20
1,530
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>HTML Compliant Output &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Producing HTML Compliant Output </h1> <div class="description"> <p> This sample shows how to configure CKEditor to output valid <a class="samples" href="http://www.w3.org/TR/html401/">HTML 4.01</a> code. Traditional HTML elements like <code>&lt;b&gt;</code>, <code>&lt;i&gt;</code>, and <code>&lt;font&gt;</code> are used in place of <code>&lt;strong&gt;</code>, <code>&lt;em&gt;</code>, and CSS styles. </p> <p> To add a CKEditor instance outputting legacy HTML 4.01 code, load the editor using a standard JavaScript call, and define CKEditor features to use the HTML compliant elements and attributes. </p> <p> A snippet of the configuration code can be seen below; check the source of this page for full definition: </p> <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', { coreStyles_bold : { element : 'b' }, coreStyles_italic : { element : 'i' }, fontSize_style : { element : 'font', attributes : { 'size' : '#(size)' } } // More definitions follow. });</pre> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;b&gt;sample text&lt;/b&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ CKEDITOR.replace( 'editor1', { /* * Style sheet for the contents */ contentsCss : 'body {color:#000; background-color#:FFF;}', /* * Simple HTML5 doctype */ docType : '<!DOCTYPE HTML>', /* * Core styles. */ coreStyles_bold : { element : 'b' }, coreStyles_italic : { element : 'i' }, coreStyles_underline : { element : 'u'}, coreStyles_strike : { element : 'strike' }, /* * Font face */ // Define the way font elements will be applied to the document. The "font" // element will be used. font_style : { element : 'font', attributes : { 'face' : '#(family)' } }, /* * Font sizes. */ fontSize_sizes : 'xx-small/1;x-small/2;small/3;medium/4;large/5;x-large/6;xx-large/7', fontSize_style : { element : 'font', attributes : { 'size' : '#(size)' } } , /* * Font colors. */ colorButton_enableMore : true, colorButton_foreStyle : { element : 'font', attributes : { 'color' : '#(color)' } }, colorButton_backStyle : { element : 'font', styles : { 'background-color' : '#(color)' } }, /* * Styles combo. */ stylesSet : [ { name : 'Computer Code', element : 'code' }, { name : 'Keyboard Phrase', element : 'kbd' }, { name : 'Sample Text', element : 'samp' }, { name : 'Variable', element : 'var' }, { name : 'Deleted Text', element : 'del' }, { name : 'Inserted Text', element : 'ins' }, { name : 'Cited Work', element : 'cite' }, { name : 'Inline Quotation', element : 'q' } ], on : { 'instanceReady' : configureHtmlOutput } }); /* * Adjust the behavior of the dataProcessor to avoid styles * and make it look like FCKeditor HTML output. */ function configureHtmlOutput( ev ) { var editor = ev.editor, dataProcessor = editor.dataProcessor, htmlFilter = dataProcessor && dataProcessor.htmlFilter; // Out self closing tags the HTML4 way, like <br>. dataProcessor.writer.selfClosingEnd = '>'; // Make output formatting behave similar to FCKeditor var dtd = CKEDITOR.dtd; for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { dataProcessor.writer.setRules( e, { indent : true, breakBeforeOpen : true, breakAfterOpen : false, breakBeforeClose : !dtd[ e ][ '#' ], breakAfterClose : true }); } // Output properties as attributes, not styles. htmlFilter.addRules( { elements : { $ : function( element ) { // Output dimensions of images as width and height if ( element.name == 'img' ) { var style = element.attributes.style; if ( style ) { // Get the width from the style. var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style ), width = match && match[1]; // Get the height from the style. match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style ); var height = match && match[1]; if ( width ) { element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' ); element.attributes.width = width; } if ( height ) { element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' ); element.attributes.height = height; } } } // Output alignment of paragraphs using align if ( element.name == 'p' ) { style = element.attributes.style; if ( style ) { // Get the align from the style. match = /(?:^|\s)text-align\s*:\s*(\w*);/i.exec( style ); var align = match && match[1]; if ( align ) { element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' ); element.attributes.align = align; } } } if ( !element.attributes.style ) delete element.attributes.style; return element; } }, attributes : { style : function( value, element ) { // Return #RGB for background and border colors return convertRGBToHex( value ); } } } ); } /** * Convert a CSS rgb(R, G, B) color back to #RRGGBB format. * @param Css style string (can include more than one color * @return Converted css style. */ function convertRGBToHex( cssStyle ) { return cssStyle.replace( /(?:rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\))/gi, function( match, red, green, blue ) { red = parseInt( red, 10 ).toString( 16 ); green = parseInt( green, 10 ).toString( 16 ); blue = parseInt( blue, 10 ).toString( 16 ); var color = [red, green, blue] ; // Add padding zeros if the hex value is less than 0x10. for ( var i = 0 ; i < color.length ; i++ ) color[i] = String( '0' + color[i] ).slice( -2 ) ; return '#' + color.join( '' ) ; }); } //]]> </script> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/output_html.html
HTML
asf20
8,352
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>XHTML Compliant Output &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Producing XHTML Compliant Output </h1> <div class="description"> <p> This sample shows how to configure CKEditor to output valid <a class="samples" href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> code. Deprecated elements (<code>&lt;font&gt;</code>, <code>&lt;u&gt;</code>) or attributes (<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code. </p> <p> To add a CKEditor instance outputting valid XHTML code, load the editor using a standard JavaScript call and define CKEditor features to use the XHTML compliant elements and styles. </p> <p> A snippet of the configuration code can be seen below; check the source of this page for full definition: </p> <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', { contentsCss : 'assets/output_xhtml.css', coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} }, coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'} }, // More definitions follow. });</pre> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;span class="Bold"&gt;sample text&lt;/span&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ CKEDITOR.replace( 'editor1', { /* * Style sheet for the contents */ contentsCss : 'assets/output_xhtml.css', /* * Core styles. */ coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} }, coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'}}, coreStyles_underline : { element : 'span', attributes : {'class': 'Underline'}}, coreStyles_strike : { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' }, coreStyles_subscript : { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' }, coreStyles_superscript : { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' }, /* * Font face */ // List of fonts available in the toolbar combo. Each font definition is // separated by a semi-colon (;). We are using class names here, so each font // is defined by {Combo Label}/{Class Name}. font_names : 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes', // Define the way font elements will be applied to the document. The "span" // element will be used. When a font is selected, the font name defined in the // above list is passed to this definition with the name "Font", being it // injected in the "class" attribute. // We must also instruct the editor to replace span elements that are used to // set the font (Overrides). font_style : { element : 'span', attributes : { 'class' : '#(family)' } }, /* * Font sizes. */ fontSize_sizes : 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble', fontSize_style : { element : 'span', attributes : { 'class' : '#(size)' } } , /* * Font colors. */ colorButton_enableMore : false, colorButton_colors : 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00', colorButton_foreStyle : { element : 'span', attributes : { 'class' : '#(color)' } }, colorButton_backStyle : { element : 'span', attributes : { 'class' : '#(color)BG' } }, /* * Indentation. */ indentClasses : ['Indent1', 'Indent2', 'Indent3'], /* * Paragraph justification. */ justifyClasses : [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ], /* * Styles combo. */ stylesSet : [ { name : 'Strong Emphasis', element : 'strong' }, { name : 'Emphasis', element : 'em' }, { name : 'Computer Code', element : 'code' }, { name : 'Keyboard Phrase', element : 'kbd' }, { name : 'Sample Text', element : 'samp' }, { name : 'Variable', element : 'var' }, { name : 'Deleted Text', element : 'del' }, { name : 'Inserted Text', element : 'ins' }, { name : 'Cited Work', element : 'cite' }, { name : 'Inline Quotation', element : 'q' } ] }); //]]> </script> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/output_xhtml.html
HTML
asf20
6,287
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using API to Customize Dialog Windows &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> <style id="styles" type="text/css"> .cke_button_myDialogCmd .cke_icon { display: none !important; } .cke_button_myDialogCmd .cke_label { display: inline !important; } </style> <script type="text/javascript"> //<![CDATA[ // When opening a dialog, its "definition" is created for it, for // each editor instance. The "dialogDefinition" event is then // fired. We should use this event to make customizations to the // definition of existing dialogs. CKEDITOR.on( 'dialogDefinition', function( ev ) { // Take the dialog name and its definition from the event // data. var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; // Check if the definition is from the dialog we're // interested on (the "Link" dialog). if ( dialogName == 'link' ) { // Get a reference to the "Link Info" tab. var infoTab = dialogDefinition.getContents( 'info' ); // Add a text field to the "info" tab. infoTab.add( { type : 'text', label : 'My Custom Field', id : 'customField', 'default' : 'Sample!', validate : function() { if ( /\d/.test( this.getValue() ) ) return 'My Custom Field must not contain digits'; } }); // Remove the "Link Type" combo and the "Browser // Server" button from the "info" tab. infoTab.remove( 'linkType' ); infoTab.remove( 'browse' ); // Set the default value for the URL field. var urlField = infoTab.get( 'url' ); urlField['default'] = 'www.example.com'; // Remove the "Target" tab from the "Link" dialog. dialogDefinition.removeContents( 'target' ); // Add a new tab to the "Link" dialog. dialogDefinition.addContents({ id : 'customTab', label : 'My Tab', accessKey : 'M', elements : [ { id : 'myField1', type : 'text', label : 'My Text Field' }, { id : 'myField2', type : 'text', label : 'Another Text Field' } ] }); // Rewrite the 'onFocus' handler to always focus 'url' field. dialogDefinition.onFocus = function() { var urlField = this.getContentElement( 'info', 'url' ); urlField.select(); }; } }); //]]> </script> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Using CKEditor Dialog API </h1> <div class="description"> <p> This sample shows how to use the <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html">CKEditor Dialog API</a> to customize CKEditor dialog windows without changing the original editor code. The following customizations are being done in the example below: </p> <ol> <li><strong>Adding dialog window tabs</strong> &ndash; "My Tab" in the "Link" dialog window.</li> <li><strong>Removing a dialog window tab</strong> &ndash; "Target" tab from the "Link" dialog window.</li> <li><strong>Adding dialog window fields</strong> &ndash; "My Custom Field" in the "Link" dialog window.</li> <li><strong>Removing dialog window fields</strong> &ndash; "Link Type" and "Browse Server" in the "Link" dialog window.</li> <li><strong>Setting default values for dialog window fields</strong> &ndash; "URL" field in the "Link" dialog window. </li> <li><strong>Creating a custom dialog window</strong> &ndash; "My Dialog" dialog window opened with the "My Dialog" toolbar button.</li> </ol> <p> For details on how to create this setup check the source code of this sample page. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <!-- This <fieldset> holds the HTML that you will usually find in your pages. --> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ // Replace the <textarea id="editor1"> with an CKEditor instance. var editor = CKEDITOR.replace( 'editor1', { // Defines a simpler toolbar to be used in this sample. // Note that we have added out "MyButton" button here. toolbar : [ [ 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike','-','Link', '-', 'MyButton' ] ] }); // Listen for the "pluginsLoaded" event, so we are sure that the // "dialog" plugin has been loaded and we are able to do our // customizations. editor.on( 'pluginsLoaded', function( ev ) { // If our custom dialog has not been registered, do that now. if ( !CKEDITOR.dialog.exists( 'myDialog' ) ) { // We need to do the following trick to find out the dialog // definition file URL path. In the real world, you would simply // point to an absolute path directly, like "/mydir/mydialog.js". var href = document.location.href.split( '/' ); href.pop(); href.push( 'api_dialog', 'my_dialog.js' ); href = href.join( '/' ); // Finally, register the dialog. CKEDITOR.dialog.add( 'myDialog', href ); } // Register the command used to open the dialog. editor.addCommand( 'myDialogCmd', new CKEDITOR.dialogCommand( 'myDialog' ) ); // Add the a custom toolbar buttons, which fires the above // command.. editor.ui.addButton( 'MyButton', { label : 'My Dialog', command : 'myDialogCmd' } ); }); //]]> </script> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/api_dialog.html
HTML
asf20
6,907
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>CKEditor Samples</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <link type="text/css" rel="stylesheet" href="sample.css" /> </head> <body> <h1 class="samples"> CKEditor Samples Site </h1> <h2 class="samples"> Basic Samples </h2> <ul class="samples"> <li> <a class="samples" href="replacebyclass.html">Replace textarea elements by class name</a><br /> Automatic replacement of all textarea elements of a given class with a CKEditor instance. </li> <li><a class="samples" href="replacebycode.html">Replace textarea elements by code</a><br /> Replacement of textarea elements with CKEditor instances by using a JavaScript call. </li> <li><a class="samples" href="fullpage.html">Full page support with the Document Properties plugin</a><br /> CKEditor inserted with a JavaScript call and used to edit the whole page from <code>&lt;html&gt;</code> to <code>&lt;/html&gt;</code>. </li> </ul> <h2 class="samples"> Basic Customization </h2> <ul class="samples"> <li><a class="samples" href="skins.html">Skins</a><br /> Changing the CKEditor skin by adjusting a single configuration option. </li> <li><a class="samples" href="ui_color.html">User Interface color</a><br /> Changing CKEditor User Interface color and adding a toolbar button that lets the user set the UI color. </li> <li><a class="samples" href="ui_languages.html">User Interface languages</a><br /> Changing CKEditor User Interface language and adding a drop-down list that lets the user choose the UI language. </li> </ul> <h2 class="samples"> Advanced Samples </h2> <ul class="samples"> <li><a class="samples" href="divreplace.html">Replace DIV elements on the fly</a><br /> Transforming a <code>div</code> element into an instance of CKEditor with a mouse click. </li> <li><a class="samples" href="ajax.html">Create and destroy editor instances for Ajax applications</a><br /> Creating and destroying CKEditor instances on the fly and saving the contents entered into the editor window. </li> <li><a class="samples" href="api.html">Basic usage of the API</a><br /> Using the CKEditor JavaScript API to interact with the editor at runtime. </li> <li><a class="samples" href="api_dialog.html">Using the JavaScript API to customize dialog windows</a><br /> Using the dialog windows API to customize dialog windows without changing the original editor code. </li> <li><a class="samples" href="enterkey.html">Using the "Enter" key in CKEditor</a><br /> Configuring the behavior of <em>Enter</em> and <em>Shift+Enter</em> keys. </li> <li><a class="samples" href="sharedspaces.html">Shared toolbars</a><br /> Displaying multiple editor instances that share the toolbar and/or the elements path. </li> <li><a class="samples" href="jqueryadapter.html">jQuery adapter example</a><br /> Using the jQuery adapter to configure CKEditor. </li> <li><a class="samples" href="output_xhtml.html">Output XHTML</a><br /> Configuring CKEditor to produce XHTML 1.1 compliant code. </li> <li><a class="samples" href="output_html.html">Output HTML</a><br /> Configuring CKEditor to produce legacy HTML 4 code. </li> <li><a class="samples" href="output_for_flash.html">Output for Flash</a><br /> Configuring CKEditor to produce HTML code that can be used with Adobe Flash. </li> <li><a class="samples" href="readonly.html">Read-only mode</a><br /> Using the readOnly API to block introducing changes to the editor contents. </li> </ul> <h2 class="samples"> Additional plugins </h2> <ul class="samples"> <li><a class="samples" href="autogrow.html">AutoGrow plugin</a><br /> Using the AutoGrow plugin in order to make the editor grow to fit the size of its content. </li> <li><a class="samples" href="bbcode.html">Output for BBCode</a><br /> Configuring CKEditor to produce BBCode tags instead of HTML. </li> <li><a class="samples" href="stylesheetparser.html">Stylesheet Parser plugin</a><br /> Using the Stylesheet Parser plugin to fill the Styles drop-down list based on the CSS classes available in the document stylesheet. </li> <li><a class="samples" href="devtools.html">Developer Tools plugin</a><br /> Using the Developer Tools plugin to display information about dialog window UI elements to allow for easier customization. </li> <li><a class="samples" href="placeholder.html">Placeholder plugin</a><br /> Using the Placeholder plugin to create uneditable sections that can only be created and modified with a proper dialog window. </li> <li><a class="samples" href="tableresize.html">TableResize plugin</a><br /> Using the TableResize plugin to enable table column resizing. </li> </ul> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/index.html
HTML
asf20
5,543
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'myDialog', function( editor ) { return { title : 'My Dialog', minWidth : 400, minHeight : 200, contents : [ { id : 'tab1', label : 'First Tab', title : 'First Tab', elements : [ { id : 'input1', type : 'text', label : 'Input 1' } ] } ] }; } );
zysms
trunk/zysms/include/ckeditor/_samples/api_dialog/my_dialog.js
JavaScript
asf20
513
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ENTER Key Configuration &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> //<![CDATA[ var editor; function changeEnter() { // If we already have an editor, let's destroy it first. if ( editor ) editor.destroy( true ); // Create the editor again, with the appropriate settings. editor = CKEDITOR.replace( 'editor1', { enterMode : Number( document.getElementById( 'xEnter' ).value ), shiftEnterMode : Number( document.getElementById( 'xShiftEnter' ).value ) }); } window.onload = changeEnter; //]]> </script> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; ENTER Key Configuration </h1> <div class="description"> <p> This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys to perform actions specified in the <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode"><code>enterMode</code></a> and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.shiftEnterMode"><code>shiftEnterMode</code></a> parameters, respectively. You can choose from the following options: </p> <ul class="samples"> <li><strong><code>ENTER_P</code></strong> &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li> <li><strong><code>ENTER_BR</code></strong> &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li> <li><strong><code>ENTER_DIV</code></strong> &ndash; new <code>&lt;div&gt;</code> blocks are created.</li> </ul> <p> The sample code below shows how to configure CKEditor to create a <code>&lt;div&gt;</code> block when <em>Enter</em> key is pressed. </p> <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', { <strong>enterMode : CKEDITOR.ENTER_DIV</strong> });</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <div style="float: left; margin-right: 20px"> When <em>Enter</em> is pressed:<br /> <select id="xEnter" onchange="changeEnter();"> <option selected="selected" value="1">Create a new &lt;P&gt; (recommended)</option> <option value="3">Create a new &lt;DIV&gt;</option> <option value="2">Break the line with a &lt;BR&gt;</option> </select> </div> <div style="float: left"> When <em>Shift+Enter</em> is pressed:<br /> <select id="xShiftEnter" onchange="changeEnter();"> <option value="1">Create a new &lt;P&gt;</option> <option value="3">Create a new &lt;DIV&gt;</option> <option selected="selected" value="2">Break the line with a &lt;BR&gt; (recommended)</option> </select> </div> <br style="clear: both" /> <form action="sample_posteddata.php" method="post"> <p> <br /> <textarea cols="80" id="editor1" name="editor1" rows="10">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/enterkey.html
HTML
asf20
4,477
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <title>CKEditor Samples &mdash; PHP Integration</title> <link type="text/css" rel="stylesheet" href="../sample.css" /> </head> <body> <h1 class="samples"> CKEditor Samples List for PHP </h1> <h2 class="samples"> Basic Samples </h2> <ul class="samples"> <li><a class="samples" href="replace.php">Replace existing textarea elements by code</a><br /> Replacement of selected textarea elements with CKEditor instances by using a JavaScript call.</li> <li><a class="samples" href="replaceall.php">Replace all textarea elements by code</a><br /> Replacement of all textarea elements with CKEditor instances by using a JavaScript call.</li> <li><a class="samples" href="standalone.php">Create CKEditor instances in PHP</a><br /> Creating a CKEditor instance (no initial textarea element is required).</li> </ul> <h2 class="samples"> Advanced Samples </h2> <ul class="samples"> <li><a class="samples" href="advanced.php">Setting configuration options</a><br /> Creating a CKEditor instance with custom configuration options.</li> <li><a class="samples" href="events.php">Listening to events</a><br /> Creating event handlers. </li> </ul> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/php/index.html
HTML
asf20
1,951
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Adding Event Handlers &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <link href="../sample.css" rel="stylesheet" type="text/css"/> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Adding Event Handlers </h1> <div class="description"> <p> This sample shows how to add event handlers to CKEditor with PHP. </p> <p> A snippet of the configuration code can be seen below; check the source code of this page for the full definition: </p> <pre class="samples">&lt;?php // Include the CKEditor class. include("ckeditor/ckeditor.php"); // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory. $CKEditor->basePath = '/ckeditor/'; // The initial value to be displayed in the editor. $initialValue = 'This is some sample text.'; // Add event handler, <em>instanceReady</em> is fired when editor is loaded. $CKEditor-><strong>addEventHandler</strong>('instanceReady', 'function (evt) { alert("Loaded editor: " + evt.editor.name); }'); // Create an editor instance. $CKEditor->editor("editor1", $initialValue); </pre> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="../sample_posteddata.php" method="post"> <label>Editor 1:</label> <?php /** * Adds a global event, will hide the "Target" tab in the "Link" dialog window in all instances. */ function CKEditorHideLinkTargetTab(&$CKEditor) { $function = 'function (ev) { // Take the dialog window name and its definition from the event data. var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; // Check if the definition comes from the "Link" dialog window. if ( dialogName == "link" ) dialogDefinition.removeContents("target") }'; $CKEditor->addGlobalEventHandler('dialogDefinition', $function); } /** * Adds a global event, will notify about an open dialog window. */ function CKEditorNotifyAboutOpenedDialog(&$CKEditor) { $function = 'function (evt) { alert("Loading a dialog window: " + evt.data.name); }'; $CKEditor->addGlobalEventHandler('dialogDefinition', $function); } // Include the CKEditor class. include("../../ckeditor.php"); // Create a class instance. $CKEditor = new CKEditor(); // Set a configuration option for all editors. $CKEditor->config['width'] = 750; // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; // The initial value to be displayed in the editor. $initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>'; // Event that will be handled only by the first editor. $CKEditor->addEventHandler('instanceReady', 'function (evt) { alert("Loaded editor: " + evt.editor.name); }'); // Create the first instance. $CKEditor->editor("editor1", $initialValue); // Clear event handlers. Instances that will be created later will not have // the 'instanceReady' listener defined a couple of lines above. $CKEditor->clearEventHandlers(); ?> <br /> <label>Editor 2:</label> <?php // Configuration that will only be used by the second editor. $config['width'] = '600'; $config['toolbar'] = 'Basic'; // Add some global event handlers (for all editors). CKEditorHideLinkTargetTab($CKEditor); CKEditorNotifyAboutOpenedDialog($CKEditor); // Event that will only be handled by the second editor. // Instead of calling addEventHandler(), events may be passed as an argument. $events['instanceReady'] = 'function (evt) { alert("Loaded second editor: " + evt.editor.name); }'; // Create the second instance. $CKEditor->editor("editor2", $initialValue, $config, $events); ?> <p> <input type="submit" value="Submit"/> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/php/events.php
PHP
asf20
5,004
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Setting Configuration Options &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <link href="../sample.css" rel="stylesheet" type="text/css"/> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Setting Configuration Options </h1> <p> This sample shows how to insert a CKEditor instance with custom configuration options. </p> <p> To set configuration options, use the <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html"><code>config</code></a> property. To set the attributes of a <code>&lt;textarea&gt;</code> element (which is displayed instead of CKEditor in unsupported browsers), use the <code>textareaAttributes</code> property. </p> <pre class="samples"> &lt;?php // Include the CKEditor class. include_once "ckeditor/ckeditor.php"; // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory. $CKEditor->basePath = '/ckeditor/'; // Set global configuration (used by every instance of CKEditor). $CKEditor-><strong>config['width']</strong> = 600; // Change default textarea attributes. $CKEditor-><strong>textareaAttributes</strong> = array("cols" => 80, "rows" => 10); // The initial value to be displayed in the editor. $initialValue = 'This is some sample text.'; // Create the first instance. $CKEditor->editor("textarea_id", $initialValue); ?&gt;</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>name</code> attribute of the <code>&lt;textarea&gt;</code> element to be created. </p> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="../sample_posteddata.php" method="post"> <label>Editor 1:</label> <?php // Include the CKEditor class. include("../../ckeditor.php"); // Create a class instance. $CKEditor = new CKEditor(); // Do not print the code directly to the browser, return it instead. $CKEditor->returnOutput = true; // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; // Set global configuration (will be used by all instances of CKEditor). $CKEditor->config['width'] = 600; // Change default textarea attributes. $CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10); // The initial value to be displayed in the editor. $initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>'; // Create the first instance. $code = $CKEditor->editor("editor1", $initialValue); echo $code; ?> <br /> <label>Editor 2:</label> <?php // Configuration that will only be used by the second editor. $config['toolbar'] = array( array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ), array( 'Image', 'Link', 'Unlink', 'Anchor' ) ); $config['skin'] = 'v2'; // Create the second instance. echo $CKEditor->editor("editor2", $initialValue, $config); ?> <p> <input type="submit" value="Submit"/> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/php/advanced.php
PHP
asf20
4,234
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Replace Selected Textarea Elements &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <link href="../sample.css" rel="stylesheet" type="text/css"/> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Replace Selected Textarea Elements Using PHP Code </h1> <div class="description"> <p> This sample shows how to replace a selected <code>&lt;textarea&gt;</code> element with a CKEditor instance by using PHP code. </p> <p> To replace a <code>&lt;textarea&gt;</code> element, place the following call at any point after the <code>&lt;textarea&gt;</code> element: </p> <pre class="samples"> &lt;?php // Include the CKEditor class. include_once "ckeditor/ckeditor.php"; // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory. $CKEditor->basePath = '/ckeditor/'; // Replace a textarea element with an id (or name) of "textarea_id". $CKEditor->replace("textarea_id"); ?&gt;</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="../sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <input type="submit" value="Submit"/> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> <?php // Include the CKEditor class. include_once "../../ckeditor.php"; // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; // Replace a textarea element with an id (or name) of "editor1". $CKEditor->replace("editor1"); ?> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/php/replace.php
PHP
asf20
3,175
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Replace All Textarea Elements &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <link href="../sample.css" rel="stylesheet" type="text/css"/> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Replace All Textarea Elements Using PHP Code </h1> <div class="description"> <p> This sample shows how to replace all <code>&lt;textarea&gt;</code> elements with CKEditor by using PHP code. </p> <p> To replace all <code>&lt;textarea&gt;</code> elements, place the following call at any point after the last <code>&lt;textarea&gt;</code> element: </p> <pre class="samples"> &lt;?php // Include the CKEditor class. include("ckeditor/ckeditor.php"); // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory. $CKEditor->basePath = '/ckeditor/'; // Replace all textarea elements with CKEditor. $CKEditor->replaceAll(); ?&gt;</pre> </div> <!-- This <div> holds alert messages to be displayed in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="../sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <label for="editor2"> Editor 2:</label> <textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <input type="submit" value="Submit"/> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> <?php // Include the CKEditor class. include("../../ckeditor.php"); // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; // Replace all textarea elements with CKEditor. $CKEditor->replaceAll(); ?> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/php/replaceall.php
PHP
asf20
3,202
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Creating CKEditor Instances &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <link href="../sample.css" rel="stylesheet" type="text/css"/> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Creating CKEditor Instances </h1> <div class="description"> <p> This sample shows how to create a CKEditor instance with PHP. </p> <pre class="samples"> &lt;?php include_once "ckeditor/ckeditor.php"; // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory. $CKEditor->basePath = '/ckeditor/'; // Create a textarea element and attach CKEditor to it. $CKEditor->editor("textarea_id", "This is some sample text"); ?&gt;</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of the <code>&lt;textarea&gt;</code> element that will be created. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <!-- This <fieldset> holds the HTML code that you will usually find in your pages. --> <form action="../sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> </p> <p> <?php // Include the CKEditor class. include_once "../../ckeditor.php"; // The initial value to be displayed in the editor. $initialValue = '<p>This is some <strong>sample text</strong>.</p>'; // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; // Create a textarea element and attach CKEditor to it. $CKEditor->editor("editor1", $initialValue); ?> <input type="submit" value="Submit"/> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/php/standalone.php
PHP
asf20
2,957
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>AutoGrow Plugin &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Using AutoGrow Plugin </h1> <div class="description"> <p> This sample shows how to configure CKEditor instances to use the <strong>AutoGrow</strong> (<code>autogrow</code>) plugin that lets the editor window expand and shrink depending on the amount and size of content entered in the editing area. </p> <p> In its default implementation the <strong>AutoGrow feature</strong> can expand the CKEditor window infinitely in order to avoid introducing scrollbars to the editing area. </p> <p> It is also possible to set a maximum height for the editor window. Once CKEditor editing area reaches the value in pixels specified in the <code> <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoGrow_maxHeight">autoGrow_maxHeight</a> </code> configuration setting, scrollbars will be added and the editor window will no longer expand. </p> <p> To add a CKEditor instance using the <code>autogrow</code> plugin and its <code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code: </p> <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', { <strong>extraPlugins : 'autogrow',</strong> autoGrow_maxHeight : 800, // Remove the Resize plugin as it does not make sense to use it in conjunction with the AutoGrow plugin. removePlugins : 'resize' });</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. The maximum height should be given in pixels. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="sample_posteddata.php" method="post"> <p> <label for="editor1"> CKEditor using the <code>autogrow</code> plugin with its default configuration:</label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ CKEDITOR.replace( 'editor1', { extraPlugins : 'autogrow', removePlugins : 'resize' }); //]]> </script> </p> <p> <label for="editor2"> CKEditor using the <code>autogrow</code> plugin with maximum height set to 400 pixels:</label> <textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ CKEDITOR.replace( 'editor2', { extraPlugins : 'autogrow', autoGrow_maxHeight : 400, removePlugins : 'resize' }); //]]> </script> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/autogrow.html
HTML
asf20
4,336
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>User Interface Globalization &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script type="text/javascript" src="../lang/_languages.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; User Interface Languages </h1> <div class="description"> <p> This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements with a CKEditor instance with an option to change the language of its user interface. </p> <p> It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates a drop-down list that lets the user change the UI language. </p> <p> By default, CKEditor automatically localizes the editor to the language of the user. The UI language can be controlled with two configuration options: <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.language"> <code>language</code></a> and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.defaultLanguage"> <code>defaultLanguage</code></a>. The <code>defaultLanguage</code> setting specifies the default CKEditor language to be used when a localization suitable for user's settings is not available. </p> <p> To specify the user interface language that will be used no matter what language is specified in user's browser or operating system, set the <code>language</code> property: </p> <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', { // Load the German interface. <strong>language: 'de'</strong> });</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="sample_posteddata.php" method="post"> <p> Available languages (<span id="count"> </span> languages!):<br /> <script type="text/javascript"> //<![CDATA[ document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' ); // Get the language list from the _languages.js file. for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) { document.write( '<option value="' + window.CKEDITOR_LANGS[i].code + '">' + window.CKEDITOR_LANGS[i].name + '</option>' ); } document.write( '</select>' ); //]]> </script> <br /> <span style="color: #888888">(You may see strange characters if your system does not support the selected language)</span> </p> <p> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ // Set the number of languages. document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length; var editor; function createEditor( languageCode ) { if ( editor ) editor.destroy(); // Replace the <textarea id="editor"> with an CKEditor // instance, using default configurations. editor = CKEDITOR.replace( 'editor1', { language : languageCode, on : { instanceReady : function() { // Wait for the editor to be ready to set // the language combo. var languages = document.getElementById( 'languages' ); languages.value = this.langCode; languages.disabled = false; } } } ); } // At page startup, load the default language: createEditor( '' ); //]]> </script> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/ui_languages.html
HTML
asf20
5,114
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery Adapter &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> <script type="text/javascript" src="../ckeditor.js"></script> <script type="text/javascript" src="../adapters/jquery.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> //<![CDATA[ $(function() { var config = { toolbar: [ ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'], ['UIColor'] ] }; // Initialize the editor. // Callback function can be passed and executed after full instance creation. $('.jquery_ckeditor').ckeditor(config); }); //]]> </script> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Using jQuery Adapter </h1> <div class="description"> <p> This sample shows how to load CKEditor and configure it using the <a class="samples" href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/jQuery_Adapter">jQuery adapter</a>. In this case the jQuery adapter is responsible for transforming a <code>&lt;textarea&gt;</code> element into a CKEditor instance and setting the configuration of the toolbar. </p> <p> CKEditor instance with custom configuration set in jQuery can be inserted with the following JavaScript code: </p> <pre class="samples">$(function() { var config = { skin:'v2' }; $('.<em>textarea_class</em>').ckeditor(config); });</pre> <p> Note that <code><em>textarea_class</em></code> in the code above is the <code>class</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. Any other jQuery selector can be used to match the target element. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <!-- This <fieldset> holds the HTML that you will usually find in your pages. --> <form action="sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> <textarea class="jquery_ckeditor" cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/jqueryadapter.html
HTML
asf20
3,517
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Output for Flash &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="assets/swfobject.js"></script> <script type="text/javascript"> function sendToFlash() { var html = CKEDITOR.instances.editor1.getData() ; var flash = document.getElementById( 'ckFlash' ) ; flash.setData( html ) ; } function init() { var so = new SWFObject("assets/output_for_flash.swf", "ckFlash", "550", "400", "8", "#ffffff") ; so.addParam("wmode", "transparent"); so.write("ckFlashContainer") ; } </script> </head> <body onload="init()"> <h1 class="samples"> CKEditor Sample &mdash; Producing Flash Compliant HTML Output </h1> <div class="description"> <p> This sample shows how to configure CKEditor to output HTML code that can be used with <a class="samples" href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000922.html"> Adobe Flash</a>. The code will contain a subset of standard HTML elements like <code>&lt;b&gt;</code>, <code>&lt;i&gt;</code>, and <code>&lt;p&gt;</code> as well as HTML attributes. </p> <p> To add a CKEditor instance outputting Flash compliant HTML code, load the editor using a standard JavaScript call, and define CKEditor features to use HTML elements and attributes. </p> <p> For details on how to create this setup check the source code of this sample page. </p> </div> <p> To see how it works, create some content in the editing area of CKEditor on the left and send it to the Flash object on the right side of the page by using the <strong>Send to Flash</strong> button. </p> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <hr /> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td style="width: 100%"> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;b&gt;sample text&lt;/b&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script type="text/javascript"> //<![CDATA[ if ( document.location.protocol == 'file:' ) alert( 'Warning: This samples does not work when loaded from local filesystem due to security restrictions implemented in Flash.' + '\n\nPlease load the sample from a web server instead.') ; CKEDITOR.replace( 'editor1', { height : 300, width : '100%', toolbar : [ ['Source','-','Bold','Italic','Underline','-','BulletedList','-','Link','Unlink'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], '/', ['Font','FontSize'], ['TextColor','-','About'] ], /* * Style sheet for the contents */ contentsCss : 'body {color:#000; background-color#FFF; font-family: Arial; font-size:80%;} p, ol, ul {margin-top: 0px; margin-bottom: 0px;}', /* * Quirks doctype */ docType : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', /* * Core styles. */ coreStyles_bold : { element : 'b' }, coreStyles_italic : { element : 'i' }, coreStyles_underline : { element : 'u'}, /* * Font face */ // Define the way font elements will be applied to the document. The "font" // element will be used. font_style : { element : 'font', attributes : { 'face' : '#(family)' } }, /* * Font sizes. * The CSS part of the font sizes isn't used by Flash, it is there to get the * font rendered correctly in CKEditor. */ fontSize_sizes : '8px/8;9px/9;10px/10;11px/11;12px/12;14px/14;16px/16;18px/18;20px/20;22px/22;24px/24;26px/26;28px/28;36px/36;48px/48;72px/72', fontSize_style : { element : 'font', attributes : { 'size' : '#(size)' }, styles : { 'font-size' : '#(size)px' } } , /* * Font colors. */ colorButton_enableMore : true, colorButton_foreStyle : { element : 'font', attributes : { 'color' : '#(color)' } }, colorButton_backStyle : { element : 'font', styles : { 'background-color' : '#(color)' } }, on : { 'instanceReady' : configureFlashOutput } }); /* * Adjust the behavior of the dataProcessor to match the * requirements of Flash */ function configureFlashOutput( ev ) { var editor = ev.editor, dataProcessor = editor.dataProcessor, htmlFilter = dataProcessor && dataProcessor.htmlFilter; // Out self closing tags the HTML4 way, like <br>. dataProcessor.writer.selfClosingEnd = '>'; // Make output formatting match Flash expectations var dtd = CKEDITOR.dtd; for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { dataProcessor.writer.setRules( e, { indent : false, breakBeforeOpen : false, breakAfterOpen : false, breakBeforeClose : false, breakAfterClose : false }); } dataProcessor.writer.setRules( 'br', { indent : false, breakBeforeOpen : false, breakAfterOpen : false, breakBeforeClose : false, breakAfterClose : false }); // Output properties as attributes, not styles. htmlFilter.addRules( { elements : { $ : function( element ) { var style, match, width, height, align; // Output dimensions of images as width and height if ( element.name == 'img' ) { style = element.attributes.style; if ( style ) { // Get the width from the style. match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style ); width = match && match[1]; // Get the height from the style. match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style ); height = match && match[1]; if ( width ) { element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' ); element.attributes.width = width; } if ( height ) { element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' ); element.attributes.height = height; } } } // Output alignment of paragraphs using align if ( element.name == 'p' ) { style = element.attributes.style; if ( style ) { // Get the align from the style. match = /(?:^|\s)text-align\s*:\s*(\w*);?/i.exec( style ); align = match && match[1]; if ( align ) { element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' ); element.attributes.align = align; } } } if ( element.attributes.style === '' ) delete element.attributes.style; return element; } } } ); } //]]> </script> <input type="button" value="Send to Flash" onclick="sendToFlash();" /> </td> <td valign="top" style="padding-left: 15px" id="ckFlashContainer"> </td> </tr> </table> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/output_for_flash.html
HTML
asf20
8,579
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Replace Textareas by Class Name &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Replace Textarea Elements by Class Name </h1> <div class="description"> <p> This sample shows how to automatically replace all <code>&lt;textarea&gt;</code> elements of a given class with a CKEditor instance. </p> <p> To replace a <code>&lt;textarea&gt;</code> element, simply assign it the <code>ckeditor</code> class, as in the code below: </p> <pre class="samples">&lt;textarea <strong>class="ckeditor</strong>" name="editor1"&gt;&lt;/textarea&gt;</pre> <p> Note that other <code>&lt;textarea&gt;</code> attributes (like <code>id</code> or <code>name</code>) need to be adjusted to your document. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <form action="sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1:</label> <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/replacebyclass.html
HTML
asf20
2,548
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Shared Toolbars &mdash; CKEditor Sample</title> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <script type="text/javascript" src="../ckeditor.js"></script> <script src="sample.js" type="text/javascript"></script> <link href="sample.css" rel="stylesheet" type="text/css" /> <style id="styles" type="text/css"> #editorsForm { height: 400px; overflow: auto; border: solid 1px #555; margin: 10px 0; padding: 0 10px; } </style> </head> <body> <h1 class="samples"> CKEditor Sample &mdash; Shared Toolbars </h1> <div class="description"> <p> This sample shows how to configure multiple CKEditor instances to share some parts of the interface. You can choose to share the toolbar (<code>topSpace</code>), the elements path (<code>bottomSpace</code>), or both. </p> <p> CKEditor instances with shared spaces can be inserted with a JavaScript call using the following code: </p> <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', { <strong>sharedSpaces : { top : 'topSpace', bottom : 'bottomSpace' }</strong> });</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. </p> </div> <!-- This <div> holds alert messages to be display in the sample page. --> <div id="alerts"> <noscript> <p> <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support, like yours, you should still see the contents (HTML data) and you should be able to edit it normally, without a rich editor interface. </p> </noscript> </div> <div id="topSpace"> </div> <form action="sample_posteddata.php" id="editorsForm" method="post"> <p> <label for="editor1"> Editor 1 (uses the shared toolbar and elements path):</label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <label for="editor2"> Editor 2 (uses the shared toolbar and elements path):</label> <textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <label for="editor3"> Editor 3 (uses the shared toolbar only):</label> <textarea cols="80" id="editor3" name="editor3" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <label for="editor4"> Editor 4 (no shared spaces):</label> <textarea cols="80" id="editor4" name="editor4" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> </p> <p> <input type="submit" value="Submit" /> </p> </form> <div id="bottomSpace"> </div> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> <script type="text/javascript"> //<![CDATA[ // Create all editor instances at the end of the page, so we are sure // that the "bottomSpace" div is available in the DOM (IE issue). CKEDITOR.replace( 'editor1', { sharedSpaces : { top : 'topSpace', bottom : 'bottomSpace' }, // Removes the maximize plugin as it's not usable // in a shared toolbar. // Removes the resizer as it's not usable in a // shared elements path. removePlugins : 'maximize,resize' } ); CKEDITOR.replace( 'editor2', { sharedSpaces : { top : 'topSpace', bottom : 'bottomSpace' }, // Removes the maximize plugin as it's not usable // in a shared toolbar. // Removes the resizer as it's not usable in a // shared elements path. removePlugins : 'maximize,resize' } ); CKEDITOR.replace( 'editor3', { sharedSpaces : { top : 'topSpace' }, // Removes the maximize plugin as it's not usable // in a shared toolbar. removePlugins : 'maximize' } ); CKEDITOR.replace( 'editor4' ); //]]> </script> </body> </html>
zysms
trunk/zysms/include/ckeditor/_samples/sharedspaces.html
HTML
asf20
5,063