X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Ffakeobjects%2Fplugin.js;h=8dbf80638a08289973baa9003191aab115558aba;hp=0b173c261964511dcd40682ccbca58ef32e9d457;hb=9afde8772159bd3436f1f5b7862960307710ae5a;hpb=614511639979907ceb0da3614122a4d8eb963ad4 diff --git a/_source/plugins/fakeobjects/plugin.js b/_source/plugins/fakeobjects/plugin.js index 0b173c2..8dbf806 100644 --- a/_source/plugins/fakeobjects/plugin.js +++ b/_source/plugins/fakeobjects/plugin.js @@ -12,13 +12,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license $ : function( element ) { var attributes = element.attributes, - realHtml = attributes && attributes._cke_realelement, + realHtml = attributes && attributes[ 'data-cke-realelement' ], realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ), realElement = realFragment && realFragment.children[ 0 ]; // If we have width/height in the element, we must move it into // the real element. - if ( realElement && element.attributes._cke_resizable ) + if ( realElement && element.attributes[ 'data-cke-resizable' ] ) { var style = element.attributes.style; @@ -62,23 +62,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable ) { - var lang = this.lang.fakeobjects; + var lang = this.lang.fakeobjects, + label = lang[ realElementType ] || lang.unknown; var attributes = { 'class' : className, src : CKEDITOR.getUrl( 'images/spacer.gif' ), - _cke_realelement : encodeURIComponent( realElement.getOuterHtml() ), - _cke_real_node_type : realElement.type, - alt : lang[ realElementType ] || lang.unknown, + 'data-cke-realelement' : encodeURIComponent( realElement.getOuterHtml() ), + 'data-cke-real-node-type' : realElement.type, + alt : label, + title : label, align : realElement.getAttribute( 'align' ) || '' }; if ( realElementType ) - attributes._cke_real_element_type = realElementType; + attributes[ 'data-cke-real-element-type' ] = realElementType; if ( isResizable ) - attributes._cke_resizable = isResizable; + attributes[ 'data-cke-resizable' ] = isResizable; return this.document.createElement( 'img', { attributes : attributes } ); }; @@ -86,6 +88,7 @@ CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, 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(); @@ -96,27 +99,28 @@ CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, class { 'class' : className, src : CKEDITOR.getUrl( 'images/spacer.gif' ), - _cke_realelement : encodeURIComponent( html ), - _cke_real_node_type : realElement.type, - alt : lang[ realElementType ] || lang.unknown, + 'data-cke-realelement' : encodeURIComponent( html ), + 'data-cke-real-node-type' : realElement.type, + alt : label, + title : label, align : realElement.attributes.align || '' }; if ( realElementType ) - attributes._cke_real_element_type = realElementType; + attributes[ 'data-cke-real-element-type' ] = realElementType; if ( isResizable ) - attributes._cke_resizable = isResizable; + attributes[ 'data-cke-resizable' ] = isResizable; return new CKEDITOR.htmlParser.element( 'img', attributes ); }; CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement ) { - if ( fakeElement.getAttribute( '_cke_real_node_type' ) != CKEDITOR.NODE_ELEMENT ) + if ( fakeElement.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT ) return null; return CKEDITOR.dom.element.createFromHtml( - decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ), + decodeURIComponent( fakeElement.data( 'cke-realelement' ) ), this.document ); };