Skip to content

Commit

Permalink
Fixed #2916 : Added Flash dialog.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.ckeditor.com/CKEditor/trunk@3110 da63caf2-3823-0410-a1e8-d69ccee00dfb
  • Loading branch information
martinkou committed Feb 27, 2009
1 parent be6b1a8 commit cdb9423
Show file tree
Hide file tree
Showing 13 changed files with 831 additions and 20 deletions.
2 changes: 1 addition & 1 deletion _source/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ CKEDITOR.config = {
* config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
*/

plugins: 'basicstyles,blockquote,button,clipboard,elementspath,find,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,showblocks,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',
plugins: 'basicstyles,blockquote,button,clipboard,elementspath,find,flashhorizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,showblocks,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',

/**
* The theme to be used to build the UI.
Expand Down
10 changes: 9 additions & 1 deletion _source/core/dom/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,
return dtd;
},

getElementsByTag: function( tagName ) {
getElementsByTag: function( tagName, namespace ) {
if ( !CKEDITOR.env.ie && namespace )
tagName = namespace + ':' + tagName;
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
},

Expand Down Expand Up @@ -493,6 +495,12 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,
// Cache the lowercased name inside a closure.
var nodeName = this.$.nodeName.toLowerCase();

if ( CKEDITOR.env.ie ) {
var scopeName = this.$.scopeName;
if ( scopeName != 'HTML' )
nodeName = scopeName.toLowerCase() + ':' + nodeName;
}

return (
/** @ignore */
this.getName = function() {
Expand Down
41 changes: 38 additions & 3 deletions _source/core/htmlparser/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ CKEDITOR.htmlParser.element = function( name, attributes ) {
};

var ckeAttrRegex = /^_cke/,
ckeNamespaceRegex = /^cke:/,
ckeStyleWidthRegex = /width\s*:\s*(\d+)/i,
ckeStyleHeightRegex = /height\s*:\s*(\d+)/i,
ckeClassRegex = /(?:^|\s+)cke_[^\s]*/g,
ckePrivateAttrRegex = /^_cke_pa_/;

Expand Down Expand Up @@ -111,6 +114,35 @@ CKEDITOR.htmlParser.element = function( name, attributes ) {
// element is a placeholder for another element.
if ( attributes._cke_realelement ) {
var realFragment = new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( attributes._cke_realelement ) );

// If _cke_resizable is set, and the fake element contains inline CSS width
// and height; then sync the width and height to the real element.
if ( attributes._cke_resizable && ( 'style' in attributes ) ) {
var match = ckeStyleWidthRegex.exec( attributes.style ),
width = match ? match[ 1 ] : null;
match = ckeStyleHeightRegex.exec( attributes.style );
var height = match ? match[ 1 ] : null;

var targetElement = realFragment.children[ 0 ];
if ( targetElement && ( width != null || height != null ) ) {
targetElement.attributes.width = width;
targetElement.attributes.height = height;

// Special case for #2916: If there's an EMBED inside an OBJECT, we need
// to set the EMBED's dimensions as well.
if ( targetElement.name == 'cke:object' ) {
for ( var i = 0; i < targetElement.children.length; i++ ) {
var child = targetElement.children[ i ];
if ( child.name == 'cke:embed' ) {
child.attributes.width = width;
child.attributes.height = height;
break;
}
}
}
}
}

realFragment.writeHtml( writer );
return;
}
Expand All @@ -122,8 +154,11 @@ CKEDITOR.htmlParser.element = function( name, attributes ) {
return;
}

// Ignore cke: prefixes when writing HTML.
var writeName = this.name.replace( ckeNamespaceRegex, '' );

// Open element tag.
writer.openTag( this.name, this.attributes );
writer.openTag( writeName, this.attributes );

// Copy all attributes to an array.
var attribsArray = [];
Expand Down Expand Up @@ -157,14 +192,14 @@ CKEDITOR.htmlParser.element = function( name, attributes ) {
}

// Close the tag.
writer.openTagClose( this.name, this.isEmpty );
writer.openTagClose( writeName, this.isEmpty );

if ( !this.isEmpty ) {
// Send children.
CKEDITOR.htmlParser.fragment.prototype.writeHtml.apply( this, arguments );

// Close the element.
writer.closeTag( this.name );
writer.closeTag( writeName );
}
}
};
Expand Down
4 changes: 4 additions & 0 deletions _source/core/htmlparser/fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ CKEDITOR.htmlParser.fragment = function() {
};

parser.onTagOpen = function( tagName, attributes, selfClosing ) {
// If the tag name is ?xml:namespace, ignore.
if ( tagName == '?xml:namespace' )
return;

var element = new CKEDITOR.htmlParser.element( tagName, attributes );

// "isEmpty" will be always "false" for unknown elements, so we
Expand Down
11 changes: 8 additions & 3 deletions _source/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ CKEDITOR.lang[ 'en' ] = {
headersColumn: 'First column',
headersRow: 'First Row',
headersBoth: 'Both',
invalidRows: 'Number of rows must be an integer greater than 0.',
invalidCols: 'Number of columns must be an integer greater than 0.',
invalidRows: 'Number of rows must be a number greater than 0.',
invalidCols: 'Number of columns must be a number greater than 0.',
invalidBorder: 'Border size must be a number.',
invalidWidth: 'Table width must be a number.',
invalidHeight: 'Table height must be a number.',
Expand Down Expand Up @@ -352,7 +352,12 @@ CKEDITOR.lang[ 'en' ] = {
width: 'Width',
height: 'Height',
hSpace: 'HSpace',
vSpace: 'VSpace'
vSpace: 'VSpace',
validateSrc: 'URL must not be empty.',
validateWidth: 'Width must be a number.',
validateHeight: 'Height must be a number.',
validateHSpace: 'HSpace must be a number.',
validateVSpace: 'VSpace must be a number.'
},

smiley: {
Expand Down
15 changes: 5 additions & 10 deletions _source/plugins/fakeobjects/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license

CKEDITOR.plugins.add( 'fakeobjects' );

CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType ) {
CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable ) {
var attributes = {
'class': className,
src: CKEDITOR.getUrl( 'images/spacer.gif' ),
_cke_realelement: encodeURIComponent( realElement.getOuterHtml() )
};
if ( realElementType )
attributes._cke_real_element_type = realElementType;
if ( isResizable )
attributes._cke_resizable = isResizable;

return this.document.createElement( 'img', { attributes: attributes } );
};

CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement ) {
var html = decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ),
realElement = CKEDITOR.dom.element.createFromHtml( html, this.document );

if ( fakeElement.$.style.width )
realElement.setStyle( 'width', fakeElement.$.style.width );
if ( fakeElement.$.style.height )
realElement.setStyle( 'height', fakeElement.$.style.height );

return realElement;
var html = decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) );
return CKEDITOR.dom.element.createFromHtml( html, this.document );
};
Loading

0 comments on commit cdb9423

Please sign in to comment.