Ticket #8630: 8630.patch

File 8630.patch, 8.5 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/wysiwygarea/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    536536                                                                ev.removeListener();
    537537
    538538                                                                var doc = iframe.getFrameDocument();
    539                                                                 doc.write( data );
     539                                                                editor.document = doc;
     540                                                                editor.window = doc.getWindow();
    540541
    541                                                                 CKEDITOR.env.air && contentDomReady( doc.getWindow().$ );
     542                                                                doc.write( data() );
     543
     544                                                                CKEDITOR.env.air && contentDomReady( editor.window.$ );
    542545                                                        });
    543546
    544547                                                // Reset adjustment back to default (#5689)
     
    607610
    608611                                                editable && CKEDITOR.env.gecko && CKEDITOR.tools.setTimeout( activateEditing, 0, null, editor );
    609612
    610                                                 domWindow       = editor.window = new CKEDITOR.dom.window( domWindow );
    611                                                 domDocument     = editor.document       = new CKEDITOR.dom.document( domDocument );
     613                                                domWindow       = editor.window;
     614                                                domDocument     = editor.document;
    612615
    613616                                                editable && domDocument.on( 'dblclick', function( evt )
    614617                                                {
     
    923926                                                                        fullPage = config.fullPage,
    924927                                                                        docType = config.docType;
    925928
    926                                                                 // Build the additional stuff to be included into <head>.
    927                                                                 var headExtra =
    928                                                                         '<style type="text/css" data-cke-temp="1">' +
    929                                                                                 editor._.styles.join( '\n' ) +
    930                                                                         '</style>';
     929                                                                // The iframe is recreated on each call of setData, so we need to clear DOM objects
     930                                                                this.onDispose();
     931                                                                createIFrame( function()
     932                                                                {
     933                                                                        // Build the additional stuff to be included into <head>.
     934                                                                        var headExtra =
     935                                                                                '<style type="text/css" data-cke-temp="1">' +
     936                                                                                        editor._.styles.join( '\n' ) +
     937                                                                                '</style>';
    931938
    932                                                                 !fullPage && ( headExtra =
    933                                                                         CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
    934                                                                         headExtra );
     939                                                                        !fullPage && ( headExtra =
     940                                                                                CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
     941                                                                                headExtra );
    935942
    936                                                                 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" data-cke-temp="1" />' : '';
     943                                                                        var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" data-cke-temp="1" />' : '';
    937944
    938                                                                 if ( fullPage )
    939                                                                 {
    940                                                                         // Search and sweep out the doctype declaration.
    941                                                                         data = data.replace( /<!DOCTYPE[^>]*>/i, function( match )
    942                                                                                 {
    943                                                                                         editor.docType = docType = match;
    944                                                                                         return '';
    945                                                                                 }).replace( /<\?xml\s[^\?]*\?>/i, function( match )
    946                                                                                 {
    947                                                                                         editor.xmlDeclaration = match;
    948                                                                                         return '';
    949                                                                                 });
    950                                                                 }
     945                                                                        if ( fullPage )
     946                                                                        {
     947                                                                                // Search and sweep out the doctype declaration.
     948                                                                                data = data.replace( /<!DOCTYPE[^>]*>/i, function( match )
     949                                                                                        {
     950                                                                                                editor.docType = docType = match;
     951                                                                                                return '';
     952                                                                                        }).replace( /<\?xml\s[^\?]*\?>/i, function( match )
     953                                                                                        {
     954                                                                                                editor.xmlDeclaration = match;
     955                                                                                                return '';
     956                                                                                        });
     957                                                                        }
    951958
    952                                                                 // Get the HTML version of the data.
    953                                                                 if ( editor.dataProcessor )
    954                                                                         data = editor.dataProcessor.toHtml( data, fixForBody );
     959                                                                        // Get the HTML version of the data.
     960                                                                        if ( editor.dataProcessor )
     961                                                                                data = editor.dataProcessor.toHtml( data, fixForBody );
    955962
    956                                                                 if ( fullPage )
    957                                                                 {
    958                                                                         // Check if the <body> tag is available.
    959                                                                         if ( !(/<body[\s|>]/).test( data ) )
    960                                                                                 data = '<body>' + data;
     963                                                                        if ( fullPage )
     964                                                                        {
     965                                                                                // Check if the <body> tag is available.
     966                                                                                if ( !(/<body[\s|>]/).test( data ) )
     967                                                                                        data = '<body>' + data;
    961968
    962                                                                         // Check if the <html> tag is available.
    963                                                                         if ( !(/<html[\s|>]/).test( data ) )
    964                                                                                 data = '<html>' + data + '</html>';
     969                                                                                // Check if the <html> tag is available.
     970                                                                                if ( !(/<html[\s|>]/).test( data ) )
     971                                                                                        data = '<html>' + data + '</html>';
    965972
    966                                                                         // Check if the <head> tag is available.
    967                                                                         if ( !(/<head[\s|>]/).test( data ) )
    968                                                                                 data = data.replace( /<html[^>]*>/, '$&<head><title></title></head>' ) ;
    969                                                                         else if ( !(/<title[\s|>]/).test( data ) )
    970                                                                                 data = data.replace( /<head[^>]*>/, '$&<title></title>' ) ;
     973                                                                                // Check if the <head> tag is available.
     974                                                                                if ( !(/<head[\s|>]/).test( data ) )
     975                                                                                        data = data.replace( /<html[^>]*>/, '$&<head><title></title></head>' ) ;
     976                                                                                else if ( !(/<title[\s|>]/).test( data ) )
     977                                                                                        data = data.replace( /<head[^>]*>/, '$&<title></title>' ) ;
    971978
    972                                                                         // The base must be the first tag in the HEAD, e.g. to get relative
    973                                                                         // links on styles.
    974                                                                         baseTag && ( data = data.replace( /<head>/, '$&' + baseTag ) );
     979                                                                                // The base must be the first tag in the HEAD, e.g. to get relative
     980                                                                                // links on styles.
     981                                                                                baseTag && ( data = data.replace( /<head>/, '$&' + baseTag ) );
    975982
    976                                                                         // Inject the extra stuff into <head>.
    977                                                                         // Attention: do not change it before testing it well. (V2)
    978                                                                         // This is tricky... if the head ends with <meta ... content type>,
    979                                                                         // Firefox will break. But, it works if we place our extra stuff as
    980                                                                         // the last elements in the HEAD.
    981                                                                         data = data.replace( /<\/head\s*>/, headExtra + '$&' );
     983                                                                                // Inject the extra stuff into <head>.
     984                                                                                // Attention: do not change it before testing it well. (V2)
     985                                                                                // This is tricky... if the head ends with <meta ... content type>,
     986                                                                                // Firefox will break. But, it works if we place our extra stuff as
     987                                                                                // the last elements in the HEAD.
     988                                                                                data = data.replace( /<\/head\s*>/, headExtra + '$&' );
    982989
    983                                                                         // Add the DOCTYPE back to it.
    984                                                                         data = docType + data;
    985                                                                 }
    986                                                                 else
    987                                                                 {
    988                                                                         data =
    989                                                                                 config.docType +
    990                                                                                 '<html dir="' + config.contentsLangDirection + '"' +
    991                                                                                         ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' +
    992                                                                                 '<head>' +
    993                                                                                         '<title>' + frameLabel + '</title>' +
    994                                                                                         baseTag +
    995                                                                                         headExtra +
    996                                                                                 '</head>' +
    997                                                                                 '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) +
    998                                                                                                   ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) +
    999                                                                                                   '>' +
    1000                                                                                         data +
    1001                                                                                 '</html>';
    1002                                                                 }
     990                                                                                // Add the DOCTYPE back to it.
     991                                                                                data = docType + data;
     992                                                                        }
     993                                                                        else
     994                                                                        {
     995                                                                                data =
     996                                                                                        config.docType +
     997                                                                                        '<html dir="' + config.contentsLangDirection + '"' +
     998                                                                                                ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' +
     999                                                                                        '<head>' +
     1000                                                                                                '<title>' + frameLabel + '</title>' +
     1001                                                                                                baseTag +
     1002                                                                                                headExtra +
     1003                                                                                        '</head>' +
     1004                                                                                        '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) +
     1005                                                                                                          ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) +
     1006                                                                                                          '>' +
     1007                                                                                                data +
     1008                                                                                        '</html>';
     1009                                                                        }
    10031010
    1004                                                                 // Distinguish bogus to normal BR at the end of document for Mozilla. (#5293).
    1005                                                                 if ( CKEDITOR.env.gecko )
    1006                                                                         data = data.replace( /<br \/>(?=\s*<\/(:?html|body)>)/, '$&<br type="_moz" />' );
     1011                                                                        // Distinguish bogus to normal BR at the end of document for Mozilla. (#5293).
     1012                                                                        if ( CKEDITOR.env.gecko )
     1013                                                                                data = data.replace( /<br \/>(?=\s*<\/(:?html|body)>)/, '$&<br type="_moz" />' );
    10071014
    1008                                                                 data += activationScript;
    1009 
    1010 
    1011                                                                 // The iframe is recreated on each call of setData, so we need to clear DOM objects
    1012                                                                 this.onDispose();
    1013                                                                 createIFrame( data );
     1015                                                                        data += activationScript;
     1016                                                                        return data;
     1017                                                                });
    10141018                                                        },
    10151019
    10161020                                                        getData : function()
  • _source/plugins/htmldataprocessor/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    515515
    516516                        // Call the browser to help us fixing a possibly invalid HTML
    517517                        // structure.
    518                         var div = new CKEDITOR.dom.element( 'div' );
     518                        var div = this.editor.document.createElement( 'div' );
    519519                        // Add fake character to workaround IE comments bug. (#3801)
    520520                        div.setHtml( 'a' + data );
    521521                        data = div.getHtml().substr( 1 );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy